Commit c73f22af authored by d.arizona's avatar d.arizona

apdet

parent 8fff5844
......@@ -422,7 +422,7 @@ export default class DashboardCAT extends Component {
<Typography style={{ fontSize: '16px', color: 'white' }}>Dashboard CAT Report</Typography>
</div>
<div style={{ padding: 20 }}>
<div style={{ marginTop: 0 }}>
<div style={{ marginTop: 0, display: 'flex' }}>
<Autocomplete
{...this.state.listCompany}
id="month"
......@@ -449,8 +449,6 @@ export default class DashboardCAT extends Component {
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.company}
/>
</div>
<div style={{ marginTop: 20 }}>
<Autocomplete
{...this.state.listPeriode}
id="month"
......@@ -462,8 +460,6 @@ export default class DashboardCAT extends Component {
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"
......@@ -484,6 +480,40 @@ export default class DashboardCAT extends Component {
value={this.state.month}
/>
</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>
{!this.state.loading && <div className="padding-20px" style={{ display: 'flex' }}>
......
......@@ -3159,6 +3159,20 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Report Type" margin="normal" style={{ marginTop: 7 }} />}
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 style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete
......@@ -3173,6 +3187,19 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Company" margin="normal" style={{ marginTop: 7 }} />}
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.listUom}
// getOptionLabel={(option) => titleCase(option.label)}
......@@ -3186,7 +3213,7 @@ export default class SubHolding extends Component {
value={this.state.uom}
/> : null : null} */}
</div>
<div style={{ marginTop: 15, display: 'flex' }}>
{/* <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete
{...this.state.listPeriode}
id="periode"
......@@ -3201,7 +3228,7 @@ export default class SubHolding extends Component {
/>}
value={this.state.periode}
/>
</div>
</div> */}
{this.state.report != null ? String(this.state.report.label).toLocaleLowerCase().includes('quarterly') ? <div style={{ marginTop: 15, display: 'flex' }}>
<Autocomplete
{...this.state.listQuarter}
......@@ -3216,7 +3243,7 @@ export default class SubHolding extends Component {
value={this.state.quarter}
/>
</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
{...this.state.listMonths}
// getOptionLabel={(option) => titleCase(option.label)}
......@@ -3229,7 +3256,7 @@ export default class SubHolding extends Component {
renderInput={(params) => <TextField {...params} label="Months" margin="normal" style={{ marginTop: 7 }} />}
value={this.state.month}
/>
</div> : null : null}
</div> : null : null} */}
</div>
<div>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0px 20px 10px 20px' }}>
......
......@@ -481,7 +481,7 @@ export default class RollingOutlook extends Component {
console.log(this.state.dataForRevision);
this.state.dataForRevision.map(i => {
if (i.report_name === item) {
if (i.revision !== revision) {
if (i.revision == revision) {
this.setState({ prevRevision: true })
} else {
this.setState({ prevRevision: false })
......@@ -1267,6 +1267,8 @@ export default class RollingOutlook extends Component {
isApprover={this.state.isApprover}
quarter={this.state.quarter.value}
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 {
quarter={this.state.quarter.value}
isApprover={this.state.isApprover}
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 {
} else {
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 })
}
......@@ -254,6 +262,9 @@ export default class BalanceSheetRO extends Component {
a.download = 'Template Rolling Outlook Balance Sheet.xlsx';
a.click();
}
setTimeout(() => {
this.setState({loading: false})
}, 500);
}
async downloadAllData() {
......@@ -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}`
)
res = await res.blob()
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -272,6 +282,9 @@ export default class BalanceSheetRO extends Component {
a.download = 'Rolling Outlook Balance Sheet.xlsx';
a.click();
}
setTimeout(() => {
this.setState({loading: false})
}, 500);
}
handleGetFor(type) {
......@@ -2827,9 +2840,7 @@ export default class BalanceSheetRO extends Component {
}}
onClick={() =>
this.setState({ loading: true }, () => {
setTimeout(() => {
this.downloadAllData()
}, 100);
})}
>
<img src={Images.download} />
......@@ -2846,7 +2857,9 @@ export default class BalanceSheetRO extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
onClick={() => this.setState({loading: true}, () => {
this.downloadTemplate()
})}
>
<img src={Images.template} />
</button>
......@@ -2860,7 +2873,14 @@ export default class BalanceSheetRO extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.setState({ visibleUpload: true })}
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.setState({
loading: false,
visibleUpload: true
})
}, 300);
})}
>
<img src={Images.upload} />
</button>
......@@ -3062,7 +3082,9 @@ export default class BalanceSheetRO extends Component {
type="button"
onClick={() => this.setState({ loading: true }, () => {
setTimeout(() => {
this.props.onClickClose()
this.setState({visibleBSRO: true, visibleUpload: false}, () => {
this.handleGetFor('edit')
})
}, 100);
})}
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