Commit 4555699a authored by ardiansyah's avatar ardiansyah

Merge branch 'ENV-DEV' into 'ENV-DEPLOYMENT'

Fix history master budget

See merge request !2392
parents defb414a e03d5af3
......@@ -2178,9 +2178,8 @@ export default class BudgetTahunan extends Component {
master_report_type_id
}
api.create().historyApproval(body).then(response => {
// // // console.log(response);
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 status_approv = ''
if (String(item.status_approval).toLocaleUpperCase().includes('CC')) {
......@@ -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) => {
const obj = this.getSubmissionObj(master_report_type_id)
console.log(obj, master_report_type_id)
return (
this.state.isAdmin && obj.lastStatus == 'APPROVED' ?
<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 {
/>
</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 (
<div style={{ flex: 1, backgroundColor: '#f8f8f8' }} >
<Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
......@@ -3475,6 +3513,7 @@ export default class BudgetTahunan extends Component {
</MuiThemeProvider>
</div>
{this.renderAttachment()}
{this.renderHistoryInfo(mstIdFinance)}
{this.state.visibleTableHistory && (
<div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}>
......@@ -3487,7 +3526,7 @@ export default class BudgetTahunan extends Component {
</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={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
<Typography style={{ fontSize: '16px', color: '#4b4b4b', fontWeight: 'bold' }}>Report CAT</Typography>
......@@ -3516,6 +3555,7 @@ export default class BudgetTahunan extends Component {
/>
</MuiThemeProvider>
{this.renderAttachment()}
{this.renderHistoryInfo(mstIdCAT)}
{this.state.visibleTableHistoryCAT && (
<div style={{ marginTop: 20 }}>
<MuiThemeProvider theme={getMuiTheme()}>
......@@ -3528,7 +3568,7 @@ export default class BudgetTahunan extends Component {
</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>
</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