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) {
......@@ -721,7 +721,7 @@ export default class CorporateAnnualTargetMR extends Component {
} else {
totalAch = 1 - (actual / target)
}
}
}
}
totalAch = String(totalAch) == 'NaN' || String(totalAch) == 'Infinity' || String(totalAch) == '-Infinity' ? 0 : totalAch
totalAch = Number(totalAch) * 100
......@@ -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 = ''
......@@ -776,25 +784,25 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(totalSW)
// console.log(total)
return [
item[0],
item[1],
item[2],
item[3],
item[4],
item[5],
item[6],
item[7],
item[8],
item[9],
item[10],
item[11],
item[12],
totalAch,
totalScorez,
totalSW,
item[16],
item[17],
item[18],
item[0],
item[1],
item[2],
item[3],
item[4],
item[5],
item[6],
item[7],
item[8],
item[9],
item[10],
item[11],
item[12],
totalAch,
totalScorez,
totalSW,
item[16],
item[17],
item[18],
// item[19],
// ]
]
......@@ -802,7 +810,7 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(totalWeight)
// console.log(total)
// console.log(datatable3);
let totalWeightz = Number(totalWeight) / 100
let totalWeightz = Number(totalWeight) / 100
let totalz = Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2)
console.log(totalz)
let lastTotal = R.equals(totalz, NaN) ? 0.0 : totalz
......@@ -812,7 +820,7 @@ export default class CorporateAnnualTargetMR extends Component {
} else {
lastTotal = totalz
}
console.log(Number(Number(total).toFixed(2) / Number(totalWeightz)).toFixed(2))
let listPerfomanceDefault = this.state.parameterPerfom.filter((val) => String(val.company_name).toLocaleLowerCase() == "default")
......@@ -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) {
......@@ -1304,7 +1313,7 @@ export default class CorporateAnnualTargetMR extends Component {
} else {
total = 1 - (actual / target)
}
}
}
}
total = String(total) == 'NaN' || String(total) == 'Infinity' || String(total) == '-Infinity' ? 0 : total
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) * 100
......@@ -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)
}
......@@ -1379,7 +1388,7 @@ export default class CorporateAnnualTargetMR extends Component {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2)
return total
}
}
let columns = [
......@@ -1789,32 +1798,32 @@ 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?
handleTotal(tableMeta)
:
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
// 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={2}
/>
tableMeta.rowData[0] === 4 ?
handleTotal(tableMeta)
:
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta).toFixed(2)}
decimalScale={2}
disabled={true}
/>
this.state.get_for == 'view' ?
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
// 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={2}
/>
:
<NumberFormat
thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={handleTotal(tableMeta).toFixed(2)}
decimalScale={2}
disabled={true}
/>
}
</div>
)
......@@ -1998,7 +2007,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ borderStyle: 'solid', backgroundColor: this.state.perfomanceScoreColor, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
{!this.state.loading && (
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography>
)}
)}
</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