Commit 60c6eba1 authored by faisalhamdi's avatar faisalhamdi

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

parents 4b8cdadc cb404c2e
......@@ -241,7 +241,7 @@ const create = (type = "") => {
const getLastestUpdateMROI = (body) => api.post('transaction/operating_indicator/monthly_report/get_latest_update', body)
// Rolling Outlook
const getRollingOutlookID = (body) => api.post('transaction/rolling_outlook/get_monthly_report_id', body)
const getRollingOutlookID = (body) => api.post('transaction/rolling_outlook/get_rolling_outlook_id', body)
const getRollingOutlookAttachment = (body) => api.post('transaction/rolling_outlook/get_report_attachment', body)
const uploadRollingOutlookAttachment = (body) => api.post('transaction/rolling_outlook/upload_attachment', body)
const deleteRollingOutlookAttachment = (body) => api.post(`transaction/rolling_outlook/delete_attachment/${body}`)
......@@ -273,8 +273,7 @@ const create = (type = "") => {
const getLastestUpdateROOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_latest_update', body)
const checkUploadRollingOutlookOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/check_import', body)
const uploadRollingOutlookOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/import_rolling_outlook', body)
const submitRollingOutlook = (body) => api.post('transaction/rolling_outlook/submit_rolling_outlook', body)
//REPORT NEW
const getAllReportBS = (body) => api.post('/transaction/db_balance_sheet/get_report_hierarki', body)
......@@ -762,7 +761,8 @@ const create = (type = "") => {
createRollingOI,
getLastestUpdateROOI,
checkUploadRollingOutlookOI,
uploadRollingOutlookOI
uploadRollingOutlookOI,
submitRollingOutlook
}
}
......
......@@ -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' }}>
......
......@@ -81,8 +81,13 @@ export default class OperatingIndicatorMR extends Component {
handleViewOnly() {
let checkCreate = this.props.permission.create
let checkEdit = this.props.permission.edit
let checkStatus = true
this.setState({viewOnly: checkCreate && checkEdit})
if (String(this.props.data.status).toLocaleUpperCase() === 'CLOSED') {
checkStatus = false
}
this.setState({viewOnly: checkCreate && checkEdit && checkStatus})
}
handleGetFor(type) {
......
......@@ -333,7 +333,7 @@ export default class OperatingIndicator extends Component {
String(item[1]).toLocaleLowerCase().includes('dec') ? 12 : null
this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company, status: item[2] },
visibleOperatingIndicator: false,
visibleDetailOpt: false,
visibleDetailMonthly: true,
......@@ -348,7 +348,7 @@ export default class OperatingIndicator extends Component {
String(item[1]).toLocaleLowerCase().includes('q3') ? "q3" : null
this.setState({
statusDetail: String(item[2]).toLocaleLowerCase(),
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company },
dataDetail: { ...this.state.dataReport[index], periode: this.state.periode.periode, operatingIndID: this.state.operatingIndID, company: this.state.company, status: item[2] },
visibleOperatingIndicator: false,
visibleDetailOpt: false,
visibleDetailMonthly: false,
......
......@@ -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 })
......@@ -660,7 +660,7 @@ export default class RollingOutlook extends Component {
let body = {
rolling_outlook_id: this.state.rollingOutlookID
}
api.create().submitMasterBudget(body).then(response => {
api.create().submitRollingOutlook(body).then(response => {
console.log(response);
if (response.data) {
if (response.data.status === "Success") {
......@@ -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={{
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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