Commit e03d5af3 authored by Hardiansyah's avatar Hardiansyah

Fix history master budget

parent db55449e
...@@ -2178,9 +2178,8 @@ export default class BudgetTahunan extends Component { ...@@ -2178,9 +2178,8 @@ export default class BudgetTahunan extends Component {
master_report_type_id master_report_type_id
} }
api.create().historyApproval(body).then(response => { api.create().historyApproval(body).then(response => {
// // // console.log(response);
if (response.data.data.length > 0) { if (response.data.data.length > 0) {
const dataTable = response.data.data.forEach(item => { const dataTable = response.data.data.map(item => {
let indexC = String(item.status_approval).toLocaleUpperCase().indexOf('C') let indexC = String(item.status_approval).toLocaleUpperCase().indexOf('C')
let status_approv = '' let status_approv = ''
if (String(item.status_approval).toLocaleUpperCase().includes('CC')) { if (String(item.status_approval).toLocaleUpperCase().includes('CC')) {
...@@ -2971,9 +2970,46 @@ export default class BudgetTahunan extends Component { ...@@ -2971,9 +2970,46 @@ export default class BudgetTahunan extends Component {
) )
} }
renderHistoryInfo = (master_report_type_id) => {
const obj = this.getSubmissionObj(master_report_type_id)
return (
this.state.checkApprover === true ?
obj.lastStatus === 'WAITING FOR REVIEW' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{obj.lastStatus}</span>
</div> : obj.lastStatus === 'WAITING FOR YOUR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{obj.lastStatus}</span>
</div> : obj.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${obj.lastStatus} - ${this.state.pic}`}</span>
</div> : obj.lastStatus === 'APPROVED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${obj.lastStatus}`}</span>
</div> : null
:
obj.lastStatus === 'SUBMITTED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{obj.lastStatus}</span>
</div> :
obj.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${obj.lastStatus} - ${this.state.pic}`}</span>
</div> :
obj.lastStatus === 'REVISION' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>NEED REVISION</span>
</div> :
obj.lastStatus === 'APPROVED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>APPROVED</span>
</div> : null
)
}
renderBtnSubmit = (master_report_type_id) => { renderBtnSubmit = (master_report_type_id) => {
const obj = this.getSubmissionObj(master_report_type_id) const obj = this.getSubmissionObj(master_report_type_id)
console.log(obj, master_report_type_id)
return ( return (
this.state.isAdmin && obj.lastStatus == 'APPROVED' ? this.state.isAdmin && obj.lastStatus == 'APPROVED' ?
<div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}> <div className="grid grid-2x" style={{ borderTop: 'solid 1px #c4c4c4', padding: 10, backgroundColor: '#f5f5f5', width: '100%', }}>
...@@ -3409,6 +3445,8 @@ export default class BudgetTahunan extends Component { ...@@ -3409,6 +3445,8 @@ export default class BudgetTahunan extends Component {
/> />
</div> </div>
); );
const mstIdFinance = this.state?.rowDataFinance?.length > 0 && this.state.rowDataFinance[0]?.master_report_type_id
const mstIdCAT = this.state?.rowDataCAT?.length > 0 && this.state.rowDataCAT[0]?.master_report_type_id
return ( return (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }} > <div style={{ flex: 1, backgroundColor: '#f8f8f8' }} >
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}> <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
...@@ -3475,6 +3513,7 @@ export default class BudgetTahunan extends Component { ...@@ -3475,6 +3513,7 @@ export default class BudgetTahunan extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
{this.renderAttachment()} {this.renderAttachment()}
{this.renderHistoryInfo(mstIdFinance)}
{this.state.visibleTableHistory && ( {this.state.visibleTableHistory && (
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
...@@ -3487,7 +3526,7 @@ export default class BudgetTahunan extends Component { ...@@ -3487,7 +3526,7 @@ export default class BudgetTahunan extends Component {
</div> </div>
)} )}
</div> </div>
{this.state.checkApprover && this.state.isApproverFinance && this.renderBtnSubmit(this.state?.rowDataFinance?.length > 0 && this.state.rowDataFinance[0]?.master_report_type_id)} {this.state.checkApprover && this.state.isApproverFinance && this.renderBtnSubmit(mstIdFinance)}
<div style={{ padding: '0 20px 20px' }}> <div style={{ padding: '0 20px 20px' }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}> <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Report CAT</Typography> <Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Report CAT</Typography>
...@@ -3516,6 +3555,7 @@ export default class BudgetTahunan extends Component { ...@@ -3516,6 +3555,7 @@ export default class BudgetTahunan extends Component {
/> />
</MuiThemeProvider> </MuiThemeProvider>
{this.renderAttachment()} {this.renderAttachment()}
{this.renderHistoryInfo(mstIdCAT)}
{this.state.visibleTableHistoryCAT && ( {this.state.visibleTableHistoryCAT && (
<div style={{ marginTop: 20 }}> <div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}> <MuiThemeProvider theme={getMuiTheme()}>
...@@ -3528,7 +3568,7 @@ export default class BudgetTahunan extends Component { ...@@ -3528,7 +3568,7 @@ export default class BudgetTahunan extends Component {
</div> </div>
)} )}
</div> </div>
{this.state.checkApprover && this.state.isApproverCAT && this.renderBtnSubmit(this.state?.rowDataCAT?.length > 0 && this.state.rowDataCAT[0]?.master_report_type_id)} {this.state.checkApprover && this.state.isApproverCAT && this.renderBtnSubmit(mstIdCAT)}
</Paper> </Paper>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment