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={{
......
......@@ -69,8 +69,15 @@ export default class OperatingIndicatorRO extends Component {
handleViewOnly() {
let checkCreate = this.props.permission.create
let checkEdit = this.props.permission.edit
let checkStatus = true
this.setState({ viewOnly: checkCreate && checkEdit })
console.log(this.props.data.status);
if (String(this.props.data.status).toLocaleUpperCase() === 'CLOSED') {
checkStatus = false
}
console.log(checkStatus);
this.setState({ viewOnly: checkCreate && checkEdit && checkStatus})
}
handleGetFor(type) {
......@@ -814,7 +821,7 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
value={ value === "0" ? "" : Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
......@@ -833,7 +840,7 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
value={ value === "0" ? "" : Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
......@@ -854,7 +861,8 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
// value={Number(value).toFixed(1)}
value={value === "0" ? "" : Number(value).toFixed(1)}
decimalScale={1}
disabled={true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
......@@ -864,7 +872,8 @@ export default class OperatingIndicatorRO extends Component {
/>
}
/>
</div>)
</div>
)
}
</div>
)
......@@ -908,7 +917,7 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
value={ value === "0" ? "" :Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
......@@ -927,7 +936,7 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
value={ value === "0" ? "" : Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
......@@ -948,7 +957,8 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
// value={Number(value).toFixed(1)}
value={value === "0" ? "" : Number(value).toFixed(1)}
decimalScale={1}
disabled={true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
......@@ -958,7 +968,8 @@ export default class OperatingIndicatorRO extends Component {
/>
}
/>
</div>)
</div>
)
}
</div>
)
......@@ -1001,7 +1012,7 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleParent(tableMeta)).toFixed(1)}
value={ value === "0" ? "" : Number(handleParent(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
/>
......@@ -1020,7 +1031,7 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleFormula(tableMeta)).toFixed(1)}
value={value === "0" ? "" : Number(handleFormula(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
......@@ -1041,7 +1052,8 @@ export default class OperatingIndicatorRO extends Component {
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(1)}
value={value === "0" ? "" : Number(value).toFixed(1)}
// value={Number(value).toFixed(1)}
decimalScale={1}
disabled={true}
// disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
......@@ -1051,7 +1063,8 @@ export default class OperatingIndicatorRO extends Component {
/>
}
/>
</div>)
</div>
)
}
</div>
)
......@@ -2045,7 +2058,11 @@ export default class OperatingIndicatorRO extends Component {
borderColor: 'transparent',
margin: 5
}}
onClick={() => this.downloadTemplate()}
onClick={() => {
// this.setState({loading: true}, () => {
this.downloadTemplate()
// })
}}
>
<img src={Images.template} />
</button>
......@@ -2120,7 +2137,7 @@ export default class OperatingIndicatorRO extends Component {
</button>
</div>
{!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 2 }}>
{this.state.get_for == 'view' && this.state.viewOnly &&
{this.state.get_for == 'view' &&
<button
type="button"
onClick={() => {
......@@ -2354,7 +2371,7 @@ export default class OperatingIndicatorRO extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes(String(this.props.quartal).toLocaleUpperCase()) && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
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