Commit b813368b authored by r.kurnia's avatar r.kurnia

cat olpa lupa push

parent 4eae37f3
......@@ -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
}
}
......
......@@ -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,10 +1624,9 @@ 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
{!this.state.loading && <FormControlLabel
style={{ margin: 0 }}
control={
<Input
......@@ -1632,52 +1635,51 @@ export default class CorporateAnnualTargetOLPA extends Component {
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 }}>
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
!handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
type="text"
placeholder=""
defaultValue={value}
color={"#5198ea"}
disabled={true}
defaultValue={"Rp Bio"}
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>
}
</div>
)
......@@ -1756,22 +1792,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={"HIG"}
/>
<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"}
<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>
}
</div>
)
......@@ -1813,22 +1860,32 @@ 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"}
/>
<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}
/>
......
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