Commit e71f2433 authored by d.arizona's avatar d.arizona

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

parents 6bdb2085 9b5f7c7a
...@@ -629,7 +629,55 @@ export default class SubHolding extends Component { ...@@ -629,7 +629,55 @@ export default class SubHolding extends Component {
item.balance_sheet.monthly_last_year_september, item.balance_sheet.monthly_last_year_september,
item.balance_sheet.monthly_last_year_october, item.balance_sheet.monthly_last_year_october,
item.balance_sheet.monthly_last_year_november, item.balance_sheet.monthly_last_year_november,
item.balance_sheet.monthly_last_year_december item.balance_sheet.monthly_last_year_december,
item.balance_sheet.ro_january,
item.balance_sheet.ro_february,
item.balance_sheet.ro_march,
item.balance_sheet.ro_april,
item.balance_sheet.ro_may,
item.balance_sheet.ro_june,
item.balance_sheet.ro_july,
item.balance_sheet.ro_august,
item.balance_sheet.ro_september,
item.balance_sheet.ro_october,
item.balance_sheet.ro_november,
item.balance_sheet.ro_december,
item.balance_sheet.ro_q1_january,
item.balance_sheet.ro_q1_february,
item.balance_sheet.ro_q1_march,
item.balance_sheet.ro_q1_april,
item.balance_sheet.ro_q1_may,
item.balance_sheet.ro_q1_june,
item.balance_sheet.ro_q1_july,
item.balance_sheet.ro_q1_august,
item.balance_sheet.ro_q1_september,
item.balance_sheet.ro_q1_october,
item.balance_sheet.ro_q1_november,
item.balance_sheet.ro_q1_december,
item.balance_sheet.ro_q2_january,
item.balance_sheet.ro_q2_february,
item.balance_sheet.ro_q2_march,
item.balance_sheet.ro_q2_april,
item.balance_sheet.ro_q2_may,
item.balance_sheet.ro_q2_june,
item.balance_sheet.ro_q2_july,
item.balance_sheet.ro_q2_august,
item.balance_sheet.ro_q2_september,
item.balance_sheet.ro_q2_october,
item.balance_sheet.ro_q2_november,
item.balance_sheet.ro_q2_december,
item.balance_sheet.ro_q3_january,
item.balance_sheet.ro_q3_february,
item.balance_sheet.ro_q3_march,
item.balance_sheet.ro_q3_april,
item.balance_sheet.ro_q3_may,
item.balance_sheet.ro_q3_june,
item.balance_sheet.ro_q3_july,
item.balance_sheet.ro_q3_august,
item.balance_sheet.ro_q3_september,
item.balance_sheet.ro_q3_october,
item.balance_sheet.ro_q3_november,
item.balance_sheet.ro_q3_december,
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -690,7 +738,55 @@ export default class SubHolding extends Component { ...@@ -690,7 +738,55 @@ export default class SubHolding extends Component {
item.balance_sheet.monthly_last_year_september, item.balance_sheet.monthly_last_year_september,
item.balance_sheet.monthly_last_year_october, item.balance_sheet.monthly_last_year_october,
item.balance_sheet.monthly_last_year_november, item.balance_sheet.monthly_last_year_november,
item.balance_sheet.monthly_last_year_december item.balance_sheet.monthly_last_year_december,
item.balance_sheet.ro_january,
item.balance_sheet.ro_february,
item.balance_sheet.ro_march,
item.balance_sheet.ro_april,
item.balance_sheet.ro_may,
item.balance_sheet.ro_june,
item.balance_sheet.ro_july,
item.balance_sheet.ro_august,
item.balance_sheet.ro_september,
item.balance_sheet.ro_october,
item.balance_sheet.ro_november,
item.balance_sheet.ro_december,
item.balance_sheet.ro_q1_january,
item.balance_sheet.ro_q1_february,
item.balance_sheet.ro_q1_march,
item.balance_sheet.ro_q1_april,
item.balance_sheet.ro_q1_may,
item.balance_sheet.ro_q1_june,
item.balance_sheet.ro_q1_july,
item.balance_sheet.ro_q1_august,
item.balance_sheet.ro_q1_september,
item.balance_sheet.ro_q1_october,
item.balance_sheet.ro_q1_november,
item.balance_sheet.ro_q1_december,
item.balance_sheet.ro_q2_january,
item.balance_sheet.ro_q2_february,
item.balance_sheet.ro_q2_march,
item.balance_sheet.ro_q2_april,
item.balance_sheet.ro_q2_may,
item.balance_sheet.ro_q2_june,
item.balance_sheet.ro_q2_july,
item.balance_sheet.ro_q2_august,
item.balance_sheet.ro_q2_september,
item.balance_sheet.ro_q2_october,
item.balance_sheet.ro_q2_november,
item.balance_sheet.ro_q2_december,
item.balance_sheet.ro_q3_january,
item.balance_sheet.ro_q3_february,
item.balance_sheet.ro_q3_march,
item.balance_sheet.ro_q3_april,
item.balance_sheet.ro_q3_may,
item.balance_sheet.ro_q3_june,
item.balance_sheet.ro_q3_july,
item.balance_sheet.ro_q3_august,
item.balance_sheet.ro_q3_september,
item.balance_sheet.ro_q3_october,
item.balance_sheet.ro_q3_november,
item.balance_sheet.ro_q3_december,
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -715,9 +811,11 @@ export default class SubHolding extends Component { ...@@ -715,9 +811,11 @@ export default class SubHolding extends Component {
} }
}) })
} }
} else { } else {
this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false }) this.setState({ dataTable: [], previewTable: false, loading: false, previewDownload: false })
} }
console.log(dataTable);
}) })
} else if (this.state.report.value === 3) { } else if (this.state.report.value === 3) {
let PLID = null let PLID = null
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1470,6 +1470,8 @@ export default class RollingOutlook extends Component { ...@@ -1470,6 +1470,8 @@ export default class RollingOutlook extends Component {
quarter={this.state.quarter.value} quarter={this.state.quarter.value}
isApprover={this.state.isApprover} isApprover={this.state.isApprover}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true} prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
status={this.state.status}
lastStatus={this.state.lastStatus}
/> />
)} )}
......
...@@ -74,7 +74,7 @@ export default class CatRevision extends Component { ...@@ -74,7 +74,7 @@ export default class CatRevision extends Component {
dataInternalBsn: [], dataInternalBsn: [],
dataFin: [], dataFin: [],
dataLearn: [], dataLearn: [],
handleDataSalah: false, // handleDataSalah: false,
get_for: 'view', get_for: 'view',
viewOnly: true, viewOnly: true,
...@@ -462,7 +462,7 @@ export default class CatRevision extends Component { ...@@ -462,7 +462,7 @@ export default class CatRevision extends Component {
"november": i[5] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]), "november": i[5] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"december": i[5] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]), "december": i[5] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)), "total_current_year": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"strategic": String(i[24]), "strategic_initiative": String(i[24]),
"pic": String(i[25]) "pic": String(i[25])
}) })
}) })
...@@ -514,7 +514,7 @@ export default class CatRevision extends Component { ...@@ -514,7 +514,7 @@ export default class CatRevision extends Component {
payload.push({ payload.push({
item_report_id: i[1] === undefined ? 0 : reg.test(String(i[1])) === false ? 0 : String(i[1]).trim(), item_report_id: i[1] === undefined ? 0 : reg.test(String(i[1])) === false ? 0 : String(i[1]).trim(),
item_report: i[2] === undefined ? "" : String(i[2]).trim(), item_report: i[2] === undefined ? "" : String(i[2]).trim(),
weight: i[3] === undefined ? "" : String(Number(i[3] * 100).toFixed(1)) + '%', weight: i[3] === undefined ? "" : String(i[3]).trim(),
uom: i[4] === undefined ? "" : String(i[4]).trim(), uom: i[4] === undefined ? "" : String(i[4]).trim(),
kpi_type: i[5] === undefined ? "" : String(i[5]).trim(), kpi_type: i[5] === undefined ? "" : String(i[5]).trim(),
max_ach: i[6] === undefined ? "" : String(i[6]).toLocaleLowerCase() !== 'unlimited' ? (String(i[6]).includes('%') ? String(i[6].trim()) : String(Number(i[6] * 100) + '%')) : String(i[6]).trim(), max_ach: i[6] === undefined ? "" : String(i[6]).toLocaleLowerCase() !== 'unlimited' ? (String(i[6]).includes('%') ? String(i[6].trim()) : String(Number(i[6] * 100) + '%')) : String(i[6]).trim(),
...@@ -530,8 +530,7 @@ export default class CatRevision extends Component { ...@@ -530,8 +530,7 @@ export default class CatRevision extends Component {
october: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(), october: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(),
november: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(), november: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(),
december: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(), december: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(),
total_current_year: i[19] == 0 ? "0.0" : String(Number(i[19]).toFixed(1)).trim(), strategic_initiative: i[20] === undefined ? "" : String(i[20]).trim(),
strategic: i[20] === undefined ? "" : String(i[20]).trim(),
pic: i[21] === undefined ? "" : String(i[21]).trim() pic: i[21] === undefined ? "" : String(i[21]).trim()
}) })
} }
...@@ -562,63 +561,64 @@ export default class CatRevision extends Component { ...@@ -562,63 +561,64 @@ export default class CatRevision extends Component {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ visibleUpload: false, visibleCATRO: false }) this.setState({ visibleUpload: false, visibleCATRO: false })
let dataTable = [] let dataTable = []
let custoId = 0 // let custoId = 0
let bisnsId = 0 // let bisnsId = 0
let dataDelete = this.state.dataDelete // let dataDelete = this.state.dataDelete
let dataFin = this.state.dataFin // let dataFin = this.state.dataFin
let dataLearn = this.state.dataLearn // let dataLearn = this.state.dataLearn
let newValidate = false // let newValidate = false
response.data.data.map((item, index) => { response.data.data.map((item, index) => {
if (item.item_report == 'CUSTOMER PERSPECTIVE') { // if (item.item_report == 'CUSTOMER PERSPECTIVE') {
custoId = item.item_report_id // custoId = item.item_report_id
} // }
if (item.item_report == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') { // if (item.item_report == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
bisnsId = item.item_report_id // bisnsId = item.item_report_id
} // }
if (String(item.item_report).trim().toLocaleUpperCase() == "CUSTOMER PERSPECTIVE") { // if (String(item.item_report).trim().toLocaleUpperCase() == "CUSTOMER PERSPECTIVE") {
newValidate = true // newValidate = true
} // }
if (String(item.item_report).trim().toLocaleUpperCase() == "LEARNING & GROWTH PERSPECTIVE") { // if (String(item.item_report).trim().toLocaleUpperCase() == "LEARNING & GROWTH PERSPECTIVE") {
newValidate = false // newValidate = false
} // }
if (item.type_report_id !== 4 && item.parent !== null && (item.parent == custoId || item.parent == bisnsId)) { // if (item.type_report_id !== 4 && item.parent !== null && (item.parent == custoId || item.parent == bisnsId)) {
let indexCust = this.state.dataCustomerPrs.findIndex((val) => val.name == item.item_report) // let indexCust = this.state.dataCustomerPrs.findIndex((val) => val.name == item.item_report)
let indexBisn = this.state.dataInternalBsn.findIndex((val) => val.name == item.item_report) // let indexBisn = this.state.dataInternalBsn.findIndex((val) => val.name == item.item_report)
if (indexCust !== -1 && item.item_report_id == 0) { // if (indexCust !== -1 && item.item_report_id == 0) {
dataDelete.push(this.state.dataCustomerPrs[indexCust].id) // dataDelete.push(this.state.dataCustomerPrs[indexCust].id)
} // }
if (indexBisn !== -1 && item.item_report_id == 0) { // if (indexBisn !== -1 && item.item_report_id == 0) {
dataDelete.push(this.state.dataInternalBsn[indexBisn].id) // dataDelete.push(this.state.dataInternalBsn[indexBisn].id)
} // }
} // }
if (newValidate == false) { // if (newValidate == false) {
let indexIDx = dataFin.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase()) // let indexIDx = dataFin.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase())
let indexIDz = dataLearn.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase()) // let indexIDz = dataLearn.findIndex((val) => String(val.name).toLocaleLowerCase() == String(item.item_report).toLocaleLowerCase())
if (indexIDx != -1) { // if (indexIDx != -1) {
dataFin[indexIDx].check = true // dataFin[indexIDx].check = true
} // }
if (indexIDz != -1) { // if (indexIDz != -1) {
dataLearn[indexIDz].check = true // dataLearn[indexIDz].check = true
} // }
} // }
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
item.item_report_id, item.item_report_id,
item.parent, item.parent,
item.formula, item.formula,
item.level == null ? 1 : item.level, item.level,
item.item_report, item.item_report,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.weight)), item.weight,
item.uom, item.uom,
item.kpi_type == "" || item.kpi_type == null ? null : { value: item.kpi_type }, item.kpi == "" || item.kpi == null ? null : { value: item.kpi },
item.max_ach == "" || item.max_ach == null ? null : { value: titleCase(item.max_ach) }, item.max_ach == "" || item.max_ach == null ? null : { value: titleCase(item.max_ach) },
item.formula_ytd == "" || item.formula_ytd == null ? null : { value: item.formula_ytd },
item.item_report === 'ROIC' ? Number(item.january).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.january).toFixed(1) : { value: item.january, formula: item.january_formula } : item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1), item.item_report === 'ROIC' ? Number(item.january).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.january).toFixed(1) : { value: item.january, formula: item.january_formula } : item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1),
item.item_report === 'ROIC' ? Number(item.february).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.february).toFixed(1) : { value: item.february, formula: item.february_formula } : item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1), item.item_report === 'ROIC' ? Number(item.february).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.february).toFixed(1) : { value: item.february, formula: item.february_formula } : item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1),
item.item_report === 'ROIC' ? Number(item.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.march).toFixed(1) : { value: item.march, formula: item.march_formula } : item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march).toFixed(1), item.item_report === 'ROIC' ? Number(item.march).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.march).toFixed(1) : { value: item.march, formula: item.march_formula } : item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march).toFixed(1),
...@@ -631,31 +631,31 @@ export default class CatRevision extends Component { ...@@ -631,31 +631,31 @@ export default class CatRevision extends Component {
item.item_report === 'ROIC' ? Number(item.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.october).toFixed(1) : { value: item.october, formula: item.october_formula } : item.october == "" ? item.october : String(item.october).indexOf(".") == -1 ? Number(item.october) : Number(item.october).toFixed(1), item.item_report === 'ROIC' ? Number(item.october).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.october).toFixed(1) : { value: item.october, formula: item.october_formula } : item.october == "" ? item.october : String(item.october).indexOf(".") == -1 ? Number(item.october) : Number(item.october).toFixed(1),
item.item_report === 'ROIC' ? Number(item.november).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.november).toFixed(1) : { value: item.november, formula: item.november_formula } : item.november == "" ? item.november : String(item.november).indexOf(".") == -1 ? Number(item.november) : Number(item.november).toFixed(1), item.item_report === 'ROIC' ? Number(item.november).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.november).toFixed(1) : { value: item.november, formula: item.november_formula } : item.november == "" ? item.november : String(item.november).indexOf(".") == -1 ? Number(item.november) : Number(item.november).toFixed(1),
item.item_report === 'ROIC' ? Number(item.december).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.december).toFixed(1) : { value: item.december, formula: item.december_formula } : item.december == "" ? item.december : String(item.december).indexOf(".") == -1 ? Number(item.december) : Number(item.december).toFixed(1), item.item_report === 'ROIC' ? Number(item.december).toFixed(1) : item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? Number(item.december).toFixed(1) : { value: item.december, formula: item.december_formula } : item.december == "" ? item.december : String(item.december).indexOf(".") == -1 ? Number(item.december) : Number(item.december).toFixed(1),
item.total_current_year == "" ? item.total_current_year : String(item.total_current_year).indexOf(".") == -1 ? Number(item.total_current_year) : Number(item.total_current_year).toFixed(1), item.current_year_total == "" ? item.current_year_total : String(item.current_year_total).indexOf(".") == -1 ? Number(item.current_year_total) : Number(item.total_current_year).toFixed(1),
item.strategic, item.strategic_initiative,
item.pic, item.pic,
item.order, item.order,
item.error item.error
]) ])
}) })
let checkDataFin = dataFin.filter((val) => val.check == false) // let checkDataFin = dataFin.filter((val) => val.check == false)
let checkDataLearn = dataLearn.filter((val) => val.check == false) // let checkDataLearn = dataLearn.filter((val) => val.check == false)
let handleDataSalah = this.state.handleDataSalah // let handleDataSalah = this.state.handleDataSalah
if (checkDataFin.length > 0 || checkDataLearn.length > 0) { // if (checkDataFin.length > 0 || checkDataLearn.length > 0) {
handleDataSalah = true // handleDataSalah = true
} // }
// console.log(indexCheck) // console.log(indexCheck)
// console.log(this.state.buttonError) // console.log(this.state.buttonError)
// console.log(dataTable) console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, dataDelete, handleDataSalah }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true}, () => {
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[27].length > 0) { if (item[26].length > 0) {
console.log('masuk') console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true }) this.setState({ buttonError: true, errorPreview: true, editable: true })
} }
}) })
console.log(this.state.dataTable); // console.log(this.state.dataTable);
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
...@@ -676,152 +676,89 @@ export default class CatRevision extends Component { ...@@ -676,152 +676,89 @@ export default class CatRevision extends Component {
}) })
} }
uploadCAT(type) { uploadCATRO(type) {
// let dataDelete = this.state.dataDelete let data = []
// // // // console.log(dataDelete) let stateFR = false
let payload = { "item_report_id": this.state.dataDelete } console.log(this.state.dataTable)
if (this.state.dataDelete.length > 0) { this.state.dataTable.map(i => {
api.create().deleteAllItemReport(payload).then((response) => { if (i[2] !== null) {
this.functionUpload(type) let indexID = this.state.dataTable.findIndex((val) => val[1] == i[2])
}) if (indexID !== -1) {
if (this.state.dataTable[indexID][6] === 'FINANCIAL PERSPECTIVE') {
stateFR = true
} else { } else {
this.functionUpload(type) stateFR = false
}
}
} else {
stateFR = false
} }
data.push({
"item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_report": String(i[5]),
"weight": String(i[6]),
"uom": String(i[7]),
"kpi_type": i[8] == null ? "" : i[8].value,
"max_ach": i[9] == null ? "" : i[9].value,
"formula": i[10] == null ? "" : i[10].value,
"january": i[5] === 'ROIC' ? String(Number(i[11]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[11]) : String(Number(i[11].value).toFixed(1)) : String(i[11]),
"february": i[5] === 'ROIC' ? String(Number(i[12]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[12]) : String(Number(i[12].value).toFixed(1)) : String(i[12]),
"march": i[5] === 'ROIC' ? String(Number(i[13]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[13]) : String(Number(i[13].value).toFixed(1)) : String(i[13]),
"april": i[5] === 'ROIC' ? String(Number(i[14]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[14]) : String(Number(i[14].value).toFixed(1)) : String(i[14]),
"may": i[5] === 'ROIC' ? String(Number(i[15]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[15]) : String(Number(i[15].value).toFixed(1)) : String(i[15]),
"june": i[5] === 'ROIC' ? String(Number(i[16]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[16]) : String(Number(i[16].value).toFixed(1)) : String(i[16]),
"july": i[5] === 'ROIC' ? String(Number(i[17]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[17]) : String(Number(i[17].value).toFixed(1)) : String(i[17]),
"august": i[5] === 'ROIC' ? String(Number(i[18]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[18]) : String(Number(i[18].value).toFixed(1)) : String(i[18]),
"september": i[5] === 'ROIC' ? String(Number(i[19]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[19]) : String(Number(i[19].value).toFixed(1)) : String(i[19]),
"october": i[5] === 'ROIC' ? String(Number(i[20]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[20]) : String(Number(i[20].value).toFixed(1)) : String(i[20]),
"november": i[5] === 'ROIC' ? String(Number(i[21]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[21]) : String(Number(i[21].value).toFixed(1)) : String(i[21]),
"december": i[5] === 'ROIC' ? String(Number(i[22]).toFixed(1)) : stateFR ? i[0] == 3 ? String(i[22]) : String(Number(i[22].value).toFixed(1)) : String(i[22]),
"total_current_year": i[6] === 'ROIC' ? String(Number(i[23]).toFixed(1)) : String(Number(i[23]).toFixed(1)) == "" ? "0.0" : String(Number(i[23]).toFixed(1)),
"strategic": String(i[24]),
"pic": String(i[25])
})
})
let payload = {
"rolling_outlook_id": this.props.rollingOutlookID,
"company_id": this.props.company.company_id,
"periode": this.props.periode,
"report_id": this.props.report_id,
"quartal": this.props.quarter,
"status": type,
"cat": data
}
// console.log(data);
// console.log(JSON.stringify(body))
api.create('UPLOAD').importRollingOutlookCAT(payload).then(response => {
console.log(payload);
console.log(response);
if (response.data) {
if (response.ok) {
if (response.data.status === "success") {
this.props.onClickClose()
this.props.getReport()
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
if (response.data.message.includes("Someone Logged In")) {
setTimeout(() => {
localStorage.removeItem(Constant.TOKEN)
window.location.reload();
}, 1000);
}
})
}
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
}
} else {
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
}
})
} }
handleValidate() { handleValidate() {
// 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),
// "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]),
// "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,
// "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 }) this.setState({ loading: false, buttonError: false, editable: false, buttonDraft: false })
// } else {
// this.setState({ loading: false, buttonError: true, editable: true, buttonDraft: true })
// }
// })
// }
} }
getLatestUpdate() { getLatestUpdate() {
...@@ -849,7 +786,6 @@ export default class CatRevision extends Component { ...@@ -849,7 +786,6 @@ export default class CatRevision extends Component {
render() { render() {
let dataTable2 = this.state.dataTable let dataTable2 = this.state.dataTable
let dataDelete = this.state.dataDelete
const handleChange = (value, tableMeta) => { const handleChange = (value, tableMeta) => {
let val = String(value).split(",").join("") let val = String(value).split(",").join("")
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
...@@ -1283,15 +1219,15 @@ export default class CatRevision extends Component { ...@@ -1283,15 +1219,15 @@ export default class CatRevision extends Component {
return total return total
} else { } else {
dataTable2[tableMeta.rowIndex].map((item, index) => { dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 13 && index <= 24) { if (index >= 11 && index <= 22) {
let valItem = item == undefined || item == "" ? 0 : item let valItem = item == undefined || item == "" ? 0 : item
total += Number(valItem) total += Number(valItem)
if (index == 24) { if (index == 22) {
lastValz += Number(valItem) lastValz += Number(valItem)
} }
} }
}) })
let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value let valz = dataTable2[tableMeta.rowIndex][10] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][10].value
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
return (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) return (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
} }
...@@ -1333,28 +1269,28 @@ export default class CatRevision extends Component { ...@@ -1333,28 +1269,28 @@ export default class CatRevision extends Component {
setCellProps: () => ({ style }), setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision') ? // handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision') ?
<div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> // <div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
{!this.state.loading && <FormControlLabel // {!this.state.loading && <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
control={ // control={
<Input // <Input
disableUnderline={true} // disableUnderline={true}
style={{ color: tableMeta.rowData[1] == "" ? "#5198ea" : "black", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent' }} // style={{ color: tableMeta.rowData[1] == "" ? "#5198ea" : "black", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
defaultValue={val} // defaultValue={val}
// disabled={!handleAction(tableMeta.rowData[2])} // // disabled={!handleAction(tableMeta.rowData[2])}
onBlur={(event) => { // onBlur={(event) => {
// // // // console.log(event.target.value) // // // // // console.log(event.target.value)
handleChangeText(event.target.value, tableMeta) // handleChangeText(event.target.value, tableMeta)
// // // console.log(dataTable2) // // // // console.log(dataTable2)
}} // }}
/> // />
} // }
/>} // />}
</div> // </div>
: // :
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[32] ? {tableMeta.rowData[32] ?
tableMeta.rowData[32].length > 0 ? tableMeta.rowData[32].length > 0 ?
...@@ -1403,12 +1339,9 @@ export default class CatRevision extends Component { ...@@ -1403,12 +1339,9 @@ export default class CatRevision extends Component {
setCellProps: () => ({ style2 }), setCellProps: () => ({ style2 }),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'center' }}>
{tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
tableMeta.rowData[0] === 1 ?
value
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1417,12 +1350,11 @@ export default class CatRevision extends Component { ...@@ -1417,12 +1350,11 @@ export default class CatRevision extends Component {
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
suffix="%" suffix="%"
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={value} value={value}
// disabled={this.props.quarter == 'q1'? false : true} disabled={true}
disable={true}
maxLength={4} maxLength={4}
onBlur={(event) => { onBlur={(event) => {
// updateValue(some) // updateValue(some)
...@@ -1447,14 +1379,14 @@ export default class CatRevision extends Component { ...@@ -1447,14 +1379,14 @@ export default class CatRevision extends Component {
), ),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'center' }}>
{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 :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
// value={value} // value={value}
control={ control={
!handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ? // !handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ?
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }} style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
...@@ -1469,24 +1401,27 @@ export default class CatRevision extends Component { ...@@ -1469,24 +1401,27 @@ export default class CatRevision extends Component {
// handleChangeText(event.target.value, tableMeta) // handleChangeText(event.target.value, tableMeta)
// // // // console.log(dataTable2) // // // // console.log(dataTable2)
}} }}
/> :
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -5 }}
type="text"
placeholder=""
defaultValue={value}
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)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // // // console.log(dataTable2)
}}
/> />
</ThemeProvider> // />
// />
// :
// <ThemeProvider theme={theme}>
// <Input
// disableUnderline={true}
// style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -5 }}
// type="text"
// placeholder=""
// defaultValue={value}
// 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)
// // updateValue(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// // // // // console.log(dataTable2)
// }}
// />
// </ThemeProvider>
} }
/> />
} }
...@@ -2752,13 +2687,13 @@ export default class CatRevision extends Component { ...@@ -2752,13 +2687,13 @@ export default class CatRevision 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 :
this.state.get_for == "view" ? this.state.get_for == "view" ?
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value).toFixed(1)} defaultValue={value}
/> />
: :
<FormControlLabel <FormControlLabel
...@@ -2802,13 +2737,13 @@ export default class CatRevision extends Component { ...@@ -2802,13 +2737,13 @@ export default class CatRevision 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 :
this.state.get_for == "view" ? this.state.get_for == "view" ?
<NumberFormat <Input
thousandSeparator={true} disableUnderline={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
disabled={true} disabled={true}
value={Number(value).toFixed(1)} defaultValue={value}
/> />
: :
<FormControlLabel <FormControlLabel
...@@ -2822,7 +2757,6 @@ export default class CatRevision extends Component { ...@@ -2822,7 +2757,6 @@ export default class CatRevision extends Component {
type="text" type="text"
placeholder="" placeholder=""
disabled={this.props.quarter == 'q1' ? false : true} disabled={this.props.quarter == 'q1' ? false : true}
disable={true}
defaultValue={value} defaultValue={value}
onBlur={(event) => { onBlur={(event) => {
// // // // console.log(event.target.value) // // // // console.log(event.target.value)
......
...@@ -419,6 +419,7 @@ export default class TaxPlanning extends Component { ...@@ -419,6 +419,7 @@ export default class TaxPlanning extends Component {
if (response.data.status === "success") { if (response.data.status === "success") {
// this.props.saveToMonthlyReport() // this.props.saveToMonthlyReport()
this.props.onClickClose() this.props.onClickClose()
this.props.refresh()
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
...@@ -430,6 +431,7 @@ export default class TaxPlanning extends Component { ...@@ -430,6 +431,7 @@ export default class TaxPlanning extends Component {
} }
// this.props.saveToMonthlyReport() // this.props.saveToMonthlyReport()
this.props.onClickClose() this.props.onClickClose()
this.props.refresh()
}) })
} }
} else { } else {
...@@ -441,9 +443,10 @@ export default class TaxPlanning extends Component { ...@@ -441,9 +443,10 @@ export default class TaxPlanning extends Component {
fileHandler = (event) => { fileHandler = (event) => {
let fileObj = event let fileObj = event
ExcelRenderer(fileObj, (err, resp) => { ExcelRenderer(fileObj, (err, resp) => {
console.log("masuk upload")
console.log(resp) console.log(resp)
if (err) { if (err) {
// console.log(err); console.log(err);
} }
else { else {
let isi = resp.rows.slice(4) let isi = resp.rows.slice(4)
...@@ -565,7 +568,7 @@ export default class TaxPlanning extends Component { ...@@ -565,7 +568,7 @@ export default class TaxPlanning extends Component {
// {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf}, // {tbc: item.formula.tbc, fcp: item.formula.fcp, tbf: item.formula.tbf},
item.level, item.level,
item.item_report, item.item_report,
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.january.tbc, formula: item.january_formula } : item.january.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 || item.type_report_id.fcp == 7 ? { value: item.january.fcp, formula: item.january_formula } : item.january.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 || item.type_report_id.tbf == 7 ? { value: item.january.tbf, formula: item.january_formula } : item.january.tbf }, { tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.january.tbc, formula: item.january_formula } : item.january.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.january.fcp, formula: item.january_formula } : item.january.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.january.tbf, formula: item.january_formula } : item.january.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.february.tbc, formula: item.february_formula } : item.february.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.february.fcp, formula: item.february_formula } : item.february.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.february.tbf, formula: item.february_formula } : item.february.tbf }, { tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.february.tbc, formula: item.february_formula } : item.february.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.february.fcp, formula: item.february_formula } : item.february.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.february.tbf, formula: item.february_formula } : item.february.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.march.tbc, formula: item.march_formula } : item.march.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.march.fcp, formula: item.march_formula } : item.march.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.march.tbf, formula: item.march_formula } : item.march.tbf }, { tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.march.tbc, formula: item.march_formula } : item.march.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.march.fcp, formula: item.march_formula } : item.march.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.march.tbf, formula: item.march_formula } : item.march.tbf },
{ tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.april.tbc, formula: item.april_formula } : item.april.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.april.fcp, formula: item.april_formula } : item.april.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.april.tbf, formula: item.april_formula } : item.april.tbf }, { tbc: item.type_report_id.tbc == 5 || item.type_report_id.tbc == 6 || item.type_report_id.tbc == 7 ? { value: item.april.tbc, formula: item.april_formula } : item.april.tbc, fcp: item.type_report_id.fcp == 5 || item.type_report_id.fcp == 6 || item.type_report_id.fcp == 7 ? { value: item.april.fcp, formula: item.april_formula } : item.april.fcp, tbf: item.type_report_id.tbf == 5 || item.type_report_id.tbf == 6 || item.type_report_id.tbf == 7 ? { value: item.april.tbf, formula: item.april_formula } : item.april.tbf },
...@@ -593,20 +596,20 @@ export default class TaxPlanning extends Component { ...@@ -593,20 +596,20 @@ export default class TaxPlanning extends Component {
item.orders, item.orders,
{ tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf }, { tbc: item.condition_it_should_be.tbc, fcp: item.condition_it_should_be.fcp, tbf: item.condition_it_should_be.tbf },
{ tbc: item.condition_if_wrong.tbc, fcp: item.condition_if_wrong.fcp, tbf: item.condition_if_wrong.tbf }, { tbc: item.condition_if_wrong.tbc, fcp: item.condition_if_wrong.fcp, tbf: item.condition_if_wrong.tbf },
item.forecast_tbc_formula, // item.forecast_tbc_formula,
item.forecast_fcp_formula, // item.forecast_fcp_formula,
item.forecast_tbf_formula, // item.forecast_tbf_formula,
item.error item.error
] ]
}) })
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => { this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, saveDraft: true }, () => {
console.log(this.state.dataTable);
this.state.dataTable.map(item => { this.state.dataTable.map(item => {
if (item[27].length > 0) { if (item[27].length > 0) {
// console.log('masuk') // console.log('masuk')
this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true }) this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
} }
}) })
// console.log(this.state.dataTable);
}) })
} }
} }
...@@ -679,25 +682,26 @@ export default class TaxPlanning extends Component { ...@@ -679,25 +682,26 @@ export default class TaxPlanning extends Component {
tbf: i[3] === 3 && i[20].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[20].tbf.value) : String(i[20].tbf) tbf: i[3] === 3 && i[20].tbf === "" ? "0" : i[3] === 5 || i[3] === 6 || i[3] === 7 ? String(i[20].tbf.value) : String(i[20].tbf)
}, },
total_current_year: String(Number(i[21]).toFixed(1)), total_current_year: String(Number(i[21]).toFixed(1)),
total_next_year: { // total_next_year: {
tbc: String(Number(i[22].tbc).toFixed(1)), // tbc: String(Number(i[22].tbc).toFixed(1)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[22].fcp).toFixed(1)) : String(Number(i[22].fcp).toFixed(1)), // fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[22].fcp).toFixed(1)) : String(Number(i[22].fcp).toFixed(1)),
tbf: String(Number(i[22].tbf).toFixed(1)) // tbf: String(Number(i[22].tbf).toFixed(1))
}, // },
total_more_year: { // total_more_year: {
tbc: String(Number(i[23].tbc).toFixed(1)), // tbc: String(Number(i[23].tbc).toFixed(1)),
fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[23].fcp).toFixed(1)) : String(Number(i[23].fcp).toFixed(1)), // fcp: String(i[8]).toLocaleUpperCase() == "CORPORATE INCOME TAX" ? String(Number(i[23].fcp).toFixed(1)) : String(Number(i[23].fcp).toFixed(1)),
tbf: String(Number(i[23].tbf).toFixed(1)) // tbf: String(Number(i[23].tbf).toFixed(1))
} // }
}) })
}) })
let body = { let body = {
submission_id: this.props.submissionID, rolling_outlook_id: this.props.rollingOutlookID,
company_id: this.props.company.company_id, company_id: this.props.company.company_id,
periode: this.props.periode, periode: this.props.periode,
report_id: this.props.report_id, report_id: this.props.report_id,
quartal: this.props.quarter,
status: type,
tax_planning: data, tax_planning: data,
status: type
} }
// console.log(data); // console.log(data);
api.create('UPLOAD').importRollingOutlookTP(body).then(response => { api.create('UPLOAD').importRollingOutlookTP(body).then(response => {
...@@ -705,7 +709,8 @@ export default class TaxPlanning extends Component { ...@@ -705,7 +709,8 @@ export default class TaxPlanning extends Component {
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
this.props.onClickClose() this.props.onClickClose()
this.props.getReport() // this.props.getReport()
this.props.refresh()
} else { } else {
this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
if (response.data.message.includes("Someone Logged In")) { if (response.data.message.includes("Someone Logged In")) {
...@@ -714,6 +719,8 @@ export default class TaxPlanning extends Component { ...@@ -714,6 +719,8 @@ export default class TaxPlanning extends Component {
window.location.reload(); window.location.reload();
}, 1000); }, 1000);
} }
this.props.onClickClose()
this.props.refresh()
}) })
// alert(response.data.status) // alert(response.data.status)
} }
...@@ -824,11 +831,12 @@ export default class TaxPlanning extends Component { ...@@ -824,11 +831,12 @@ export default class TaxPlanning extends Component {
} }
downloadTemplate = async () => { downloadTemplate = async () => {
let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`
console.log(url);
let res = await fetch( let res = await fetch(
// `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` // `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}` `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`
) )
console.log(`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/tax_planning/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`)
res = await res.blob() res = await res.blob()
if (res.size > 0) { if (res.size > 0) {
let url = window.URL.createObjectURL(res); let url = window.URL.createObjectURL(res);
...@@ -920,7 +928,12 @@ export default class TaxPlanning extends Component { ...@@ -920,7 +928,12 @@ export default class TaxPlanning extends Component {
if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') { if (splitform[1] == 'TP1' || splitform[1] == 'TP2' || splitform[1] == 'TP3') {
let indexID = dataTable2.findIndex((val) => val[24] == splitform[0]) let indexID = dataTable2.findIndex((val) => val[24] == splitform[0])
if (indexID !== -1) { if (indexID !== -1) {
// console.log(splitform)
let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf let data = splitform[1] == 'TP1' ? dataTable2[indexID][tableMeta.columnIndex].tbc : splitform[1] == 'TP2' ? dataTable2[indexID][tableMeta.columnIndex].fcp : dataTable2[indexID][tableMeta.columnIndex].tbf
// console.log(data)
// if(value == null){
// console.log(tableMeta);
// }
let valuezz = data.value == undefined ? data : data.value let valuezz = data.value == undefined ? data : data.value
anjay.push(valuezz == "" ? 0 : valuezz) anjay.push(valuezz == "" ? 0 : valuezz)
} }
...@@ -1113,22 +1126,6 @@ export default class TaxPlanning extends Component { ...@@ -1113,22 +1126,6 @@ export default class TaxPlanning extends Component {
} }
} }
const handleTotalControl = (tableMeta, dex, periode) => {
let total = 0
dataTable2[tableMeta.rowIndex].map((item, index) => {
if (index >= 9 && index <= 20) {
let indexChild = item.tbf.formula.findIndex((val) => val.periode === periode)
if (indexChild !== -1) {
total += Number(item.tbf.formula[indexChild].value)
}
}
})
let nilai = Number(total) + Number(dataTable2[88][21])
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = nilai
// console.log(nilai);
return nilai
}
const handleTotal = (tableMeta, dex, periode) => { const handleTotal = (tableMeta, dex, periode) => {
let total = 0 let total = 0
let totalfcp = 0 let totalfcp = 0
...@@ -1288,7 +1285,7 @@ export default class TaxPlanning extends Component { ...@@ -1288,7 +1285,7 @@ export default class TaxPlanning extends Component {
tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ? tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null null
: :
this.state.get_for == 'view'? // this.state.get_for == 'view'?
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ? tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1323,105 +1320,105 @@ export default class TaxPlanning extends Component { ...@@ -1323,105 +1320,105 @@ export default class TaxPlanning extends Component {
} }
/> />
</div> </div>
: // :
tableMeta.rowData[3] === 3 ? // tableMeta.rowData[3] === 3 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value.tbf} // value={value.tbf}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="input" // placeholder="input"
disabled={this.props.isApprover == true ? 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)} // disabled={this.props.isApprover == true ? 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)}
value={Number(value.tbf).toFixed(1)} // value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { // onBlur={(event) => {
// updateValue(event.target.value) // // updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 2) // handleChange(event.target.value, tableMeta, 2)
// console.log(dataTable2) // // console.log(dataTable2)
}} // }}
/> // />
} // }
/> // />
</div> // </div>
: // :
tableMeta.rowData[3] === 2 ? // tableMeta.rowData[3] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> // <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleParent(tableMeta, 3)).toFixed(1)} // value={Number(handleParent(tableMeta, 3)).toFixed(1)}
/> // />
</span> // </span>
: // :
tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 ? // tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 ?
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> // />
: // :
tableMeta.rowData[3] === 7 ? // tableMeta.rowData[3] === 7 ?
(Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ? // (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ // style={{
fontSize: 12, // fontSize: 12,
textAlign: 'right', // textAlign: 'right',
borderColor: 'transparent', // borderColor: 'transparent',
margin: 0, // margin: 0,
width: 96, // width: 96,
backgroundColor: 'transparent', // backgroundColor: 'transparent',
color: 'black' // color: 'black'
}} // }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> : // /> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow> // <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ // style={{
fontSize: 12, // fontSize: 12,
textAlign: 'right', // textAlign: 'right',
borderColor: 'transparent', // borderColor: 'transparent',
margin: 0, // margin: 0,
width: 96, // width: 96,
backgroundColor: 'transparent', // backgroundColor: 'transparent',
color: 'red' // color: 'red'
}} // }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> // />
</LightTooltip> // </LightTooltip>
: // :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value.tbf} // value={value.tbf}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(value.tbf).toFixed(1)} // value={Number(value.tbf).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
} }
</div> </div>
</div> </div>
...@@ -1458,7 +1455,7 @@ export default class TaxPlanning extends Component { ...@@ -1458,7 +1455,7 @@ export default class TaxPlanning extends Component {
tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ? tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null null
: :
this.state.get_for == 'view'? // this.state.get_for == 'view'?
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ? tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1493,105 +1490,105 @@ export default class TaxPlanning extends Component { ...@@ -1493,105 +1490,105 @@ export default class TaxPlanning extends Component {
} }
/> />
</div> </div>
: // :
tableMeta.rowData[3] === 3 ? // tableMeta.rowData[3] === 3 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value.tbf} // value={value.tbf}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="input" // placeholder="input"
disabled={this.props.isApprover == true ? 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)} // disabled={this.props.isApprover == true ? 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)}
value={Number(value.tbf).toFixed(1)} // value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { // onBlur={(event) => {
// updateValue(event.target.value) // // updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 2) // handleChange(event.target.value, tableMeta, 2)
// console.log(dataTable2) // // console.log(dataTable2)
}} // }}
/> // />
} // }
/> // />
</div> // </div>
: // :
tableMeta.rowData[3] === 2 ? // tableMeta.rowData[3] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> // <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleParent(tableMeta, 3)).toFixed(1)} // value={Number(handleParent(tableMeta, 3)).toFixed(1)}
/> // />
</span> // </span>
: // :
tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 ? // tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 ?
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> // />
: // :
tableMeta.rowData[3] === 7 ? // tableMeta.rowData[3] === 7 ?
(Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ? // (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ // style={{
fontSize: 12, // fontSize: 12,
textAlign: 'right', // textAlign: 'right',
borderColor: 'transparent', // borderColor: 'transparent',
margin: 0, // margin: 0,
width: 96, // width: 96,
backgroundColor: 'transparent', // backgroundColor: 'transparent',
color: 'black' // color: 'black'
}} // }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> : // /> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow> // <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ // style={{
fontSize: 12, // fontSize: 12,
textAlign: 'right', // textAlign: 'right',
borderColor: 'transparent', // borderColor: 'transparent',
margin: 0, // margin: 0,
width: 96, // width: 96,
backgroundColor: 'transparent', // backgroundColor: 'transparent',
color: 'red' // color: 'red'
}} // }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> // />
</LightTooltip> // </LightTooltip>
: // :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value.tbf} // value={value.tbf}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(value.tbf).toFixed(1)} // value={Number(value.tbf).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
} }
</div> </div>
</div> </div>
...@@ -1628,7 +1625,7 @@ export default class TaxPlanning extends Component { ...@@ -1628,7 +1625,7 @@ export default class TaxPlanning extends Component {
tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ? tableMeta.rowData[3] === 4 || tableMeta.rowData[3] === 1 ?
null null
: :
this.state.get_for == 'view'? // this.state.get_for == 'view'?
tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ? tableMeta.rowData[3] === 5 || tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 7 ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
...@@ -1663,105 +1660,105 @@ export default class TaxPlanning extends Component { ...@@ -1663,105 +1660,105 @@ export default class TaxPlanning extends Component {
} }
/> />
</div> </div>
: // :
tableMeta.rowData[3] === 3 ? // tableMeta.rowData[3] === 3 ?
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value.tbf} // value={value.tbf}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="input" // placeholder="input"
disabled={this.props.isApprover == true ? 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)} // disabled={this.props.isApprover == true ? 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)}
value={Number(value.tbf).toFixed(1)} // value={Number(value.tbf).toFixed(1)}
onBlur={(event) => { // onBlur={(event) => {
// updateValue(event.target.value) // // updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 2) // handleChange(event.target.value, tableMeta, 2)
// console.log(dataTable2) // // console.log(dataTable2)
}} // }}
/> // />
} // }
/> // />
</div> // </div>
: // :
tableMeta.rowData[3] === 2 ? // tableMeta.rowData[3] === 2 ?
<span style={{ fontSize: 12, textAlign: 'right' }}> // <span style={{ fontSize: 12, textAlign: 'right' }}>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleParent(tableMeta, 3)).toFixed(1)} // value={Number(handleParent(tableMeta, 3)).toFixed(1)}
/> // />
</span> // </span>
: // :
tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 ? // tableMeta.rowData[3] === 6 || tableMeta.rowData[3] === 5 ?
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> // />
: // :
tableMeta.rowData[3] === 7 ? // tableMeta.rowData[3] === 7 ?
(Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ? // (Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(value, tableMeta, 3)).toFixed(1) <= Number(this.state.maxValue)) ?
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ // style={{
fontSize: 12, // fontSize: 12,
textAlign: 'right', // textAlign: 'right',
borderColor: 'transparent', // borderColor: 'transparent',
margin: 0, // margin: 0,
width: 96, // width: 96,
backgroundColor: 'transparent', // backgroundColor: 'transparent',
color: 'black' // color: 'black'
}} // }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> : // /> :
<LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow> // <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[25].tbf}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ // style={{
fontSize: 12, // fontSize: 12,
textAlign: 'right', // textAlign: 'right',
borderColor: 'transparent', // borderColor: 'transparent',
margin: 0, // margin: 0,
width: 96, // width: 96,
backgroundColor: 'transparent', // backgroundColor: 'transparent',
color: 'red' // color: 'red'
}} // }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)} // value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
/> // />
</LightTooltip> // </LightTooltip>
: // :
<div style={{ flex: 1 }}> // <div style={{ flex: 1 }}>
<FormControlLabel // <FormControlLabel
style={{ margin: 0 }} // style={{ margin: 0 }}
value={value.tbf} // value={value.tbf}
control={ // control={
<NumberFormat // <NumberFormat
thousandSeparator={true} // thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} // style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" // type="text"
placeholder="" // placeholder=""
disabled={true} // disabled={true}
value={Number(value.tbf).toFixed(1)} // value={Number(value.tbf).toFixed(1)}
/> // />
} // }
/> // />
</div> // </div>
} }
</div> </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