Commit 01ccb14a authored by d.arizona's avatar d.arizona

apdet

parent 52e426d8
......@@ -91,8 +91,8 @@ export default class CorporateAnnualTarget extends Component {
this.getKPIType()
this.getMaxAch()
this.getLatestUpdate()
// console.log(this.props.status)
// // console.log(this.props.lastStatus);
// // console.log(this.props.status)
// // // console.log(this.props.lastStatus);
}
......@@ -105,12 +105,12 @@ export default class CorporateAnnualTarget extends Component {
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
}
// console.log(JSON.stringify(payload))
// // console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
console.log(response)
// console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status == 'success') {
......@@ -226,9 +226,9 @@ export default class CorporateAnnualTarget extends Component {
}
}
})
// console.log(dataTable)
// // console.log(dataTable)
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataCustomerPrs)
// // console.log(dataCustomerPrs)
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -256,7 +256,7 @@ export default class CorporateAnnualTarget extends Component {
`https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
)
res = await res.blob()
// // console.log(res)
// // // console.log(res)
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
let a = document.createElement('a');
......@@ -267,16 +267,16 @@ export default class CorporateAnnualTarget extends Component {
}
async downloadAllData() {
// // console.log('masuk')
// // // console.log('masuk')
let bram = [this.props.submissionID, this.props.report_id, this.props.company.company_id, this.props.periode, this.props.revision]
// // console.log(bram)
// // // console.log(bram)
let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
let res = await fetch(
this.props.submissionID == null ? resNull : resReal
)
res = await res.blob()
// // console.log(res)
// // // console.log(res)
this.setState({ loading: false })
if (res.size > 0) {
let url = window.URL.createObjectURL(res);
......@@ -290,13 +290,13 @@ export default class CorporateAnnualTarget extends Component {
fileHandler = (event) => {
let fileObj = event
ExcelRenderer(fileObj, (err, resp) => {
// // // console.log(resp)
// // // // console.log(resp)
if (err) {
// // console.log(err);
// // // console.log(err);
}
else {
let isi = resp.rows.slice(3)
// // console.log(isi);
// console.log(isi);
let payload = []
let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
isi.map((i, index) => {
......@@ -318,15 +318,16 @@ export default class CorporateAnnualTarget extends Component {
}
nilaiTotal = i[6] == 'SUM' ? total : i[6] == 'AVG' ? total / 12 : lastValz
}
// // console.log(nilaiTotal)
// // // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
// console.log(i[2])
// // console.log(Number(i[2] * 100))
// // // // console.log(i[2] === undefined ? "" : String(Number(i[2]*100)).length > 3? String(Number(i[2]*100).toFixed(0) + '%') : String(Number(i[2]*100)) + '%')
payload.push({
item_report_id: i[0] === undefined ? 0 : reg.test(String(i[0])) === false ? 0 : String(i[0]).trim(),
item_report: i[1] === undefined ? "" : String(i[1]).trim(),
weight: i[2] === undefined ? "" : String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%',
weight: i[2] === undefined ? "" : (String(i[2]).includes('%')? String(i[2].trim()) : (String(Number(i[2] * 100)).length > 3 ? String(Number(i[2] * 100).toFixed(0) + '%') : String(Number(i[2] * 100)) + '%')),
uom: i[3] === undefined ? "" : String(i[3]).trim(),
kpi_type: i[4] === undefined ? "" : String(i[4]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? String(Number(i[5] * 100) + '%') : String(i[5]).trim(),
max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? (String(i[5]).includes('%')? String(i[5].trim()) : String(Number(i[5] * 100) + '%')) : String(i[5]).trim(),
formula: i[6] === undefined ? "" : String(i[6]).trim(),
total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(),
january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(),
......@@ -349,6 +350,8 @@ export default class CorporateAnnualTarget extends Component {
})
}
})
// console.log(payload)
let body = {
company_id: this.props.company.company_id,
periode: this.props.periode,
......@@ -356,7 +359,7 @@ export default class CorporateAnnualTarget extends Component {
status: '',
cat: payload
}
// // console.log(body)
// // // console.log(body)
this.setState({ payload: body, judul: resp.rows[1][0] })
}
});
......@@ -367,7 +370,7 @@ export default class CorporateAnnualTarget extends Component {
let dataDelete = this.state.dataDelete
api.create().getIdDeleteFromExcel(this.state.payload).then((response) => {
if (response.data) {
// // // console.log(response.data)
// // // // console.log(response.data)
let idDelete = response.data.data.item_report_id
if (idDelete.length > 0) {
idDelete.map((item, index) => {
......@@ -377,10 +380,10 @@ export default class CorporateAnnualTarget extends Component {
}
}
})
// console.log(JSON.stringify(this.state.payload))
// console.log(this.state.payload)
api.create().checkUploadMB(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
// // console.log(JSON.stringify(this.state.payload));
// // console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
......@@ -447,16 +450,16 @@ export default class CorporateAnnualTarget extends Component {
item.error
])
})
// console.log(dataTable)
// // console.log(this.state.buttonError)
// // console.log(dataTable)
// // // console.log(this.state.buttonError)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, dataDelete }, () => {
this.state.dataTable.map(item => {
if (item[30].length > 0) {
// // console.log('masuk')
// // // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true })
}
})
// // // console.log(this.state.dataTable);
// // // // console.log(this.state.dataTable);
})
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
......@@ -479,7 +482,7 @@ export default class CorporateAnnualTarget extends Component {
uploadCAT(type) {
// let dataDelete = this.state.dataDelete
// // console.log(dataDelete)
// // // console.log(dataDelete)
let payload = { "item_report_id": this.state.dataDelete }
if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => {
......@@ -505,7 +508,10 @@ export default class CorporateAnnualTarget extends Component {
stateFR = false
}
}
} else {
stateFR = false
}
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_report": String(i[6]),
......@@ -515,18 +521,18 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(2)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)) == "" ? "0.0" : String(Number(i[13]).toFixed(1)),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(2)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)) == "" ? "0.0" : String(Number(i[14]).toFixed(1)),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(2)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)) == "" ? "0.0" : String(Number(i[15]).toFixed(1)),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(2)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)) == "" ? "0.0" : String(Number(i[16]).toFixed(1)),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(2)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)) == "" ? "0.0" : String(Number(i[17]).toFixed(1)),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(2)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)) == "" ? "0.0" : String(Number(i[18]).toFixed(1)),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(2)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(Number(i[19]).toFixed(1)) == "" ? "0.0" : String(Number(i[19]).toFixed(1)),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(2)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(Number(i[20]).toFixed(1)) == "" ? "0.0" : String(Number(i[20]).toFixed(1)),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(2)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(Number(i[21]).toFixed(1)) == "" ? "0.0" : String(Number(i[21]).toFixed(1)),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(2)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(Number(i[22]).toFixed(1)) == "" ? "0.0" : String(Number(i[22]).toFixed(1)),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(2)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(2)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(Number(i[24]).toFixed(1)) == "" ? "0.0" : String(Number(i[24]).toFixed(1)),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(2)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(i[13]),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(2)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(i[14]),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(2)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(i[15]),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(2)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(i[16]),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(2)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(i[17]),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(2)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(i[18]),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(2)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(i[19]),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(2)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(i[20]),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(2)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(i[21]),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(2)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(i[22]),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(2)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(i[23]),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(2)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(i[24]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[25]).toFixed(2)) : String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": i[6] === 'ROIC' ? String(Number(i[26]).toFixed(2)) : String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": i[6] === 'ROIC' ? String(Number(i[27]).toFixed(2)) : String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
......@@ -546,7 +552,7 @@ export default class CorporateAnnualTarget extends Component {
// // console.log(data);
// console.log(JSON.stringify(body))
api.create('UPLOAD').uploadMasterBudget(body).then(response => {
// // console.log(response);
// // // console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
......@@ -573,7 +579,7 @@ export default class CorporateAnnualTarget extends Component {
handleValidate() {
let data = []
// console.log(this.state.dataTable)
// // console.log(this.state.dataTable)
let totalWeight = 0
let dataTableBaru = this.state.dataTable
let dataTampung = []
......@@ -595,14 +601,14 @@ export default class CorporateAnnualTarget extends Component {
if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
// // console.log(indexID)
// // console.log(i[2])
// // // console.log(indexID)
// // // console.log(i[2])
if (indexID !== -1) {
// // console.log(dataTableBaru[indexID][6])
// // // console.log(dataTableBaru[indexID][6])
if (dataTableBaru[indexID][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || dataTableBaru[indexID][6] == 'CUSTOMER PERSPECTIVE') {
if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) {
handleKosongKPIMAXYTD = true
// // console.log(handleKosongKPIMAXYTD)
// // // console.log(handleKosongKPIMAXYTD)
}
} else if (dataTableBaru[indexID][6] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
......@@ -615,7 +621,7 @@ export default class CorporateAnnualTarget extends Component {
// if (i[0] == null && i[2] == null) {
// if (i[6] == "" || i[7] == "" || i[9] == null || i[10] == null || i[11] == null) {
// handleKosongKPIMAXYTD = true
// // // console.log(handleKosongKPIMAXYTD)
// // // // console.log(handleKosongKPIMAXYTD)
// }
// }
......@@ -635,9 +641,9 @@ export default class CorporateAnnualTarget extends Component {
weightReal = i[7]
dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
}
// // console.log(weightReal)
// // console.log(dataTableBaru[index][7])
// // console.log(dataTampung[indexID].valChild)
// // // console.log(weightReal)
// // // console.log(dataTableBaru[index][7])
// // // console.log(dataTampung[indexID].valChild)
}
}
......@@ -671,8 +677,8 @@ export default class CorporateAnnualTarget extends Component {
})
})
// // console.log(dataTableBaru)
// // console.log(JSON.stringify(data))
// // // console.log(dataTableBaru)
// // // console.log(JSON.stringify(data))
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
......@@ -681,7 +687,7 @@ export default class CorporateAnnualTarget extends Component {
"status": "submitted",
"cat": data
}
// // console.log(totalWeight)
// // // console.log(totalWeight)
// this.setState({dataTable: dataTampung})
if (handleKosongKPIMAXYTD) {
this.setState({ alert: true, messageAlert: 'KPI / Weight / KPI Type / Max Ach / Formula YTD / Cannot be Empty', tipeAlert: 'warning', loading: false, editable: true })
......@@ -689,7 +695,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true })
} else {
api.create().validateSubmitReport(payload).then((response) => {
// // console.log(response)
// // // console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, buttonDraft: false })
} else {
......@@ -706,22 +712,24 @@ export default class CorporateAnnualTarget extends Component {
backToMasterBudget(type) {
let data = []
let stateFR = false
// console.log(this.state.dataTable)
// // console.log(this.state.dataTable)
this.state.dataTable.map(i => {
if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
// // console.log(indexID)
// // console.log(i[2])
// // // console.log(indexID)
// // // console.log(i[2])
if (indexID !== -1) {
// // console.log(dataTableBaru[indexID][6])
// // // console.log(dataTableBaru[indexID][6])
if (this.state.dataTable[indexID][6] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
} else {
stateFR = false
}
}
} else {
stateFR = false
}
// // // console.log(i[9] == null? "" : i[9].value)
// // // // console.log(i[9] == null? "" : i[9].value)
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_name": String(i[6]),
......@@ -732,18 +740,18 @@ export default class CorporateAnnualTarget extends Component {
"max_ach": i[10] == null ? "" : i[10].value,
"formula": i[11] == null ? "" : i[11].value,
"total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(2)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)) == "" ? "0.0" : String(Number(i[13]).toFixed(1)),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(2)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)) == "" ? "0.0" : String(Number(i[14]).toFixed(1)),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(2)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)) == "" ? "0.0" : String(Number(i[15]).toFixed(1)),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(2)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)) == "" ? "0.0" : String(Number(i[16]).toFixed(1)),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(2)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)) == "" ? "0.0" : String(Number(i[17]).toFixed(1)),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(2)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)) == "" ? "0.0" : String(Number(i[18]).toFixed(1)),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(2)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(Number(i[19]).toFixed(1)) == "" ? "0.0" : String(Number(i[19]).toFixed(1)),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(2)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(Number(i[20]).toFixed(1)) == "" ? "0.0" : String(Number(i[20]).toFixed(1)),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(2)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(Number(i[21]).toFixed(1)) == "" ? "0.0" : String(Number(i[21]).toFixed(1)),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(2)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(Number(i[22]).toFixed(1)) == "" ? "0.0" : String(Number(i[22]).toFixed(1)),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(2)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(2)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(Number(i[24]).toFixed(1)) == "" ? "0.0" : String(Number(i[24]).toFixed(1)),
"january": i[6] === 'ROIC' ? String(Number(i[13]).toFixed(2)) : stateFR ? String(Number(i[13].value).toFixed(1)) : String(i[13]),
"february": i[6] === 'ROIC' ? String(Number(i[14]).toFixed(2)) : stateFR ? String(Number(i[14].value).toFixed(1)) : String(i[14]),
"march": i[6] === 'ROIC' ? String(Number(i[15]).toFixed(2)) : stateFR ? String(Number(i[15].value).toFixed(1)) : String(i[15]),
"april": i[6] === 'ROIC' ? String(Number(i[16]).toFixed(2)) : stateFR ? String(Number(i[16].value).toFixed(1)) : String(i[16]),
"may": i[6] === 'ROIC' ? String(Number(i[17]).toFixed(2)) : stateFR ? String(Number(i[17].value).toFixed(1)) : String(i[17]),
"june": i[6] === 'ROIC' ? String(Number(i[18]).toFixed(2)) : stateFR ? String(Number(i[18].value).toFixed(1)) : String(i[18]),
"july": i[6] === 'ROIC' ? String(Number(i[19]).toFixed(2)) : stateFR ? String(Number(i[19].value).toFixed(1)) : String(i[19]),
"august": i[6] === 'ROIC' ? String(Number(i[20]).toFixed(2)) : stateFR ? String(Number(i[20].value).toFixed(1)) : String(i[20]),
"september": i[6] === 'ROIC' ? String(Number(i[21]).toFixed(2)) : stateFR ? String(Number(i[21].value).toFixed(1)) : String(i[21]),
"october": i[6] === 'ROIC' ? String(Number(i[22]).toFixed(2)) : stateFR ? String(Number(i[22].value).toFixed(1)) : String(i[22]),
"november": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(2)) : stateFR ? String(Number(i[23].value).toFixed(1)) : String(i[23]),
"december": i[6] === 'ROIC' ? String(Number(i[24]).toFixed(2)) : stateFR ? String(Number(i[24].value).toFixed(1)) : String(i[24]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[25]).toFixed(2)) : String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": i[6] === 'ROIC' ? String(Number(i[26]).toFixed(2)) : String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": i[6] === 'ROIC' ? String(Number(i[27]).toFixed(2)) : String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
......@@ -751,7 +759,7 @@ export default class CorporateAnnualTarget extends Component {
"pic": String(i[29])
})
})
// console.log(JSON.stringify(data))
// // console.log(JSON.stringify(data))
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
......@@ -769,10 +777,10 @@ export default class CorporateAnnualTarget extends Component {
if (this.state.dataDelete.length > 0) {
api.create().deleteAllItemReport(payload).then((response) => {
// // console.log(response)
// // // console.log(response)
// api.create().validateSubmitReport(payloadBro).then((response) => {
// // // console.log(response)
// // // // console.log(response)
// if (response.data.data.result) {
this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose()
......@@ -782,9 +790,9 @@ export default class CorporateAnnualTarget extends Component {
// })
})
} else {
// // // console.log('sini jing')
// // // // console.log('sini jing')
// api.create().validateSubmitReport(payloadBro).then((response) => {
// // // console.log(response)
// // // // console.log(response)
// if (response.data.data.result) {
this.props.saveToMasterBudget(payloadBro)
this.props.onClickClose()
......@@ -803,12 +811,12 @@ export default class CorporateAnnualTarget extends Component {
type: 'KPI_TYPE'
}
api.create().getAllSettingByType(body).then(response => {
// // // console.log(response)
// // // // console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
// // console.log(data)
// // // console.log(data)
let inputKPI = []
data.map((item) => {
......@@ -820,7 +828,7 @@ export default class CorporateAnnualTarget extends Component {
options: inputKPI,
getOptionLabel: (option) => titleCase(option.value),
};
// // console.log(defaultProps)
// // // console.log(defaultProps)
this.setState({ kpiTypeList: defaultProps })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -947,7 +955,7 @@ export default class CorporateAnnualTarget extends Component {
let columnEnd = 24
let month = column - 1
let total = 0
// console.log(formulaAwal)
// // console.log(formulaAwal)
if (forecast == undefined) {
dataTable2[tableMeta.rowIndex].map((itemz, indexz) => {
if (indexz >= columnStart && indexz <= columnStart + month) {
......@@ -984,10 +992,10 @@ export default class CorporateAnnualTarget extends Component {
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
// console.log(dataTable2[tableMeta.rowIndex][30])
// // console.log(dataTable2[tableMeta.rowIndex][30])
let array = dataTable2[tableMeta.rowIndex][30].filter((val) => val.periode == Number(column))
let valuezz = array[0].value
// console.log(valuezz)
// // console.log(valuezz)
anjay.push(valuezz == "" ? 0 : valuezz)
// let indexID = dataTable2[tableMeta.rowIndex][30].findIndex((val) => val.periode == Number(this.props.periode))
// if (indexID !== -1) {
......@@ -1145,21 +1153,21 @@ export default class CorporateAnnualTarget extends Component {
}
})
// if (dataTable2[tableMeta.rowIndex][6] == "NPAT" && forecast !== undefined) {
// console.log(tableMeta.rowData[3])
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// // console.log(item1)
// console.log(anjay2)
// console.log(total)
// // console.log(tableMeta.rowData[3])
// // console.log(splitFormula)
// // console.log(baru)
// // console.log(anjay)
// // // console.log(item1)
// // console.log(anjay2)
// // console.log(total)
// }
// console.log(tableMeta.rowData[3])
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// console.log(item1)
// console.log(anjay2)
// console.log(total)
// // console.log(tableMeta.rowData[3])
// // console.log(splitFormula)
// // console.log(baru)
// // console.log(anjay)
// // console.log(item1)
// // console.log(anjay2)
// // console.log(total)
total = dataTable2[tableMeta.rowIndex][6] == "ROIC" ? "0" : R.equals(total, NaN) ? "0.0" : total
if (dataTable2[tableMeta.rowIndex][6] == "ROIC") {
......@@ -1273,7 +1281,7 @@ export default class CorporateAnnualTarget extends Component {
}
const handleTambah = (data, rowIndex) => {
// console.log(dataTable2)
// // console.log(dataTable2)
let newData = []
dataTable2.map((item, index) => {
newData.push(item)
......@@ -1317,7 +1325,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ dataTable: dataTable2 }, () => {
setTimeout(() => {
this.setState({ loading: false })
// console.log(dataTable2)
// // console.log(dataTable2)
}, 500)
})
}
......@@ -1406,7 +1414,7 @@ export default class CorporateAnnualTarget extends Component {
cursor: 'pointer',
borderColor: 'transparent',
}}
// onClick={() => // // console.log(tableMeta.rowData[1])}
// onClick={() => // // // console.log(tableMeta.rowData[1])}
onClick={() => {
this.setState({ loading: true })
handleTambah(tableMeta.rowData[1], tableMeta.rowIndex)
......@@ -1462,9 +1470,9 @@ export default class CorporateAnnualTarget extends Component {
defaultValue={val}
// disabled={!handleAction(tableMeta.rowData[2])}
onBlur={(event) => {
// // console.log(event.target.value)
// // // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
// // console.log(dataTable2)
}}
/>
}
......@@ -1579,10 +1587,10 @@ export default class CorporateAnnualTarget extends Component {
color={"#5198ea"}
disabled={true}
onBlur={(event) => {
// // console.log(event.target.value)
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
// // // console.log(dataTable2)
}}
/> :
<ThemeProvider theme={theme}>
......@@ -1595,10 +1603,10 @@ export default class CorporateAnnualTarget extends Component {
color={"#5198ea"}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? false : !handleAction(tableMeta.rowData[2]))}
onBlur={(event) => {
// // console.log(event.target.value)
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
......@@ -1745,7 +1753,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(dataTable2)
// // // console.log(dataTable2)
}}
/>
}
......@@ -1765,7 +1773,7 @@ export default class CorporateAnnualTarget extends Component {
</TableCell>
),
customBodyRender: (value, tableMeta) => {
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
return (
<div style={{ width: 96 }}>
{
......@@ -1784,7 +1792,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -1809,7 +1817,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -1832,7 +1840,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -1870,7 +1878,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -1895,7 +1903,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -1918,7 +1926,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -1956,7 +1964,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -1981,7 +1989,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2004,7 +2012,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2043,7 +2051,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2068,7 +2076,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2091,7 +2099,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2130,7 +2138,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2155,7 +2163,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2178,7 +2186,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2217,7 +2225,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2242,7 +2250,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2265,7 +2273,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2304,7 +2312,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2329,7 +2337,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2352,7 +2360,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2391,7 +2399,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2416,7 +2424,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2439,7 +2447,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2478,7 +2486,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2503,7 +2511,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2526,7 +2534,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2565,7 +2573,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2590,7 +2598,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2613,7 +2621,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2652,7 +2660,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2677,7 +2685,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2700,7 +2708,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2739,7 +2747,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2764,7 +2772,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2787,7 +2795,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2827,7 +2835,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2852,7 +2860,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2875,7 +2883,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2914,7 +2922,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2939,7 +2947,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -2956,13 +2964,13 @@ export default class CorporateAnnualTarget extends Component {
style={{ color: '#5198ea', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleTotal(tableMeta)).toFixed(1)}
value={Number(value).toFixed(2)}
disabled={false}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -3001,7 +3009,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -3026,7 +3034,7 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -3043,13 +3051,13 @@ export default class CorporateAnnualTarget extends Component {
style={{ color: '#5198ea', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleTotal(tableMeta)).toFixed(1)}
value={Number(value).toFixed(2)}
disabled={false}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
// // // console.log(tableMeta.rowData[0])
}}
/>
}
......@@ -3086,9 +3094,9 @@ export default class CorporateAnnualTarget extends Component {
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value}
onBlur={(event) => {
// // console.log(event.target.value)
// // // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
......@@ -3126,10 +3134,10 @@ export default class CorporateAnnualTarget extends Component {
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
defaultValue={value}
onBlur={(event) => {
// // console.log(event.target.value)
// // // console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
// // // console.log(dataTable2)
}}
/>
</ThemeProvider>
......
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