Commit 668933c4 authored by faisalhamdi's avatar faisalhamdi

cat pq!

parent 4af02019
...@@ -40,9 +40,15 @@ export default class TableSubHolding extends Component { ...@@ -40,9 +40,15 @@ export default class TableSubHolding extends Component {
super(props) super(props)
this.state = { this.state = {
performanceScoreColor: '#fff', performanceScoreColor: '#fff',
performanceScoreColorQuarterly: '#fff',
performanceScoreColorFy: '#fff',
parameterScore: [], parameterScore: [],
totalScore: 0, totalScore: 0,
totalScoreQuarterly: 0,
totalScoreFy: 0,
performanceScore: '', performanceScore: '',
performanceScoreQuarterly: '',
performanceScoreFy: '',
parameterPerfom: [], parameterPerfom: [],
} }
} }
...@@ -84,10 +90,19 @@ export default class TableSubHolding extends Component { ...@@ -84,10 +90,19 @@ export default class TableSubHolding extends Component {
let totalWeight = 0 let totalWeight = 0
let total = 0 let total = 0
let score = 0 let score = 0
let totalWeightQuarterly = 0
let totalWeightFy = 0
let totalQuarterly = 0
let totalFy = 0
let scoreQuarterly = 0
let scoreFy = 0
let performanceScore = '' let performanceScore = ''
let performanceScoreQuarterly = ''
let performanceScoreFy = ''
dataTable2.map((item, index) => { dataTable2.map((item, index) => {
// console.log(item[6]) // console.log(item[6])
//total weight //total weight
if (this.props.type === 10) {
if (item[0] !== 1 && item[0] !== 4) { if (item[0] !== 1 && item[0] !== 4) {
if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') { if (item[12] == '' || String(item[12]) == '0' || String(item[12]) == '0.0') {
totalWeight += Number(0) totalWeight += Number(0)
...@@ -98,12 +113,39 @@ export default class TableSubHolding extends Component { ...@@ -98,12 +113,39 @@ export default class TableSubHolding extends Component {
if (item[0] !== 1 && item[0] !== 4) { if (item[0] !== 1 && item[0] !== 4) {
total += Number(item[15]) total += Number(item[15])
} }
} else {
if (item[0] !== 1 && item[0] !== 4) {
// Quarterly
if (item[13] == '' || String(item[13]) == '0' || String(item[13]) == '0.0') {
totalWeightQuarterly += Number(0)
} else {
totalWeightQuarterly += Number(item[6])
}
// FY
if (item[22] == '' || String(item[22]) == '0' || String(item[22]) == '0.0') {
totalWeightFy += Number(0)
} else {
totalWeightFy += Number(item[6])
}
}
if (item[0] !== 1 && item[0] !== 4) {
totalQuarterly += Number(item[18])
totalFy += Number(item[26])
}
}
}) })
totalWeight = Number(totalWeight) / 100 totalWeight = Number(totalWeight) / 100
totalWeightQuarterly = Number(totalWeightQuarterly) / 100
totalWeightFy = Number(totalWeightFy) / 100
// console.log(total); // console.log(total);
// console.log(totalWeight); // console.log(totalWeight);
score = Number(Number(total).toFixed(2) / Number(totalWeight)).toFixed(2) score = Number(Number(total).toFixed(2) / Number(totalWeight)).toFixed(2)
let lastTotal = R.equals(score, NaN) ? 0.0 : score scoreQuarterly = Number(Number(totalQuarterly).toFixed(2) / Number(totalWeightQuarterly)).toFixed(2)
scoreFy = Number(Number(totalFy).toFixed(2) / Number(totalWeightFy)).toFixed(2)
let lastTotal = isNaN(score) ? "0.0" : score
let lastTotalQuarterly = isNaN(scoreQuarterly) ? "0.0" : scoreQuarterly
let lastTotalFy = isNaN(scoreFy) ? "0.0" : scoreFy
let indexPerform = this.state.parameterPerfom.findIndex((val) => val.company_id == this.props.company.company_id) let indexPerform = this.state.parameterPerfom.findIndex((val) => val.company_id == this.props.company.company_id)
let listPerfomanceDefault = [] let listPerfomanceDefault = []
...@@ -113,16 +155,31 @@ export default class TableSubHolding extends Component { ...@@ -113,16 +155,31 @@ export default class TableSubHolding extends Component {
listPerfomanceDefault = this.state.parameterPerfom.filter((val) => val.company_id == this.props.company.company_id) listPerfomanceDefault = this.state.parameterPerfom.filter((val) => val.company_id == this.props.company.company_id)
} }
let performanceScoreColor = '#fff' let performanceScoreColor = '#fff'
let performanceScoreColorQuarterly = '#fff'
let performanceScoreColorFy = '#fff'
if (listPerfomanceDefault.length > 0) { if (listPerfomanceDefault.length > 0) {
listPerfomanceDefault.map((item, index) => { listPerfomanceDefault.map((item, index) => {
// console.log(Number(lastTotal)) // console.log(Number(lastTotal))
// console.log(Number(item.min_value)) // console.log(Number(item.min_value))
// console.log(Number(item.max_value)) // console.log(Number(item.max_value))
if (this.props.type === 10) {
if (Number(lastTotal) >= Number(item.min_value) && Number(lastTotal) <= Number(item.max_value)) { if (Number(lastTotal) >= Number(item.min_value) && Number(lastTotal) <= Number(item.max_value)) {
// console.log('masuk') console.log('masuk appraisal')
performanceScore = item.description performanceScore = item.description
performanceScoreColor = item.value performanceScoreColor = item.value
} }
} else {
if (Number(lastTotalQuarterly) >= Number(item.min_value) && Number(lastTotalQuarterly) <= Number(item.max_value)) {
// console.log('masuk quarterly')
performanceScoreQuarterly = item.description
performanceScoreColorQuarterly = item.value
}
if (Number(lastTotalFy) >= Number(item.min_value) && Number(lastTotalFy) <= Number(item.max_value)) {
// console.log('masuk fy')
performanceScoreFy = item.description
performanceScoreColorFy = item.value
}
}
}) })
} }
// console.log(performanceScoreColor) // console.log(performanceScoreColor)
...@@ -132,7 +189,7 @@ export default class TableSubHolding extends Component { ...@@ -132,7 +189,7 @@ export default class TableSubHolding extends Component {
// console.log(performanceScoreColor) // console.log(performanceScoreColor)
setTimeout(() => { setTimeout(() => {
this.setState({ totalScore: lastTotal, performanceScore, loading: false, performanceScoreColor }, () => { this.setState({ totalScore: lastTotal, totalScoreQuarterly: lastTotalQuarterly, totalScoreFy: lastTotalFy, performanceScore, performanceScoreQuarterly, performanceScoreFy, loading: false, performanceScoreColor, performanceScoreColorQuarterly, performanceScoreColorFy }, () => {
this.setState({ loading: true }) this.setState({ loading: true })
setTimeout(() => { setTimeout(() => {
this.setState({ loading: false }) this.setState({ loading: false })
...@@ -24355,9 +24412,9 @@ export default class TableSubHolding extends Component { ...@@ -24355,9 +24412,9 @@ export default class TableSubHolding extends Component {
}, },
] ]
const totalArray = (item) => { // const totalArray = (item) => {
console.log(item); // console.log(item);
} // }
const columnCatPQ = [ const columnCatPQ = [
{ {
name: "", name: "",
...@@ -24846,7 +24903,7 @@ export default class TableSubHolding extends Component { ...@@ -24846,7 +24903,7 @@ export default class TableSubHolding extends Component {
placeholder="" placeholder=""
suffix={`%`} suffix={`%`}
disabled={true} disabled={true}
value={tableMeta.rowIndex[21]} value={tableMeta.rowData[21]}
/> />
} }
/> />
...@@ -25415,7 +25472,7 @@ export default class TableSubHolding extends Component { ...@@ -25415,7 +25472,7 @@ export default class TableSubHolding extends Component {
/> />
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
{this.props.type === 10 || this.props.type === 11 ? {this.props.type === 10 ?
<div style={{ paddingBottom: 15 }}> <div style={{ paddingBottom: 15 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}> <div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div> <div>
...@@ -25449,7 +25506,50 @@ export default class TableSubHolding extends Component { ...@@ -25449,7 +25506,50 @@ export default class TableSubHolding extends Component {
</div> </div>
</div> </div>
</div> </div>
: null :
this.props.type === 11 ?
<div style={{ paddingBottom: 15 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5 }}>
<div>
<div style={{display: 'flex'}}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE QUARTERLY</Typography>
</div>
<div style={{ border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScoreQuarterly}</Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE FY</Typography>
</div>
<div style={{ border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScoreFy}</Typography>
</div>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15 }}>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5, paddingRight: 66 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div>
<div style={{ borderStyle: 'solid', backgroundColor: this.state.performanceScoreColorQuarterly, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.performanceScoreQuarterly}</Typography>
</div>
</div>
<div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div>
<div style={{ borderStyle: 'solid', backgroundColor: this.state.performanceScoreColorFy, borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.performanceScoreFy}</Typography>
</div>
</div>
</div>
</div>
:
null
} }
</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