Commit 269c760c authored by Riri Novita's avatar Riri Novita

Merge branch 'dev/staging-riri' into 'ENV-STAGING'

MB CAT gembel

See merge request !1929
parents d73dcbd6 0d75357a
...@@ -183,18 +183,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -183,18 +183,30 @@ export default class CorporateAnnualTarget extends Component {
parentTrue ? item.cat.max_ach == "" ? null : { value: titleCase(item.cat.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) }, parentTrue ? item.cat.max_ach == "" ? null : { value: titleCase(item.cat.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
parentTrue ? item.cat.formula == "" ? null : { value: item.cat.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd }, parentTrue ? item.cat.formula == "" ? null : { value: item.cat.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1), item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)) : { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)) : { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)) : { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)) : { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)) : { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)) : { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)) : { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)) : { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)) : { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)) : { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)) : { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)) : { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)), item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)) : { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)) : { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)) : { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)) : { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)) : { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)) : { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)) : { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)) : { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)) : { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)) : { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)) : { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)),
// item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 || this.props.status === 'CLOSED' ? (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)) : { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)),
item.cat.total_current_year == "" ? 0 : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1), item.cat.total_current_year == "" ? 0 : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1), item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1), item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
...@@ -736,7 +748,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -736,7 +748,7 @@ export default class CorporateAnnualTarget extends Component {
if (response.ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false }) // this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCAT: false, visibleButtonUpload: true }) this.setState({ visibleUploadSimulasi: false, visibleCAT: false, visibleButtonUpload: true })
let dataTable = [] let dataTable = []
let custoId = 0 let custoId = 0
let bisnsId = 0 let bisnsId = 0
...@@ -1237,6 +1249,144 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1237,6 +1249,144 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
handleValidateSimulasi() {
let data = []
// // // console.log(this.state.dataTable)
let totalWeight = 0
let dataTableBaru = this.state.dataTable
let dataTampung = []
let weightReal = null
let handleKosongKPIMAXYTD = false
let stateFR = false
console.log(this.state.dataTable)
this.state.dataTable.map((i, index) => {
if (i[0] == 1) {
dataTampung.push({
id: i[1],
maxValue: i[7],
valChild: 0
})
}
if (i[0] !== 1 && i[0] !== 4) {
totalWeight += Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
}
if (i[2] !== null) {
let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
// // // // console.log(indexID)
// // // // console.log(i[2])
if (indexID !== -1) {
// // // // 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)
}
} else if (dataTableBaru[indexID][6] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
} else {
stateFR = false
}
}
}
// 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)
// }
// }
if (i[2] !== null) {
let indexID = dataTampung.findIndex((val) => val.id == i[2])
if (indexID !== -1) {
let weightParent = Number(dataTampung[indexID].maxValue == "" || dataTampung[indexID].maxValue == undefined ? 0 : dataTampung[indexID].maxValue.replace('%', ''))
let valChild = Number(dataTampung[indexID].valChild)
let valReal = Number(i[7] == "" || i[7] == undefined ? 0 : i[7].replace('%', ''))
let totalBaru = valChild + valReal
if (totalBaru > weightParent) {
dataTableBaru[index][7] = `${String(Number(weightParent - valChild).toFixed(1)) + '%'}`
dataTampung[indexID].valChild = dataTampung[indexID].valChild + weightParent - valChild
weightReal = `${String(Number(weightParent - valChild).toFixed(1)) + '%'}`
} else {
dataTableBaru[index][7] = i[7]
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(String(weightReal).substr(0,String(weightReal).length-1))
// // console.log(Number(String(weightReal).substr(0,String(weightReal).length-1)).toFixed(1));
// console.log(weightReal)
// console.log(i[7])
let b = []
// console.log(i[13].value == undefined? 'Y' : 'N')
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_name": String(i[6]),
"parent": i[2] == "" ? null : i[2],
"weight": weightReal == null ? String(i[7]) : weightReal,
"uom": String(i[8]),
"kpi_type": i[9] == null ? "" : i[9].value,
"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[13].value == undefined ? (String(i[13]) == '' ? "0.0" : String(i[13])) : String(i[13].value),
// "january": stateFR ? String(i[13].value) : String(i[13]) == "" ? "0.0" : String(i[13]),
"february": i[14].value == undefined ? (String(i[14]) == '' ? "0.0" : String(i[14])) : String(i[14].value),
"march": i[15].value == undefined ? (String(i[15]) == '' ? "0.0" : String(i[15])) : String(i[15].value),
"april": i[16].value == undefined ? (String(i[16]) == '' ? "0.0" : String(i[16])) : String(i[16].value),
"may": i[17].value == undefined ? (String(i[17]) == '' ? "0.0" : String(i[17])) : String(i[17].value),
"june": i[18].value == undefined ? (String(i[18]) == '' ? "0.0" : String(i[18])) : String(i[18].value),
"july": i[19].value == undefined ? (String(i[19]) == '' ? "0.0" : String(i[19])) : String(i[19].value),
"august": i[20].value == undefined ? (String(i[20]) == '' ? "0.0" : String(i[20])) : String(i[20].value),
"september": i[21].value == undefined ? (String(i[21]) == '' ? "0.0" : String(i[21])) : String(i[21].value),
"october": i[22].value == undefined ? (String(i[22]) == '' ? "0.0" : String(i[22])) : String(i[22].value),
"november": i[23].value == undefined ? (String(i[23]) == '' ? "0.0" : String(i[23])) : String(i[23].value),
"december": i[24].value == undefined ? (String(i[24]) == '' ? "0.0" : String(i[24])) : String(i[24].value),
"total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]),
"total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]),
"total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]),
"strategic": String(i[28]),
"pic": String(i[29])
})
stateFR = false
})
// // // // console.log(dataTableBaru)
// // // // console.log(JSON.stringify(data))
let payload = {
"submission_id": this.props.submissionID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"currency_id": this.props.defaultCurrency.id,
"status": "submitted",
"cat": data
}
// // // // 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 })
} else if (totalWeight < 100) {
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true })
} else {
console.log(JSON.stringify(payload))
api.create().validateSubmitReport(payload).then((response) => {
console.log(response)
if (response.data.data.result) {
this.setState({ loading: false, buttonError: false, editable: false, buttonDraft: false })
} else {
this.setState({ loading: false, buttonError: true, editable: true, buttonDraft: true })
}
})
}
}
closeAlert() { closeAlert() {
this.setState({ alert: false }) this.setState({ alert: false })
} }
...@@ -2431,7 +2581,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2431,7 +2581,9 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? //for simulasi
(handleReturnFormula(tableMeta.rowData[2], tableMeta)?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2456,7 +2608,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2456,7 +2608,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2500,7 +2653,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2500,7 +2653,8 @@ export default class CorporateAnnualTarget extends Component {
} }
/> />
} }
</div>) </div>
)
} }
</div> </div>
) )
...@@ -2541,7 +2695,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2541,7 +2695,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2566,7 +2721,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2566,7 +2721,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2651,7 +2807,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2651,7 +2807,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2676,7 +2833,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2676,7 +2833,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2762,7 +2920,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2762,7 +2920,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2787,7 +2946,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2787,7 +2946,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2873,7 +3033,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2873,7 +3033,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2898,7 +3059,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2898,7 +3059,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2984,7 +3146,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2984,7 +3146,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3009,7 +3172,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3009,7 +3172,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3095,7 +3259,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3095,7 +3259,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3120,7 +3285,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3120,7 +3285,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3206,7 +3372,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3206,7 +3372,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3231,7 +3398,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3231,7 +3398,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3317,7 +3485,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3317,7 +3485,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3342,7 +3511,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3342,7 +3511,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3428,7 +3598,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3428,7 +3598,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3453,7 +3624,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3453,7 +3624,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3539,7 +3711,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3539,7 +3711,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3564,7 +3737,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3564,7 +3737,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3650,7 +3824,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3650,7 +3824,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3675,7 +3850,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3675,7 +3850,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3762,7 +3938,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3762,7 +3938,8 @@ export default class CorporateAnnualTarget extends Component {
// </div> : // </div> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3787,7 +3964,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3787,7 +3964,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3873,7 +4051,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3873,7 +4051,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3898,7 +4077,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3898,7 +4077,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -3984,7 +4164,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3984,7 +4164,8 @@ export default class CorporateAnnualTarget extends Component {
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
// (handleReturnFormula(tableMeta.rowData[2], tableMeta) && this.props.status !== 'CLOSED' ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -4009,7 +4190,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -4009,7 +4190,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
{(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ? {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) ?
// {(tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 || tableMeta.rowData[0] === 7) && this.props.status !== 'CLOSED' ?
// null // null
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -4175,7 +4357,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -4175,7 +4357,8 @@ export default class CorporateAnnualTarget extends Component {
</Alert> </Alert>
</Snackbar> </Snackbar>
<div style={{ flex: 1, padding: 20, width: '100%' }}> <div style={{ flex: 1, padding: 20, width: '100%' }}>
{this.state.visibleCAT ? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}> {this.state.visibleCAT ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Corporate Annual Target</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Corporate Annual Target</Typography>
</div> </div>
...@@ -4398,6 +4581,101 @@ export default class CorporateAnnualTarget extends Component { ...@@ -4398,6 +4581,101 @@ export default class CorporateAnnualTarget extends Component {
</div>} </div>}
</div> </div>
</Paper> </Paper>
:
this.state.visibleButtonUpload ?
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div>
<div style={{ padding: 25 }}>
<div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
{this.props.defaultCurrency.id === 1 ?
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
:
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
}
</div>
{this.state.dataLoaded && (
<div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={dataTable2}
columns={columns}
options={options}
/>
</MuiThemeProvider>
</div>
)}
</div>
<div className="grid grid-2x">
<div className="col-1">
<button
className="button"
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
}}
onClick={() =>
this.setState({ loading: true, visibleCAT: true, dataTable: [] }, () => {
setTimeout(() => {
this.getItemHierarki()
}, 100)
})}
>
<div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
</div>
</button>
</div>
{!this.props.isApprover && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{/* {(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && */}
<button
type="button"
onClick={() =>
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
setTimeout(() => {
this.handleValidateSimulasi()
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false })
}, 100)
})
}
style={{ marginRight: 20 }}
>
<div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
<Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
</div>
</button>
{/* } */}
{/* {(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && */}
<button
type="button"
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none'
}}
onClick={() =>
this.setState({ handleDoubleClick: 1 }, () => {
setTimeout(() => {
this.uploadSimulasi("submitted")
}, 100);
})
}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save Data</Typography>
</div>
</button>
{/* } */}
</div>}
</div>
</div>
</Paper>
: :
<Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
<div> <div>
...@@ -4518,7 +4796,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -4518,7 +4796,8 @@ export default class CorporateAnnualTarget extends Component {
</div>} </div>}
</div> </div>
</div> </div>
</Paper>} </Paper>
}
</div> </div>
{ {
...@@ -4602,7 +4881,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -4602,7 +4881,7 @@ export default class CorporateAnnualTarget extends Component {
}} }}
/> />
</div> </div>
{this.state.visibleButtonUpload && {/* {this.state.visibleButtonUpload &&
<div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}> <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
<div> <div>
<button <button
...@@ -4627,7 +4906,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -4627,7 +4906,7 @@ export default class CorporateAnnualTarget extends Component {
</button> </button>
</div> </div>
</div> </div>
} } */}
{/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> (Simulasi) Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */} {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> (Simulasi) Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
</div> </div>
......
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