Commit 5b7da6bc authored by d.arizona's avatar d.arizona

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into didam

parents d373357d 3243630e
...@@ -1069,6 +1069,7 @@ export default class BudgetTahunan extends Component { ...@@ -1069,6 +1069,7 @@ export default class BudgetTahunan extends Component {
onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleTP: false, visibleBudgetTahunan: true })}
getReport={this.getCompanyActive.bind(this)} getReport={this.getCompanyActive.bind(this)}
status={this.state.status} status={this.state.status}
isApprover={this.state.isApprover}
/> />
)} )}
{this.state.visibleFAM && ( {this.state.visibleFAM && (
...@@ -1085,6 +1086,7 @@ export default class BudgetTahunan extends Component { ...@@ -1085,6 +1086,7 @@ export default class BudgetTahunan extends Component {
onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })} onClickClose={() => this.setState({ visibleFAM: false, visibleBudgetTahunan: true })}
getReport={this.getCompanyActive.bind(this)} getReport={this.getCompanyActive.bind(this)}
status={this.state.status} status={this.state.status}
isApprover={this.state.isApprover}
/> />
)} )}
{this.state.visibleCAT && ( {this.state.visibleCAT && (
......
...@@ -45,7 +45,8 @@ export default class BalanceSheet extends Component { ...@@ -45,7 +45,8 @@ export default class BalanceSheet extends Component {
editable: false, editable: false,
buttonError: false, buttonError: false,
judulColumn: null, judulColumn: null,
updateBy: '-' updateBy: '-',
handleTekTekTek: 0
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -326,7 +327,7 @@ export default class BalanceSheet extends Component { ...@@ -326,7 +327,7 @@ export default class BalanceSheet extends Component {
item.total_current_year, item.total_current_year,
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.order, item.orders,
item.error item.error
] ]
}) })
...@@ -2126,13 +2127,14 @@ export default class BalanceSheet extends Component { ...@@ -2126,13 +2127,14 @@ export default class BalanceSheet extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.state.editable === true ? onClick={() =>
null : this.state.editable === true ?
this.setState({ loading: true }, () => { null :
setTimeout(() => { this.state.handleTekTekTek == 1 ? null :
this.backToMasterBudget('draft') this.setState({ handleTekTekTek: 1 }, () => {
}, 100); this.backToMasterBudget('draft')
})} })
}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
...@@ -2141,17 +2143,14 @@ export default class BalanceSheet extends Component { ...@@ -2141,17 +2143,14 @@ export default class BalanceSheet extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => { onClick={() =>
this.state.buttonError ? this.state.buttonError ?
this.setState({ loading: true }, () => { this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
setTimeout(() => { :
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false }) this.state.handleTekTekTek == 1 ? null :
}, 100); this.setState({ handleTekTekTek: 1 }, () => {
}) this.backToMasterBudget('submitted')
: this.setState({ loading: true }, () => { })}
this.backToMasterBudget('submitted')
})
}}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
...@@ -2233,11 +2232,14 @@ export default class BalanceSheet extends Component { ...@@ -2233,11 +2232,14 @@ export default class BalanceSheet extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { onClick={() => this.setState({ loading: true }, () =>
setTimeout(() => { this.state.handleTekTekTek == 1 ? null :
this.uploadBalanceSheet('draft') this.setState({ handleTekTekTek: 1 }, () => {
}, 100); setTimeout(() => {
})} this.uploadBalanceSheet('draft')
}, 100);
})
)}
style={{ marginRight: 20 }} style={{ marginRight: 20 }}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
...@@ -2247,11 +2249,14 @@ export default class BalanceSheet extends Component { ...@@ -2247,11 +2249,14 @@ export default class BalanceSheet extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { onClick={() => this.setState({ loading: true }, () =>
setTimeout(() => { this.state.handleTekTekTek == 1 ? null :
this.uploadBalanceSheet('submitted') this.setState({ handleTekTekTek: 1 }, () => {
}, 100); setTimeout(() => {
})} this.uploadBalanceSheet('submitted')
}, 100);
})
)}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
......
...@@ -444,7 +444,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -444,7 +444,7 @@ export default class FixedAssetsMovement extends Component {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true }) this.setState({ loading: false, buttonError: false, editable: false })
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({ loading: false, buttonError: true, editable: true })
} }
...@@ -725,6 +725,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -725,6 +725,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
...@@ -812,6 +813,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -812,6 +813,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -900,6 +902,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -900,6 +902,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -988,6 +991,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -988,6 +991,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1076,6 +1080,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1076,6 +1080,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1164,6 +1169,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1164,6 +1169,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1252,6 +1258,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1252,6 +1258,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1340,6 +1347,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1340,6 +1347,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1428,6 +1436,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1428,6 +1436,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1516,6 +1525,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1516,6 +1525,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1604,6 +1614,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1604,6 +1614,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1692,6 +1703,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1692,6 +1703,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1818,6 +1830,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1818,6 +1830,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1906,6 +1919,7 @@ export default class FixedAssetsMovement extends Component { ...@@ -1906,6 +1919,7 @@ export default class FixedAssetsMovement extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2009,55 +2023,57 @@ export default class FixedAssetsMovement extends Component { ...@@ -2009,55 +2023,57 @@ export default class FixedAssetsMovement extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> {this.props.isApprover === true ? null :
<a data-tip={'Download Template'} data-for="template"> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Download Template'} data-for="template">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.downloadTemplate()} }}
> onClick={() => this.downloadTemplate()}
<img src={Images.template} /> >
</button> <img src={Images.template} />
</a> </button>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Upload'} data-for="upload"> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Upload'} data-for="upload">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.setState({ visibleUpload: true })} }}
> onClick={() => this.setState({ visibleUpload: true })}
<img src={Images.upload} /> >
</button> <img src={Images.upload} />
</a> </button>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Download'} data-for="download"> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Download'} data-for="download">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => }}
this.setState({ loading: true }, () => { onClick={() =>
setTimeout(() => { this.setState({ loading: true }, () => {
this.downloadAllData() setTimeout(() => {
}, 100); this.downloadAllData()
})} }, 100);
> })}
<img src={Images.download} /> >
</button> <img src={Images.download} />
</a> </button>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> </a>
</div> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
}
</div> </div>
</div> </div>
...@@ -2096,80 +2112,80 @@ export default class FixedAssetsMovement extends Component { ...@@ -2096,80 +2112,80 @@ export default class FixedAssetsMovement extends Component {
</div> </div>
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%'}}> {this.props.isApprover === true ? null :
<button <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%'}}>
className="button" <button
type="button" className="button"
style={{ type="button"
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
outline: 'none', borderColor: 'transparent',
marginRight: 20 outline: 'none',
}} marginRight: 20
onClick={() => { }}
this.setState({ loading: true }, () => { onClick={() => {
setTimeout(() => {
// this.setState({ loading: false, buttonError: false, editable: true })
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"
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
// disabled={this.state.buttonError}
onClick={() => {
this.state.buttonError ?
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false }) // this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate()
}, 100); }, 100);
}) })
: this.backToMasterBudget('submitted') }}
}} >
style={{ <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
backgroundColor: 'transparent', <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
cursor: this.state.buttonError === true ? 'default' : 'pointer', </div>
borderColor: 'transparent', </button>
outline: 'none', <button
}} className="button"
> type="button"
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> style={{
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> backgroundColor: 'transparent',
</div> cursor: this.state.editable !== true ? 'pointer' : 'default',
</button> borderColor: 'transparent',
</div> outline: 'none',
marginRight: 20
}}
onClick={() => this.state.editable === true ?
null :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => {
this.state.buttonError ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false })
}, 100);
})
: this.setState({ loading: true }, () => {
this.backToMasterBudget('submitted')
})
}}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
}
</div> </div>
</Paper> </Paper>
: :
......
...@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip'; ...@@ -9,6 +9,7 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab'; import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -45,7 +46,9 @@ export default class ProfitLoss extends Component { ...@@ -45,7 +46,9 @@ export default class ProfitLoss extends Component {
editable: false, editable: false,
buttonError: false, buttonError: false,
judulColumn: null, judulColumn: null,
updateBy: '-' updateBy: '-',
buttonDraft: true,
handleTekTekTek: 0
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -163,9 +166,9 @@ export default class ProfitLoss extends Component { ...@@ -163,9 +166,9 @@ export default class ProfitLoss extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false, buttonError: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else { } else {
this.setState({ dataTable, loading: false, buttonError: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} }
}) })
...@@ -230,7 +233,8 @@ export default class ProfitLoss extends Component { ...@@ -230,7 +233,8 @@ export default class ProfitLoss extends Component {
"status": type, "status": type,
"profit_loss": data "profit_loss": data
} }
// console.log(data); console.log(data);
this.setState({ loading: false })
this.props.saveToMasterBudget(payload) this.props.saveToMasterBudget(payload)
this.props.onClickClose() this.props.onClickClose()
} }
...@@ -331,7 +335,7 @@ export default class ProfitLoss extends Component { ...@@ -331,7 +335,7 @@ export default class ProfitLoss extends Component {
item.total_current_year, item.total_current_year,
item.total_next_year, item.total_next_year,
item.total_more_year, item.total_more_year,
item.order, item.orders,
item.error item.error
] ]
}) })
...@@ -419,7 +423,7 @@ export default class ProfitLoss extends Component { ...@@ -419,7 +423,7 @@ export default class ProfitLoss extends Component {
handleValidate() { handleValidate() {
let data = [] let data = []
console.log(this.state.dataTable) // console.log(this.state.dataTable)
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
data.push({ data.push({
item_report_id: i[1], item_report_id: i[1],
...@@ -454,7 +458,7 @@ export default class ProfitLoss extends Component { ...@@ -454,7 +458,7 @@ export default class ProfitLoss extends Component {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true }) this.setState({ loading: false, buttonError: false, editable: false })
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({ loading: false, buttonError: true, editable: true })
} }
...@@ -554,7 +558,7 @@ export default class ProfitLoss extends Component { ...@@ -554,7 +558,7 @@ export default class ProfitLoss extends Component {
} else if (opt == "kali") { } else if (opt == "kali") {
total = Number(total) * Number(item) total = Number(total) * Number(item)
} else if (opt == "bagi") { } else if (opt == "bagi") {
total = Number(total) / Number(item) total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item)
} else { } else {
total += item total += item
} }
...@@ -641,7 +645,7 @@ export default class ProfitLoss extends Component { ...@@ -641,7 +645,7 @@ export default class ProfitLoss extends Component {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null : {tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
...@@ -651,6 +655,7 @@ export default class ProfitLoss extends Component { ...@@ -651,6 +655,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -679,23 +684,24 @@ export default class ProfitLoss extends Component { ...@@ -679,23 +684,24 @@ export default class ProfitLoss extends Component {
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 4 ?
null null
: : tableMeta.rowData[0] === 1 ?
<div style={{ flex: 1 }}> null :
<FormControlLabel <div style={{ flex: 1 }}>
style={{ margin: 0 }} <FormControlLabel
value={value} style={{ margin: 0 }}
control={ value={value}
<NumberFormat control={
thousandSeparator={true} <NumberFormat
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} thousandSeparator={true}
type="text" style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
placeholder="" type="text"
disabled={true} placeholder=""
value={Number(value).toFixed(1)} disabled={true}
/> value={Number(value).toFixed(1)}
} />
/> }
</div> />
</div>
} }
</div> </div>
) )
...@@ -724,10 +730,11 @@ export default class ProfitLoss extends Component { ...@@ -724,10 +730,11 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -812,11 +819,12 @@ export default class ProfitLoss extends Component { ...@@ -812,11 +819,12 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
console.log(dataTable2) // console.log(dataTable2)
}} }}
/> />
} }
...@@ -901,6 +909,7 @@ export default class ProfitLoss extends Component { ...@@ -901,6 +909,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -990,6 +999,7 @@ export default class ProfitLoss extends Component { ...@@ -990,6 +999,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1079,6 +1089,7 @@ export default class ProfitLoss extends Component { ...@@ -1079,6 +1089,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1168,6 +1179,7 @@ export default class ProfitLoss extends Component { ...@@ -1168,6 +1179,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1257,6 +1269,7 @@ export default class ProfitLoss extends Component { ...@@ -1257,6 +1269,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1346,6 +1359,7 @@ export default class ProfitLoss extends Component { ...@@ -1346,6 +1359,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1435,6 +1449,7 @@ export default class ProfitLoss extends Component { ...@@ -1435,6 +1449,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1524,6 +1539,7 @@ export default class ProfitLoss extends Component { ...@@ -1524,6 +1539,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1613,6 +1629,7 @@ export default class ProfitLoss extends Component { ...@@ -1613,6 +1629,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1702,6 +1719,7 @@ export default class ProfitLoss extends Component { ...@@ -1702,6 +1719,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1829,6 +1847,7 @@ export default class ProfitLoss extends Component { ...@@ -1829,6 +1847,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1918,6 +1937,7 @@ export default class ProfitLoss extends Component { ...@@ -1918,6 +1937,7 @@ export default class ProfitLoss extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.isApprover}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2034,55 +2054,57 @@ export default class ProfitLoss extends Component { ...@@ -2034,55 +2054,57 @@ export default class ProfitLoss extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> {this.props.isApprover == true ? null :
<a data-tip={'Download Template'} data-for="template"> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<button <a data-tip={'Download Template'} data-for="template">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.downloadTemplate()} }}
> onClick={() => this.downloadTemplate()}
<img src={Images.template} /> >
</button> <img src={Images.template} />
</a> </button>
<ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Upload'} data-for="upload"> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Upload'} data-for="upload">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => this.setState({ visibleUpload: true })} }}
> onClick={() => this.setState({ visibleUpload: true })}
<img src={Images.upload} /> >
</button> <img src={Images.upload} />
</a> </button>
<ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> </a>
<a data-tip={'Download'} data-for="download"> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
<button <a data-tip={'Download'} data-for="download">
style={{ <button
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
margin: 5 borderColor: 'transparent',
}} margin: 5
onClick={() => }}
this.setState({ loading: true }, () => { onClick={() =>
setTimeout(() => { this.setState({ loading: true }, () => {
this.downloadAllData() setTimeout(() => {
}, 100); this.downloadAllData()
})} }, 100);
> })}
<img src={Images.download} /> >
</button> <img src={Images.download} />
</a> </button>
<ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> </a>
</div> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
</div>
}
</div> </div>
</div> </div>
...@@ -2119,79 +2141,93 @@ export default class ProfitLoss extends Component { ...@@ -2119,79 +2141,93 @@ export default class ProfitLoss extends Component {
</div> </div>
</button> </button>
</div> </div>
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> {this.props.isApprover === true ? null :
<button <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
className="button" <button
type="button" className="button"
style={{ type="button"
backgroundColor: 'transparent', style={{
cursor: 'pointer', backgroundColor: 'transparent',
borderColor: 'transparent', cursor: 'pointer',
outline: 'none', borderColor: 'transparent',
marginRight: 20 outline: 'none',
}} marginRight: 20
onClick={() => { }}
this.setState({ loading: true }, () => { onClick={() => {
setTimeout(() => { this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false}, () => {
this.handleValidate()
}, 100);
})
}}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.state.editable === true ?
this.setState({ loading: true }, () => {
setTimeout(() => {
this.backToMasterBudget('draft')
}, 100);
}) :
this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
}, 100);
})}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
onClick={() => {
this.state.buttonError ?
this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false }) this.handleValidate()
}, 100); }, 100);
}) })
: this.backToMasterBudget('submitted') }}
}} >
style={{ <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
backgroundColor: 'transparent', <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
cursor: this.state.buttonError === true ? 'default' : 'pointer', </div>
borderColor: 'transparent', </button>
outline: 'none', <button
}} className="button"
> type="button"
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> style={{
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> backgroundColor: 'transparent',
</div> cursor: this.state.editable !== true ? 'pointer' : 'default',
</button> borderColor: 'transparent',
</div> outline: 'none',
marginRight: 20
}}
disabled={this.state.buttonDraft}
onClick={() =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('draft')
})
}
// onClick={() => this.state.editable === true ?
// null :
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.backToMasterBudget('draft')
// }, 100);
// })}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
</div>
</button>
<button
type="button"
disabled={this.state.buttonError}
// onClick={() => {
// this.state.buttonError ?
// this.setState({ loading: true }, () => {
// setTimeout(() => {
// this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false })
// }, 100);
// })
// : this.setState({ loading: true }, () => {
// this.backToMasterBudget('submitted')
// })
// }}
onClick={() => this.state.buttonError?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('submitted')
})}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div>
</button>
</div>
}
</div> </div>
</Paper> </Paper>
: :
...@@ -2260,12 +2296,22 @@ export default class ProfitLoss extends Component { ...@@ -2260,12 +2296,22 @@ export default class ProfitLoss extends Component {
<button <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { // onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.uploadProfitLoss('draft') // this.uploadProfitLoss('draft')
}, 100); // }, 100);
})} // })}
style={{ marginRight: 20 }} onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
setTimeout(() => {
this.uploadProfitLoss("draft")
}, 100);
})
)}
style={{
marginRight: 20
}}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
...@@ -2274,11 +2320,19 @@ export default class ProfitLoss extends Component { ...@@ -2274,11 +2320,19 @@ export default class ProfitLoss extends Component {
<button <button
type="button" type="button"
// disabled={this.state.buttonError} // disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { // onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.uploadProfitLoss('submitted') // this.uploadProfitLoss('submitted')
}, 100); // }, 100);
})} // })}
onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
setTimeout(() => {
this.uploadProfitLoss("submitted")
}, 100);
})
)}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
......
...@@ -11,6 +11,7 @@ import ReactTooltip from 'react-tooltip'; ...@@ -11,6 +11,7 @@ import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab'; import { Alert } from '@material-ui/lab';
import * as R from 'ramda';
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -48,7 +49,10 @@ export default class TaxPlanning extends Component { ...@@ -48,7 +49,10 @@ export default class TaxPlanning extends Component {
editable: false, editable: false,
buttonError: false, buttonError: false,
judulColumn: null, judulColumn: null,
updateBy: '-' updateBy: '-',
buttonDraft: true,
handleTekTekTek: 0
} }
this.handleValue = this.handleValue.bind(this) this.handleValue = this.handleValue.bind(this)
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
...@@ -170,9 +174,9 @@ export default class TaxPlanning extends Component { ...@@ -170,9 +174,9 @@ export default class TaxPlanning extends Component {
} }
} }
}) })
this.setState({ dataTable, loading: false, buttonError: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} else { } else {
this.setState({ dataTable, loading: false, buttonError: true }) this.setState({ dataTable, loading: false, buttonError: true, editable: true })
} }
}) })
} }
...@@ -693,7 +697,7 @@ export default class TaxPlanning extends Component { ...@@ -693,7 +697,7 @@ export default class TaxPlanning extends Component {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
console.log(response) console.log(response)
if (response.data.data.result) { if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: true, }) this.setState({ loading: false, buttonError: false, editable: false })
// alert("Type Input Can't be Empty") // alert("Type Input Can't be Empty")
} else { } else {
this.setState({ loading: false, buttonError: true, editable: true }) this.setState({ loading: false, buttonError: true, editable: true })
...@@ -717,6 +721,8 @@ export default class TaxPlanning extends Component { ...@@ -717,6 +721,8 @@ export default class TaxPlanning extends Component {
} }
async downloadAllData() { async downloadAllData() {
let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
console.log(url);
let res = await fetch( let res = await fetch(
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
) )
...@@ -820,7 +826,7 @@ export default class TaxPlanning extends Component { ...@@ -820,7 +826,7 @@ export default class TaxPlanning extends Component {
"formula": rilFormula "formula": rilFormula
} }
api.create().countingFormula(body).then(response => { api.create().countingFormula(body).then(response => {
console.log(response); // console.log(response);
}) })
} else { } else {
let body = { let body = {
...@@ -832,10 +838,10 @@ export default class TaxPlanning extends Component { ...@@ -832,10 +838,10 @@ export default class TaxPlanning extends Component {
"formula": rilFormula "formula": rilFormula
} }
api.create().countingFormula(body).then(response => { api.create().countingFormula(body).then(response => {
console.log(response) // console.log(response)
console.log(tableMeta) // console.log(tableMeta)
console.log(tableMeta.rowIndex) // console.log(tableMeta.rowIndex)
console.log(rowColumn) // console.log(rowColumn)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
return response.data.data.result return response.data.data.result
...@@ -884,7 +890,14 @@ export default class TaxPlanning extends Component { ...@@ -884,7 +890,14 @@ export default class TaxPlanning extends Component {
} }
} }
}) })
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) if (R.equals(Number(total), NaN) ){
total = {tbc: "", fcp: "", tbf: ""}
} else {
total = Number(total)
}
// console.log(Number(total))
// console.log(dataTable2[tableMeta.rowIndex])
let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
return a return a
} }
...@@ -1009,6 +1022,7 @@ export default class TaxPlanning extends Component { ...@@ -1009,6 +1022,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1085,6 +1099,7 @@ export default class TaxPlanning extends Component { ...@@ -1085,6 +1099,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1163,6 +1178,7 @@ export default class TaxPlanning extends Component { ...@@ -1163,6 +1178,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1271,6 +1287,7 @@ export default class TaxPlanning extends Component { ...@@ -1271,6 +1287,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1348,6 +1365,7 @@ export default class TaxPlanning extends Component { ...@@ -1348,6 +1365,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1426,6 +1444,7 @@ export default class TaxPlanning extends Component { ...@@ -1426,6 +1444,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1537,6 +1556,7 @@ export default class TaxPlanning extends Component { ...@@ -1537,6 +1556,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc)} value={Number(value.tbc)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1614,6 +1634,7 @@ export default class TaxPlanning extends Component { ...@@ -1614,6 +1634,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1692,6 +1713,7 @@ export default class TaxPlanning extends Component { ...@@ -1692,6 +1713,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1802,6 +1824,7 @@ export default class TaxPlanning extends Component { ...@@ -1802,6 +1824,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1879,6 +1902,7 @@ export default class TaxPlanning extends Component { ...@@ -1879,6 +1902,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1957,6 +1981,7 @@ export default class TaxPlanning extends Component { ...@@ -1957,6 +1981,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2067,6 +2092,7 @@ export default class TaxPlanning extends Component { ...@@ -2067,6 +2092,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2144,6 +2170,7 @@ export default class TaxPlanning extends Component { ...@@ -2144,6 +2170,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2222,6 +2249,7 @@ export default class TaxPlanning extends Component { ...@@ -2222,6 +2249,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2332,6 +2360,7 @@ export default class TaxPlanning extends Component { ...@@ -2332,6 +2360,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2409,6 +2438,7 @@ export default class TaxPlanning extends Component { ...@@ -2409,6 +2438,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2487,6 +2517,7 @@ export default class TaxPlanning extends Component { ...@@ -2487,6 +2517,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2597,6 +2628,7 @@ export default class TaxPlanning extends Component { ...@@ -2597,6 +2628,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2674,6 +2706,7 @@ export default class TaxPlanning extends Component { ...@@ -2674,6 +2706,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2752,6 +2785,7 @@ export default class TaxPlanning extends Component { ...@@ -2752,6 +2785,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2862,6 +2896,7 @@ export default class TaxPlanning extends Component { ...@@ -2862,6 +2896,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -2939,6 +2974,7 @@ export default class TaxPlanning extends Component { ...@@ -2939,6 +2974,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3017,6 +3053,7 @@ export default class TaxPlanning extends Component { ...@@ -3017,6 +3053,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3127,6 +3164,7 @@ export default class TaxPlanning extends Component { ...@@ -3127,6 +3164,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3204,6 +3242,7 @@ export default class TaxPlanning extends Component { ...@@ -3204,6 +3242,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3282,6 +3321,7 @@ export default class TaxPlanning extends Component { ...@@ -3282,6 +3321,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3392,6 +3432,7 @@ export default class TaxPlanning extends Component { ...@@ -3392,6 +3432,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3469,6 +3510,7 @@ export default class TaxPlanning extends Component { ...@@ -3469,6 +3510,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3547,6 +3589,7 @@ export default class TaxPlanning extends Component { ...@@ -3547,6 +3589,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3657,6 +3700,7 @@ export default class TaxPlanning extends Component { ...@@ -3657,6 +3700,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3734,6 +3778,7 @@ export default class TaxPlanning extends Component { ...@@ -3734,6 +3778,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3812,6 +3857,7 @@ export default class TaxPlanning extends Component { ...@@ -3812,6 +3857,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3922,6 +3968,7 @@ export default class TaxPlanning extends Component { ...@@ -3922,6 +3968,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -3999,6 +4046,7 @@ export default class TaxPlanning extends Component { ...@@ -3999,6 +4046,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4077,6 +4125,7 @@ export default class TaxPlanning extends Component { ...@@ -4077,6 +4125,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4192,7 +4241,7 @@ export default class TaxPlanning extends Component { ...@@ -4192,7 +4241,7 @@ export default class TaxPlanning extends Component {
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="input" placeholder="input"
disabled={true} disabled={this.props.isApprover}
value={Number(handleTotal(tableMeta)).toFixed(1)} value={Number(handleTotal(tableMeta)).toFixed(1)}
/> />
} }
...@@ -4298,6 +4347,7 @@ export default class TaxPlanning extends Component { ...@@ -4298,6 +4347,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4375,6 +4425,7 @@ export default class TaxPlanning extends Component { ...@@ -4375,6 +4425,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4453,6 +4504,7 @@ export default class TaxPlanning extends Component { ...@@ -4453,6 +4504,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4563,6 +4615,7 @@ export default class TaxPlanning extends Component { ...@@ -4563,6 +4615,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbc).toFixed(1)} value={Number(value.tbc).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4640,6 +4693,7 @@ export default class TaxPlanning extends Component { ...@@ -4640,6 +4693,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.fcp).toFixed(1)} value={Number(value.fcp).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4718,6 +4772,7 @@ export default class TaxPlanning extends Component { ...@@ -4718,6 +4772,7 @@ export default class TaxPlanning extends Component {
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="input" placeholder="input"
disabled={this.props.isApprover}
value={Number(value.tbf).toFixed(1)} value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -4825,6 +4880,7 @@ export default class TaxPlanning extends Component { ...@@ -4825,6 +4880,7 @@ export default class TaxPlanning extends Component {
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
</div> </div>
<div style={{ width: '50%' }}> <div style={{ width: '50%' }}>
{this.props.isApprover == true ? null :
<div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
<a data-tip={'Download Template'} data-for="template"> <a data-tip={'Download Template'} data-for="template">
<button <button
...@@ -4874,6 +4930,7 @@ export default class TaxPlanning extends Component { ...@@ -4874,6 +4930,7 @@ export default class TaxPlanning extends Component {
</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> </div>
...@@ -4910,6 +4967,7 @@ export default class TaxPlanning extends Component { ...@@ -4910,6 +4967,7 @@ export default class TaxPlanning extends Component {
</div> </div>
</button> </button>
</div> </div>
{this.props.isApprover === true ? null :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
<button <button
className="button" className="button"
...@@ -4923,7 +4981,7 @@ export default class TaxPlanning extends Component { ...@@ -4923,7 +4981,7 @@ export default class TaxPlanning extends Component {
}} }}
onClick={() => { onClick={() => {
// this.forceUpdate() // this.forceUpdate()
this.setState({ loading: true }, () => { this.setState({ loading: true, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
// this.setState({ loading: false, buttonError: false, editable: true }) // this.setState({ loading: false, buttonError: false, editable: true })
this.handleValidate() this.handleValidate()
...@@ -4938,21 +4996,24 @@ export default class TaxPlanning extends Component { ...@@ -4938,21 +4996,24 @@ export default class TaxPlanning extends Component {
<button <button
className="button" className="button"
type="button" type="button"
onClick={() => this.state.editable === true ? disabled={this.state.buttonDraft}
this.setState({ loading: true }, () => { // onClick={() => this.state.editable === true ?
setTimeout(() => { // null :
this.backToMasterBudget('draft') // this.setState({ loading: true }, () => {
}, 100); // setTimeout(() => {
}) : // this.backToMasterBudget('draft')
this.setState({ loading: true }, () => { // }, 100);
setTimeout(() => { // })
this.props.onClickClose() // }
}, 100); onClick={() =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('draft')
}) })
} }
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: this.state.editable !== true ? 'pointer' : 'default',
borderColor: 'transparent', borderColor: 'transparent',
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
...@@ -4966,15 +5027,24 @@ export default class TaxPlanning extends Component { ...@@ -4966,15 +5027,24 @@ export default class TaxPlanning extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => { // onClick={() => {
this.state.buttonError ? // this.state.buttonError ?
this.setState({ loading: true }, () => { // this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false }) // this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning', loading: false })
}, 100); // }, 100);
}) // })
: this.backToMasterBudget('submitted') // : this.setState({ loading: true }, () => {
}} // this.backToMasterBudget('submitted')
// })
// }}
onClick={() => this.state.buttonError?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
:
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
this.backToMasterBudget('submitted')
})}
style={{ style={{
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer', cursor: this.state.buttonError === true ? 'default' : 'pointer',
...@@ -4987,6 +5057,7 @@ export default class TaxPlanning extends Component { ...@@ -4987,6 +5057,7 @@ export default class TaxPlanning extends Component {
</div> </div>
</button> </button>
</div> </div>
}
</div> </div>
</Paper> </Paper>
: :
...@@ -5054,13 +5125,28 @@ export default class TaxPlanning extends Component { ...@@ -5054,13 +5125,28 @@ export default class TaxPlanning extends Component {
</button> </button>
<button <button
type="button" type="button"
// disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { // onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.uploadTP('draft') // this.uploadTP('draft')
}, 100); // }, 100);
})} // })}
style={{ marginRight: 20}} // style={{ marginRight: 20}}
style={{
backgroundColor: 'transparent',
cursor: this.state.buttonError === true ? 'default' : 'pointer',
borderColor: 'transparent',
outline: 'none',
marginRight: 20
}}
onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
setTimeout(() => {
this.uploadTP("draft")
}, 100);
})
)}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
...@@ -5069,11 +5155,19 @@ export default class TaxPlanning extends Component { ...@@ -5069,11 +5155,19 @@ export default class TaxPlanning extends Component {
<button <button
type="button" type="button"
disabled={this.state.buttonError} disabled={this.state.buttonError}
onClick={() => this.setState({ loading: true }, () => { // onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { // setTimeout(() => {
this.uploadTP('submitted') // this.uploadTP('submitted')
}, 100); // }, 100);
})} // })}
onClick={() => this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1? null :
this.setState({handleTekTekTek: 1}, () => {
setTimeout(() => {
this.uploadTP("submitted")
}, 100);
})
)}
> >
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
......
...@@ -55,7 +55,6 @@ export default class CreateManagementDoc extends Component { ...@@ -55,7 +55,6 @@ export default class CreateManagementDoc extends Component {
this.getPeriode() this.getPeriode()
this.getMonth() this.getMonth()
this.getFileSize() this.getFileSize()
console.log(this.props.setting_id)
console.log(this.props.name) console.log(this.props.name)
} }
...@@ -69,9 +68,15 @@ export default class CreateManagementDoc extends Component { ...@@ -69,9 +68,15 @@ export default class CreateManagementDoc extends Component {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
if(response.data.data.length == 0){
this.setState({
sizeUpload: "1"
})
} else
this.setState({ this.setState({
sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1" sizeUpload: response.data.data[0].value
}) })
console.log(this.state.sizeUpload)
} }
} }
}) })
...@@ -121,7 +126,7 @@ export default class CreateManagementDoc extends Component { ...@@ -121,7 +126,7 @@ export default class CreateManagementDoc extends Component {
// } // }
api.create().getDocumentCategory().then(response => { api.create().getDocumentCategory().then(response => {
console.log(response); // console.log(response);
if (response.data) { if (response.data) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
...@@ -155,7 +160,7 @@ export default class CreateManagementDoc extends Component { ...@@ -155,7 +160,7 @@ export default class CreateManagementDoc extends Component {
getPeriode() { getPeriode() {
api.create().getPeriodeTransaction().then(response => { api.create().getPeriodeTransaction().then(response => {
let dateNow = new Date let dateNow = new Date
console.log(dateNow) // console.log(dateNow)
let year = format(dateNow, 'yyyy') let year = format(dateNow, 'yyyy')
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -179,7 +184,6 @@ export default class CreateManagementDoc extends Component { ...@@ -179,7 +184,6 @@ export default class CreateManagementDoc extends Component {
getMonth(){ getMonth(){
api.create().getMonthTransaction().then(response => { api.create().getMonthTransaction().then(response => {
let dateNow = new Date let dateNow = new Date
console.log(dateNow)
// let bulan = format(dateNow, 'MMMM') // let bulan = format(dateNow, 'MMMM')
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
...@@ -220,7 +224,7 @@ export default class CreateManagementDoc extends Component { ...@@ -220,7 +224,7 @@ export default class CreateManagementDoc extends Component {
let length = event.name.split(".").length let length = event.name.split(".").length
let fileType = event.name.split(".")[length - 1] let fileType = event.name.split(".")[length - 1]
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
console.log(fileType) // console.log(fileType)
if (err) { if (err) {
console.log(err); console.log(err);
} }
...@@ -248,7 +252,7 @@ export default class CreateManagementDoc extends Component { ...@@ -248,7 +252,7 @@ export default class CreateManagementDoc extends Component {
formData.append("documentPeriode", null); formData.append("documentPeriode", null);
formData.append("documentMonth", null); formData.append("documentMonth", null);
this.setState({ formData }, ()=> { this.setState({ formData }, ()=> {
this.props.createDocument(this.state.formData, this.props.setting_id) this.props.createDocument(this.state.formData, this.props.setting_id, this.props.name)
}) })
} }
...@@ -274,7 +278,7 @@ export default class CreateManagementDoc extends Component { ...@@ -274,7 +278,7 @@ export default class CreateManagementDoc extends Component {
formData.append("documentPeriode", this.state.periode.periode); formData.append("documentPeriode", this.state.periode.periode);
formData.append("documentMonth", this.state.monthId.month_id); formData.append("documentMonth", this.state.monthId.month_id);
this.setState({ formData }, ()=> { this.setState({ formData }, ()=> {
this.props.createDocument(this.state.formData, this.props.setting_id) this.props.createDocument(this.state.formData, this.props.setting_id, this.props.name)
}) })
} }
} }
......
...@@ -37,7 +37,7 @@ export default class DocumentManagement extends Component { ...@@ -37,7 +37,7 @@ export default class DocumentManagement extends Component {
menu: "document management" menu: "document management"
} }
api.create().getPermission(payload).then(response => { api.create().getPermission(payload).then(response => {
console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.setState({ this.setState({
...@@ -95,7 +95,7 @@ export default class DocumentManagement extends Component { ...@@ -95,7 +95,7 @@ export default class DocumentManagement extends Component {
}) })
} }
createDocument(payload, settingID) { createDocument(payload, settingID, menuName) {
api.create().uploadDocument(payload).then(response => { api.create().uploadDocument(payload).then(response => {
console.log(response) console.log(response)
if (response.data) { if (response.data) {
...@@ -106,8 +106,8 @@ export default class DocumentManagement extends Component { ...@@ -106,8 +106,8 @@ export default class DocumentManagement extends Component {
}) })
} }
else if (response.data.message === "Upload Document Success") { else if (response.data.message === "Upload Document Success") {
this.getDataDocument(settingID) this.getDataDocument(settingID, menuName)
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', settingID, visibleCreate: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'success', settingID, menuName, visibleCreate: false })
} }
else { else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
...@@ -146,7 +146,7 @@ export default class DocumentManagement extends Component { ...@@ -146,7 +146,7 @@ export default class DocumentManagement extends Component {
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.getDataDocument(this.state.settingID) this.getDataDocument(this.state.settingID, this.state.menuName)
this.setState({ konfirmasi: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success', visibleCreate: false }) this.setState({ konfirmasi: false, alert: true, messageAlert: response.data.message, tipeAlert: 'success', visibleCreate: false })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......
...@@ -57,7 +57,6 @@ export default class EditManagementDoc extends Component { ...@@ -57,7 +57,6 @@ export default class EditManagementDoc extends Component {
this.getFileSize() this.getFileSize()
if (this.props.type === 'edit') { if (this.props.type === 'edit') {
this.getDetailDoc() this.getDetailDoc()
console.log(this.props.data)
} }
} }
...@@ -265,12 +264,11 @@ export default class EditManagementDoc extends Component { ...@@ -265,12 +264,11 @@ export default class EditManagementDoc extends Component {
} }
fileHandler = (event) => { fileHandler = (event) => {
console.log(event)
let fileObj = event let fileObj = event
let length = event.name.split(".").length let length = event.name.split(".").length
let fileType = event.name.split(".")[length - 1] let fileType = event.name.split(".")[length - 1]
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
console.log(fileType) // console.log(fileType)
if (err) { if (err) {
console.log(err); console.log(err);
} }
...@@ -321,12 +319,6 @@ export default class EditManagementDoc extends Component { ...@@ -321,12 +319,6 @@ export default class EditManagementDoc extends Component {
this.setState({ formData }, () => { this.setState({ formData }, () => {
this.props.updateDocument(this.state.formData) this.props.updateDocument(this.state.formData)
}) })
var object = {};
formData.forEach(function(value, key){
object[key] = value;
});
var json = JSON.stringify(object);
console.log(json)
} }
} }
......
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