Commit 10bf5f68 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

push gadang

See merge request !670
parents c9bde168 49512e0a
...@@ -252,12 +252,13 @@ export default class BudgetTahunan extends Component { ...@@ -252,12 +252,13 @@ export default class BudgetTahunan extends Component {
dataTableRevision.push([ dataTableRevision.push([
item.report_id, item.report_id,
item.report_name === 'CAT' ? 'Corporate Annual Target' : item.report_name, item.report_name === 'CAT' ? 'Corporate Annual Target' : item.report_name,
"" "",
item.number
]) ])
} }
}) })
// // console.log(dataTableRevision); // // console.log(dataTableRevision);
this.setState({ dataTable, loading: false, dataTableRevision, dataForRevision: response.data.data }, ()=> { this.setState({ dataTable, loading: false, dataTableRevision: dataTableRevision.sort((a,b) => a.number - b.number), dataForRevision: response.data.data }, ()=> {
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
}) })
} }
...@@ -953,6 +954,9 @@ export default class BudgetTahunan extends Component { ...@@ -953,6 +954,9 @@ export default class BudgetTahunan extends Component {
) )
} }
} }
}, {
name: "",
options: { display: false }
} }
] ]
...@@ -973,17 +977,49 @@ export default class BudgetTahunan extends Component { ...@@ -973,17 +977,49 @@ export default class BudgetTahunan extends Component {
let detailRevisiCheck = this.state.detailRevisiCheck let detailRevisiCheck = this.state.detailRevisiCheck
let payload = { let payload = {
report_id: value[0], report_id: value[0],
remarks: value[2] remarks: value[2],
number: value[3]
} }
let indexDataRevisi = this.state.dataTableRevision.findIndex((val) => val[3] == value[3])
let indexId = detailRevisiCheck.findIndex((val) => val.report_id == value[0]) let indexId = detailRevisiCheck.sort((a,b) => a.number - b.number).findIndex((val) => val.number == value[3])
// console.log(indexId)
if (indexId == -1) { if (indexId == -1) {
this.state.dataTableRevision.map((item,index) => {
if (index > indexDataRevisi) {
let indexIds = detailRevisiCheck.findIndex((val) => val.number == item[3])
if (indexIds == -1) {
let payload2 = {
report_id: item[0],
remarks: item[2],
number: item[3]
}
detailRevisiCheck.push(payload2)
}
}
})
detailRevisiCheck.push(payload) detailRevisiCheck.push(payload)
} else { } else {
detailRevisiCheck.splice(indexId, 1)
let x = 0
detailRevisiCheck.sort((a,b) => a.number - b.number).map((item,index) => {
if (item.number < value[3]) {
x += 1
}
})
if (x < 1) {
this.state.dataTableRevision.map((item,index) => {
if (index > indexDataRevisi) {
let indexIdz = detailRevisiCheck.findIndex((val) => val.number == item[3])
if (indexIdz !== -1) {
detailRevisiCheck.splice(indexIdz, 1)
}
}
})
detailRevisiCheck.splice(indexId, 1)
}
} }
this.setState({ detailRevisiCheck }) this.setState({ detailRevisiCheck: detailRevisiCheck.sort((a,b) => a.number - b.number) })
// // console.log(detailRevisiCheck) // console.log(detailRevisiCheck)
} }
const options = { const options = {
......
...@@ -14,6 +14,7 @@ import Constant from '../../library/Constant'; ...@@ -14,6 +14,7 @@ import Constant from '../../library/Constant';
import { Alert, Autocomplete } from '@material-ui/lab'; import { Alert, Autocomplete } from '@material-ui/lab';
import UploadFile from "../../library/Upload"; import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer'; import { ExcelRenderer } from 'react-excel-renderer';
import * as R from 'ramda'
const LightTooltip = withStyles((theme) => ({ const LightTooltip = withStyles((theme) => ({
tooltip: { tooltip: {
...@@ -109,7 +110,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -109,7 +110,7 @@ export default class CorporateAnnualTarget extends Component {
let dataTable = [] let dataTable = []
let dataCustomerPrs = [] let dataCustomerPrs = []
let dataInternalBsn = [] let dataInternalBsn = []
// // console.log(response)\ console.log(response)
if (response.data) { if (response.data) {
if (response.ok) { if (response.ok) {
if (response.data.status == 'success') { if (response.data.status == 'success') {
...@@ -153,23 +154,25 @@ export default class CorporateAnnualTarget extends Component { ...@@ -153,23 +154,25 @@ 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.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.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.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.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.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.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.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.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.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.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.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.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.cat.total_current_year == "" ? item.cat.total_current_year : 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 == "" ? item.cat.total_current_year : 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),
item.cat.strategic, item.cat.strategic,
item.cat.pic item.cat.pic,
item.cat.forecast_formula,
item.order
]) ])
} }
if (item.children !== null) { if (item.children !== null) {
...@@ -211,7 +214,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -211,7 +214,9 @@ export default class CorporateAnnualTarget extends Component {
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),
item.cat.strategic, item.cat.strategic,
item.cat.pic item.cat.pic,
item.cat.forecast_formula,
item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
if (item.children.length > 0) { if (item.children.length > 0) {
...@@ -435,7 +440,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -435,7 +440,9 @@ export default class CorporateAnnualTarget extends Component {
item.total_next_year == "" ? item.total_next_year : String(item.total_next_year).indexOf(".") == -1 ? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1), item.total_next_year == "" ? item.total_next_year : String(item.total_next_year).indexOf(".") == -1 ? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1),
item.total_more_year == "" ? item.total_more_year : String(item.total_more_year).indexOf(".") == -1 ? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1), item.total_more_year == "" ? item.total_more_year : String(item.total_more_year).indexOf(".") == -1 ? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1),
item.strategic, item.strategic,
item.pic, item.pic,,
item.forecast_formula,,
item.order,
item.error item.error
]) ])
}) })
...@@ -871,23 +878,279 @@ export default class CorporateAnnualTarget extends Component { ...@@ -871,23 +878,279 @@ export default class CorporateAnnualTarget extends Component {
let dataDelete = this.state.dataDelete 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("")
// let total = 0
// let lastValz = 0
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
// dataTable2[tableMeta.rowIndex].map((item, index) => {
// if (index >= 13 && index <= 24) {
// let valItem = item == undefined || item == "" ? 0 : item
// total += Number(valItem)
// if (index == 24) {
// lastValz += Number(valItem)
// }
// }
// })
// let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value
// dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz))
// // // console.log(dataTable2[tableMeta.rowIndex])
} }
const handleValueFormula = (value, tableMeta, column, periode, forecast) => {
// loading = true
let splitFormula = String(tableMeta.rowData[3]).split(/([()@])/)
let baru = []
let anjay = []
splitFormula.map((item, index) => {
let items = String(item).substr(Number(String(item).length) - 1, 1)
let subForm = String(item).substr(0, Number(String(item).length) - 1)
let re = /^[a-zA-Z0-9_]+$/;
if (item !== "") {
if (!re.test(items)) {
baru.push(subForm)
baru.push(items)
} else {
baru.push(String(item))
}
}
})
baru.map((item, index) => {
if (item == '-' || item == '+' || item == '/' || item == '*' || item == '(' || item == ')') {
anjay.push(item)
} else if (item == '' || item == '@') {
} else if (item == "CurrMonth") {
anjay.push(String(column))
} else if (item.includes('[CM]SUM')) {
let columnStart = 13
let indexX = String(item).indexOf('[')
let formulaAwal = String(item).substr(0,indexX)
let columnEnd = 24
let month = column-1
let total = 0
// console.log(formulaAwal)
if(forecast == undefined) {
dataTable2[tableMeta.rowIndex].map((itemz,indexz) => {
if (indexz >= columnStart && indexz <= columnStart + month) {
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${formulaAwal}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = Number(value.formula[indexID].value)
total += valuezz
}
}
})
} else {
}
anjay.push(String(total))
} else if (item.includes('[CM]AVG')) {
if (forecast == undefined) {
anjay.push('/')
anjay.push(column)
}
} else if (item.includes('X')) {
let indexX = String(item).indexOf('X')
if (indexX == 0) {
anjay.push(String(item).substr(1,String(item).length))
} else {
let formulaAwal = String(item).substr(0,indexX-1)
let operatorX = String(item).substr(indexX-1,1)
let nilaiX = String(item).substr(indexX+1,String(item).length)
if (forecast == undefined) {
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${formulaAwal}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = value.formula[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
let array = dataTable2[tableMeta.rowIndex][30].filter((val) => val.periode == Number(this.props.periode))
// console.log(dataTable2[tableMeta.rowIndex][6])
let valuezz = array[0].value
console.log(valuezz)
anjay.push(valuezz == "" ? 0 : valuezz)
// let indexID = dataTable2[tableMeta.rowIndex][30].findIndex((val) => val.periode == Number(this.props.periode))
// if (indexID !== -1) {
// let valuezz = value.formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
}
anjay.push(operatorX)
anjay.push(nilaiX)
}
} else {
if (String(item).includes('#')) {
if (forecast == undefined) {
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) {
let valuezz = value.formula[indexID].value
anjay.push(valuezz == "" || valuezz == null? "0" : valuezz)
}
}
} else {
let indexID = dataTable2.findIndex((val) => val[31] == item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][column].value == undefined ? dataTable2[indexID][column] : dataTable2[indexID][column].value
if (item == dataTable2[tableMeta.rowIndex][31]) {
anjay.push(0)
} else {
anjay.push(valuezz == "" ? "0" : valuezz)
}
} else {
if (item === '(-1)') {
anjay.push(-1)
}
}
}
}
})
let anjay2 = []
let kurung = false
let item1 = []
let brpKurung = 0
anjay.map((item, index) => {
if (item == "(") {
kurung = true
// brpKurung += 1
} else if (item == ")") {
// brpKurung -= 1
// if (brpKurung == 0) {
kurung = false
anjay2.push(item1)
item1 = []
// }
} else {
if (kurung) {
item1.push(item)
} else {
anjay2.push(item)
}
}
})
let total = 0
let opt = ""
let totalPrio = 0
let optPrio = ""
let prio = false
anjay2.map((item, index) => {
if (Array.isArray(item)) {
prio = true
item.map((items, indexs) => {
if (items == "+") {
optPrio = "tambah"
} else if (items == "-") {
optPrio = "kurang"
} else if (items == "*") {
optPrio = "kali"
} else if (items == "/") {
optPrio = "bagi"
} else {
if (optPrio == "tambah") {
totalPrio = Number(totalPrio) + Number(items)
} else if (optPrio == "kurang") {
totalPrio = Number(totalPrio) - Number(items)
} else if (optPrio == "kali") {
totalPrio = Number(totalPrio) * Number(items)
} else if (optPrio == "bagi") {
totalPrio = Number(totalPrio) / Number(items) == NaN ? 0 : Number(totalPrio) / Number(items)
} else {
totalPrio += Number(items)
}
}
})
if (index == anjay2.length - 1) {
if (opt == "tambah") {
total = Number(total) + Number(totalPrio)
} else if (opt == "kurang") {
total = Number(total) - Number(totalPrio)
} else if (opt == "kali") {
total = Number(total) * Number(totalPrio)
} else if (opt == "bagi") {
total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
} else {
total += Number(totalPrio)
}
}
} else {
if (item == "+") {
opt = "tambah"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else if (item == "-") {
opt = "kurang"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else if (item == "*") {
opt = "kali"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else if (item == "/") {
opt = "bagi"
if (prio) {
total = Number(Number(totalPrio) + Number(total))
prio = false
totalPrio = 0
optPrio = ""
}
} else {
if (opt == "tambah") {
total = Number(total) + Number(item)
} else if (opt == "kurang") {
total = Number(total) - Number(item)
} else if (opt == "kali") {
total = Number(total) * Number(item)
} else if (opt == "bagi") {
total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
} else {
total += Number(item)
}
}
}
})
// if (dataTable2[tableMeta.rowIndex][6] == "ROIC" && forecast == undefined) {
// console.log(tableMeta.rowData[3])
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// // console.log(item1)
// console.log(anjay2)
// console.log(total)
// }
// console.log(tableMeta.rowData[3])
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// console.log(item1)
// console.log(anjay2)
// console.log(total)
total = dataTable2[tableMeta.rowIndex][6] == "ROIC"? "0" : R.equals(total, NaN) ? "0.0" : total
if (dataTable2[tableMeta.rowIndex][6] == "ROIC") {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = "0"
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = "0"
}
} else {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
}
}
return total
}
const handleValueForecast = (value, tableMeta, periode) => {
return handleValueFormula(value, tableMeta, periode, periode, 'forecast')
}
const handleChangeDropdown = (value, tableMeta) => { const handleChangeDropdown = (value, tableMeta) => {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
let valz = value.value let valz = value.value
...@@ -914,9 +1177,6 @@ export default class CorporateAnnualTarget extends Component { ...@@ -914,9 +1177,6 @@ export default class CorporateAnnualTarget extends Component {
} else { } else {
index = data.findIndex((val) => val.value == value.value) index = data.findIndex((val) => val.value == value.value)
} }
// // console.log(value)
// // console.log(data)
// // console.log(index)
if (index == -1) { if (index == -1) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = null
return null return null
...@@ -927,39 +1187,12 @@ export default class CorporateAnnualTarget extends Component { ...@@ -927,39 +1187,12 @@ export default class CorporateAnnualTarget extends Component {
} }
const handleChangePercentage = (value, tableMeta) => { const handleChangePercentage = (value, tableMeta) => {
// let valueReal = value.replace('%', '')
// let indexParentDatatable = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
// let indexParentReal = this.state.dataReal.findIndex((val) => val.id == tableMeta.rowData[2])
// let valParent = dataTable2[indexParentDatatable][7]
// valParent.replace('%', '')
// let valChild = 0
// dataTable2.map((item, index) => {
// if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) {
// let weightItem = item[7] == "" ? 0 : item[7].replace('%', '')
// // // console.log(weightItem)
// valChild += Number(weightItem)
// }
// })
// let endVal = ''
// if ((Number(valueReal) + Number(valChild)) > Number(valParent.replace('%', ''))) {
// endVal = `${Number(valParent.replace('%', '')) - (Number(valChild))}%`
// // // console.log(endVal)
// } else {
// endVal = `${Number(valueReal)}%`
// // // console.log(endVal)
// }
// // // // console.log(endVal)
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = endVal
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
} }
const handleChangeText = (value, tableMeta) => { const handleChangeText = (value, tableMeta) => {
// // console.log(value)
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
// this.setState({dataTable: dataTable2})
} }
const handleAction = (idParent, typeReport, tableMeta) => { const handleAction = (idParent, typeReport, tableMeta) => {
...@@ -995,6 +1228,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -995,6 +1228,19 @@ export default class CorporateAnnualTarget extends Component {
} }
const handleReturnFormula = (idParent, tableMeta) => {
if (idParent !== null) {
let indexsss = dataTable2.findIndex((val) => val[1] == idParent)
if (dataTable2[indexsss][6] == 'FINANCIAL PERSPECTIVE') {
return true
} else {
return false
}
} else {
return false
}
}
const handleTambah = (data, rowIndex) => { const handleTambah = (data, rowIndex) => {
// console.log(dataTable2) // console.log(dataTable2)
let newData = [] let newData = []
...@@ -1189,8 +1435,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1189,8 +1435,8 @@ export default class CorporateAnnualTarget extends Component {
</div> </div>
: :
<div style={{ width: 300 }}> <div style={{ width: 300 }}>
{tableMeta.rowData[30] ? {tableMeta.rowData[32] ?
tableMeta.rowData[30].length > 0 ? tableMeta.rowData[32].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow> <LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
...@@ -1488,6 +1734,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1488,6 +1734,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 1)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1509,7 +1779,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1509,7 +1779,7 @@ export default class CorporateAnnualTarget extends Component {
/> />
} }
/> />
</div> </div>)
} }
</div> </div>
) )
...@@ -1529,6 +1799,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1529,6 +1799,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 2)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1545,12 +1839,12 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1545,12 +1839,12 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>)
} }
</div> </div>
) )
...@@ -1570,6 +1864,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1570,6 +1864,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 3)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1581,17 +1899,18 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1581,17 +1899,18 @@ export default class CorporateAnnualTarget extends Component {
type="text" type="text"
placeholder="" placeholder=""
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
decimalScale={1}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1611,6 +1930,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1611,6 +1930,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 4)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1627,12 +1970,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1627,12 +1970,13 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1652,6 +1996,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1652,6 +1996,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 5)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1662,18 +2030,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1662,18 +2030,19 @@ export default class CorporateAnnualTarget extends Component {
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="" placeholder=""
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1693,6 +2062,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1693,6 +2062,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 6)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1703,18 +2096,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1703,18 +2096,19 @@ export default class CorporateAnnualTarget extends Component {
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="" placeholder=""
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1734,6 +2128,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1734,6 +2128,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 7)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1750,12 +2168,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1750,12 +2168,13 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1775,6 +2194,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1775,6 +2194,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 8)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1785,18 +2228,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1785,18 +2228,19 @@ export default class CorporateAnnualTarget extends Component {
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="" placeholder=""
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1816,6 +2260,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1816,6 +2260,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 9)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1826,18 +2294,19 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1826,18 +2294,19 @@ export default class CorporateAnnualTarget extends Component {
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="" placeholder=""
value={Number(value).toFixed(1)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
decimalScale={1} decimalScale={1}
value={Number(value).toFixed(1)}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1857,6 +2326,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1857,6 +2326,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 10)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1873,12 +2366,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1873,12 +2366,13 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1898,6 +2392,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1898,6 +2392,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 11)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1914,12 +2432,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1914,12 +2432,13 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1939,6 +2458,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1939,6 +2458,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueFormula(value, tableMeta, 12)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1955,12 +2498,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1955,12 +2498,13 @@ export default class CorporateAnnualTarget extends Component {
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -1979,26 +2523,53 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1979,26 +2523,53 @@ export default class CorporateAnnualTarget extends Component {
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{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 (handleReturnFormula(tableMeta.rowData[2], tableMeta)?
style={{ margin: 0 }} <div style={{ flex: 1 }}>
value={value} <FormControlLabel
control={ style={{ margin: 0 }}
<NumberFormat value={value}
thousandSeparator={true} control={
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} <NumberFormat
type="text" thousandSeparator={true}
placeholder="" style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
value={Number(handleTotal(tableMeta)).toFixed(1)} type="text"
decimalScale={1} placeholder=""
disabled={true} value={Number(handleValueForecast(value, tableMeta, this.props.periode)).toFixed(1)}
// onBlur={(event) => { disabled={true}
// // updateValue(event.target.value) decimalScale={1}
// handleChange(event.target.value, tableMeta) onBlur={(event) => {
// // // console.log(dataTable2) // updateValue(event.target.value)
// }} handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> />
} </div>
/> :
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleTotal(tableMeta)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
)
} }
</div> </div>
) )
...@@ -2018,6 +2589,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2018,6 +2589,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueForecast(value, tableMeta, Number(this.props.periode) + 1)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2025,21 +2620,22 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2025,21 +2620,22 @@ export default class CorporateAnnualTarget extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", 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=""
value={Number(value).toFixed(1)} value={Number(handleTotal(tableMeta)).toFixed(1)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={true}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -2059,6 +2655,30 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2059,6 +2655,30 @@ 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)?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleValueForecast(value, tableMeta, Number(this.props.periode) + 2)).toFixed(1)}
disabled={true}
decimalScale={1}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div>
:
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2066,21 +2686,22 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2066,21 +2686,22 @@ export default class CorporateAnnualTarget extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "#5198ea", 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=""
value={Number(value).toFixed(1)} value={Number(handleTotal(tableMeta)).toFixed(1)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)} disabled={true}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(tableMeta.rowData[0])
}} }}
/> />
} }
/> />
</div> </div>
)
} }
</div> </div>
) )
...@@ -2166,7 +2787,17 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2166,7 +2787,17 @@ export default class CorporateAnnualTarget extends Component {
) )
} }
} }
} }, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
},
] ]
const loadingComponent = ( const loadingComponent = (
<div style={{ position: 'absolute', zIndex: 1500, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}> <div style={{ position: 'absolute', zIndex: 1500, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
......
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