Commit 4fee691b authored by Riri Novita's avatar Riri Novita

Merge branch 'master' of http://103.44.149.204/d.arizona/tia-dev into riri

parents d037eb88 873b685d
......@@ -366,6 +366,7 @@ const create = (type = "") => {
const createDBPLOLPA = (body) => api.post('transaction/db_profit_loss/outlook_pa/create_outlook_report', body)
const getHierarkiDBPLRO = (body) => api.post('transaction/db_profit_loss/rolling_outlook/get_report_hierarki', body)
const createDBPLRO = (body) => api.post('transaction/db_profit_loss/rolling_outlook/create_rolling_outlook', body)
const getDetailReportOLPACAT = (body) => api.post('transaction/cat/outlook_pa/get_report_hierarki', body)
// Monthly
const getMonthlyReport = (body) => api.post('transaction/monthly_report/get_all_report', body)
......@@ -802,7 +803,8 @@ const create = (type = "") => {
getHierarkiDBPLOLPA,
createDBPLOLPA,
getHierarkiDBPLRO,
createDBPLRO
createDBPLRO,
getDetailReportOLPACAT
}
}
......
......@@ -860,9 +860,9 @@ export default class CorporateAnnualTarget extends Component {
"october": i[22].value != undefined? String(Number(i[22].value).toFixed(1)) : String(i[22]),
"november": i[23].value != undefined? String(Number(i[23].value).toFixed(1)) : String(i[23]),
"december": i[24].value != undefined? String(Number(i[24].value).toFixed(1)) : String(i[24]),
"total_current_year": i[6] === String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": i[6] === String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": i[6] === String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
"total_current_year": String(Number(i[25]).toFixed(1)) == "" ? "0.0" : String(Number(i[25]).toFixed(1)),
"total_next_year": String(Number(i[26]).toFixed(1)) == "" ? "0.0" : String(Number(i[26]).toFixed(1)),
"total_more_year": String(Number(i[27]).toFixed(1)) == "" ? "0.0" : String(Number(i[27]).toFixed(1)),
"strategic": String(i[28]),
"pic": String(i[29])
})
......@@ -1140,8 +1140,11 @@ export default class CorporateAnnualTarget extends Component {
let valuezz = value.formula[indexID].value
anjay.push(valuezz == "" || valuezz == null ? "0" : valuezz)
}
} else {
let array = dataTable2[tableMeta.rowIndex][30].filter((val) => val.periode == Number(column))
let valuezz = array[0].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
} else {
let convertID = -1
if (tableMeta.rowData[11].value == 'FORMULA') {
......@@ -1325,6 +1328,7 @@ export default class CorporateAnnualTarget extends Component {
const handleValueForecast = (value, tableMeta, periode) => {
return handleValueFormula(value, tableMeta, periode, periode, 'forecast')
}
const handleChangeDropdown = (value, tableMeta) => {
dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
let valz = value.value
......
......@@ -761,9 +761,9 @@ class HomePage extends Component {
pathname: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("master") ? `/home/master-budget/` : String(tableMeta.rowData[3]).toLocaleLowerCase().includes("monthly") ? `/home/monthly-report/` : String(tableMeta.rowData[3]).toLocaleLowerCase().includes("rolling") ? `/home/rolling-outlook/` : `/home/outlook-performance/`,
state: {
userType: 'approver',
rawData: {...this.state.rawData[tableMeta.rowIndex], quarter: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("rolling") ? this.state.quarter.value : null },
rawData: {...this.state.rawData[tableMeta.rowIndex], quarter: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("rolling") ? this.state.rawData[tableMeta.rowIndex].quartal : null },
month: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("master") ? null : getDataMonth(this.state.rawData[tableMeta.rowIndex]),
quarter: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("rolling") ? this.state.quarter.value : null
quarter: String(tableMeta.rowData[3]).toLocaleLowerCase().includes("rolling") ? this.state.rawData[tableMeta.rowIndex].quartal : null
}
}}>
<button
......
......@@ -208,8 +208,8 @@ export default class BalanceSheetOLPA extends Component {
Number(item.balance_sheet.august).toFixed(1),
Number(item.balance_sheet.september).toFixed(1),
Number(item.balance_sheet.october).toFixed(1),
Number(item.balance_sheet.november).toFixed(1),
Number(item.balance_sheet.december).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november).toFixed(1), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december).toFixed(1), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
Number(item.balance_sheet.total_current_year).toFixed(1),
item.order,
item.condition_it_should_be,
......@@ -244,8 +244,8 @@ export default class BalanceSheetOLPA extends Component {
Number(item.balance_sheet.august).toFixed(1),
Number(item.balance_sheet.september).toFixed(1),
Number(item.balance_sheet.october).toFixed(1),
Number(item.balance_sheet.november).toFixed(1),
Number(item.balance_sheet.december).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november).toFixed(1), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december).toFixed(1), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
Number(item.balance_sheet.total_current_year).toFixed(1),
item.order,
item.condition_it_should_be,
......@@ -310,8 +310,8 @@ export default class BalanceSheetOLPA extends Component {
august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
december: i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1))),
december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1))),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
})
})
......@@ -416,8 +416,8 @@ export default class BalanceSheetOLPA extends Component {
Number(item.august).toFixed(1),
Number(item.september).toFixed(1),
Number(item.october).toFixed(1),
Number(item.november).toFixed(1),
Number(item.december).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.november).toFixed(1), formula: item.november_formula } : Number(item.november).toFixed(1),
item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.december).toFixed(1), formula: item.december_formula } : Number(item.december).toFixed(1),
Number(item.total_current_year).toFixed(1),
item.orders,
item.condition_it_should_be,
......@@ -466,8 +466,8 @@ export default class BalanceSheetOLPA extends Component {
august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
december: i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1))),
december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[18]).toFixed(1))),
total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
})
})
......@@ -692,16 +692,16 @@ export default class BalanceSheetOLPA extends Component {
anjay.push(valuezz == "" ? 0 : valuezz)
// console.log(valuezz)
}
// } else {
// // console.log(baru);
// // console.log(value);
// let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
// // console.log(indexID)
// if (indexID !== -1) {
// // console.log(value.formula[indexID].value)
// let valuezz = value.formula[indexID].value
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
} else {
// console.log(baru);
// console.log(value);
let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
// console.log(indexID)
if (indexID !== -1) {
// console.log(value.formula[indexID].value)
let valuezz = value.formula[indexID].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
}
} else if (String(item).includes('[M-1]')) {
let tst = String(item).replace('[M-1]', '')
......@@ -738,7 +738,11 @@ export default class BalanceSheetOLPA extends Component {
})
// console.log(baru)
// console.log(anjay)
// if (tableMeta.rowData[5] == 'Profit (loss) MTD') {
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// }
let total = 0
let opt = ""
anjay.map((item, index) => {
......@@ -1675,8 +1679,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 5 ?
......@@ -1686,8 +1689,7 @@ export default class BalanceSheetOLPA extends Component {
type="text"
placeholder=""
disabled={true}
value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
// value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
/>
:
tableMeta.rowData[0] === 1 ?
......
......@@ -93,10 +93,11 @@ export default class CorporateAnnualTargetOLPA extends Component {
}
componentDidMount() {
// this.getKPIType()
// this.getMaxAch()
// this.getLatestUpdate()
this.getKPIType()
this.getMaxAch()
this.getLatestUpdate()
// this.handleViewOnly()
// this.getItemHierarki()
console.log(this.state.get_for)
}
......@@ -144,19 +145,22 @@ export default class CorporateAnnualTargetOLPA extends Component {
getItemHierarki() {
this.setState({ loading: true })
let payload = {
"report_id": this.props.report_id,
"report_id": 10,
"revision": Number(this.props.revision),
"periode": this.props.periode,
"company_id": this.props.company.company_id,
"submission_id": this.props.submissionID
"get_for": this.state.get_for,
"quartal": "q1",
"rolling_outlook_id": 0
}
console.log(JSON.stringify(payload))
api.create().getDetailReportMB(payload).then(response => {
// console.log(JSON.stringify(payload))
api.create().getDetailReportOLPACAT(payload).then(response => {
let dataTable = []
let dataCustomerPrs = []
let dataInternalBsn = []
let dataFin = []
let dataLearn = []
console.log(payload)
console.log(response)
if (response.data) {
if (response.ok) {
......@@ -215,30 +219,30 @@ export default class CorporateAnnualTargetOLPA extends Component {
item.level,
"",
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.cat.weight).substr(0, String(item.cat.weight).length - 1)).toFixed(1)) + '%'),
parentTrue ? item.cat.uom : item.uom,
parentTrue ? item.cat.kpi_type == "" ? null : { value: item.cat.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
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 },
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" ? item.type_report_id == 3 ? (item.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1)) : { 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.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1)) : { 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.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1)) : { 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" ? item.type_report_id == 3 ? (item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1)) : { 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 == "" ? 0 : 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.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.pic,
item.cat.forecast_formula,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1)).toFixed(1)) + '%'),
parentTrue ? item.corporate_annual_target.uom : item.uom,
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.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
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.total_actual_before == "" ? item.corporate_annual_target.total_actual_before : String(item.corporate_annual_target.total_actual_before).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_actual_before) : Number(item.corporate_annual_target.total_actual_before).toFixed(1),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.january == "" ? item.corporate_annual_target.january : String(item.corporate_annual_target.january).indexOf(".") == -1 ? Number(item.corporate_annual_target.january) : Number(item.corporate_annual_target.january).toFixed(1)) : { value: item.corporate_annual_target.january, formula: item.corporate_annual_target.january_formula } : (item.corporate_annual_target.january == "" ? item.corporate_annual_target.january : String(item.corporate_annual_target.january).indexOf(".") == -1 ? Number(item.corporate_annual_target.january) : Number(item.corporate_annual_target.january).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.february == "" ? item.corporate_annual_target.february : String(item.corporate_annual_target.february).indexOf(".") == -1 ? Number(item.corporate_annual_target.february) : Number(item.corporate_annual_target.february).toFixed(1)) : { value: item.corporate_annual_target.february, formula: item.corporate_annual_target.february_formula } : (item.corporate_annual_target.february == "" ? item.corporate_annual_target.february : String(item.corporate_annual_target.february).indexOf(".") == -1 ? Number(item.corporate_annual_target.february) : Number(item.corporate_annual_target.february).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.march == "" ? item.corporate_annual_target.march : String(item.corporate_annual_target.march).indexOf(".") == -1 ? Number(item.corporate_annual_target.march) : Number(item.corporate_annual_target.march).toFixed(1)) : { value: item.corporate_annual_target.march, formula: item.corporate_annual_target.march_formula } : (item.corporate_annual_target.march == "" ? item.corporate_annual_target.march : String(item.corporate_annual_target.march).indexOf(".") == -1 ? Number(item.corporate_annual_target.march) : Number(item.corporate_annual_target.march).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.april == "" ? item.corporate_annual_target.april : String(item.corporate_annual_target.april).indexOf(".") == -1 ? Number(item.corporate_annual_target.april) : Number(item.corporate_annual_target.april).toFixed(1)) : { value: item.corporate_annual_target.april, formula: item.corporate_annual_target.april_formula } : (item.corporate_annual_target.april == "" ? item.corporate_annual_target.april : String(item.corporate_annual_target.april).indexOf(".") == -1 ? Number(item.corporate_annual_target.april) : Number(item.corporate_annual_target.april).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.may == "" ? item.corporate_annual_target.may : String(item.corporate_annual_target.may).indexOf(".") == -1 ? Number(item.corporate_annual_target.may) : Number(item.corporate_annual_target.may).toFixed(1)) : { value: item.corporate_annual_target.may, formula: item.corporate_annual_target.may_formula } : (item.corporate_annual_target.may == "" ? item.corporate_annual_target.may : String(item.corporate_annual_target.may).indexOf(".") == -1 ? Number(item.corporate_annual_target.may) : Number(item.corporate_annual_target.may).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.june == "" ? item.corporate_annual_target.june : String(item.corporate_annual_target.june).indexOf(".") == -1 ? Number(item.corporate_annual_target.june) : Number(item.corporate_annual_target.june).toFixed(1)) : { value: item.corporate_annual_target.june, formula: item.corporate_annual_target.june_formula } : (item.corporate_annual_target.june == "" ? item.corporate_annual_target.june : String(item.corporate_annual_target.june).indexOf(".") == -1 ? Number(item.corporate_annual_target.june) : Number(item.corporate_annual_target.june).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.july == "" ? item.corporate_annual_target.july : String(item.corporate_annual_target.july).indexOf(".") == -1 ? Number(item.corporate_annual_target.july) : Number(item.corporate_annual_target.july).toFixed(1)) : { value: item.corporate_annual_target.july, formula: item.corporate_annual_target.july_formula } : (item.corporate_annual_target.july == "" ? item.corporate_annual_target.july : String(item.corporate_annual_target.july).indexOf(".") == -1 ? Number(item.corporate_annual_target.july) : Number(item.corporate_annual_target.july).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.august == "" ? item.corporate_annual_target.august : String(item.corporate_annual_target.august).indexOf(".") == -1 ? Number(item.corporate_annual_target.august) : Number(item.corporate_annual_target.august).toFixed(1)) : { value: item.corporate_annual_target.august, formula: item.corporate_annual_target.august_formula } : (item.corporate_annual_target.august == "" ? item.corporate_annual_target.august : String(item.corporate_annual_target.august).indexOf(".") == -1 ? Number(item.corporate_annual_target.august) : Number(item.corporate_annual_target.august).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.september == "" ? item.corporate_annual_target.september : String(item.corporate_annual_target.september).indexOf(".") == -1 ? Number(item.corporate_annual_target.september) : Number(item.corporate_annual_target.september).toFixed(1)) : { value: item.corporate_annual_target.september, formula: item.corporate_annual_target.september_formula } : (item.corporate_annual_target.september == "" ? item.corporate_annual_target.september : String(item.corporate_annual_target.september).indexOf(".") == -1 ? Number(item.corporate_annual_target.september) : Number(item.corporate_annual_target.september).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.october == "" ? item.corporate_annual_target.october : String(item.corporate_annual_target.october).indexOf(".") == -1 ? Number(item.corporate_annual_target.october) : Number(item.corporate_annual_target.october).toFixed(1)) : { value: item.corporate_annual_target.october, formula: item.corporate_annual_target.october_formula } : (item.corporate_annual_target.october == "" ? item.corporate_annual_target.october : String(item.corporate_annual_target.october).indexOf(".") == -1 ? Number(item.corporate_annual_target.october) : Number(item.corporate_annual_target.october).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.november == "" ? item.corporate_annual_target.november : String(item.corporate_annual_target.november).indexOf(".") == -1 ? Number(item.corporate_annual_target.november) : Number(item.corporate_annual_target.november).toFixed(1)) : { value: item.corporate_annual_target.november, formula: item.corporate_annual_target.november_formula } : (item.corporate_annual_target.november == "" ? item.corporate_annual_target.november : String(item.corporate_annual_target.november).indexOf(".") == -1 ? Number(item.corporate_annual_target.november) : Number(item.corporate_annual_target.november).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? item.type_report_id == 3 ? (item.corporate_annual_target.december == "" ? item.corporate_annual_target.december : String(item.corporate_annual_target.december).indexOf(".") == -1 ? Number(item.corporate_annual_target.december) : Number(item.corporate_annual_target.december).toFixed(1)) : { value: item.corporate_annual_target.december, formula: item.corporate_annual_target.december_formula } : (item.corporate_annual_target.december == "" ? item.corporate_annual_target.december : String(item.corporate_annual_target.december).indexOf(".") == -1 ? Number(item.corporate_annual_target.december) : Number(item.corporate_annual_target.december).toFixed(1)),
item.corporate_annual_target.total_current_year == "" ? 0 : String(item.corporate_annual_target.total_current_year).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_current_year) : Number(item.corporate_annual_target.total_current_year).toFixed(1),
item.corporate_annual_target.total_next_year == "" ? item.corporate_annual_target.total_next_year : String(item.corporate_annual_target.total_next_year).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_next_year) : Number(item.corporate_annual_target.total_next_year).toFixed(1),
item.corporate_annual_target.total_more_year == "" ? item.corporate_annual_target.total_more_year : String(item.corporate_annual_target.total_more_year).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_more_year) : Number(item.corporate_annual_target.total_more_year).toFixed(1),
item.corporate_annual_target.strategic,
item.corporate_annual_target.pic,
item.corporate_annual_target.forecast_formula,
item.order
])
}
......@@ -259,30 +263,30 @@ export default class CorporateAnnualTargetOLPA extends Component {
item.level,
"",
item.description,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.cat.weight).substr(0, String(item.cat.weight).length - 1)).toFixed(1)) + '%'),
item.cat.uom,
item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(Number(String(item.corporate_annual_target.weight).substr(0, String(item.corporate_annual_target.weight).length - 1)).toFixed(1)) + '%'),
item.corporate_annual_target.uom,
item.kpi_type == "" ? null : { value: item.kpi_type },
item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
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.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.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.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.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.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.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.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 == "" ? 0 : 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.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.pic,
item.cat.forecast_formula,
item.corporate_annual_target.total_actual_before == "" ? item.corporate_annual_target.total_actual_before : String(item.corporate_annual_target.total_actual_before).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_actual_before) : Number(item.corporate_annual_target.total_actual_before).toFixed(1),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.january, formula: item.corporate_annual_target.january_formula } : (item.corporate_annual_target.january == "" ? item.corporate_annual_target.january : String(item.corporate_annual_target.january).indexOf(".") == -1 ? Number(item.corporate_annual_target.january) : Number(item.corporate_annual_target.january).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.february, formula: item.corporate_annual_target.february_formula } : (item.corporate_annual_target.february == "" ? item.corporate_annual_target.february : String(item.corporate_annual_target.february).indexOf(".") == -1 ? Number(item.corporate_annual_target.february) : Number(item.corporate_annual_target.february).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.march, formula: item.corporate_annual_target.march_formula } : (item.corporate_annual_target.march == "" ? item.corporate_annual_target.march : String(item.corporate_annual_target.march).indexOf(".") == -1 ? Number(item.corporate_annual_target.march) : Number(item.corporate_annual_target.march).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.april, formula: item.corporate_annual_target.april_formula } : (item.corporate_annual_target.april == "" ? item.corporate_annual_target.april : String(item.corporate_annual_target.april).indexOf(".") == -1 ? Number(item.corporate_annual_target.april) : Number(item.corporate_annual_target.april).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.may, formula: item.corporate_annual_target.may_formula } : (item.corporate_annual_target.may == "" ? item.corporate_annual_target.may : String(item.corporate_annual_target.may).indexOf(".") == -1 ? Number(item.corporate_annual_target.may) : Number(item.corporate_annual_target.may).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.june, formula: item.corporate_annual_target.june_formula } : (item.corporate_annual_target.june == "" ? item.corporate_annual_target.june : String(item.corporate_annual_target.june).indexOf(".") == -1 ? Number(item.corporate_annual_target.june) : Number(item.corporate_annual_target.june).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.july, formula: item.corporate_annual_target.july_formula } : (item.corporate_annual_target.july == "" ? item.corporate_annual_target.july : String(item.corporate_annual_target.july).indexOf(".") == -1 ? Number(item.corporate_annual_target.july) : Number(item.corporate_annual_target.july).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.august, formula: item.corporate_annual_target.august_formula } : (item.corporate_annual_target.august == "" ? item.corporate_annual_target.august : String(item.corporate_annual_target.august).indexOf(".") == -1 ? Number(item.corporate_annual_target.august) : Number(item.corporate_annual_target.august).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.september, formula: item.corporate_annual_target.september_formula } : (item.corporate_annual_target.september == "" ? item.corporate_annual_target.september : String(item.corporate_annual_target.september).indexOf(".") == -1 ? Number(item.corporate_annual_target.september) : Number(item.corporate_annual_target.september).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.october, formula: item.corporate_annual_target.october_formula } : (item.corporate_annual_target.october == "" ? item.corporate_annual_target.october : String(item.corporate_annual_target.october).indexOf(".") == -1 ? Number(item.corporate_annual_target.october) : Number(item.corporate_annual_target.october).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.november, formula: item.corporate_annual_target.november_formula } : (item.corporate_annual_target.november == "" ? item.corporate_annual_target.november : String(item.corporate_annual_target.november).indexOf(".") == -1 ? Number(item.corporate_annual_target.november) : Number(item.corporate_annual_target.november).toFixed(1)),
item.parent_name == "FINANCIAL PERSPECTIVE" ? { value: item.corporate_annual_target.december, formula: item.corporate_annual_target.december_formula } : (item.corporate_annual_target.december == "" ? item.corporate_annual_target.december : String(item.corporate_annual_target.december).indexOf(".") == -1 ? Number(item.corporate_annual_target.december) : Number(item.corporate_annual_target.december).toFixed(1)),
item.corporate_annual_target.total_current_year == "" ? 0 : String(item.corporate_annual_target.total_current_year).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_current_year) : Number(item.corporate_annual_target.total_current_year).toFixed(1),
item.corporate_annual_target.total_next_year == "" ? item.corporate_annual_target.total_next_year : String(item.corporate_annual_target.total_next_year).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_next_year) : Number(item.corporate_annual_target.total_next_year).toFixed(1),
item.corporate_annual_target.total_more_year == "" ? item.corporate_annual_target.total_more_year : String(item.corporate_annual_target.total_more_year).indexOf(".") == -1 ? Number(item.corporate_annual_target.total_more_year) : Number(item.corporate_annual_target.total_more_year).toFixed(1),
item.corporate_annual_target.strategic,
item.corporate_annual_target.pic,
item.corporate_annual_target.forecast_formula,
item.order
])
if (item.children !== null) {
......@@ -938,12 +942,12 @@ export default class CorporateAnnualTargetOLPA extends Component {
type: 'KPI_TYPE'
}
api.create().getAllSettingByType(body).then(response => {
// // // // // console.log(response)
// console.log(response)
if (response.data) {
if (response.ok) {
if (response.data.status === 'success') {
let data = response.data.data
// // // // console.log(data)
// console.log(data)
let inputKPI = []
data.map((item) => {
......@@ -955,7 +959,7 @@ export default class CorporateAnnualTargetOLPA extends Component {
options: inputKPI,
getOptionLabel: (option) => titleCase(option.value),
};
// // // // console.log(defaultProps)
// console.log(defaultProps)
this.setState({ kpiTypeList: defaultProps })
} else {
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
......@@ -1528,32 +1532,32 @@ export default class CorporateAnnualTargetOLPA extends Component {
}
const columns = [
// {
// name: "",
// options: {
// display: false
// }
// }, {
// name: "",
// options: {
// display: false
// }
// }, {
// name: "",
// options: {
// display: false
// }
// }, {
// name: "",
// options: {
// display: false
// }
// }, {
// name: "",
// options: {
// display: false
// }
// },
{
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
}, {
name: "",
options: {
display: false
}
},
{
name: "",
options: {
......@@ -1569,7 +1573,7 @@ export default class CorporateAnnualTargetOLPA extends Component {
// handleAction(tableMeta.rowData[2]) &&
<div style={{ display: 'flex' }}>
{/* {tableMeta.rowData[6] === "Active" ? */}
{/* {handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && <span>
{handleAction(tableMeta.rowData[2], tableMeta.rowData[0], tableMeta) && <span>
<LightTooltip title={'Add'} arrow>
<button
style={{
......@@ -1604,7 +1608,7 @@ export default class CorporateAnnualTargetOLPA extends Component {
<img src={Images.delete} />
</button>
</LightTooltip>
</span>} */}
</span>}
</div >
);
}
......@@ -1620,64 +1624,62 @@ export default class CorporateAnnualTargetOLPA extends Component {
setCellProps: () => ({ style }),
customBodyRender: (val, tableMeta) => {
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]) }}>
{!this.state.loading &&
<FormControlLabel
style={{ margin: 0 }}
control={
{!this.state.loading && <FormControlLabel
style={{ margin: 0 }}
control={
<Input
disableUnderline={true}
style={{ color: tableMeta.rowData[1] == "" ? "#5198ea" : "black", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, backgroundColor: 'transparent' }}
type="text"
placeholder=""
defaultValue={val}
disabled={true}
// disabled={!handleAction(tableMeta.rowData[2])}
// onBlur={(event) => {
// // // // console.log(event.target.value)
// handleChangeText(event.target.value, tableMeta)
// // // console.log(dataTable2)
// }}
/>
}
/>}
onBlur={(event) => {
// console.log(event.target.value)
handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
}
/>}
</div>
:
<div style={{ width: 300 }}>
{tableMeta.rowData[32] ?
tableMeta.rowData[32].length > 0 ?
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<LightTooltip title={"Report Items Not Registered"} arrow>
<span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</LightTooltip>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
tableMeta.rowData[1] == null ?
<div style={{ paddingLeft: 20 }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
tableMeta.rowData[4] == 0 ?
<span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
:
tableMeta.rowData[1] == null ?
<div style={{ paddingLeft: 20 }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
:
<div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
<span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
</div>
}
</div>
// :
// <div style={{ width: 300 }}>
// {tableMeta.rowData[32] ?
// tableMeta.rowData[32].length > 0 ?
// <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
// <LightTooltip title={"Report Items Not Registered"} arrow>
// <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </LightTooltip>
// </div>
// :
// tableMeta.rowData[4] == 0 ?
// <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
// :
// tableMeta.rowData[1] == null ?
// <div style={{ paddingLeft: 20 }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// :
// <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// :
// tableMeta.rowData[4] == 0 ?
// <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
// :
// tableMeta.rowData[1] == null ?
// <div style={{ paddingLeft: 20 }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// :
// <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
// <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
// </div>
// }
// </div>
)
}
}
......@@ -1705,12 +1707,17 @@ export default class CorporateAnnualTargetOLPA extends Component {
control={
<NumberFormat
thousandSeparator={true}
style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
suffix="%"
style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
suffix={'%'}
value={Number(value).toFixed(1)}
value={value}
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)}
maxLength={4}
onBlur={(event) => {
// updateValue(some)
handleChangePercentage(event.target.value, tableMeta)
}}
/>
}
/>
......@@ -1733,16 +1740,45 @@ export default class CorporateAnnualTargetOLPA extends Component {
<div style={{ textAlign: 'right' }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<div style={{ flex: 1 }}>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
defaultValue={"Rp Bio"}
/>
</div>
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
!handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
type="text"
placeholder=""
defaultValue={value}
color={"#5198ea"}
disabled={true}
onBlur={(event) => {
// console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/> :
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginBottom: -5 }}
type="text"
placeholder=""
defaultValue={value}
color={"#5198ea"}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? false : !handleAction(tableMeta.rowData[2]))}
onBlur={(event) => {
// console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// console.log(dataTable2)
}}
/>
</ThemeProvider>
}
/>
}
</div>
)
......@@ -1756,21 +1792,26 @@ export default class CorporateAnnualTargetOLPA extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta) => {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<div style={{ flex: 1 }}>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
defaultValue={"HIG"}
/>
</div>
<Autocomplete
{...this.state.kpiTypeList}
id="kpiType"
onChange={(event, newInputValue) => handleChangeDropdown(newInputValue, tableMeta)}
debug
disableClearable
disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
value={handleValueDropdown(val, 'KPI', tableMeta)}
style={{ padding: 0, margin: 0 }}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} />
</div>
}
/>
}
</div>
......@@ -1785,21 +1826,27 @@ export default class CorporateAnnualTargetOLPA extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta) => {
customBodyRender: (val, tableMeta) => {
return (
<div style={{ width: 96 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<div style={{ flex: 1 }}>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
defaultValue={"Unlimited"}
/>
</div>
<Autocomplete
{...this.state.maxAchList}
id="maxAchList"
onChange={(event, newInputValue) => handleChangeDropdown(newInputValue, tableMeta)}
debug
disableClearable
value={handleValueDropdown(val, 'MAX', tableMeta)}
style={{ padding: 0, margin: 0 }}
disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<input style={{ borderColor: 'white', width: 96, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} />
</div>
}
// value={this.state.parent}
/>
}
</div>
)
......@@ -1813,21 +1860,31 @@ export default class CorporateAnnualTargetOLPA extends Component {
<Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
</TableCell>
),
customBodyRender: (value, tableMeta, updateValue) => {
customBodyRender: (val, tableMeta, updateValue) => {
return (
<div style={{ width: 105 }}>
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<div style={{ flex: 1 }}>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text"
placeholder=""
disabled={true}
defaultValue={"SUM"}
/>
</div>
<Autocomplete
{...this.state.formulaYtdList}
id="formulaYtdList"
onChange={(event, newInputValue) => {
// updateValue(newInputValue)
handleChangeDropdown(newInputValue, tableMeta)
}
}
debug
disableClearable
value={handleValueDropdown(val, 'FORMULA', tableMeta)}
disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
style={{ padding: 0, margin: 0 }}
renderInput={(params) =>
<div ref={params.InputProps.ref} style={{ padding: 0, margin: 0 }}>
<input style={{ borderColor: 'white', width: 105, textAlign: 'center', padding: 0, margin: 0, color: handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ? "#5198ea" : "black" }} type="text" {...params.inputProps} />
</div>
}
// value={this.state.parent}
/>
}
</div>
)
......@@ -3092,7 +3149,8 @@ export default class CorporateAnnualTargetOLPA extends Component {
{this.state.loading && loadingComponent}
<MuiThemeProvider theme={getMuiTheme()}>
<MUIDataTable
data={this.state.dataTableDummy}
// data={this.state.dataTableDummy}
data={dataTable2}
columns={columns}
options={options}
/>
......
......@@ -265,7 +265,7 @@ export default class RollingOutlook extends Component {
item.number,
item.report_name,
item.revision,
this.state.isSubmit === false ? "CLOSED" : item.current_status,
this.state.quarter.value == 'q1' && !this.state.isApprovedMB? "CLOSED" : (this.state.quarter.value != 'q1' && !this.state.isApprovedRO ? "CLOSED" : (this.state.isSubmit === false ? "CLOSED" : item.current_status)),
item.report_id,
// Number(item.revision) > 0 ? (item.current_status == "not-yet" ? false : item.is_can_upload) : item.is_can_upload,
item.report_name === "Cash Flow" ? item.is_can_upload : (Number(item.revision) > 0 ? (item.current_status == "not-yet" ? false : item.is_can_upload) : item.is_can_upload),
......@@ -540,7 +540,11 @@ export default class RollingOutlook extends Component {
lastStatus: response.data.data.last_status === null ? 'SUBMIT' : response.data.data.last_status,
loading: false,
lastRevision: response.data.data.last_revision,
btnApprove: response.data.data.is_submit
btnApprove: response.data.data.is_submit,
isApprovedMB: response.data.data.is_approved_master_budget,
isApprovedRO: response.data.data.is_approved_rolling_before,
msgApproveMB: response.data.data.message_approval_master_budget,
msgApproveRO: response.data.data.message_approval_rolling_outlook
}, () => {
console.log(this.state.lastStatus);
this.historyApproval()
......@@ -1768,6 +1772,16 @@ export default class RollingOutlook extends Component {
</div>
)}
</div>
{this.state.quarter != null && this.state.quarter.value == 'q1' && this.state.isApprovedMB === false && (
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.msgApproveMB}</span>
</div>
)}
{this.state.quarter != null && this.state.quarter.value != 'q1' && this.state.isApprovedRO === false && (
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.msgApproveRO}</span>
</div>
)}
{this.state.checkApprover === true ?
this.state.lastStatus === 'WAITING FOR REVIEW' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
......@@ -1775,7 +1789,16 @@ export default class RollingOutlook extends Component {
</div> : this.state.lastStatus === 'WAITING FOR YOUR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.lastStatus}</span>
</div> : null
</div> : this.state.lastStatus === 'WAITING FOR APPROVAL' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus} - ${this.state.pic}`}</span>
</div> : this.state.lastStatus === 'REVISION' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{this.state.textRevision}</span>
</div> : this.state.lastStatus === 'APPROVED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
<span>{`${this.state.lastStatus}`}</span>
</div> : null
:
this.state.lastStatus === 'SUBMITTED' ?
<div style={{ width: '100%', padding: '10px 20px', backgroundColor: 'yellow', textAlign: 'center', marginTop: 20 }}>
......@@ -2008,6 +2031,7 @@ export default class RollingOutlook extends Component {
quarter={this.state.quarter.value}
isApprover={this.state.isApprover}
prevRevision={this.state.isSubmit ? this.state.prevRevision : true}
PLBSFAMSubmitted={this.state.lastStatus == 'APPROVED'? true : false}
/>
)}
......
......@@ -2289,7 +2289,7 @@ export default class BalanceSheetRO extends Component {
}
}
}, {
name: `${this.props.periode} Total Outlook`,
name: `31 Dec ${this.props.periode} Total Outlook`,
options: {
customHeadRender: (columnMeta) => (
<TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
......
......@@ -388,6 +388,7 @@ export default class CashFlow extends Component {
const handleValueFormula = (value, tableMeta, column, periode, forecast) => {
// console.log(tableMeta.rowData[5])
// console.log(column)
loading = true
let splitFormula = String(tableMeta.rowData[3]).split(/([()@])/)
let baru = []
......@@ -466,25 +467,26 @@ export default class CashFlow extends Component {
anjay.push(forecastt)
} else {
let tst = String(item).replace('[M-1]', '')
let data = column == 7 ? 18 : column - 1
let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
let tst = String(item).replace('[M-1]', '[M1]')
// let data = column == 7 ? 18 : column - 1
// let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
// console.log(tst)
let indexID = tableMeta.rowData[column].formula.findIndex((val) => val.item_formula == String(`@${tst}`))
if (indexID !== -1) {
let valuezz = tableMeta.rowData[data].formula[indexID].value
if (tableMeta.rowData[5] == "Cash at the beginning period" && column != 7) {
// console.log(data)
// console.log(dataTable2[tableMeta.rowIndex+1][5])
// console.log(dataTable2[tableMeta.rowIndex+1][data])
// console.log(dataTable2[tableMeta.rowIndex-1][data].value)
// console.log(dataTable2[tableMeta.rowIndex][data].value)
// console.log(dataTable2[tableMeta.rowIndex+1][data].value)
let valuezzz = dataTable2[tableMeta.rowIndex + 1][data].value
anjay.push(valuezzz == "" ? 0 : valuezzz)
} else {
let valuezz = tableMeta.rowData[column].formula[indexID].value
// if (tableMeta.rowData[5] == "Cash at the beginning period" && column == 9) {
// console.log(data)
// console.log(dataTable2[tableMeta.rowIndex+1][5])
// console.log(dataTable2[tableMeta.rowIndex+1][data])
// console.log(dataTable2[tableMeta.rowIndex-1][data].value)
// console.log(dataTable2[tableMeta.rowIndex][data].value)
// console.log(dataTable2[tableMeta.rowIndex+1][data].value)
// let valuezzz = dataTable2[tableMeta.rowIndex + 1][data].value
anjay.push(valuezz == "" ? 0 : valuezz)
}
// } else {
// anjay.push(valuezz == "" ? 0 : valuezz)
// }
}
}
} else {
......@@ -504,10 +506,10 @@ export default class CashFlow extends Component {
}
}
} else {
let indexID = dataTable2.findIndex((val) => val[22] == item)
let indexID = dataTable2.findIndex((val) => val[18] == item)
if (indexID !== -1) {
let valuezz = dataTable2[indexID][column].value == undefined ? dataTable2[indexID][column] : dataTable2[indexID][column].value
if (item == dataTable2[tableMeta.rowIndex][22]) {
if (item == dataTable2[tableMeta.rowIndex][18]) {
anjay.push(0)
} else {
anjay.push(valuezz == "" ? 0 : valuezz)
......@@ -517,6 +519,7 @@ export default class CashFlow extends Component {
anjay.push(-1)
}
}
}
}
})
......@@ -678,15 +681,23 @@ export default class CashFlow extends Component {
total = R.equals(total, NaN) ? "0.0" : total
// if (column == 9 && tableMeta.rowData[1] == 3243762) {
// console.log(tableMeta.rowData)
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// console.log(anjay2)
// console.log(total)
// }
if (tableMeta.rowData[5] == '2.1 Additional fixed assets and CIP' && column == 7) {
console.log(tableMeta.rowData)
console.log(splitFormula)
console.log(baru)
console.log(anjay)
console.log(anjay2)
console.log(total)
}
// if (tableMeta.rowData[5] == '2.1 Additional fixed assets and CIP' && column == 7) {
// console.log(tableMeta.rowData)
// console.log(splitFormula)
// console.log(baru)
// console.log(anjay)
// console.log(anjay2)
// console.log(total)
// }
if (dataTable2[tableMeta.rowIndex][column].value == undefined) {
dataTable2[tableMeta.rowIndex][column] = total
......
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