Commit d965ba16 authored by EKSAD's avatar EKSAD

apdet issue

parent 7697ba96
...@@ -163,9 +163,9 @@ export default class ProfitLoss extends Component { ...@@ -163,9 +163,9 @@ export default class ProfitLoss extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false, buttonError: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else { } else {
this.setState({ dataTable, loading: false, buttonError: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} }
}) })
...@@ -231,6 +231,7 @@ export default class ProfitLoss extends Component { ...@@ -231,6 +231,7 @@ export default class ProfitLoss extends Component {
"profit_loss": data "profit_loss": data
} }
// console.log(data); // console.log(data);
this.setState({ loading: false })
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -419,7 +420,7 @@ export default class ProfitLoss extends Component { ...@@ -419,7 +420,7 @@ export default class ProfitLoss extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
...@@ -454,7 +455,7 @@ export default class ProfitLoss extends Component { ...@@ -454,7 +455,7 @@ export default class ProfitLoss extends Component {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true }) this.setState({ loading: false, buttonError: false, editable: false })
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({ loading: false, buttonError: true, editable: true })
} }
...@@ -651,6 +652,7 @@ export default class ProfitLoss extends Component { ...@@ -651,6 +652,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -666,7 +668,7 @@ export default class ProfitLoss extends Component { ...@@ -666,7 +668,7 @@ export default class ProfitLoss extends Component {
} }
} }
}, { }, {
name: this.state.judulColumn !== null ? this.state.judulColumn[3] : `31 Dec ${Number(this.props.periode) - 1} Actual`, name: this.state.judulColumn !== null ? this.state.judulColumn[2] : `31 Dec ${Number(this.props.periode) - 1} Actual`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
...@@ -679,23 +681,24 @@ export default class ProfitLoss extends Component { ...@@ -679,23 +681,24 @@ export default class ProfitLoss extends Component {
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null null
: : tableMeta.rowData[0] === 1 ?
<div style={{ flex: 1 }}> null :
<FormControlLabel <div style={{ flex: 1 }}>
style={{ margin: 0 }} <FormControlLabel
value={value} style={{ margin: 0 }}
control={ value={value}
<NumberFormat control={
thousandSeparator={true} <NumberFormat
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} thousandSeparator={true}
type="text" style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
placeholder="" type="text"
disabled={true} placeholder=""
value={Number(value).toFixed(1)} disabled={true}
/> value={Number(value).toFixed(1)}
} />
/> }
</div> />
</div>
} }
</div> </div>
) )
...@@ -724,10 +727,11 @@ export default class ProfitLoss extends Component { ...@@ -724,10 +727,11 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -812,6 +816,7 @@ export default class ProfitLoss extends Component { ...@@ -812,6 +816,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -901,6 +906,7 @@ export default class ProfitLoss extends Component { ...@@ -901,6 +906,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -990,6 +996,7 @@ export default class ProfitLoss extends Component { ...@@ -990,6 +996,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1079,6 +1086,7 @@ export default class ProfitLoss extends Component { ...@@ -1079,6 +1086,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1168,6 +1176,7 @@ export default class ProfitLoss extends Component { ...@@ -1168,6 +1176,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1257,6 +1266,7 @@ export default class ProfitLoss extends Component { ...@@ -1257,6 +1266,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1346,6 +1356,7 @@ export default class ProfitLoss extends Component { ...@@ -1346,6 +1356,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1435,6 +1446,7 @@ export default class ProfitLoss extends Component { ...@@ -1435,6 +1446,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1524,6 +1536,7 @@ export default class ProfitLoss extends Component { ...@@ -1524,6 +1536,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1613,6 +1626,7 @@ export default class ProfitLoss extends Component { ...@@ -1613,6 +1626,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1702,6 +1716,7 @@ export default class ProfitLoss extends Component { ...@@ -1702,6 +1716,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1829,6 +1844,7 @@ export default class ProfitLoss extends Component { ...@@ -1829,6 +1844,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1918,6 +1934,7 @@ export default class ProfitLoss extends Component { ...@@ -1918,6 +1934,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2034,55 +2051,57 @@ export default class ProfitLoss extends Component { ...@@ -2034,55 +2051,57 @@ export default class ProfitLoss extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> {this.props.isApprover == true ? null :
<a data-tip={'Download Template'} data-for="template"> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Download Template'} data-for="template">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.downloadTemplate()} }}
> onClick={() => this.downloadTemplate()}
<img src={Images.template} /> >
</button> <img src={Images.template} />
</a> </button>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Upload'} data-for="upload"> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Upload'} data-for="upload">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.setState({ visibleUpload: true })} }}
> onClick={() => this.setState({ visibleUpload: true })}
<img src={Images.upload} /> >
</button> <img src={Images.upload} />
</a> </button>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Download'} data-for="download"> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Download'} data-for="download">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => }}
this.setState({ loading: true }, () => { onClick={() =>
setTimeout(() => { this.setState({ loading: true }, () => {
this.downloadAllData() setTimeout(() => {
}, 100); this.downloadAllData()
})} }, 100);
> })}
<img src={Images.download} /> >
</button> <img src={Images.download} />
</a> </button>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> </a>
</div> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
}
</div> </div>
</div> </div>
...@@ -2119,79 +2138,79 @@ export default class ProfitLoss extends Component { ...@@ -2119,79 +2138,79 @@ export default class ProfitLoss extends Component {
</div> </div>
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> {this.props.isApprover === true ? null :
<button <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
className="button" <button
type="button" className="button"
style={{ type="button"
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
outline: 'none', borderColor: 'transparent',
marginRight: 20 outline: 'none',
}} marginRight: 20
onClick={() => { }}
this.setState({ loading: true }, () => { onClick={() => {
setTimeout(() => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => {
this.state.buttonError ?
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false }) this.handleValidate()
}, 100); }, 100);
}) })
: this.backToMasterBudget('submitted') }}
}} >
style={{ <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
backgroundColor: 'transparent', <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
cursor: this.state.buttonError === true ? 'default' : 'pointer', </div>
borderColor: 'transparent', </button>
outline: 'none', <button
}} className="button"
> type="button"
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> style={{
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> backgroundColor: 'transparent',
</div> cursor: this.state.editable !== true ? 'pointer' : 'default',
</button> borderColor: 'transparent',
</div> outline: 'none',
marginRight: 20
}}
onClick={() => this.state.editable === true ?
null :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
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.setState({ loading: true }, () => {
this.backToMasterBudget('submitted')
})
}}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
}
</div> </div>
</Paper> </Paper>
: :
......
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