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

update last

parent 758245e9
......@@ -128,7 +128,7 @@ export default class CorporateAnnualTargetMR extends Component {
checkStatus = false
}
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev})
this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
}
getParameterGroup() {
......@@ -238,7 +238,7 @@ export default class CorporateAnnualTargetMR extends Component {
])
// let index = dataTable.findIndex((val) => val[5] == item.description)
console.log(index, length - 1)
if (index == length -1 && item.parent_name == "LEARNING & GROWTH PERSPECTIVE") {
if (index == length - 1 && item.parent_name == "LEARNING & GROWTH PERSPECTIVE") {
dataTable.push([
4,
0,
......@@ -705,9 +705,9 @@ export default class CorporateAnnualTargetMR extends Component {
let target = item[12] == "" ? 0 : Number(item[12])
if (target < 0) {
if (actual >= target) {
totalAch = ((target-actual) / target) + 1
totalAch = ((target - actual) / target) + 1
} else {
totalAch = (target-actual) / target
totalAch = (target - actual) / target
}
} else if (target == 0) {
if (target <= actual) {
......@@ -734,22 +734,30 @@ export default class CorporateAnnualTargetMR extends Component {
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 = item[9] == '100%' && (item[8] == 'HIB' || item[8] == 'HIG')? Number(totalAch) / 100 > 1 ? 1 : Number(totalAch) / 100 : Number(totalAch) / 100
let achx100 = item[9] == '100%' && (item[8] == 'HIB' || item[8] == 'HIG') ? Number(totalAch) / 100 > 1 ? 1 : Number(totalAch) / 100 : Number(totalAch) / 100
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(listParameterFilter)
// console.log(listParameterFilterCompany)
// // console.log(Number(item.min_value))
// console.log(Number(item.max_value))
// }
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)
listParameterFilter.map((items, index) => {
if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(items.value)
}
})
} else {
listParameterFilterCompany.map((item, index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
totalScore = Number(item.value)
listParameterFilterCompany.map((items, index) => {
if (Number(achx100) >= Number(items.min_value) && Number(achx100) <= Number(items.max_value)) {
totalScore = Number(items.value)
}
})
}
let totalScorez = Number(totalScore).toFixed(0)
// if (item[5] == "Max Quality drop from Bor-Barge") {
// console.log(totalScorez)
// }
//Score X Weight
let totalSW = 0
let handlePercent = ''
......@@ -835,6 +843,7 @@ export default class CorporateAnnualTargetMR extends Component {
console.log(listPerfomanceDefault)
console.log(perfomanceScore)
console.log(perfomanceScoreColor)
console.log(datatable3)
// if (lastTotal >= 1.00 && lastTotal <= 2.00) {
// perfomanceScore = 'K'
// } else if (lastTotal >= 2.01 && lastTotal <= 2.75) {
......@@ -851,10 +860,10 @@ export default class CorporateAnnualTargetMR extends Component {
// perfomanceScore = 'IST'
// }
setTimeout(() => {
this.setState({ totalScore: lastTotal, perfomanceScore, loading: false, perfomanceScoreColor}, () => {
this.setState({loading: true})
this.setState({ totalScore: lastTotal, perfomanceScore, loading: false, perfomanceScoreColor }, () => {
this.setState({ loading: true })
setTimeout(() => {
this.setState({loading: false})
this.setState({ loading: false })
}, 500);
})
}, 500);
......@@ -1288,9 +1297,9 @@ export default class CorporateAnnualTargetMR extends Component {
let target = tableMeta.rowData[12] == "" ? 0 : Number(tableMeta.rowData[12])
if (target < 0) {
if (actual >= target) {
total = ((target-actual) / target) + 1
total = ((target - actual) / target) + 1
} else {
total = (target-actual) / target
total = (target - actual) / target
}
} else if (target == 0) {
if (target <= actual) {
......@@ -1333,12 +1342,12 @@ export default class CorporateAnnualTargetMR extends Component {
}
})
}
if (Number(tableMeta.rowData[12]) > Number(0)){
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0)
} else {
if (Number(tableMeta.rowData[12]) == Number(0)) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(0).toFixed(0)
return Number(0).toFixed(0)
} else {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0)
}
}
......@@ -1351,13 +1360,13 @@ export default class CorporateAnnualTargetMR extends Component {
// }
if (tableMeta.rowData[0] == 4) {
let totalScore = 0
dataTable2.map((item,index) => {
if(item[0] !== 4 && item[0] !== 1) {
dataTable2.map((item, index) => {
if (item[0] !== 4 && item[0] !== 1) {
totalScore += Number(item[15])
}
})
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(2)
if (tableMeta.rowIndex == dataTable2.length -1) {
if (tableMeta.rowIndex == dataTable2.length - 1) {
someXXX = Number(totalScore).toFixed(2)
console.log(someXXX)
}
......@@ -1789,9 +1798,9 @@ export default class CorporateAnnualTargetMR extends Component {
customBodyRender: (value, tableMeta) => {
return (
<div style={{ width: 75 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2?
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 ?
null :
tableMeta.rowData[0] === 4?
tableMeta.rowData[0] === 4 ?
handleTotal(tableMeta)
:
this.state.get_for == 'view' ?
......
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