Commit 52de3b63 authored by Riri Novita's avatar Riri Novita

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

parents 91bee0d8 434983ce
......@@ -416,6 +416,7 @@ export default class CorporateAnnualTargetMR extends Component {
})
console.log(dataTable)
this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
this.handleCalculate(dataTable)
this.state.dataTable.map(item => {
if (item[16].length > 0) {
console.log('masuk')
......@@ -630,73 +631,12 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ alert: false })
}
handleCalculate(datatable2, someXXX) {
handleCalculate(datatable2) {
this.setState({ loading: true }, () => {
let total = 0
let perfomanceScore = ''
// console.log(datatable2)
// console.log(datatable2[datatable2.length-1][15])
// console.log(datatable2[datatable2.length-6][11])
// const handleAchiement = (kpi, actualData, targetData) => {
// // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) * 100
// return Number(total) * 100
// }
// const handleScore = (kpi, maxAch, ach) => {
// let listParameter = this.state.parameterScore
// let parameterKpi = kpi
// let parameterAch = String(maxAch).includes('%') ? `MAX${String(maxAch).substr(0, String(maxAch).length - 1)}` : String(maxAch)
// let parameterMix = `${parameterKpi}_${parameterAch}`
// let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase())
// let listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
// let totalScore = 0
// let achx100 = maxAch == '100%' ? Number(ach) / 100 > 1 ? 1 : Number(ach) / 100 : Number(ach) / 100
// if (listParameterFilterCompany.length == 0) {
// listParameterFilter.map((item, index) => {
// if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
// totalScore = Number(item.value)
// }
// })
// } else {
// listParameterFilterCompany.map((item, index) => {
// if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
// totalScore = Number(item.value)
// }
// })
// }
// // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
// return Number(totalScore).toFixed(0)
// }
// const handleTotal = (weight, target, score) => {
// let total = 0
// let handlePercent = ''
// // if (tableMeta.rowData[5] == 'Trading profit (NPBT buah luar & plasma)') {
// // console.log(dataTable2[tableMeta.rowIndex])
// // }
// if (String(weight).includes('%')) {
// // handlePercent = String(weight)
// handlePercent = String(weight).substr(0, String(weight).length - 1)
// } else {
// handlePercent = String(weight)
// }
// // console.log(handlePercent)
// if (target == '' || String(target) == '0' || String(target) == '0.0') {
// total = 0
// } else {
// total = Number(score) * Number(handlePercent) / 100
// // console.log(total)
// }
// // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2)
// return total
// }
let datatable3 = datatable2.map((item, index) => {
//ach
let totalAch = 0
if (item[8] == 'HIB') {
......@@ -713,6 +653,7 @@ export default class CorporateAnnualTargetMR extends Component {
// if (item[5] == "People Benchstrength") {
// console.log(totalAch)
// }
//score
let listParameter = this.state.parameterScore
let parameterKpi = item[8]
......@@ -801,8 +742,7 @@ export default class CorporateAnnualTargetMR extends Component {
perfomanceScore = 'IST'
}
setTimeout(() => {
this.setState({ totalScore: total, perfomanceScore, loading: false })
// console.log(total)
this.setState({ totalScore: total, perfomanceScore, loading: false})
}, 500);
})
......@@ -1959,7 +1899,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => {
setTimeout(() => {
// this.handleValidate()
this.handleCalculate(dataTable2, someXXX)
this.handleCalculate(dataTable2)
}, 100);
})
}}
......
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