Commit 5c922371 authored by EKSAD's avatar EKSAD

nyicil

parent 35ed8ee7
......@@ -69,7 +69,6 @@ export default class ProfitLoss extends Component {
let dataTable = []
if (response.data) {
let res = response.data.data
console.log(res)
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) {
......@@ -327,6 +326,7 @@ export default class ProfitLoss extends Component {
}
uploadProfitLoss() {
// console.log('tes');
let data = []
this.state.dataTable.map(i => {
data.push({
......@@ -377,6 +377,8 @@ export default class ProfitLoss extends Component {
}
async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url);
let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
)
......@@ -386,13 +388,14 @@ export default class ProfitLoss extends Component {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
a.href = url;
a.download = 'Master Budget Profit & Loss.xlsx';
a.download = 'Balance Sheet.xlsx';
a.click();
}
}
handleValidate() {
let data = []
console.log(this.state.dataTable)
this.state.dataTable.map(i => {
data.push({
item_report_id: i[1],
......@@ -420,9 +423,10 @@ export default class ProfitLoss extends Component {
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": "submitted",
"profit_loss": data
"profit_loss": data,
"status": "submitted"
}
console.log(payload)
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
......@@ -433,11 +437,14 @@ export default class ProfitLoss extends Component {
})
}
closeAlert() {
this.setState({ alert: false })
}
render() {
let dataTable2 = this.state.dataTable
const handleChange = (value, tableMeta, type) => {
let val = String(value).split(",").join("")
// let data = this.state.dataTable2
if (type === "actual") {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
} else {
......@@ -690,6 +697,7 @@ export default class ProfitLoss extends Component {
control={
<NumberFormat
thousandSeparator={true}
decimalSeparator={"."}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
......@@ -1982,7 +1990,7 @@ export default class ProfitLoss extends Component {
{this.state.messageAlert}
</Alert>
</Snackbar>
{this.state.loading && loadingComponent}
{/* {this.state.loading && loadingComponent} */}
<div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleProfitLoss === true ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
......@@ -2050,13 +2058,14 @@ export default class ProfitLoss extends Component {
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
......@@ -2131,10 +2140,16 @@ export default class ProfitLoss extends Component {
</button>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => this.state.buttonError?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: this.backToMasterBudget('submitted')}
disabled={this.state.buttonError}
onClick={() => {
this.state.buttonError ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false })
}, 100);
})
: this.backToMasterBudget('submitted')
}}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......@@ -2160,13 +2175,14 @@ export default class ProfitLoss extends Component {
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</MuiThemeProvider>
</div>
)}
</div>
......@@ -2187,7 +2203,7 @@ export default class ProfitLoss extends Component {
<button
className="button"
type="button"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
......@@ -2209,7 +2225,7 @@ export default class ProfitLoss extends Component {
</button>
<button
type="button"
disabled={this.state.buttonError}
// disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.uploadProfitLoss()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment