Commit b83e2c26 authored by Deni Rinaldi's avatar Deni Rinaldi

cat issue refresh

parent c1b792c8
...@@ -54,7 +54,7 @@ const theme = createMuiTheme({ ...@@ -54,7 +54,7 @@ const theme = createMuiTheme({
export default class CorporateAnnualTargetMR extends Component { export default class CorporateAnnualTargetMR extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
dataTables: [], dataTables: [],
loading: true, loading: true,
...@@ -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()
...@@ -105,32 +105,32 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -105,32 +105,32 @@ export default class CorporateAnnualTargetMR extends Component {
} else { } else {
checkApprover = false checkApprover = false
} }
if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') { if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
checkLastStatus = true checkLastStatus = true
} else { } else {
checkLastStatus = false checkLastStatus = false
} }
// else if (this.props.prevRevision) { // else if (this.props.prevRevision) {
// viewOnly = false // viewOnly = false
// } // }
if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') { if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
checkStatus = true checkStatus = true
} else { } else {
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 })
} }
}) })
} }
...@@ -180,7 +180,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -180,7 +180,7 @@ export default class CorporateAnnualTargetMR extends Component {
"months": this.props.month.month_id, "months": this.props.month.month_id,
"get_for": this.state.get_for "get_for": this.state.get_for
} }
api.create().getHierarkiMontlyReportCAT(payload).then(response => { api.create().getHierarkiMontlyReportCAT(payload).then(response => {
let dataTable = [] let dataTable = []
console.log(payload); console.log(payload);
...@@ -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 },
...@@ -210,12 +210,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -210,12 +210,12 @@ export default class CorporateAnnualTargetMR extends Component {
item.corporate_annual_target.formula_ytd == "" ? null : item.corporate_annual_target.formula_ytd, item.corporate_annual_target.formula_ytd == "" ? null : item.corporate_annual_target.formula_ytd,
// parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd }, // parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1), item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly, item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly, item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
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 },
...@@ -244,12 +244,12 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -244,12 +244,12 @@ export default class CorporateAnnualTargetMR extends Component {
item.corporate_annual_target.formula == "" ? null : item.corporate_annual_target.formula_ytd, item.corporate_annual_target.formula == "" ? null : item.corporate_annual_target.formula_ytd,
// item.formula == "" ? null : { value: item.formula_ytd }, // item.formula == "" ? null : { value: item.formula_ytd },
item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1), item.corporate_annual_target.actual_monthly == "" ? item.corporate_annual_target.actual_monthly : String(item.corporate_annual_target.actual_monthly).indexOf(".") == -1 ? Number(item.corporate_annual_target.actual_monthly) : Number(item.corporate_annual_target.actual_monthly).toFixed(1),
item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly, item.corporate_annual_target.target_monthly === null ? "0" : item.corporate_annual_target.target_monthly,
item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly, item.corporate_annual_target.achivement_monthly === null ? "0" : item.corporate_annual_target.achivement_monthly,
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 }, () => {
...@@ -295,7 +295,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -295,7 +295,7 @@ export default class CorporateAnnualTargetMR extends Component {
a.href = url; a.href = url;
a.download = 'Template Monthly Report Corporate Annual Target.xlsx' a.download = 'Template Monthly Report Corporate Annual Target.xlsx'
a.click(); a.click();
} }
} }
async downloadAllData() { async downloadAllData() {
...@@ -353,9 +353,9 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -353,9 +353,9 @@ 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],
...@@ -565,7 +565,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -565,7 +565,7 @@ export default class CorporateAnnualTargetMR extends Component {
"score_x_weight": i[15], "score_x_weight": i[15],
"notes": i[16] "notes": i[16]
}) })
}) })
let payload = { let payload = {
"monthly_report_id": this.props.monthlyReportId, "monthly_report_id": this.props.monthlyReportId,
"company_id": this.props.company.company_id, "company_id": this.props.company.company_id,
...@@ -579,7 +579,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -579,7 +579,7 @@ export default class CorporateAnnualTargetMR extends Component {
} }
// console.log(JSON.stringify(payload)); // console.log(JSON.stringify(payload));
console.log(payload); console.log(payload);
api.create('UPLOAD').createMonthlyReportCAT(payload).then(response => { api.create('UPLOAD').createMonthlyReportCAT(payload).then(response => {
console.log(response); console.log(response);
if (response.data) { if (response.data) {
...@@ -595,59 +595,62 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -595,59 +595,62 @@ export default class CorporateAnnualTargetMR extends Component {
// this.getSubmission() // this.getSubmission()
document.body.style.overflow = 'unset'; document.body.style.overflow = 'unset';
}) })
} }
}) })
} }
closeAlert() { closeAlert() {
this.setState({ alert: false }) this.setState({ alert: false })
} }
handleCalculate(){ handleCalculate(datatable) {
let total = 0 this.setState({ loading: false }, () => {
let perfomanceScore = '' let total = 0
let dataTable2 = this.state.dataTable let perfomanceScore = ''
// console.log(dataTable2) console.log(datatable)
dataTable2.map((item,index) => { datatable.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)
if (total >= 1.00 && total <= 2.00) {
perfomanceScore = 'K'
} else if (total >= 2.01 && total <= 2.75) {
perfomanceScore = 'C'
} else if (total >= 2.76 && total <= 3.00) {
perfomanceScore = 'B-'
} else if (total >= 3.01 && total <= 3.75) {
perfomanceScore = 'B'
} else if (total >= 3.76 && total <= 4.00) {
perfomanceScore = 'B+'
} else if (total >= 4.01 && total <= 4.75) {
perfomanceScore = 'BS'
} else if (total >= 4.76 && total <= 5.00) {
perfomanceScore = 'IST'
}
this.setState({ totalScore: total, perfomanceScore })
}) })
total = Number(total).toFixed(2)
if ( total >= 1.00 && total <= 2.00) {
perfomanceScore = 'K'
} else if ( total >= 2.01 && total <= 2.75) {
perfomanceScore = 'C'
} else if ( total >= 2.76 && total <= 3.00) {
perfomanceScore = 'B-'
} else if ( total >= 3.01 && total <= 3.75) {
perfomanceScore = 'B'
} else if ( total >= 3.76 && total <= 4.00) {
perfomanceScore = 'B+'
} else if ( total >= 4.01 && total <= 4.75) {
perfomanceScore = 'BS'
} else if ( total >= 4.76 && total <= 5.00) {
perfomanceScore = 'IST'
}
this.setState({totalScore: total, perfomanceScore, loading: false})
} }
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
...@@ -691,37 +694,37 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -691,37 +694,37 @@ export default class CorporateAnnualTargetMR extends Component {
anjay.push(item) anjay.push(item)
} else if (item == '' || item == '@') { } else if (item == '' || item == '@') {
// } else if (item == "CurrMonth") { // } else if (item == "CurrMonth") {
// anjay.push(String(column)) // anjay.push(String(column))
// } else if (item.includes('[CM]SUM')) { // } else if (item.includes('[CM]SUM')) {
// let columnStart = 13 // let columnStart = 13
// let indexX = String(item).indexOf('[') // let indexX = String(item).indexOf('[')
// let formulaAwal = String(item).substr(0, indexX) // let formulaAwal = String(item).substr(0, indexX)
// let columnEnd = 24 // let columnEnd = 24
// let month = column - 1 // let month = column - 1
// let total = 0 // let total = 0
// // // // console.log(formulaAwal) // // // // console.log(formulaAwal)
// if (forecast == undefined) { // if (forecast == undefined) {
// dataTable2[tableMeta.rowIndex].map((itemz, indexz) => { // dataTable2[tableMeta.rowIndex].map((itemz, indexz) => {
// if (indexz >= columnStart && indexz <= columnStart + month) { // if (indexz >= columnStart && indexz <= columnStart + month) {
// let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${formulaAwal}`) && val.periode == Number(this.props.periode)) // let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${formulaAwal}`) && val.periode == Number(this.props.periode))
// if (indexID !== -1) { // if (indexID !== -1) {
// let valuezz = Number(value.formula[indexID].value) // let valuezz = Number(value.formula[indexID].value)
// total += valuezz // total += valuezz
// } // }
// } // }
// }) // })
// } else { // } else {
// } // }
// anjay.push(String(total)) // anjay.push(String(total))
// } else if (item.includes('[CM]AVG')) { // } else if (item.includes('[CM]AVG')) {
// if (forecast == undefined) { // if (forecast == undefined) {
// anjay.push('/') // anjay.push('/')
// anjay.push(column) // anjay.push(column)
// } // }
} }
else if (item.includes('X')) { else if (item.includes('X')) {
let indexX = String(item).indexOf('X') let indexX = String(item).indexOf('X')
if (indexX == 0) { if (indexX == 0) {
...@@ -925,37 +928,37 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -925,37 +928,37 @@ export default class CorporateAnnualTargetMR extends Component {
return false return false
} else { } else {
// if ((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')) { // if ((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')) {
if (idParent !== null) { if (idParent !== null) {
// console.log(tableMeta) // console.log(tableMeta)
let indexsss = dataTable2.findIndex((val) => val[1] == idParent) let indexsss = dataTable2.findIndex((val) => val[1] == idParent)
if (dataTable2[indexsss][5] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][5] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') { if (dataTable2[indexsss][5] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][5] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') {
return true return true
} else {
if (typeReport == 3) {
return true
} else {
return false
}
}
} else { } else {
if (typeReport == null || typeReport == 3) { if (typeReport == 3) {
return true return true
} else if (tableMeta !== undefined && tableMeta.rowData[0] == 1) {
let indexID = dataTable2.findIndex((val) => val[2] == tableMeta.rowData[1])
if (indexID !== -1) {
return false
} else {
return true
}
} else { } else {
return false return false
} }
} }
} else {
if (typeReport == null || typeReport == 3) {
return true
} else if (tableMeta !== undefined && tableMeta.rowData[0] == 1) {
let indexID = dataTable2.findIndex((val) => val[2] == tableMeta.rowData[1])
if (indexID !== -1) {
return false
} else {
return true
}
} else {
return false
}
}
// } else { // } else {
// return false // return false
// } // }
} }
} }
const handleTambah = (data, rowIndex) => { const handleTambah = (data, rowIndex) => {
...@@ -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,42 +1026,42 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1023,42 +1026,42 @@ 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)
} }
}) })
} }
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(totalScore).toFixed(0)
return Number(totalScore).toFixed(0) return Number(totalScore).toFixed(0)
} }
...@@ -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
...@@ -1105,7 +1108,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1105,7 +1108,7 @@ export default class CorporateAnnualTargetMR extends Component {
// console.log(totalScoreXXX) // console.log(totalScoreXXX)
// console.log(perfomanceScore) // console.log(perfomanceScore)
// }, 300); // }, 300);
} }
return total return total
} }
...@@ -1140,7 +1143,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1140,7 +1143,7 @@ export default class CorporateAnnualTargetMR extends Component {
options: { options: {
display: false display: false
} }
}, },
{ {
name: "Key Performance Indicator", name: "Key Performance Indicator",
options: { options: {
...@@ -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
...@@ -1257,7 +1260,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1257,7 +1260,7 @@ export default class CorporateAnnualTargetMR extends Component {
), ),
customBodyRender: (value, tableMeta, updateValue) => { customBodyRender: (value, tableMeta, updateValue) => {
return ( return (
<div style={{ textAlign: 'center' }}> <div style={{ textAlign: 'center' }}>
<div style={{ textAlign: 'center', width: 60 }}> <div style={{ textAlign: 'center', width: 60 }}>
{value} {value}
</div> </div>
...@@ -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' }}
...@@ -1347,30 +1350,30 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1347,30 +1350,30 @@ export default class CorporateAnnualTargetMR extends Component {
disabled={true} disabled={true}
decimalScale={1} decimalScale={1}
/> />
: :
<div style={{ flex: 1, textAlign: 'right' }}> <div style={{ flex: 1, textAlign: 'right' }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
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)
handleChange(event.target.value, tableMeta) handleChange(event.target.value, tableMeta)
// // console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
} }
/> />
</div> </div>
} }
</div> </div>
) )
...@@ -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' }}
...@@ -1434,23 +1437,23 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1434,23 +1437,23 @@ export default class CorporateAnnualTargetMR extends Component {
suffix={"%"} suffix={"%"}
decimalScale={1} decimalScale={1}
/> />
: :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={Number(value).toFixed(1)} value={Number(value).toFixed(1)}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
suffix={"%"} suffix={"%"}
value={handleAchiement(tableMeta).toFixed(1)} value={handleAchiement(tableMeta).toFixed(1)}
decimalScale={1} decimalScale={1}
disabled={true} disabled={true}
/> />
} }
/> />
} }
</div> </div>
) )
...@@ -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' }}
...@@ -1480,27 +1483,27 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1480,27 +1483,27 @@ export default class CorporateAnnualTargetMR extends Component {
disabled={true} disabled={true}
decimalScale={0} decimalScale={0}
/> />
: :
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
value={Number(value).toFixed(0)} value={Number(value).toFixed(0)}
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
value={handleScore(tableMeta)} value={handleScore(tableMeta)}
decimalScale={0} decimalScale={0}
disabled={true} disabled={true}
// onBlur={(event) => { // onBlur={(event) => {
// // updateValue(event.target.value) // // updateValue(event.target.value)
// handleChange(event.target.value, tableMeta) // handleChange(event.target.value, tableMeta)
// // // console.log(dataTable2) // // // console.log(dataTable2)
// }} // }}
/> />
} }
/> />
} }
</div> </div>
) )
...@@ -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' }}
...@@ -1530,7 +1533,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1530,7 +1533,7 @@ export default class CorporateAnnualTargetMR extends Component {
disabled={true} disabled={true}
decimalScale={2} decimalScale={2}
/> />
: :
<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,30 +1562,30 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1559,30 +1562,30 @@ 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
style={{ margin: 0 }} style={{ margin: 0 }}
control={ control={
<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}
defaultValue={value} defaultValue={value}
disabled={this.state.get_for == 'view'} disabled={this.state.get_for == 'view'}
onBlur={(event) => { onBlur={(event) => {
// updateValue(event.target.value) // updateValue(event.target.value)
handleChange(event.target.value, tableMeta, 'text') handleChange(event.target.value, tableMeta, 'text')
// // console.log(dataTable2) // // console.log(dataTable2)
}} }}
/> />
</ThemeProvider> </ThemeProvider>
} }
/> />
} }
</div> </div>
) )
...@@ -1594,7 +1597,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1594,7 +1597,7 @@ export default class CorporateAnnualTargetMR extends Component {
options: { options: {
display: false display: false
} }
}, },
] ]
...@@ -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>
...@@ -1671,10 +1674,10 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1671,10 +1674,10 @@ export default class CorporateAnnualTargetMR extends Component {
borderColor: 'transparent', borderColor: 'transparent',
margin: 5 margin: 5
}} }}
onClick={() => onClick={() =>
this.setState({ loading: true }, () => { this.setState({ loading: true }, () => {
setTimeout(() => { setTimeout(() => {
this.downloadAllData() this.downloadAllData()
}, 100); }, 100);
})} })}
> >
...@@ -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>
...@@ -1746,7 +1749,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1746,7 +1749,7 @@ export default class CorporateAnnualTargetMR extends Component {
</button> </button>
</div> </div>
{this.props.isApprover === true ? {this.props.isApprover === true ?
<div className="col-2"></div> <div className="col-2"></div>
: :
<div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
{this.state.get_for == 'view' && this.state.viewOnly && <button {this.state.get_for == 'view' && this.state.viewOnly && <button
...@@ -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);
}) })
}} }}
...@@ -1838,7 +1841,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1838,7 +1841,7 @@ export default class CorporateAnnualTargetMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div> </div>
</button>} </button>}
</div> </div>
} }
</div> </div>
</Paper> : </Paper> :
...@@ -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);
}) })
}} }}
...@@ -1980,7 +1983,7 @@ export default class CorporateAnnualTargetMR extends Component { ...@@ -1980,7 +1983,7 @@ export default class CorporateAnnualTargetMR extends Component {
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
</div> </div>
</button> </button>
</div> </div>
</div> </div>
</div> </div>
</Paper> </Paper>
......
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