Commit 55cb53a9 authored by Riri Novita's avatar Riri Novita

Update Banyak

parent ab9fa1c1
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -165,7 +165,6 @@ export default class FixedAssetsMovement extends Component { ...@@ -165,7 +165,6 @@ export default class FixedAssetsMovement extends Component {
} }
} }
res.map((item, index) => { res.map((item, index) => {
console.log(item);
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.id, item.id,
...@@ -911,24 +910,26 @@ export default class FixedAssetsMovement extends Component { ...@@ -911,24 +910,26 @@ export default class FixedAssetsMovement extends Component {
const handleForecast = (tableMeta, periode) => { const handleForecast = (tableMeta, periode) => {
let total = 0 let total = 0
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'gain/ (loss) on fixed assets' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') { if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'gain/ (loss) on fixed assets' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
console.log('cek forcast 1');
if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') { if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
console.log('cek forcast 2');
let indexID = dataTable2.findIndex((val, index) => String(val[5]).toLocaleLowerCase() == 'ending balance' && dataTable2[index - 1][2] == tableMeta.rowData[2]) let indexID = dataTable2.findIndex((val, index) => String(val[5]).toLocaleLowerCase() == 'ending balance' && dataTable2[index - 1][2] == tableMeta.rowData[2])
if (indexID !== -1) { if (indexID !== -1) {
console.log('cek forcast 3');
// console.log(dataTable2) // console.log(dataTable2)
total = tableMeta.columnIndex == 21 ? dataTable2[indexID][20] : dataTable2[indexID][18].value total = tableMeta.columnIndex == 21 ? dataTable2[indexID][20] : dataTable2[indexID][18].value
} }
} else { } else {
let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode) // simulasi
let indexID = dataTable2[tableMeta.rowIndex][25].findIndex((val) => val.periode == periode)
// Asli
// let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode)
if (indexID !== -1) { if (indexID !== -1) {
total = dataTable2[tableMeta.rowIndex][23][indexID].value // simulasi
total = dataTable2[tableMeta.rowIndex][25][indexID].value
// Asli
// total = dataTable2[tableMeta.rowIndex][23][indexID].value
} }
} }
} else { } else {
total = handleValueFormula(tableMeta.columnIndex, tableMeta) total = handleValueFormula(tableMeta.columnIndex, tableMeta)
console.log('cek forcast 4');
} }
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
return total return total
...@@ -2608,44 +2609,44 @@ export default class FixedAssetsMovement extends Component { ...@@ -2608,44 +2609,44 @@ export default class FixedAssetsMovement extends Component {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{ {
this.props.status === 'CLOSED' ? // this.props.status === 'CLOSED' ?
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? // tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null // null
: // :
tableMeta.rowData[0] === 3 ? // tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
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={true} // disabled={true}
value={Number(value).toFixed(1)} // value={Number(value).toFixed(1)}
/> // />
} // }
/> // />
</div> : // </div> :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(value).toFixed(1)} // value={Number(value).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
: // :
tableMeta.rowData[0] === 3 ? tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -2715,44 +2716,44 @@ export default class FixedAssetsMovement extends Component { ...@@ -2715,44 +2716,44 @@ export default class FixedAssetsMovement extends Component {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{ {
this.props.status === 'CLOSED' ? // this.props.status === 'CLOSED' ?
tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ? // tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
null // null
: // :
tableMeta.rowData[0] === 3 ? // tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
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={true} // disabled={true}
value={Number(value).toFixed(1)} // value={Number(value).toFixed(1)}
/> // />
} // }
/> // />
</div> : // </div> :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value} // value={value}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(value).toFixed(1)} // value={Number(value).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
: // :
tableMeta.rowData[0] === 3 ? tableMeta.rowData[0] === 3 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
......
...@@ -496,7 +496,7 @@ export default class BalanceSheetMR extends Component { ...@@ -496,7 +496,7 @@ export default class BalanceSheetMR extends Component {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleBSMR: false, loading: true, visibleButtonUpload: true }) this.setState({ visibleUploadSimulasi: false, visibleBSMR: false, loading: true, visibleButtonUpload: true })
let err = false let err = false
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
if (item.type_report_id === 3) { if (item.type_report_id === 3) {
...@@ -885,6 +885,129 @@ export default class BalanceSheetMR extends Component { ...@@ -885,6 +885,129 @@ export default class BalanceSheetMR extends Component {
}) })
} }
handleValidateSimulasi() {
let data = []
let err = false
let errorContrl = false
let editAble = this.state.editAble
let dataTable = this.state.dataTable
let kansas = this.state.kansas
console.log(dataTable[dataTable.length - 1])
dataTable.map((i, index) => {
if (i[0] === 3) {
// console.log(i);
// if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
// console.log('msk 1');
// // console.log(i);
// err = true
// } else
if (i[18] === "" && (Number(i[14]).toFixed(1) < this.state.minValue || Number(i[14]).toFixed(1) > this.state.maxValue)) {
console.log('msk 2');
err = true
}
}
if (String(i[5]) == "Control (should be nil)") {
if (Number(i[9]).toFixed(1) < this.state.minValue || Number(i[9]).toFixed(1) > this.state.maxValue) {
errorContrl = true
editAble = true
}
}
data.push({
"item_report_id": i[1],
"rolling_outlook": i[6],
"master_budget": i[7],
"rolling_budget": i[8],
"actual": i[9],
"actual_previous_month": i[10],
"amount_act_vs_previous_month": i[11],
"percent_act_vs_previous_month": i[12],
"amount_act_vs_mb": i[13],
"percent_act_vs_mb": i[14],
"amount_act_vs_rb": i[15],
"percent_act_vs_rb": i[16],
"mtd_vs_previous_month": i[17],
"mtd_vs_mb": i[18],
"mtd_vs_rb": i[19]
})
})
// console.log(JSON.stringify(data));
// data.map(i => {
// if (i.mtd_vs_previous_month === "" && (Number(i.percent_act_vs_previous_month) < this.state.minValue || Number(i.percent_act_vs_previous_month) > this.state.maxValue)) {
// console.log('msk 1');
// console.log(i);
// err = true
// } else if (i.mtd_vs_mb === "" && (Number(i.percent_act_vs_mb) < this.state.minValue || Number(i.percent_act_vs_mb) > this.state.maxValue)) {
// console.log('msk 2');
// err = true
// } else if (i.mtd_vs_rb === "" && (Number(i.percent_act_vs_rb) < this.state.minValue || Number(i.percent_act_vs_rb) > this.state.maxValue)) {
// console.log('msk 3');
// err = true
// }
// })
// if (err === true) {
// console.log('error');
// this.setState({ loading: false, buttonError: true, saveDraft: false })
// } else {
// console.log('g error');
// this.setState({ loading: false, buttonError: false, saveDraft: false })
// }
// console.log(JSON.stringify(data))
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": "submitted",
"months": this.props.month.month_id,
"balance_sheet": data
}
// console.log(JSON.stringify(payload));
// console.log(this.state.dataTable)
api.create().validateSubmitReportBS(payload).then((response) => {
console.log(response.data.data.result)
console.log(err);
console.log(errorContrl);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false && errorContrl === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
if (kansas == 0) {
this.setState({ kansas: 1, loading: true }, () => {
this.handleValidate()
})
} else {
this.setState({ kansas: 0 })
}
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
if (kansas == 0) {
this.setState({ kansas: 1, loading: true }, () => {
this.handleValidate()
})
} else {
this.setState({ kansas: 0 })
}
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
closeAlert() { closeAlert() {
this.setState({ alert: false }) this.setState({ alert: false })
} }
...@@ -2778,90 +2901,91 @@ export default class BalanceSheetMR extends Component { ...@@ -2778,90 +2901,91 @@ export default class BalanceSheetMR extends Component {
</Alert> </Alert>
</Snackbar> </Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleBSMR ? <Paper style={{ paddingTop: 10 }}> {this.state.visibleBSMR ?
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <Paper style={{ paddingTop: 10 }}>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
</div> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
<div style={{ padding: 20 }}> </div>
<div style={{ display: 'flex', justifyContent: 'space-between' }}> <div style={{ padding: 20 }}>
<div> <div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
{this.props.defaultCurrency.id === 1 ? <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> {this.props.defaultCurrency.id === 1 ?
: <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography> :
} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
</div> }
<div style={{ width: '50%' }}> </div>
{this.props.isApprover === true || this.state.get_for == 'view' ? <div style={{ width: '50%' }}>
null {this.props.isApprover === true || this.state.get_for == 'view' ?
// <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> null
// <a data-tip={'Download'} data-for="download"> // <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
// <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 style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> :
<a data-tip={'Upload Simulasi'} data-for="upload"> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Upload Simulasi'} 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({ visibleUploadSimulasi: true, buttonDraft: true })} }}
> onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
<img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} /> >
</button> <img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} />
</a> </button>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Download Template'} data-for="template"> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<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" />
{/* <a data-tip={'Download'} data-for="download">
<button <button
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
...@@ -2880,196 +3004,13 @@ export default class BalanceSheetMR extends Component { ...@@ -2880,196 +3004,13 @@ export default class BalanceSheetMR extends Component {
</button> </button>
</a> </a>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */} <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
</div> </div>
}
</div>
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return (
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
)
}) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
}
</div>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, textDecorationLine: 'underline' }}>Notes:</Typography>
</div>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, fontWeight: 'bold' }}>Rolling Outlook (Full Year) or Rolling Budget (RB)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jan-Mar = MB figures</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Apr-Jun = OL Q1 figures or MB figures (if OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jul-Sep = OL Q2 figures or OL Q1 (if OL Q2 not available) or MB (if OL Q2 and OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Oct-Dec = OL Q3 figures or OL Q2 (if OL Q3 not available) and consecutive to the MB</Typography>
</div>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
{this.props.isApprover === true ?
<div className="col-2">
</div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'view' && this.state.viewOnly && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.handleGetFor('edit')
})
}}
>
<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' }}>Edit</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
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>}
{this.state.get_for === 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.backToMonthlyReport('draft')
})
} }
> </div>
<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>}
{this.state.get_for === 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
{/* : null
} */}
</Paper> :
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && !this.state.loading && ( {!this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable <MUIDataTable
data={dataTable2} data={dataTable2}
...@@ -3079,21 +3020,59 @@ export default class BalanceSheetMR extends Component { ...@@ -3079,21 +3020,59 @@ export default class BalanceSheetMR extends Component {
</MuiThemeProvider> </MuiThemeProvider>
)} )}
</div> </div>
<div style={{ display: 'flex' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
<div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
{
this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
return (
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
)
}) :
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
}
</div>
</div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, textDecorationLine: 'underline' }}>Notes:</Typography>
</div>
<div style={{ display: 'flex', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5, fontWeight: 'bold' }}>Rolling Outlook (Full Year) or Rolling Budget (RB)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jan-Mar = MB figures</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Apr-Jun = OL Q1 figures or MB figures (if OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Jul-Sep = OL Q2 figures or OL Q1 (if OL Q2 not available) or MB (if OL Q2 and OL Q1 not available)</Typography>
</div>
<div style={{ display: 'flex', paddingLeft: 10, justifyContent: 'space-between', maxWidth: '100%', paddingRight: 15 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 0 }}>Period Oct-Dec = OL Q3 figures or OL Q2 (if OL Q3 not available) and consecutive to the MB</Typography>
</div>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 10, padding: 20 }}> {/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
<div className="grid grid-2x" style={{ padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}> <div className="col-1" style={{ paddingLeft: 0 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => { onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.getItemHierarki() this.props.onClickClose()
}, 100); }, 100);
})} })}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none' outline: 'none',
}} }}
> >
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
...@@ -3101,78 +3080,318 @@ export default class BalanceSheetMR extends Component { ...@@ -3101,78 +3080,318 @@ export default class BalanceSheetMR extends Component {
</div> </div>
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}> {this.props.isApprover === true ?
<button <div className="col-2">
className="button" </div> :
type="button" <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
style={{ {this.state.get_for == 'view' && this.state.viewOnly && <button
backgroundColor: 'transparent', className="button"
cursor: 'pointer', type="button"
borderColor: 'transparent', style={{
outline: 'none', backgroundColor: 'transparent',
marginRight: 20 cursor: 'pointer',
}} borderColor: 'transparent',
onClick={() => { outline: 'none',
this.setState({ loading: true, dataTable: dataTable2 }, () => { marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
this.handleGetFor('edit')
})
}}
>
<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' }}>Edit</Typography>
</div>
</button>}
{this.state.get_for == 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
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>}
{this.state.get_for === 'edit' && <button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() =>
this.state.saveDraft ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.backToMonthlyReport('draft')
})
}
>
<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>}
{this.state.get_for === 'edit' && <button
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.backToMonthlyReport('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
{/* : null
} */}
</Paper>
:
this.state.visibleButtonUpload ?
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && !this.state.loading && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
</div>
<div className="grid grid-2x" style={{ marginTop: 10, padding: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.getItemHierarki()
}, 100); }, 100);
}) })}
}} style={{
> backgroundColor: 'transparent',
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> cursor: 'pointer',
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> borderColor: 'transparent',
</div> outline: 'none'
</button> }}
<button >
className="button" <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
type="button" <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
style={{ </div>
backgroundColor: 'transparent', </button>
cursor: 'pointer', </div>
borderColor: 'transparent', <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
outline: 'none', <button
marginRight: 20 className="button"
}} type="button"
onClick={() => style={{
this.state.saveDraft === true ? backgroundColor: 'transparent',
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' }) cursor: 'pointer',
: borderColor: 'transparent',
this.state.handleDoubleClick == 1 ? null : outline: 'none',
this.setState({ handleDoubleClick: 1 }, () => { marginRight: 20
this.uploadBalanceSheet('draft') }}
}) onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
setTimeout(() => {
this.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</Paper>
:
<Paper style={{ paddingTop: 10 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
</div>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
} }
> </div>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> {this.state.dataLoaded && !this.state.loading && (
</div> <MuiThemeProvider theme={getMuiTheme()}>
</button> <MUIDataTable
<button data={dataTable2}
type="button" columns={columns}
// disabled={this.state.buttonError} options={options}
onClick={() => />
this.state.buttonError ? </MuiThemeProvider>
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' }) )}
: </div>
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadBalanceSheet('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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> <div className="grid grid-2x" style={{ marginTop: 10, padding: 20 }}>
</Paper> <div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true, dataTable: dataTable2 }, () => {
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.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadBalanceSheet('draft')
})
}
>
<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({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1 }, () => {
this.uploadBalanceSheet('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
</Paper>
} }
</div> </div>
{this.state.visibleUpload && ( {this.state.visibleUpload && (
...@@ -3252,7 +3471,7 @@ export default class BalanceSheetMR extends Component { ...@@ -3252,7 +3471,7 @@ export default class BalanceSheetMR extends Component {
}} }}
/> />
</div> </div>
{this.state.visibleButtonUpload && {/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}> <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div> <div>
<button <button
...@@ -3276,7 +3495,7 @@ export default class BalanceSheetMR extends Component { ...@@ -3276,7 +3495,7 @@ export default class BalanceSheetMR extends Component {
</button> </button>
</div> </div>
</div> </div>
} } */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */} {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div> </div>
</div> </div>
......
...@@ -1074,6 +1074,236 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1074,6 +1074,236 @@ export default class CorporateAnnualTargetMR extends Component {
} }
handleCalculateSimulasi(datatable2) {
// console.log(datatable2)
this.setState({ loading: true }, () => {
let total = 0
let perfomanceScore = ''
let totalWeight = 0
// console.log(datatable2)
let datatable3 = datatable2.map((item, index) => {
// console.log(item[6])
//total weight
if (item[0] !== 1 && item[0] !== 4) {
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalWeight += Number(0)
} else {
totalWeight += Number(item[6])
}
}
//ach
let totalAch = 0
if (item[8] == 'HIB') {
let actual = item[11] == "" ? 0 : Number(item[11])
let target = item[12] == "" ? 0 : Number(item[12])
// if (item[5] == "Striping Ratio (SR) YTD") {
// console.log(actual)
// console.log(target)
// console.log(actual/target)
// }
if (target < 0) {
if (actual > target) {
totalAch = (actual / target) - 1
} else {
totalAch = (actual / target)
}
} else if (target == 0) {
if (target >= actual) {
totalAch = 1.26
} else {
totalAch = 0
}
} else {
if (actual == target) {
totalAch = (actual / target)
} else {
totalAch = 2 - (actual / target)
}
}
// if (item[5] == "Striping Ratio (SR) YTD") {
// console.log(actual)
// console.log(target)
// console.log(actual/target)
// }
} else {
let actual = item[11] == "" ? 0 : Number(item[11])
let target = item[12] == "" ? 0 : Number(item[12])
if (target < 0) {
if (actual >= target) {
totalAch = ((target - actual) / target) + 1
} else {
totalAch = (target - actual) / target
}
} else if (target == 0) {
if (target <= actual) {
totalAch = 1.26
} else {
totalAch = 0
}
} else {
// if (actual <= target) {
totalAch = (actual / target)
// } else {
// totalAch = 1 - (actual / target)
// }
}
}
totalAch = String(totalAch) == 'NaN' || String(totalAch) == 'Infinity' || String(totalAch) == '-Infinity' ? 0 : totalAch
totalAch = this.props.lastStatus == 'APPROVED' ? item[13] : Number(totalAch) * 100
//score
let listParameter = this.state.parameterScore
let parameterKpi = item[8]
let parameterAch = String(item[9]).includes('%') ? `MAX${String(item[9]).substr(0, String(item[9]).length - 1)}` : String(item[9])
let parameterMix = `${parameterKpi}_${parameterAch}`
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase())
let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
let totalScore = 0
let achx100 = item[9] == '100%' && (item[8] == 'HIB' || item[8] == 'HIG') ? (Number(totalAch) / 100 > 1 ? 1 : Number(totalAch) / 100) : Number(totalAch) / 100
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(listParameterFilter)
// console.log(listParameterFilterCompany)
// // console.log(Number(item.min_value))
// console.log(Number(item.max_value))
// }
if (listParameterFilterCompany.length == 0) {
listParameterFilter.map((items, index) => {
if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(items.value)
}
})
} else {
listParameterFilterCompany.map((items, index) => {
if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(items.value)
}
})
}
let totalScorez = this.props.lastStatus == 'APPROVED' ? item[14] : Number(totalScore).toFixed(0)
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(totalScorez)
// }
//Score X Weight
let totalSW = 0
let handlePercent = ''
if (String(item[6]).includes('%')) {
handlePercent = String(item[6]).substr(0, String(item[6]).length - 1)
} else {
handlePercent = String(item[6])
}
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalSW = 0
} else {
totalSW = (Number(totalScorez) * Number(handlePercent) / 100)
}
totalSW = this.props.lastStatus == 'APPROVED' ? item[15] : Number(totalSW).toFixed(2)
if (item[0] !== 1 && item[0] !== 4) {
total += Number(totalSW)
}
// console.log(item[5])
// console.log(totalAch);
// console.log(achx100);
// console.log(listParameterFilter);
// console.log(listParameterFilterCompany);
// console.log(totalScorez)
// console.log(totalSW)
// console.log(item[12])
// console.log(item[5])
// console.log(total)
return [
item[0],
item[1],
item[2],
item[3],
item[4],
item[5],
item[6],
item[7],
item[8],
item[9],
item[10],
item[11],
item[12],
totalAch,
totalScorez,
totalSW,
item[16],
item[17],
item[18],
// item[19],
// ]
]
})
// console.log(totalWeight)
// console.log(total)
// console.log(datatable3);
let totalWeightz = Number(totalWeight) / 100
let totalz = Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2)
console.log(totalz)
let lastTotal = R.equals(totalz, NaN) ? 0.0 : totalz
if (R.equals(totalz, NaN) || R.equals(totalz, "NaN")) {
lastTotal = 0.0
} else {
lastTotal = totalz
}
console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
let indexPerform = this.state.parameterPerfom.findIndex((val) => val.company_id == this.props.company.company_id)
let listPerfomanceDefault = []
if (indexPerform == -1) {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => String(val.company_name).toLocaleLowerCase() == "default")
} else {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => val.company_id == this.props.company.company_id)
}
let performanceScore = ''
let perfomanceScoreColor = '#fff'
if (listPerfomanceDefault.length > 0) {
listPerfomanceDefault.map((item, index) => {
console.log(Number(lastTotal))
console.log(Number(item.min_value))
console.log(Number(item.max_value))
if (Number(lastTotal) >= Number(item.min_value) && Number(lastTotal) <= Number(item.max_value)) {
console.log('masuk')
perfomanceScore = item.description
perfomanceScoreColor = item.value
}
})
}
// console.log(Number(lastTotal))
console.log(this.state.parameterPerfom)
console.log(listPerfomanceDefault)
console.log(perfomanceScore)
console.log(perfomanceScoreColor)
console.log(datatable3)
// if (lastTotal >= 1.00 && lastTotal <= 2.00) {
// perfomanceScore = 'K'
// } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
// perfomanceScore = 'C'
// } else if (lastTotal >= 2.76 && lastTotal <= 3.00) {
// perfomanceScore = 'B-'
// } else if (lastTotal >= 3.01 && lastTotal <= 3.75) {
// perfomanceScore = 'B'
// } else if (lastTotal >= 3.76 && lastTotal <= 4.00) {
// perfomanceScore = 'B+'
// } else if (lastTotal >= 4.01 && lastTotal <= 4.75) {
// perfomanceScore = 'BS'
// } else if (lastTotal >= 4.76 && lastTotal <= 5.00) {
// perfomanceScore = 'IST'
// }
setTimeout(() => {
this.setState({ totalScore: lastTotal, perfomanceScore, loading: false, perfomanceScoreColor }, () => {
this.setState({ loading: true })
setTimeout(() => {
this.setState({ loading: false })
}, 500);
})
}, 500);
})
}
handleBackgroundPerf(total) { handleBackgroundPerf(total) {
// console.log(total) // console.log(total)
let color = 'white' let color = 'white'
...@@ -2484,7 +2714,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -2484,7 +2714,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => { this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => {
setTimeout(() => { setTimeout(() => {
// this.handleValidate() // this.handleValidate()
this.handleCalculate(dataTable2) this.handleCalculateSimulasi(dataTable2)
}, 100); }, 100);
}) })
}} }}
......
...@@ -405,7 +405,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -405,7 +405,7 @@ export default class FixedAssetsMovementMR extends Component {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, loading: true, visibleFAMMR: false, refresh: true, visibleButtonUpload: true }) this.setState({ visibleUploadSimulasi: false, loading: true, visibleFAMMR: false, refresh: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
item.type_report_id, item.type_report_id,
...@@ -670,6 +670,62 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -670,6 +670,62 @@ export default class FixedAssetsMovementMR extends Component {
}) })
} }
handleValidateSimulasi() {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
data.push({
"item_report_id": i[1],
"mtd_mb": i[6],
"mtd_rb": i[7],
"mtd_actual": i[8],
"act_vs_mb_amount": String(i[9]) === 'NaN' || String(i[9]) === 'Infinity' || String(i[9]) === '-Infinity' ? '0.0' : String(i[9]),
"act_vs_mb_percent": String(i[10]) === 'NaN' || String(i[10]) === 'Infinity' || String(i[10]) === '-Infinity' ? '0.0' : String(i[10]),
"act_vs_rb_amount": String(i[11]) === 'NaN' || String(i[11]) === 'Infinity' || String(i[11]) === '-Infinity' ? '0.0' : String(i[11]),
"act_vs_rb_percent": String(i[12]) === 'NaN' || String(i[12]) === 'Infinity' || String(i[12]) === '-Infinity' ? '0.0' : String(i[12])
})
})
// console.log(JSON.stringify(data))
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": "submitted",
"months": this.props.month.month_id,
"fixed_asset_movement": data
}
// console.log(JSON.stringify(payload));
api.create().validateSubmitReportFAM(payload).then((response) => {
console.log(response.data.data.result)
console.log(err);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
closeAlert() { closeAlert() {
this.setState({ alert: false }) this.setState({ alert: false })
} }
...@@ -1738,129 +1794,227 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1738,129 +1794,227 @@ export default class FixedAssetsMovementMR extends Component {
</div> </div>
} }
</div> </div>
</Paper> : </Paper>
<Paper style={{ paddingTop: 10 }}> :
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > this.state.visibleButtonUpload ?
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography> <Paper style={{ paddingTop: 10 }}>
</div> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<div style={{ padding: 20 }}> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ padding: 20 }}>
{!this.state.refresh && ( <div>
<MuiThemeProvider theme={getMuiTheme()}> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<MUIDataTable <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
data={dataTable2} {this.props.defaultCurrency.id === 1 ?
columns={columns} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
options={options} :
/> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
</MuiThemeProvider> }
)} </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{!this.state.refresh && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ? */}
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
// this.setState({ loading: false })
this.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> </Paper>
<div className="col-1" style={{ paddingLeft: 0 }}> :
<button <Paper style={{ paddingTop: 10 }}>
type="button" <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => { <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Fixed Assets Movement</Typography>
setTimeout(() => { </div>
this.getItemHierarki() <div style={{ padding: 20 }}>
}, 100); <div>
})} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
style={{ <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
backgroundColor: 'transparent', {this.props.defaultCurrency.id === 1 ?
cursor: 'pointer', <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
borderColor: 'transparent', :
outline: 'none' <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}} }
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div> </div>
{/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null : <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ? */} {!this.state.refresh && (
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}> <MuiThemeProvider theme={getMuiTheme()}>
<button <MUIDataTable
className="button" data={dataTable2}
type="button" columns={columns}
style={{ options={options}
backgroundColor: 'transparent', />
cursor: 'pointer', </MuiThemeProvider>
borderColor: 'transparent', )}
outline: 'none', </div>
marginRight: 20 <div className="grid grid-2x" style={{ marginTop: 20 }}>
}} <div className="col-1" style={{ paddingLeft: 0 }}>
onClick={() => { <button
this.setState({ loading: true }, () => { type="button"
onClick={() => this.setState({ loading: true, visibleFAMMR: true }, () => {
setTimeout(() => { setTimeout(() => {
// this.setState({ loading: false }) this.getItemHierarki()
this.handleValidate()
}, 100); }, 100);
}) })}
}} style={{
> backgroundColor: 'transparent',
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> cursor: 'pointer',
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> borderColor: 'transparent',
</div> outline: 'none'
</button> }}
<button >
className="button" <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
type="button" <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
style={{ </div>
backgroundColor: 'transparent', </button>
cursor: 'pointer', </div>
borderColor: 'transparent', {/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
outline: 'none', (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ? */}
marginRight: 20 <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
}} <button
onClick={() => className="button"
this.state.saveDraft === true ? type="button"
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' }) style={{
: backgroundColor: 'transparent',
this.state.handleDoubleClick === 1 ? null : cursor: 'pointer',
this.setState({ handleDoubleClick: 1, loading: true }, () => { borderColor: 'transparent',
this.uploadFAMMR('draft') outline: 'none',
}) marginRight: 20
} }}
> onClick={() => {
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> this.setState({ loading: true }, () => {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> setTimeout(() => {
</div> // this.setState({ loading: false })
</button> this.handleValidate()
<button }, 100);
type="button" })
// disabled={this.state.buttonError} }}
onClick={() => >
this.state.buttonError ? <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' }) <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
: </div>
this.state.handleDoubleClick === 1 ? null : </button>
this.setState({ handleDoubleClick: 1, loading: true }, () => { <button
this.uploadFAMMR('submitted') className="button"
})} type="button"
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
}} marginRight: 20
> }}
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> onClick={() =>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> this.state.saveDraft === true ?
</div> this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
</button> :
this.state.handleDoubleClick === 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadFAMMR('draft')
})
}
>
<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({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick === 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadFAMMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
</div> </div>
</div> </Paper>
</Paper>
} }
</div> </div>
{this.state.visibleUpload && ( {this.state.visibleUpload && (
...@@ -1940,7 +2094,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1940,7 +2094,7 @@ export default class FixedAssetsMovementMR extends Component {
}} }}
/> />
</div> </div>
{this.state.visibleButtonUpload && {/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}> <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div> <div>
<button <button
...@@ -1964,7 +2118,7 @@ export default class FixedAssetsMovementMR extends Component { ...@@ -1964,7 +2118,7 @@ export default class FixedAssetsMovementMR extends Component {
</button> </button>
</div> </div>
</div> </div>
} } */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */} {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div> </div>
</div> </div>
......
...@@ -605,7 +605,7 @@ export default class ProfitLossMR extends Component { ...@@ -605,7 +605,7 @@ export default class ProfitLossMR extends Component {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visiblePLMR: false, loading: true, visibleButtonUpload: true }) this.setState({ visibleUploadSimulasi: false, visiblePLMR: false, loading: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
item.type_report_id, item.type_report_id,
...@@ -868,6 +868,86 @@ export default class ProfitLossMR extends Component { ...@@ -868,6 +868,86 @@ export default class ProfitLossMR extends Component {
}) })
} }
handleValidateSimulasi() {
let data = []
let err = false
this.state.dataTable.map((i, index) => {
if (i[0] === 3) {
// console.log(i);
if (i[19] === "" && (Number(i[16]).toFixed(1) < this.state.minValue || Number(i[16]).toFixed(1) > this.state.maxValue)) {
console.log('msk 1');
// console.log(i);
err = true
}
// else if ( i[20] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) {
// console.log('msk 2');
// err = true
// } else if ( i[21] === "" && (Number(i[18]) < this.state.minValue || Number(i[18]) > this.state.maxValue)) {
// console.log('msk 3');
// err = true
// }
}
data.push({
"item_report_id": i[1],
"notes": i[6],
"rolling_outlook": i[7],
"master_budget": i[8],
"rolling_budget": i[9],
"actual": i[10],
"ytd_actual": i[11],
"actual_previous_month": i[12],
"amount_act_vs_previous_month": i[13],
"percent_act_vs_previous_month": i[14],
"amount_act_vs_mb": i[15],
"percent_act_vs_mb": i[16],
"amount_act_vs_rb": i[17],
"percent_act_vs_rb": i[18],
"mtd_vs_mb": i[19],
"mtd_vs_rb": i[20],
"mtd_vs_previous_month": i[21],
})
})
console.log(this.state.dataTable);
// console.log(JSON.stringify(data))
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": "submitted",
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"profit_loss": data
}
console.log(JSON.stringify(payload));
api.create().validateSubmitReportPL(payload).then((response) => {
console.log(response)
console.log(err);
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && err === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
closeAlert() { closeAlert() {
this.setState({ alert: false }) this.setState({ alert: false })
} }
...@@ -2385,7 +2465,7 @@ export default class ProfitLossMR extends Component { ...@@ -2385,7 +2465,7 @@ export default class ProfitLossMR extends Component {
<div className="col-2"> <div className="col-2">
</div> : </div> :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
{this.state.get_for == 'view' && this.state.viewOnly && {this.state.get_for == 'view' && this.state.viewOnly &&
<button <button
className="button" className="button"
type="button" type="button"
...@@ -2482,126 +2562,221 @@ export default class ProfitLossMR extends Component { ...@@ -2482,126 +2562,221 @@ export default class ProfitLossMR extends Component {
} */} } */}
</Paper> </Paper>
: :
<Paper style={{ paddingTop: 10 }}> this.state.visibleButtonUpload ?
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <Paper style={{ paddingTop: 10 }}>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Profit Loss</Typography> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
</div> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Profit Loss</Typography>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.month.month_value} {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ padding: 20 }}>
{this.state.dataLoaded && ( <div>
<MuiThemeProvider theme={getMuiTheme()}> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<MUIDataTable <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.month.month_value} {this.props.periode} (rev.{this.props.revision})</Typography>
data={dataTable2} {this.props.defaultCurrency.id === 1 ?
columns={columns} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
options={options} :
/> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
</MuiThemeProvider> }
)} </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLMR: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
// this.setState({ loading: false })
this.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> </Paper>
<div className="col-1" style={{ paddingLeft: 0 }}> :
<button <Paper style={{ paddingTop: 10 }}>
type="button" <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
onClick={() => this.setState({ loading: true, visiblePLMR: true }, () => { <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Profit Loss</Typography>
setTimeout(() => { </div>
this.getItemHierarki() <div style={{ padding: 20 }}>
}, 100); <div>
})} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
style={{ <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.month.month_value} {this.props.periode} (rev.{this.props.revision})</Typography>
backgroundColor: 'transparent', {this.props.defaultCurrency.id === 1 ?
cursor: 'pointer', <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
borderColor: 'transparent', :
outline: 'none' <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}} }
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<button {this.state.dataLoaded && (
className="button" <MuiThemeProvider theme={getMuiTheme()}>
type="button" <MUIDataTable
style={{ data={dataTable2}
backgroundColor: 'transparent', columns={columns}
cursor: 'pointer', options={options}
borderColor: 'transparent', />
outline: 'none', </MuiThemeProvider>
marginRight: 20 )}
}} </div>
onClick={() => { <div className="grid grid-2x" style={{ marginTop: 20 }}>
this.setState({ loading: true }, () => { <div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLMR: true }, () => {
setTimeout(() => { setTimeout(() => {
// this.setState({ loading: false }) this.getItemHierarki()
this.handleValidate()
}, 100); }, 100);
}) })}
}} style={{
> backgroundColor: 'transparent',
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> cursor: 'pointer',
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> borderColor: 'transparent',
</div> outline: 'none'
</button> }}
<button >
className="button" <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
type="button" <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
style={{ </div>
backgroundColor: 'transparent', </button>
cursor: 'pointer', </div>
borderColor: 'transparent', <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
outline: 'none', <button
marginRight: 20 className="button"
}} type="button"
onClick={() => style={{
this.state.saveDraft === true ? backgroundColor: 'transparent',
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' }) cursor: 'pointer',
: borderColor: 'transparent',
this.state.handleDoubleClick == 1 ? null : outline: 'none',
this.setState({ handleDoubleClick: 1, loading: true }, () => { marginRight: 20
this.uploadProfitLossMR('draft') }}
}) onClick={() => {
} this.setState({ loading: true }, () => {
> setTimeout(() => {
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> // this.setState({ loading: false })
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> this.handleValidate()
</div> }, 100);
</button> })
<button }}
type="button" >
// disabled={this.state.buttonError} <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
onClick={() => <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
this.state.buttonError ? </div>
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' }) </button>
: <button
this.state.handleDoubleClick == 1 ? null : className="button"
this.setState({ handleDoubleClick: 1, loading: true }, () => { type="button"
this.uploadProfitLossMR('submitted') style={{
})} backgroundColor: 'transparent',
style={{ cursor: 'pointer',
backgroundColor: 'transparent', borderColor: 'transparent',
cursor: 'pointer', outline: 'none',
borderColor: 'transparent', marginRight: 20
outline: 'none', }}
}} onClick={() =>
> this.state.saveDraft === true ?
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> :
</div> this.state.handleDoubleClick == 1 ? null :
</button> this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossMR('draft')
})
}
>
<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({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossMR('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
</div> </div>
</div> </Paper>}
</Paper>}
</div> </div>
{this.state.visibleUpload && ( {this.state.visibleUpload && (
...@@ -2681,7 +2856,7 @@ export default class ProfitLossMR extends Component { ...@@ -2681,7 +2856,7 @@ export default class ProfitLossMR extends Component {
}} }}
/> />
</div> </div>
{this.state.visibleButtonUpload && {/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}> <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div> <div>
<button <button
...@@ -2705,7 +2880,7 @@ export default class ProfitLossMR extends Component { ...@@ -2705,7 +2880,7 @@ export default class ProfitLossMR extends Component {
</button> </button>
</div> </div>
</div> </div>
} } */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */} {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div> </div>
</div> </div>
......
...@@ -504,7 +504,7 @@ export default class TaxPlanningMR extends Component { ...@@ -504,7 +504,7 @@ export default class TaxPlanningMR extends Component {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleTP: false, loading: true, visibleButtonUpload: true }) this.setState({ visibleUploadSimulasi: false, visibleTP: false, loading: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
0, 0,
...@@ -714,6 +714,77 @@ export default class TaxPlanningMR extends Component { ...@@ -714,6 +714,77 @@ export default class TaxPlanningMR extends Component {
}) })
} }
handleValidateSimulasi(dataTable2) {
let data = []
let errorContrl = this.state.buttonError
let editAble = this.state.editAble
console.log(this.state.dataTable)
console.log(dataTable2)
dataTable2.map(i => {
console.log(i)
// this.setState({ loading: false })
console.log(i[9].tbf)
if (String(i[8]) === "Control (should be nil)") {
console.log(i[9].tbf)
console.log(this.state.minValue)
console.log(this.state.maxValue)
if (Number(i[9].tbf) < Number(this.state.minValue) || Number(i[9].tbf) > Number(this.state.maxValue)) {
errorContrl = true
editAble = true
} else {
errorContrl = false
editAble = false
}
}
data.push({
item_report_id: i[4],
trial_balance_commercial: String(Number(i[9].tbc).toFixed(1)),
fiscal_correction: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].fcp).toFixed(2)) : String(Number(i[9].fcp).toFixed(1)),
trial_balance_fiscal: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[9].tbf).toFixed(2)) : String(Number(i[9].tbf).toFixed(1)),
trial_balance_fiscal_actual: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[10]).toFixed(2)) : String(Number(i[10]).toFixed(1)),
trial_balance_fiscal_mb: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[11]).toFixed(2)) : String(Number(i[11]).toFixed(1))
})
})
// this.setState({ loading: false, buttonError: errorContrl, editable: editAble, saveDraft: false })
console.log(errorContrl)
let i = this.state.dataTable
let payload = {
"monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"status": "submitted",
"months": this.props.month.month_id,
"currency_id": this.props.defaultCurrency.id,
"tax_planning": data
}
api.create().validateSubmitReportMRTP(payload).then((response) => {
console.log(payload)
console.log(response)
if (response.data) {
if (response.data.status === "success") {
if (response.data.data.result && errorContrl === false && editAble === false) {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
}
})
}
downloadTemplate = async () => { downloadTemplate = async () => {
let res = await fetch( let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&currency_id=${this.props.defaultCurrency.id}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&currency_id=${this.props.defaultCurrency.id}`
...@@ -1911,123 +1982,214 @@ export default class TaxPlanningMR extends Component { ...@@ -1911,123 +1982,214 @@ export default class TaxPlanningMR extends Component {
</div> </div>
</Paper> </Paper>
: :
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> this.state.visibleButtonUpload === true ?
<div> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ padding: 25 }}> <div>
<div> <div style={{ padding: 25 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()}, {this.props.periode} (rev.{this.props.revision})</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
{this.props.defaultCurrency.id === 1 ? <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()}, {this.props.periode} (rev.{this.props.revision})</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> {this.props.defaultCurrency.id === 1 ?
: <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography> :
} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
</div> }
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</div> </div>
)} {this.state.dataLoaded && (
</div> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<div className="grid grid-2x" style={{ marginTop: 20 }}> {this.state.loading && loadingComponent}
<div className="col-1"> {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<button <MUIDataTable
type="button" data={dataTable2}
onClick={() => this.setState({ loading: true, visibleTP: true }, () => { columns={columns}
setTimeout(() => { options={options}
this.getItemHierarki() />
}, 100); </MuiThemeProvider>}
})}
style={{ marginRight: 20, marginLeft: 10 }}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div> </div>
</button> )}
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="grid grid-2x" style={{ marginTop: 20 }}>
<button <div className="col-1">
className="button" <button
type="button" type="button"
style={{ onClick={() => this.setState({ loading: true, visibleTP: true }, () => {
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false, buttonError: false, editable: true }) this.getItemHierarki()
this.handleValidate(dataTable2)
}, 100); }, 100);
}) })}
}} style={{ marginRight: 20, marginLeft: 10 }}
> >
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div> </div>
</button> </button>
<button </div>
type="button" <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
// disabled={this.state.buttonError} <button
style={{ className="button"
backgroundColor: 'transparent', type="button"
cursor: 'pointer', style={{
borderColor: 'transparent', backgroundColor: 'transparent',
outline: 'none', cursor: 'pointer',
marginRight: 20 borderColor: 'transparent',
}} outline: 'none',
onClick={() => this.state.saveDraft === true ? marginRight: 20
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' }) }}
: onClick={() => {
this.state.handleDoubleClick == 1 ? null : // this.forceUpdate()
this.setState({ handleDoubleClick: 1, loading: true }, () => { this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
this.uploadTP('draft') this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidateSimulasi(dataTable2)
}, 100); }, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})} })}
>
<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 as Draft</Typography> backgroundColor: 'transparent',
</div> cursor: 'pointer',
</button> borderColor: 'transparent',
<button outline: 'none',
type="button" }}
// disabled={this.state.buttonError} >
style={{ <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
backgroundColor: 'transparent', <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save Data</Typography>
cursor: 'pointer', </div>
borderColor: 'transparent', </button>
outline: 'none', </div>
}} </div>
onClick={() => this.state.editable === true ? </div>
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' }) </Paper>
:
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div>
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()}, {this.props.periode} (rev.{this.props.revision})</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
: :
this.state.handleDoubleClick == 1 ? null : <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
this.setState({ handleDoubleClick: 1, loading: true }, () => { }
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
{!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>}
</div>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1">
<button
type="button"
onClick={() => this.setState({ loading: true, visibleTP: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{ marginRight: 20, marginLeft: 10 }}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
// this.forceUpdate()
this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
this.uploadTP('submitted') this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate(dataTable2)
}, 100); }, 100);
})} })
> }}
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 10 }}> >
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
</div> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</button> </div>
</button>
<button
type="button"
// disabled={this.state.buttonError}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.state.saveDraft === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
setTimeout(() => {
this.uploadTP('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}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.state.editable === true ?
this.setState({ alert: true, messageAlert: 'Data Incomplete', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
setTimeout(() => {
this.uploadTP('submitted')
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 10 }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
</div> </div>
</div> </div>
</div> </Paper>
</Paper>
} }
</div> </div>
{this.state.visibleUpload && ( {this.state.visibleUpload && (
...@@ -2107,7 +2269,7 @@ export default class TaxPlanningMR extends Component { ...@@ -2107,7 +2269,7 @@ export default class TaxPlanningMR extends Component {
}} }}
/> />
</div> </div>
{this.state.visibleButtonUpload && {/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}> <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div> <div>
<button <button
...@@ -2131,7 +2293,7 @@ export default class TaxPlanningMR extends Component { ...@@ -2131,7 +2293,7 @@ export default class TaxPlanningMR extends Component {
</button> </button>
</div> </div>
</div> </div>
} } */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */} {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div> </div>
</div> </div>
......
...@@ -602,7 +602,7 @@ export default class ProfitLossROO extends Component { ...@@ -602,7 +602,7 @@ export default class ProfitLossROO extends Component {
console.log("checkUpload Response", response) console.log("checkUpload Response", response)
if (response.data) { if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visiblePLRO: false, loading: true, visibleButtonUpload: true }) this.setState({ visibleUploadSimulasi: false, visiblePLRO: false, loading: true, visibleButtonUpload: true })
let dataTable = response.data.data.map((item, index) => { let dataTable = response.data.data.map((item, index) => {
return [ return [
item.type_report_id, item.type_report_id,
...@@ -850,6 +850,10 @@ export default class ProfitLossROO extends Component { ...@@ -850,6 +850,10 @@ export default class ProfitLossROO extends Component {
// }) // })
} }
handleValidateSimulasi() {
this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false, handleDoubleClick: 0 })
}
closeAlert() { closeAlert() {
this.setState({ alert: false }) this.setState({ alert: false })
} }
...@@ -2742,127 +2746,222 @@ export default class ProfitLossROO extends Component { ...@@ -2742,127 +2746,222 @@ export default class ProfitLossROO extends Component {
} */} } */}
</Paper> </Paper>
: :
<Paper style={{ paddingTop: 10 }}> this.state.visibleButtonUpload ?
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <Paper style={{ paddingTop: 10 }}>
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
</div> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography>
<div style={{ padding: 20 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div> </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}> <div style={{ padding: 20 }}>
{this.state.dataLoaded && ( <div>
<MuiThemeProvider theme={getMuiTheme()}> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<MUIDataTable <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
data={dataTable2} {this.props.defaultCurrency.id === 1 ?
columns={columns} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
options={options} :
/> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
</MuiThemeProvider> }
)} </div>
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.dataLoaded && (
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
)}
</div>
<div className="grid grid-2x" style={{ marginTop: 20 }}>
<div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLRO: true }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => {
this.setState({ loading: true }, () => {
setTimeout(() => {
// this.setState({ loading: false })
this.handleValidateSimulasi()
}, 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
type="button"
// disabled={this.state.buttonError}
onClick={() =>
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadSimulasi('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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 Data</Typography>
</div>
</button>
</div>
</div>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 20 }}> </Paper>
<div className="col-1" style={{ paddingLeft: 0 }}> :
<button <Paper style={{ paddingTop: 10 }}>
type="button" <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
onClick={() => this.setState({ loading: true, visiblePLRO: true }, () => { <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography>
setTimeout(() => { </div>
this.getItemHierarki() <div style={{ padding: 20 }}>
}, 100); <div>
})} <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
style={{ <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
backgroundColor: 'transparent', {this.props.defaultCurrency.id === 1 ?
cursor: 'pointer', <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
borderColor: 'transparent', :
outline: 'none' <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}} }
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
<button {this.state.dataLoaded && (
className="button" <MuiThemeProvider theme={getMuiTheme()}>
type="button" <MUIDataTable
style={{ data={dataTable2}
backgroundColor: 'transparent', columns={columns}
cursor: 'pointer', options={options}
borderColor: 'transparent', />
outline: 'none', </MuiThemeProvider>
marginRight: 20 )}
}} </div>
onClick={() => { <div className="grid grid-2x" style={{ marginTop: 20 }}>
this.setState({ loading: true }, () => { <div className="col-1" style={{ paddingLeft: 0 }}>
<button
type="button"
onClick={() => this.setState({ loading: true, visiblePLRO: true }, () => {
setTimeout(() => { setTimeout(() => {
// this.setState({ loading: false }) this.getItemHierarki()
this.handleValidate()
}, 100); }, 100);
}) })}
}} style={{
> backgroundColor: 'transparent',
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> cursor: 'pointer',
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography> borderColor: 'transparent',
</div> outline: 'none'
</button> }}
<button >
className="button" <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
type="button" <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
style={{ </div>
backgroundColor: 'transparent', </button>
cursor: 'pointer', </div>
borderColor: 'transparent', <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
outline: 'none', <button
marginRight: 20 className="button"
}} type="button"
onClick={() => style={{
this.state.saveDraft === true ? backgroundColor: 'transparent',
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' }) cursor: 'pointer',
: borderColor: 'transparent',
this.state.handleDoubleClick == 1 ? null : outline: 'none',
this.setState({ handleDoubleClick: 1, loading: true }, () => { marginRight: 20
this.uploadProfitLossRO('draft') }}
}) onClick={() => {
} this.setState({ loading: true }, () => {
> setTimeout(() => {
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> // this.setState({ loading: false })
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography> this.handleValidate()
</div> }, 100);
</button> })
<button }}
type="button" >
// disabled={this.state.buttonError} <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
onClick={() => <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
this.state.buttonError ? </div>
this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' }) </button>
: <button
this.state.handleDoubleClick == 1 ? null : className="button"
this.setState({ handleDoubleClick: 1, loading: true }, () => { type="button"
this.uploadProfitLossRO('submitted') style={{
})} backgroundColor: 'transparent',
style={{ cursor: 'pointer',
backgroundColor: 'transparent', borderColor: 'transparent',
cursor: 'pointer', outline: 'none',
borderColor: 'transparent', marginRight: 20
outline: 'none', }}
}} onClick={() =>
> this.state.saveDraft === true ?
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> :
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/} this.state.handleDoubleClick == 1 ? null :
</div> this.setState({ handleDoubleClick: 1, loading: true }, () => {
</button> this.uploadProfitLossRO('draft')
})
}
>
<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({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
:
this.state.handleDoubleClick == 1 ? null :
this.setState({ handleDoubleClick: 1, loading: true }, () => {
this.uploadProfitLossRO('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: '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>
{/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
</div>
</button>
</div>
</div> </div>
</div> </div>
</div> </Paper>}
</Paper>}
</div> </div>
{this.state.visibleUpload && ( {this.state.visibleUpload && (
...@@ -2944,7 +3043,7 @@ export default class ProfitLossROO extends Component { ...@@ -2944,7 +3043,7 @@ export default class ProfitLossROO extends Component {
}} }}
/> />
</div> </div>
{this.state.visibleButtonUpload && {/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}> <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div> <div>
<button <button
...@@ -2968,7 +3067,7 @@ export default class ProfitLossROO extends Component { ...@@ -2968,7 +3067,7 @@ export default class ProfitLossROO extends Component {
</button> </button>
</div> </div>
</div> </div>
} } */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */} {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div> </div>
</div> </div>
......
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