Commit a2828c4b authored by Riri Novita's avatar Riri Novita

Merge branch 'riri' into 'master'

apdet

See merge request !1301
parents 91aa7148 f54a12fa
......@@ -267,6 +267,7 @@ const create = (type = "") => {
const getHierarkiRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/get_report_hierarki', body)
const createRollingOI = (body) => api.post('transaction/operating_indicator/rolling_outlook/create_rolling_outlook', body)
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)
......@@ -750,7 +751,8 @@ const create = (type = "") => {
getRollingOI,
getHierarkiRollingOI,
createRollingOI,
getLastestUpdateROOI
getLastestUpdateROOI,
checkUploadRollingOutlookOI
}
}
......
......@@ -347,13 +347,11 @@ export default class OperatingIndicatorRO extends Component {
}
async downloadAllData() {
// // // console.log('masuk')
let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode]
// // console.log(bram)
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${this.state.operatingIndIDRolling == null ? "" : this.state.operatingIndIDRolling}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&quartal=${this.props.quartal}`
console.log(url);
let res = await fetch(
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${this.state.operatingIndIDRolling === null ? "" : this.state.operatingIndIDRolling}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&quartal=${this.props.quartal}`
)
res = await res.blob()
// // console.log(res)
this.setState({ loading: false })
......@@ -385,7 +383,6 @@ export default class OperatingIndicatorRO extends Component {
item_report_id: i[1] === undefined ? "0" : String(i[1]).trim(),
item_report: i[2] === undefined ? "0" : String(i[2]).trim(),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
// total_actual_before: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
......@@ -404,20 +401,23 @@ export default class OperatingIndicatorRO extends Component {
})
let body = {
company_id: this.props.data.company.company_id,
operating_indicator_id: this.state.operatingIndIDRolling,
periode: this.props.data.periode,
quartal: this.props.quartal,
report_id: this.props.data.report_id,
rolling_outlook: payload,
status: 'submitted'
}
console.log(body)
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
console.log(resp.rows[1][0]);
this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
}
});
}
checkUpload() {
// // console.log(JSON.stringify(this.state.payload))
api.create().checkUploadOperatingInd(this.state.payload).then(response => {
api.create().checkUploadRollingOutlookOI(this.state.payload).then(response => {
// // // console.log(JSON.stringify(this.state.payload));
// // console.log('===============')
console.log(response)
......@@ -437,7 +437,6 @@ export default class OperatingIndicatorRO extends Component {
item.level,
item.item_report,
item.uom,
item.total_actual_before,
item.january,
item.february,
item.march,
......@@ -2355,7 +2354,7 @@ export default class OperatingIndicatorRO extends Component {
this.setState({ uploadStatus: 'idle', percentage: '0' })
}}
onUpload={() => {
this.state.judul === "MASTER BUDGET - OPERATING 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("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
this.checkUpload() :
this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
}}
......
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