Commit b83e2c26 authored by Deni Rinaldi's avatar Deni Rinaldi

cat issue refresh

parent c1b792c8
...@@ -73,7 +73,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -73,7 +73,7 @@ export default class CorporateAnnualTargetMR extends Component {
totalScore: 0, totalScore: 0,
perfomanceScore: '', perfomanceScore: '',
buttonError: true, buttonError: true,
viewOnly : true viewOnly: true
} }
this.fileHandler = this.fileHandler.bind(this); this.fileHandler = this.fileHandler.bind(this);
} }
...@@ -88,7 +88,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -88,7 +88,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
handleGetFor(type) { handleGetFor(type) {
this.setState({get_for: type}, () => { this.setState({ get_for: type }, () => {
this.getLatestUpdate() this.getLatestUpdate()
this.getKPIType() this.getKPIType()
this.getMaxAch() this.getMaxAch()
...@@ -121,16 +121,16 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -121,16 +121,16 @@ export default class CorporateAnnualTargetMR extends Component {
checkStatus = false checkStatus = false
} }
this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus}) this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus })
} }
getParameterGroup() { getParameterGroup() {
api.create().getParameterByGroupName({ api.create().getParameterByGroupName({
"group_name" : 'ACHIEVEMENT_KPI' "group_name": 'ACHIEVEMENT_KPI'
}).then((response) => { }).then((response) => {
// console.log(response.data.data) // console.log(response.data.data)
if (response.data) { if (response.data) {
this.setState({parameterScore: response.data.data}) this.setState({ parameterScore: response.data.data })
} }
}) })
} }
...@@ -192,7 +192,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -192,7 +192,7 @@ export default class CorporateAnnualTargetMR extends Component {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (indexIDzz === -1) { if (indexIDzz === -1) {
let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE' let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE'
let weight = String(item.corporate_annual_target.weight).substr(0,String(item.corporate_annual_target.weight).length-1) let weight = String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1)
// console.log(weight) // console.log(weight)
dataTable.push([ dataTable.push([
item.type_report_id, item.type_report_id,
...@@ -201,7 +201,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -201,7 +201,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.corporate_annual_target.weight == ""? Number(0).toFixed(1) : Number(weight).toFixed(1), item.corporate_annual_target.weight == "" ? Number(0).toFixed(1) : Number(weight).toFixed(1),
parentTrue ? item.corporate_annual_target.uom : item.uom, parentTrue ? item.corporate_annual_target.uom : item.uom,
parentTrue ? item.corporate_annual_target.jenis_kpi == "" ? null : item.corporate_annual_target.jenis_kpi : item.jenis_kpi == "" ? null : item.kpi_type, parentTrue ? item.corporate_annual_target.jenis_kpi == "" ? null : item.corporate_annual_target.jenis_kpi : item.jenis_kpi == "" ? null : item.kpi_type,
// parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type }, // parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
...@@ -215,7 +215,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -215,7 +215,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score, item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight, item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes, item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes,
item.corporate_annual_target.actual_formula === null? [] : item.corporate_annual_target.actual_formula, item.corporate_annual_target.actual_formula === null ? [] : item.corporate_annual_target.actual_formula,
item.order item.order
]) ])
} }
...@@ -235,7 +235,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -235,7 +235,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.formula, item.formula,
item.level, item.level,
item.description, item.description,
item.weight == ''? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1), item.weight == '' ? Number(0).toFixed(1) : Number(Number(item.weight) * 100).toFixed(1),
item.uom, item.uom,
item.kpi_type == "" ? null : item.kpi_type, item.kpi_type == "" ? null : item.kpi_type,
// item.kpi_type == "" ? null : { value: item.kpi_type }, // item.kpi_type == "" ? null : { value: item.kpi_type },
...@@ -249,7 +249,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -249,7 +249,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score, item.corporate_annual_target.score === null ? "0" : item.corporate_annual_target.score,
item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight, item.corporate_annual_target.score_x_weight === null ? "0" : item.corporate_annual_target.score_x_weight,
item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes, item.corporate_annual_target.notes === null ? "" : item.corporate_annual_target.notes,
item.corporate_annual_target.actual_formula === null? [] : item.corporate_annual_target.actual_formula, item.corporate_annual_target.actual_formula === null ? [] : item.corporate_annual_target.actual_formula,
item.order item.order
]) ])
if (item.children !== null) { if (item.children !== null) {
...@@ -262,7 +262,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -262,7 +262,7 @@ export default class CorporateAnnualTargetMR extends Component {
}) })
// console.log(dataTable); // console.log(dataTable);
this.setState({ dataTable, loading: false, saveDraft: true }, () => { this.setState({ dataTable, loading: false, saveDraft: true }, () => {
this.handleCalculate() this.handleCalculate(dataTable)
}) })
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
...@@ -355,7 +355,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -355,7 +355,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
checkUpload() { checkUpload() {
this.setState({loading: true}) this.setState({ loading: true })
api.create().checkUploadMonthlyReportCAT(this.state.payload).then(response => { api.create().checkUploadMonthlyReportCAT(this.state.payload).then(response => {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
console.log(this.state.payload) console.log(this.state.payload)
...@@ -382,7 +382,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -382,7 +382,7 @@ export default class CorporateAnnualTargetMR extends Component {
item.score, item.score,
item.score_x_weight, item.score_x_weight,
item.notes, item.notes,
item.actual_formula === null? [] : item.actual_formula, item.actual_formula === null ? [] : item.actual_formula,
item.order, item.order,
item.error item.error
] ]
...@@ -557,7 +557,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -557,7 +557,7 @@ export default class CorporateAnnualTargetMR extends Component {
"uom": i[7], "uom": i[7],
"jenis_kpi": i[8] == null ? "" : i[8], "jenis_kpi": i[8] == null ? "" : i[8],
"max_ach": i[9] == null ? "" : i[9], "max_ach": i[9] == null ? "" : i[9],
"formula_ytd":i[10] == null ? "" : i[10], "formula_ytd": i[10] == null ? "" : i[10],
"actual_monthly": i[11] == null || i[11] == "" ? 0.0 : i[11], "actual_monthly": i[11] == null || i[11] == "" ? 0.0 : i[11],
"target_monthly": i[12] == null || i[12] == "" ? 0.0 : i[12], "target_monthly": i[12] == null || i[12] == "" ? 0.0 : i[12],
"achivement_monthly": i[13], "achivement_monthly": i[13],
...@@ -603,51 +603,54 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -603,51 +603,54 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ alert: false }) this.setState({ alert: false })
} }
handleCalculate(){ handleCalculate(datatable) {
this.setState({ loading: false }, () => {
let total = 0 let total = 0
let perfomanceScore = '' let perfomanceScore = ''
let dataTable2 = this.state.dataTable console.log(datatable)
// console.log(dataTable2) datatable.map((item, index) => {
dataTable2.map((item,index) => { let value = String(item[15]) == 'NaN' || String(item[15]) == '' ? 0 : Number(item[15])
let value = String(item[15]) == 'NaN' || String(item[15]) == ''? 0 : Number(item[15])
total += value total += value
}) })
console.log(total);
total = Number(total).toFixed(2) total = Number(total).toFixed(2)
if ( total >= 1.00 && total <= 2.00) { if (total >= 1.00 && total <= 2.00) {
perfomanceScore = 'K' perfomanceScore = 'K'
} else if ( total >= 2.01 && total <= 2.75) { } else if (total >= 2.01 && total <= 2.75) {
perfomanceScore = 'C' perfomanceScore = 'C'
} else if ( total >= 2.76 && total <= 3.00) { } else if (total >= 2.76 && total <= 3.00) {
perfomanceScore = 'B-' perfomanceScore = 'B-'
} else if ( total >= 3.01 && total <= 3.75) { } else if (total >= 3.01 && total <= 3.75) {
perfomanceScore = 'B' perfomanceScore = 'B'
} else if ( total >= 3.76 && total <= 4.00) { } else if (total >= 3.76 && total <= 4.00) {
perfomanceScore = 'B+' perfomanceScore = 'B+'
} else if ( total >= 4.01 && total <= 4.75) { } else if (total >= 4.01 && total <= 4.75) {
perfomanceScore = 'BS' perfomanceScore = 'BS'
} else if ( total >= 4.76 && total <= 5.00) { } else if (total >= 4.76 && total <= 5.00) {
perfomanceScore = 'IST' perfomanceScore = 'IST'
} }
this.setState({totalScore: total, perfomanceScore, loading: false}) this.setState({ totalScore: total, perfomanceScore })
})
} }
handleBackgroundPerf(total) { handleBackgroundPerf(total) {
console.log(total) console.log(total)
let color = 'white' let color = 'white'
if ( total >= 1.00 && total <= 2.00) { if (total >= 1.00 && total <= 2.00) {
color = 'red' color = 'red'
} else if ( total >= 2.01 && total <= 2.75) { } else if (total >= 2.01 && total <= 2.75) {
color = 'yellow' color = 'yellow'
} else if ( total >= 2.76 && total <= 3.00) { } else if (total >= 2.76 && total <= 3.00) {
color = 'lightgreen' color = 'lightgreen'
} else if ( total >= 3.01 && total <= 3.75) { } else if (total >= 3.01 && total <= 3.75) {
color = 'yellowgreen' color = 'yellowgreen'
} else if ( total >= 3.76 && total <= 4.00) { } else if (total >= 3.76 && total <= 4.00) {
color = 'forestgreen' color = 'forestgreen'
} else if ( total >= 4.01 && total <= 4.75) { } else if (total >= 4.01 && total <= 4.75) {
color = 'deepskyblue' color = 'deepskyblue'
} else if ( total >= 4.76 && total <= 5.00) { } else if (total >= 4.76 && total <= 5.00) {
color = 'dodgerblue' color = 'dodgerblue'
} }
return color return color
...@@ -967,7 +970,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -967,7 +970,7 @@ export default class CorporateAnnualTargetMR extends Component {
newData.push([ newData.push([
null, null,
"", "",
item[2] == null || item[2] == ""? item[1] : item[2], item[2] == null || item[2] == "" ? item[1] : item[2],
item[3], item[3],
item[4], item[4],
"", "",
...@@ -1023,36 +1026,36 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1023,36 +1026,36 @@ export default class CorporateAnnualTargetMR extends Component {
const handleAchiement = (tableMeta) => { const handleAchiement = (tableMeta) => {
let total = 0 let total = 0
if (tableMeta.rowData[8] == 'HIB') { if (tableMeta.rowData[8] == 'HIB') {
let actual = tableMeta.rowData[11] == ""? 0 : Number(tableMeta.rowData[11]) let actual = tableMeta.rowData[11] == "" ? 0 : Number(tableMeta.rowData[11])
let target = tableMeta.rowData[12] == ""? 0 : Number(tableMeta.rowData[12]) let target = tableMeta.rowData[12] == "" ? 0 : Number(tableMeta.rowData[12])
total = 2 - (actual / target) total = 2 - (actual / target)
} else { } else {
let actual = tableMeta.rowData[11] == ""? 0 : Number(tableMeta.rowData[11]) let actual = tableMeta.rowData[11] == "" ? 0 : Number(tableMeta.rowData[11])
let target = tableMeta.rowData[12] == ""? 0 : Number(tableMeta.rowData[12]) let target = tableMeta.rowData[12] == "" ? 0 : Number(tableMeta.rowData[12])
total = actual/target total = actual / target
} }
total = String(total) == 'NaN' || String(total) == 'Infinity' || String(total) == '-Infinity' ? 0 : total total = String(total) == 'NaN' || String(total) == 'Infinity' || String(total) == '-Infinity' ? 0 : total
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) * 100 dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) * 100
return Number(total)*100 return Number(total) * 100
} }
const handleScore = (tableMeta) => { const handleScore = (tableMeta) => {
let listParameter = this.state.parameterScore let listParameter = this.state.parameterScore
let parameterKpi = tableMeta.rowData[8] let parameterKpi = tableMeta.rowData[8]
let parameterAch = String(tableMeta.rowData[9]).includes('%')? `MAX${String(tableMeta.rowData[9]).substr(0,String(tableMeta.rowData[9]).length - 1)}` : String(tableMeta.rowData[9]) let parameterAch = String(tableMeta.rowData[9]).includes('%') ? `MAX${String(tableMeta.rowData[9]).substr(0, String(tableMeta.rowData[9]).length - 1)}` : String(tableMeta.rowData[9])
let parameterMix = `${parameterKpi}_${parameterAch}` let parameterMix = `${parameterKpi}_${parameterAch}`
let listParameterFilter = listParameter.filter((val) => val.setting_type == String(parameterMix).toLocaleUpperCase()) 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 listParameterFilterCompany = listParameterFilter.filter((val) => val.company_id == this.props.company.company_id)
let totalScore = 0 let totalScore = 0
let achx100 = tableMeta.rowData[9] == '100%'? Number(tableMeta.rowData[13])/100 > 1? 1 : Number(tableMeta.rowData[13])/100 : Number(tableMeta.rowData[13])/100 let achx100 = tableMeta.rowData[9] == '100%' ? Number(tableMeta.rowData[13]) / 100 > 1 ? 1 : Number(tableMeta.rowData[13]) / 100 : Number(tableMeta.rowData[13]) / 100
if (listParameterFilterCompany.length == 0) { if (listParameterFilterCompany.length == 0) {
listParameterFilter.map((item,index) => { listParameterFilter.map((item, index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) { if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
totalScore = Number(item.value) totalScore = Number(item.value)
} }
}) })
} else { } else {
listParameterFilterCompany.map((item,index) => { listParameterFilterCompany.map((item, index) => {
if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) { if (Number(achx100) >= Number(item.min_value) && Number(achx100) <= Number(item.max_value)) {
totalScore = Number(item.value) totalScore = Number(item.value)
} }
...@@ -1068,7 +1071,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1068,7 +1071,7 @@ export default class CorporateAnnualTargetMR extends Component {
// if (tableMeta.rowData[5] == 'Trading profit (NPBT buah luar & plasma)') { // if (tableMeta.rowData[5] == 'Trading profit (NPBT buah luar & plasma)') {
// console.log(dataTable2[tableMeta.rowIndex]) // console.log(dataTable2[tableMeta.rowIndex])
// } // }
let handlePercent = String(dataTable2[tableMeta.rowIndex][6]).substr(0,String(dataTable2[tableMeta.rowIndex][6]).length-1) let handlePercent = String(dataTable2[tableMeta.rowIndex][6]).substr(0, String(dataTable2[tableMeta.rowIndex][6]).length - 1)
if (dataTable2[tableMeta.rowIndex][12] == '' || String(dataTable2[tableMeta.rowIndex][12]) == '0' || String(dataTable2[tableMeta.rowIndex][12]) == '0.0') { if (dataTable2[tableMeta.rowIndex][12] == '' || String(dataTable2[tableMeta.rowIndex][12]) == '0' || String(dataTable2[tableMeta.rowIndex][12]) == '0.0') {
total = 0 total = 0
} else { } else {
...@@ -1076,27 +1079,27 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1076,27 +1079,27 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(total) // console.log(total)
} }
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(2)
if (tableMeta.rowIndex == dataTable2.length -1) { if (tableMeta.rowIndex == dataTable2.length - 1) {
let totals = 0 let totals = 0
let perfomanceScoreX = '' let perfomanceScoreX = ''
dataTable2.map((item,index) => { dataTable2.map((item, index) => {
let value = String(item[15]) == 'NaN' || String(item[15]) == ''? 0 : Number(item[15]) let value = String(item[15]) == 'NaN' || String(item[15]) == '' ? 0 : Number(item[15])
totals += value totals += value
}) })
totals = Number(totals).toFixed(2) totals = Number(totals).toFixed(2)
if ( totals >= 1.00 && totals <= 2.00) { if (totals >= 1.00 && totals <= 2.00) {
perfomanceScoreX = 'K' perfomanceScoreX = 'K'
} else if ( totals >= 2.01 && totals <= 2.75) { } else if (totals >= 2.01 && totals <= 2.75) {
perfomanceScoreX = 'C' perfomanceScoreX = 'C'
} else if ( totals >= 2.76 && totals <= 3.00) { } else if (totals >= 2.76 && totals <= 3.00) {
perfomanceScoreX = 'B-' perfomanceScoreX = 'B-'
} else if ( totals >= 3.01 && totals <= 3.75) { } else if (totals >= 3.01 && totals <= 3.75) {
perfomanceScoreX = 'B' perfomanceScoreX = 'B'
} else if ( totals >= 3.76 && totals <= 4.00) { } else if (totals >= 3.76 && totals <= 4.00) {
perfomanceScoreX = 'B+' perfomanceScoreX = 'B+'
} else if ( totals >= 4.01 && totals <= 4.75) { } else if (totals >= 4.01 && totals <= 4.75) {
perfomanceScoreX = 'BS' perfomanceScoreX = 'BS'
} else if ( totals >= 4.76 && totals <= 5.00) { } else if (totals >= 4.76 && totals <= 5.00) {
perfomanceScoreX = 'IST' perfomanceScoreX = 'IST'
} }
// totalScoreXXX = totals // totalScoreXXX = totals
...@@ -1152,7 +1155,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1152,7 +1155,7 @@ export default class CorporateAnnualTargetMR extends Component {
setCellProps: () => ({ style }), setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => { customBodyRender: (val, tableMeta) => {
return ( return (
handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision')? handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && (tableMeta.rowData[1] == "" || String(this.props.status).toLocaleLowerCase() == 'draft' || String(this.props.status).toLocaleLowerCase() == 'submitted' || String(this.props.status).toLocaleLowerCase() == 'revision') ?
<div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <div style={{ textAlign: 'left', paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
{!this.state.loading && <FormControlLabel {!this.state.loading && <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1226,7 +1229,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1226,7 +1229,7 @@ export default class CorporateAnnualTargetMR extends Component {
{tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
<FormControlLabel <FormControlLabel
style={{ margin: 0}} style={{ margin: 0 }}
value={value} value={value}
control={ control={
<NumberFormat <NumberFormat
...@@ -1336,7 +1339,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1336,7 +1339,7 @@ export default class CorporateAnnualTargetMR 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
: :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -1355,12 +1358,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1355,12 +1358,12 @@ export default class CorporateAnnualTargetMR extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: this.state.get_for == 'view'? "black" : handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)? "#5198ea" : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view' ? "black" : handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) ? "#5198ea" : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={ tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)).toFixed(1) : Number(value).toFixed(1)} value={tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ? Number(handleValueFormula(value, tableMeta, tableMeta.columnIndex)).toFixed(1) : 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)}
disabled={this.state.get_for == 'view'? true : !handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)} disabled={this.state.get_for == 'view' ? true : !handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta)}
decimalScale={1} decimalScale={1}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
...@@ -1422,7 +1425,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1422,7 +1425,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ width: 75, textAlign: 'right' }}> <div style={{ width: 75, textAlign: 'right' }}>
{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 :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -1469,7 +1472,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1469,7 +1472,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ width: 70, textAlign: 'right' }}> <div style={{ width: 70, textAlign: 'right' }}>
{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 :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -1519,7 +1522,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1519,7 +1522,7 @@ export default class CorporateAnnualTargetMR extends Component {
<div style={{ width: 75 }}> <div style={{ width: 75 }}>
{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 :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
...@@ -1559,7 +1562,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1559,7 +1562,7 @@ export default class CorporateAnnualTargetMR 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
: :
this.state.get_for == 'view'? this.state.get_for == 'view' ?
value value
: :
<FormControlLabel <FormControlLabel
...@@ -1568,7 +1571,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1568,7 +1571,7 @@ export default class CorporateAnnualTargetMR extends Component {
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Input <Input
disableUnderline={true} disableUnderline={true}
style={{ color: this.state.get_for == 'view'? "black" : "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 150, backgroundColor: 'transparent' }} style={{ color: this.state.get_for == 'view' ? "black" : "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 150, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
multiline={true} multiline={true}
...@@ -1643,7 +1646,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1643,7 +1646,7 @@ export default class CorporateAnnualTargetMR extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => this.downloadTemplate() } onClick={() => this.downloadTemplate()}
> >
<img src={Images.template} /> <img src={Images.template} />
</button> </button>
...@@ -1697,28 +1700,28 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1697,28 +1700,28 @@ export default class CorporateAnnualTargetMR extends Component {
</MuiThemeProvider> </MuiThemeProvider>
)} )}
</div> </div>
<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>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Last Updated by : {this.state.updateBy}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Last Updated by : {this.state.updateBy}</Typography>
</div> </div>
<div style={{display: 'flex', flexDirection: 'row'}}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{padding: 5}}> <div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE</Typography>
</div> </div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}> <div style={{ border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScore}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScore}</Typography>
</div> </div>
</div> </div>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15}}> <div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notes}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notes}</Typography>
</div> </div>
<div style={{display: 'flex', flexDirection: 'row'}}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{padding: 5}}> <div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div> </div>
<div style={{borderStyle: 'solid', backgroundColor: this.handleBackgroundPerf(this.state.totalScore), borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}> <div style={{ borderStyle: 'solid', backgroundColor: this.handleBackgroundPerf(this.state.totalScore), borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography> <Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography>
</div> </div>
</div> </div>
...@@ -1760,7 +1763,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1760,7 +1763,7 @@ export default class CorporateAnnualTargetMR extends Component {
marginRight: 20 marginRight: 20
}} }}
onClick={() => { onClick={() => {
this.setState({loading: true}, () => { this.setState({ loading: true }, () => {
this.handleGetFor('edit') this.handleGetFor('edit')
}) })
}} }}
...@@ -1783,7 +1786,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1783,7 +1786,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => { this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => {
setTimeout(() => { setTimeout(() => {
// this.handleValidate() // this.handleValidate()
this.handleCalculate() this.handleCalculate(dataTable2)
}, 100); }, 100);
}) })
}} }}
...@@ -1863,34 +1866,34 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1863,34 +1866,34 @@ export default class CorporateAnnualTargetMR extends Component {
</MuiThemeProvider> </MuiThemeProvider>
)} )}
</div> </div>
<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>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Last Updated by : {this.state.updateBy}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Last Updated by : {this.state.updateBy}</Typography>
</div> </div>
<div style={{display: 'flex', flexDirection: 'row'}}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{padding: 5}}> <div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>TOTAL SCORE</Typography>
</div> </div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}> <div style={{ border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScore}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.state.totalScore}</Typography>
</div> </div>
</div> </div>
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15}}> <div style={{ display: 'flex', justifyContent: 'space-between', maxWidth: '100%', paddingLeft: 15, paddingRight: 15 }}>
<div> <div>
<Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notes}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notes}</Typography>
</div> </div>
<div style={{display: 'flex', flexDirection: 'row'}}> <div style={{ display: 'flex', flexDirection: 'row' }}>
<div style={{padding: 5}}> <div style={{ padding: 5 }}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>PERFOMANCE</Typography>
</div> </div>
<div style={{borderStyle: 'solid', backgroundColor: this.handleBackgroundPerf(this.state.totalScore), borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}> <div style={{ borderStyle: 'solid', backgroundColor: this.handleBackgroundPerf(this.state.totalScore), borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end' }}>
<Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography> <Typography style={{ fontSize: '11px', color: 'black', fontWeight: 'bold' }}>{this.state.perfomanceScore}</Typography>
</div> </div>
</div> </div>
</div> </div>
<div className="grid grid-2x" style={{ marginTop: 10, padding: 20, paddingLeft: 0, paddingRight: 0 }}> <div className="grid grid-2x" style={{ marginTop: 10, padding: 20, paddingLeft: 0, paddingRight: 0 }}>
<div className="col-1" style={{paddingLeft: 0}}> <div className="col-1" style={{ paddingLeft: 0 }}>
<button <button
type="button" type="button"
onClick={() => this.setState({ loading: true, visibleCATMR: true }, () => { onClick={() => this.setState({ loading: true, visibleCATMR: true }, () => {
...@@ -1925,7 +1928,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1925,7 +1928,7 @@ export default class CorporateAnnualTargetMR extends Component {
this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => { this.setState({ loading: true, dataTable: dataTable2, saveDraft: false, buttonError: false }, () => {
setTimeout(() => { setTimeout(() => {
// this.handleValidate() // this.handleValidate()
this.handleCalculate() this.handleCalculate(dataTable2)
}, 100); }, 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