Commit dcf536eb authored by Deni Rinaldi's avatar Deni Rinaldi

roic

parent 10bf5f68
...@@ -25,3 +25,4 @@ plugins/locale/*/*.js ...@@ -25,3 +25,4 @@ plugins/locale/*/*.js
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
debug.log
...@@ -154,21 +154,21 @@ export default class CorporateAnnualTarget extends Component { ...@@ -154,21 +154,21 @@ export default class CorporateAnnualTarget extends Component {
parentTrue ? item.cat.max_ach == "" ? null : { value: titleCase(item.cat.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) }, parentTrue ? item.cat.max_ach == "" ? null : { value: titleCase(item.cat.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
parentTrue ? item.cat.formula == "" ? null : { value: item.cat.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd }, parentTrue ? item.cat.formula == "" ? null : { value: item.cat.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1), item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.january).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.february).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.march).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.april).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.may).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.june, formula: item.cat.june_formula } : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.may).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.july, formula: item.cat.july_formula } : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.may).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.august).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.september).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.october).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.november).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE"? { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)), item.description === 'ROIC' ? Number(item.cat.december).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)),
item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1), item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1), item.description === 'ROIC' ? Number(item.cat.total_next_year).toFixed(2) : item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1), item.description === 'ROIC' ? Number(item.cat.total_more_year).toFixed(2) : item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic, item.cat.strategic,
item.cat.pic, item.cat.pic,
item.cat.forecast_formula, item.cat.forecast_formula,
...@@ -198,21 +198,21 @@ export default class CorporateAnnualTarget extends Component { ...@@ -198,21 +198,21 @@ export default class CorporateAnnualTarget extends Component {
item.max_ach == "" ? null : { value: titleCase(item.max_ach) }, item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item.formula == "" ? null : { value: item.formula_ytd }, item.formula == "" ? null : { value: item.formula_ytd },
item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1), item.cat.total_actual_before == "" ? item.cat.total_actual_before : String(item.cat.total_actual_before).indexOf(".") == -1 ? Number(item.cat.total_actual_before) : Number(item.cat.total_actual_before).toFixed(1),
item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1), item.description === 'ROIC' ? Number(item.cat.january).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.january, formula: item.cat.january_formula } : (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)),
item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1), item.description === 'ROIC' ? Number(item.cat.february).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.february, formula: item.cat.february_formula } : (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)),
item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1), item.description === 'ROIC' ? Number(item.cat.march).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.march, formula: item.cat.march_formula } : (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)),
item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1), item.description === 'ROIC' ? Number(item.cat.april).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.april, formula: item.cat.april_formula } : (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)),
item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1), item.description === 'ROIC' ? Number(item.cat.may).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.may, formula: item.cat.may_formula } : (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)),
item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1), item.description === 'ROIC' ? Number(item.cat.may).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.june, formula: item.cat.june_formula } : item.description === 'ROIC' ? Number(item.cat.june).toFixed(1) : (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)),
item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1), item.description === 'ROIC' ? Number(item.cat.may).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.july, formula: item.cat.july_formula } : item.description === 'ROIC' ? Number(item.cat.july).toFixed(1) : (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)),
item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1), item.description === 'ROIC' ? Number(item.cat.august).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.august, formula: item.cat.august_formula } : (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)),
item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1), item.description === 'ROIC' ? Number(item.cat.september).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.september, formula: item.cat.september_formula } : (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)),
item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1), item.description === 'ROIC' ? Number(item.cat.october).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.october, formula: item.cat.october_formula } : (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)),
item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1), item.description === 'ROIC' ? Number(item.cat.november).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.november, formula: item.cat.november_formula } : (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)),
item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1), item.description === 'ROIC' ? Number(item.cat.december).toFixed(2) : item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.cat.december, formula: item.cat.december_formula } : (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)),
item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1), item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1),
item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1), item.description === 'ROIC' ? Number(item.cat.total_next_year).toFixed(2) : item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1),
item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1), item.description === 'ROIC' ? Number(item.cat.total_more_year).toFixed(2) : item.cat.total_more_year == "" ? item.cat.total_more_year : String(item.cat.total_more_year).indexOf(".") == -1 ? Number(item.cat.total_more_year) : Number(item.cat.total_more_year).toFixed(1),
item.cat.strategic, item.cat.strategic,
item.cat.pic, item.cat.pic,
item.cat.forecast_formula, item.cat.forecast_formula,
...@@ -226,6 +226,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -226,6 +226,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}) })
console.log(dataTable)
this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => { this.setState({ dataTable, loading: false, dataReal: res, editable: true, dataCustomerPrs, dataInternalBsn }, () => {
// console.log(dataCustomerPrs) // console.log(dataCustomerPrs)
}) })
...@@ -238,7 +239,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -238,7 +239,7 @@ export default class CorporateAnnualTarget extends Component {
}, 1000); }, 1000);
} }
}) })
} };
} else { } else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
} }
...@@ -381,7 +382,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -381,7 +382,7 @@ export default class CorporateAnnualTarget extends Component {
// console.log(JSON.stringify(this.state.payload)); // console.log(JSON.stringify(this.state.payload));
// console.log(response) // console.log(response)
if (response.data) { if (response.data) {
if (response. ok) { if (response.ok) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
// this.setState({ visibleUpload: false, visibleCAT: false }) // this.setState({ visibleUpload: false, visibleCAT: false })
this.setState({ visibleUpload: false, visibleCAT: false }) this.setState({ visibleUpload: false, visibleCAT: false })
...@@ -440,8 +441,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -440,8 +441,8 @@ export default class CorporateAnnualTarget extends Component {
item.total_next_year == "" ? item.total_next_year : String(item.total_next_year).indexOf(".") == -1 ? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1), item.total_next_year == "" ? item.total_next_year : String(item.total_next_year).indexOf(".") == -1 ? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1),
item.total_more_year == "" ? item.total_more_year : String(item.total_more_year).indexOf(".") == -1 ? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1), item.total_more_year == "" ? item.total_more_year : String(item.total_more_year).indexOf(".") == -1 ? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1),
item.strategic, item.strategic,
item.pic,, item.pic, ,
item.forecast_formula,, item.forecast_formula, ,
item.order, item.order,
item.error item.error
]) ])
...@@ -625,7 +626,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -625,7 +626,7 @@ export default class CorporateAnnualTarget extends Component {
} }
data.push({ data.push({
"item_report_id": i[1] == "" || i[1] == null? 0 : i[1], "item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_name": String(i[6]), "item_name": String(i[6]),
"parent": i[2] == "" ? null : i[2], "parent": i[2] == "" ? null : i[2],
"weight": weightReal == null ? String(i[7]) : weightReal, "weight": weightReal == null ? String(i[7]) : weightReal,
...@@ -667,9 +668,9 @@ export default class CorporateAnnualTarget extends Component { ...@@ -667,9 +668,9 @@ export default class CorporateAnnualTarget extends Component {
// // console.log(totalWeight) // // console.log(totalWeight)
// this.setState({dataTable: dataTampung}) // this.setState({dataTable: dataTampung})
if (handleKosongKPIMAXYTD) { if (handleKosongKPIMAXYTD) {
this.setState({ alert: true, messageAlert: 'KPI / Weight / KPI Type / Max Ach / Formula YTD / Cannot be Empty', tipeAlert: 'warning', loading: false, editable: true}) this.setState({ alert: true, messageAlert: 'KPI / Weight / KPI Type / Max Ach / Formula YTD / Cannot be Empty', tipeAlert: 'warning', loading: false, editable: true })
} else if (totalWeight < 100) { } else if (totalWeight < 100) {
this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true}) this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, editable: true })
} else { } else {
api.create().validateSubmitReport(payload).then((response) => { api.create().validateSubmitReport(payload).then((response) => {
// // console.log(response) // // console.log(response)
...@@ -692,7 +693,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -692,7 +693,7 @@ export default class CorporateAnnualTarget extends Component {
this.state.dataTable.map(i => { this.state.dataTable.map(i => {
// // // console.log(i[9] == null? "" : i[9].value) // // // console.log(i[9] == null? "" : i[9].value)
data.push({ data.push({
"item_report_id": i[1] == "" || i[1] == null? 0 : i[1], "item_report_id": i[1] == "" || i[1] == null ? 0 : i[1],
"item_name": String(i[6]), "item_name": String(i[6]),
"parent": i[2] == "" ? null : i[2], "parent": i[2] == "" ? null : i[2],
"weight": String(i[7]), "weight": String(i[7]),
...@@ -912,13 +913,13 @@ export default class CorporateAnnualTarget extends Component { ...@@ -912,13 +913,13 @@ export default class CorporateAnnualTarget extends Component {
} 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) {
...@@ -940,11 +941,11 @@ export default class CorporateAnnualTarget extends Component { ...@@ -940,11 +941,11 @@ export default class CorporateAnnualTarget extends Component {
} 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) {
anjay.push(String(item).substr(1,String(item).length)) anjay.push(String(item).substr(1, String(item).length))
} else { } else {
let formulaAwal = String(item).substr(0,indexX-1) let formulaAwal = String(item).substr(0, indexX - 1)
let operatorX = String(item).substr(indexX-1,1) let operatorX = String(item).substr(indexX - 1, 1)
let nilaiX = String(item).substr(indexX+1,String(item).length) let nilaiX = String(item).substr(indexX + 1, String(item).length)
if (forecast == undefined) { if (forecast == undefined) {
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))
...@@ -974,7 +975,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -974,7 +975,7 @@ export default class CorporateAnnualTarget extends Component {
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode)) let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
if (indexID !== -1) { if (indexID !== -1) {
let valuezz = value.formula[indexID].value let valuezz = value.formula[indexID].value
anjay.push(valuezz == "" || valuezz == null? "0" : valuezz) anjay.push(valuezz == "" || valuezz == null ? "0" : valuezz)
} }
} }
...@@ -1130,7 +1131,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1130,7 +1131,7 @@ export default class CorporateAnnualTarget extends Component {
// console.log(anjay2) // console.log(anjay2)
// console.log(total) // console.log(total)
total = dataTable2[tableMeta.rowIndex][6] == "ROIC"? "0" : R.equals(total, NaN) ? "0.0" : total total = dataTable2[tableMeta.rowIndex][6] == "ROIC" ? "0" : R.equals(total, NaN) ? "0.0" : total
if (dataTable2[tableMeta.rowIndex][6] == "ROIC") { if (dataTable2[tableMeta.rowIndex][6] == "ROIC") {
if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) { if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = "0" dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = "0"
...@@ -1170,7 +1171,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1170,7 +1171,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
const handleValueDropdown = (value, type, tableMeta) => { const handleValueDropdown = (value, type, tableMeta) => {
let data = type == 'KPI'? this.state.kpiTypeList.options : (type == 'MAX'? this.state.maxAchList.options : this.state.formulaYtdList.options) let data = type == 'KPI' ? this.state.kpiTypeList.options : (type == 'MAX' ? this.state.maxAchList.options : this.state.formulaYtdList.options)
let index = 0 let index = 0
if (value == null) { if (value == null) {
index = -1 index = -1
...@@ -1250,7 +1251,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1250,7 +1251,7 @@ export default class CorporateAnnualTarget 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],
"", "",
...@@ -1412,7 +1413,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1412,7 +1413,7 @@ export default class CorporateAnnualTarget 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 }}
...@@ -1731,10 +1732,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1731,10 +1732,31 @@ export default class CorporateAnnualTarget extends Component {
// // console.log(tableMeta.rowData[0]) // // console.log(tableMeta.rowData[0])
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2|| tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1796,10 +1818,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1796,10 +1818,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1861,10 +1904,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1861,10 +1904,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1927,10 +1991,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1927,10 +1991,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -1993,10 +2078,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -1993,10 +2078,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2059,10 +2165,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2059,10 +2165,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2125,10 +2252,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2125,10 +2252,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2191,10 +2339,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2191,10 +2339,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2257,10 +2426,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2257,10 +2426,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2323,10 +2513,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2323,10 +2513,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2379,7 +2590,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2379,7 +2590,7 @@ export default class CorporateAnnualTarget extends Component {
} }
} }
}, { }, {
name: `Nop ${this.props.periode}`, name: `Nov ${this.props.periode}`,
options: { options: {
customHeadRender: (columnMeta) => ( customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
...@@ -2389,10 +2600,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2389,10 +2600,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2455,10 +2687,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2455,10 +2687,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2521,9 +2774,32 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2521,9 +2774,32 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<div style={{ flex: 1 }}>
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(handleTotal(tableMeta)).toFixed(2)}
disabled={true}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/>
</div> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null : null :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2586,10 +2862,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2586,10 +2862,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2652,10 +2949,31 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2652,10 +2949,31 @@ export default class CorporateAnnualTarget extends Component {
customBodyRender: (value, tableMeta) => { customBodyRender: (value, tableMeta) => {
return ( return (
<div style={{ width: 96 }}> <div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? {
tableMeta.rowData[6] === 'ROIC' ?
<FormControlLabel
style={{ margin: 0 }}
value={value}
control={
<NumberFormat
thousandSeparator={true}
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
value={Number(value).toFixed(2)}
disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
onBlur={(event) => {
// updateValue(event.target.value)
handleChange(event.target.value, tableMeta)
// // console.log(tableMeta.rowData[0])
}}
/>
}
/> :
tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null null
: :
(handleReturnFormula(tableMeta.rowData[2], tableMeta)? (handleReturnFormula(tableMeta.rowData[2], tableMeta) ?
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
<FormControlLabel <FormControlLabel
style={{ margin: 0 }} style={{ margin: 0 }}
...@@ -2979,7 +3297,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2979,7 +3297,7 @@ export default class CorporateAnnualTarget extends Component {
disabled={this.state.buttonDraft} disabled={this.state.buttonDraft}
onClick={() => onClick={() =>
this.state.editable === true ? this.state.editable === true ?
this.setState({alert: true}) : this.setState({ alert: true }) :
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
this.backToMasterBudget('draft') this.backToMasterBudget('draft')
...@@ -2994,7 +3312,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -2994,7 +3312,7 @@ export default class CorporateAnnualTarget extends Component {
type="button" type="button"
disabled={this.state.buttonDraft} disabled={this.state.buttonDraft}
onClick={() => onClick={() =>
this.state.editable? this.setState({alert: true}) : this.state.editable ? this.setState({ alert: true }) :
this.state.buttonError ? this.state.buttonError ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
: :
...@@ -3049,7 +3367,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3049,7 +3367,7 @@ export default class CorporateAnnualTarget extends Component {
borderColor: 'transparent', borderColor: 'transparent',
}} }}
onClick={() => onClick={() =>
this.setState({ loading: true, visibleCAT: true, dataTable: []}, () => { this.setState({ loading: true, visibleCAT: true, dataTable: [] }, () => {
setTimeout(() => { setTimeout(() => {
this.getItemHierarki() this.getItemHierarki()
}, 100) }, 100)
...@@ -3067,7 +3385,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3067,7 +3385,7 @@ export default class CorporateAnnualTarget extends Component {
this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => { this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
setTimeout(() => { setTimeout(() => {
this.handleValidate() this.handleValidate()
this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false}) this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false })
}, 100) }, 100)
}) })
} }
...@@ -3088,8 +3406,8 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3088,8 +3406,8 @@ export default class CorporateAnnualTarget extends Component {
outline: 'none', outline: 'none',
marginRight: 20 marginRight: 20
}} }}
onClick={() => this.state.editable? onClick={() => this.state.editable ?
this.setState({alert: true}) : this.setState({ loading: true }, () => this.setState({ alert: true }) : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
this.setState({ handleTekTekTek: 1 }, () => { this.setState({ handleTekTekTek: 1 }, () => {
setTimeout(() => { setTimeout(() => {
...@@ -3113,7 +3431,7 @@ export default class CorporateAnnualTarget extends Component { ...@@ -3113,7 +3431,7 @@ export default class CorporateAnnualTarget extends Component {
}} }}
disabled={this.state.buttonDraft} disabled={this.state.buttonDraft}
onClick={() => onClick={() =>
this.state.editable? this.setState({alert: true}) : this.state.editable ? this.setState({ alert: true }) :
this.state.buttonError === true ? this.state.buttonError === true ?
this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) : this.setState({ loading: true }, () => this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' }) : this.setState({ loading: true }, () =>
this.state.handleTekTekTek == 1 ? null : this.state.handleTekTekTek == 1 ? null :
......
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