Commit fe22144d authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

Ggmac

See merge request !1309
parents 3134b6cf b324ef53
...@@ -422,7 +422,7 @@ export default class DashboardCAT extends Component { ...@@ -422,7 +422,7 @@ export default class DashboardCAT extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Dashboard CAT Report</Typography> <Typography style={{ fontSize: '16px', color: 'white' }}>Dashboard CAT Report</Typography>
</div> </div>
<div style={{ padding: 20 }}> <div style={{ padding: 20 }}>
<div style={{ marginTop: 0 }}> <div style={{ marginTop: 0, display: 'flex' }}>
<Autocomplete <Autocomplete
{...this.state.listCompany} {...this.state.listCompany}
id="month" id="month"
...@@ -449,8 +449,6 @@ export default class DashboardCAT extends Component { ...@@ -449,8 +449,6 @@ export default class DashboardCAT extends Component {
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company} value={this.state.company}
/> />
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete <Autocomplete
{...this.state.listPeriode} {...this.state.listPeriode}
id="month" id="month"
...@@ -462,8 +460,6 @@ export default class DashboardCAT extends Component { ...@@ -462,8 +460,6 @@ export default class DashboardCAT extends Component {
renderInput={(params) => <TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.periode} value={this.state.periode}
/> />
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete <Autocomplete
{...this.state.listMonth} {...this.state.listMonth}
id="month" id="month"
...@@ -484,6 +480,40 @@ export default class DashboardCAT extends Component { ...@@ -484,6 +480,40 @@ export default class DashboardCAT extends Component {
value={this.state.month} value={this.state.month}
/> />
</div> </div>
{/* <div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listPeriode}
id="month"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true }, () => {
this.getDasboardCAT()
})}
disableClearable
style={{ maxWidth: 250, marginRight: 20 }}
renderInput={(params) => <TextField {...params} label="Periode" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.periode}
/>
</div> */}
{/* <div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listMonth}
id="month"
onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true }, () => {
let index = this.state.listMonth.options.findIndex((val) => val.month_id == this.state.month.month_id)
let selectedMonth = []
this.state.listMonth.options.map((item, indexs) => {
if (indexs <= index) {
selectedMonth.push(item.month_value)
}
})
this.setState({ selectedMonth })
this.getDasboardCAT()
})}
disableClearable
style={{ maxWidth: 250, marginRight: 20 }}
renderInput={(params) => <TextField {...params} label="Month" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/>
</div> */}
</div> </div>
{!this.state.loading && <div className="padding-20px" style={{ display: 'flex' }}> {!this.state.loading && <div className="padding-20px" style={{ display: 'flex' }}>
......
...@@ -3159,6 +3159,20 @@ export default class SubHolding extends Component { ...@@ -3159,6 +3159,20 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.report} value={this.state.report}
/> />
<Autocomplete
{...this.state.listPeriode}
id="periode"
onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disabled={this.state.intent === 'Home' ? true : false}
disableClearable
style={{ width: 250, marginLeft: 20}}
renderInput={(params) =>
<TextField {...params} label="Period" margin="normal" style={{ marginTop: 7 }}
/>}
value={this.state.periode}
/>
</div> </div>
<div style={{ marginTop: 15, display: 'flex' }}> <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete <Autocomplete
...@@ -3173,6 +3187,19 @@ export default class SubHolding extends Component { ...@@ -3173,6 +3187,19 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company} value={this.state.company}
/> />
{this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ?
<Autocomplete
{...this.state.listMonths}
// getOptionLabel={(option) => titleCase(option.label)}
id="months"
onChange={(event, newInputValue) => this.setState({ month: newInputValue, loading: true, previewTable: false }, () => {
this.getReportType()
})}
disableClearable
style={{ width: 250, marginLeft: 20}}
renderInput={(params) => <TextField {...params} label="Months" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/> : null : null}
{/* {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete {/* {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <Autocomplete
{...this.state.listUom} {...this.state.listUom}
// getOptionLabel={(option) => titleCase(option.label)} // getOptionLabel={(option) => titleCase(option.label)}
...@@ -3186,7 +3213,7 @@ export default class SubHolding extends Component { ...@@ -3186,7 +3213,7 @@ export default class SubHolding extends Component {
value={this.state.uom} value={this.state.uom}
/> : null : null} */} /> : null : null} */}
</div> </div>
<div style={{ marginTop: 15, display: 'flex' }}> {/* <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete <Autocomplete
{...this.state.listPeriode} {...this.state.listPeriode}
id="periode" id="periode"
...@@ -3201,7 +3228,7 @@ export default class SubHolding extends Component { ...@@ -3201,7 +3228,7 @@ export default class SubHolding extends Component {
/>} />}
value={this.state.periode} value={this.state.periode}
/> />
</div> </div> */}
{this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('quarterly') ? <div style={{ marginTop: 15, display: 'flex' }}> {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('quarterly') ? <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete <Autocomplete
{...this.state.listQuarter} {...this.state.listQuarter}
...@@ -3216,7 +3243,7 @@ export default class SubHolding extends Component { ...@@ -3216,7 +3243,7 @@ export default class SubHolding extends Component {
value={this.state.quarter} value={this.state.quarter}
/> />
</div> : null : null} </div> : null : null}
{this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <div style={{ marginTop: 15, display: 'flex' }}> {/* {this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('summary') ? <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete <Autocomplete
{...this.state.listMonths} {...this.state.listMonths}
// getOptionLabel={(option) => titleCase(option.label)} // getOptionLabel={(option) => titleCase(option.label)}
...@@ -3229,7 +3256,7 @@ export default class SubHolding extends Component { ...@@ -3229,7 +3256,7 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Months" margin="normal" style={{ marginTop: 7 }} />} renderInput={(params) => <TextField {...params} label="Months" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month} value={this.state.month}
/> />
</div> : null : null} </div> : null : null} */}
</div> </div>
<div> <div>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0px 20px 10px 20px' }}> <div style={{ display: 'flex', justifyContent: 'space-between', padding: '0px 20px 10px 20px' }}>
......
...@@ -481,7 +481,7 @@ export default class RollingOutlook extends Component { ...@@ -481,7 +481,7 @@ export default class RollingOutlook extends Component {
console.log(this.state.dataForRevision); console.log(this.state.dataForRevision);
this.state.dataForRevision.map(i => { this.state.dataForRevision.map(i => {
if (i.report_name === item) { if (i.report_name === item) {
if (i.revision !== revision) { if (i.revision == revision) {
this.setState({ prevRevision: true }) this.setState({ prevRevision: true })
} else { } else {
this.setState({ prevRevision: false }) this.setState({ prevRevision: false })
...@@ -1267,6 +1267,8 @@ export default class RollingOutlook extends Component { ...@@ -1267,6 +1267,8 @@ export default class RollingOutlook extends Component {
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
quarter={this.state.quarter.value} quarter={this.state.quarter.value}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true} prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
...@@ -1285,6 +1287,8 @@ export default class RollingOutlook extends Component { ...@@ -1285,6 +1287,8 @@ export default class RollingOutlook extends Component {
quarter={this.state.quarter.value} quarter={this.state.quarter.value}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true} prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
......
...@@ -96,7 +96,15 @@ export default class BalanceSheetRO extends Component { ...@@ -96,7 +96,15 @@ export default class BalanceSheetRO extends Component {
} else { } else {
checkStatus = false checkStatus = false
} }
// console.log(this.props.isApprover);
// console.log(this.props.lastStatus);
// console.log(this.props.prevRevision);
// console.log(this.props.status);
// console.log(!checkApprover);
// console.log(checkLastStatus);
// console.log(checkStatus);
// console.log(checkPrevRev);
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev }) this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
} }
...@@ -254,6 +262,9 @@ export default class BalanceSheetRO extends Component { ...@@ -254,6 +262,9 @@ export default class BalanceSheetRO extends Component {
a.download = 'Template Rolling Outlook Balance Sheet.xlsx'; a.download = 'Template Rolling Outlook Balance Sheet.xlsx';
a.click(); a.click();
} }
setTimeout(() => {
this.setState({loading: false})
}, 500);
} }
async downloadAllData() { async downloadAllData() {
...@@ -264,7 +275,6 @@ export default class BalanceSheetRO extends Component { ...@@ -264,7 +275,6 @@ export default class BalanceSheetRO extends Component {
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${this.props.rollingOutlookID === null ? "" : this.props.rollingOutlookID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${this.props.rollingOutlookID === null ? "" : this.props.rollingOutlookID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}`
) )
res = await res.blob() res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
let a = document.createElement('a'); let a = document.createElement('a');
...@@ -272,6 +282,9 @@ export default class BalanceSheetRO extends Component { ...@@ -272,6 +282,9 @@ export default class BalanceSheetRO extends Component {
a.download = 'Rolling Outlook Balance Sheet.xlsx'; a.download = 'Rolling Outlook Balance Sheet.xlsx';
a.click(); a.click();
} }
setTimeout(() => {
this.setState({loading: false})
}, 500);
} }
handleGetFor(type) { handleGetFor(type) {
...@@ -2827,9 +2840,7 @@ export default class BalanceSheetRO extends Component { ...@@ -2827,9 +2840,7 @@ export default class BalanceSheetRO extends Component {
}} }}
onClick={() => onClick={() =>
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData() this.downloadAllData()
}, 100);
})} })}
> >
<img src={Images.download} /> <img src={Images.download} />
...@@ -2846,7 +2857,9 @@ export default class BalanceSheetRO extends Component { ...@@ -2846,7 +2857,9 @@ export default class BalanceSheetRO extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.downloadTemplate()} onClick={() => this.setState({loading: true}, () => {
this.downloadTemplate()
})}
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
...@@ -2860,7 +2873,14 @@ export default class BalanceSheetRO extends Component { ...@@ -2860,7 +2873,14 @@ export default class BalanceSheetRO extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.setState({ visibleUpload: true })} onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({
loading: false,
visibleUpload: true
})
}, 300);
})}
> >
<img src={Images.upload} /> <img src={Images.upload} />
</button> </button>
...@@ -3062,7 +3082,9 @@ export default class BalanceSheetRO extends Component { ...@@ -3062,7 +3082,9 @@ export default class BalanceSheetRO extends Component {
type="button" type="button"
onClick={() => this.setState({ loading: true }, () => { onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.props.onClickClose() this.setState({visibleBSRO: true, visibleUpload: false}, () => {
this.handleGetFor('edit')
})
}, 100); }, 100);
})} })}
style={{ style={{
......
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