import React, { Component } from 'react'; import { Typography, Paper, createMuiTheme, ThemeProvider, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, withStyles, makeStyles, Snackbar } from '@material-ui/core'; import MUIDataTable from 'mui-datatables'; import NumberFormat from 'react-number-format'; import api from '../../api'; import AddIcon from '@material-ui/icons/Add'; import { values } from 'ramda'; import PropagateLoader from "react-spinners/PropagateLoader" import Images from '../../assets/Images'; import ReactTooltip from 'react-tooltip'; import Tooltip from '@material-ui/core/Tooltip'; import { titleCase } from '../../library/Utils'; import Constant from '../../library/Constant'; import { Alert, Autocomplete } from '@material-ui/lab'; import UploadFile from "../../library/Upload"; import { ExcelRenderer } from 'react-excel-renderer'; const LightTooltip = withStyles((theme) => ({ tooltip: { backgroundColor: theme.palette.common.white, color: 'rgba(0, 0, 0, 0.87)', boxShadow: theme.shadows[1], fontSize: 11, }, }))(Tooltip); var ct = require("../../library/CustomTable"); const getMuiTheme = () => createMuiTheme(ct.customTable3()); const options = ct.customOptionsFixedColumn(); const style = { position: "sticky", left: 0, background: "white", zIndex: 101, }; const style2 = { position: "sticky", background: "white", zIndex: 100 }; const theme = createMuiTheme({ overrides: { // Style sheet name ⚛️ MuiInputBase: { input: { color: '#5198ea' } } }, }); export default class CorporateAnnualTarget extends Component { constructor(props) { super(props) this.state = { dataTable: [ // ["FINANCIAL PERSPECTIVE", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181", "9,884,181"], // ["Control", "-", "-"], // ["Accumulated Depreciation (negative value)", "2,647,647", "2,058,898"], // ["Control", "-", "-"], // ["Gain / (Loss) on Fixed Assets", "-", "-"], // ["Control", "-", "-"] ], loading: false, uomList: [], formulaYtdList: { options: [{ value: 'SUM' }, { value: 'AVG' }, { value: 'LAST' }], getOptionLabel: (option) => titleCase(option.value), }, kpiTypeList: [], maxAchList: [], visibleCAT: true, buttonError: true, // formulaYTDList: null,, dataDelete: [], dataReal: [], buttonDraft: true, updateBy: '', handleTekTekTek: 0, editable: false } this.fileHandler = this.fileHandler.bind(this); } componentDidMount() { this.getKPIType() this.getMaxAch() this.getLatestUpdate() console.log(this.props.lastStatus); } getItemHierarki() { this.setState({ loading: true }) let payload = { "report_id": this.props.report_id, "revision": Number(this.props.revision), "periode": this.props.periode, "company_id": this.props.company.company_id, "submission_id": this.props.submissionID } console.log(JSON.stringify(payload)) api.create().getDetailReportMB(payload).then(response => { let dataTable = [] console.log(response) let res = response.data.data const handlePushChild = (item) => { let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) if (indexIDzz === -1) { let parentTrue = item.parent_name == 'INTERNAL BUSINESS PROCESS PERSPECTIVE' || item.parent_name == 'CUSTOMER PERSPECTIVE' dataTable.push([ item.type_report_id, item.id, item.parent, item.formula, item.level, "", item.description, item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.cat.weight).indexOf(".") == -1 ? item.cat.weight : `${Number(item.weight) * 100}%`), 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: item.cat.max_ach } : item.max_ach == "" ? null : { value: 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.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1), item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1), item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1), item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1), item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1), item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1), item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1), item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1), item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1), item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1), item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1), item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1), item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1), item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1), item.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 ]) } if (item.children !== null) { if (item.children.length > 0) { item.children.map((items, indexs) => { handlePushChild(items) }) } } } res.map((item, index) => { dataTable.push([ item.type_report_id, item.id, item.parent, item.formula, item.level, "", item.description, item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : item.cat.weight, item.cat.uom, item.kpi_type == "" ? null : { value: item.kpi_type }, item.max_ach == "" ? null : { value: 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.cat.january == "" ? item.cat.january : String(item.cat.january).indexOf(".") == -1 ? Number(item.cat.january) : Number(item.cat.january).toFixed(1), item.cat.february == "" ? item.cat.february : String(item.cat.february).indexOf(".") == -1 ? Number(item.cat.february) : Number(item.cat.february).toFixed(1), item.cat.march == "" ? item.cat.march : String(item.cat.march).indexOf(".") == -1 ? Number(item.cat.march) : Number(item.cat.march).toFixed(1), item.cat.april == "" ? item.cat.april : String(item.cat.april).indexOf(".") == -1 ? Number(item.cat.april) : Number(item.cat.april).toFixed(1), item.cat.may == "" ? item.cat.may : String(item.cat.may).indexOf(".") == -1 ? Number(item.cat.may) : Number(item.cat.may).toFixed(1), item.cat.june == "" ? item.cat.june : String(item.cat.june).indexOf(".") == -1 ? Number(item.cat.june) : Number(item.cat.june).toFixed(1), item.cat.july == "" ? item.cat.july : String(item.cat.july).indexOf(".") == -1 ? Number(item.cat.july) : Number(item.cat.july).toFixed(1), item.cat.august == "" ? item.cat.august : String(item.cat.august).indexOf(".") == -1 ? Number(item.cat.august) : Number(item.cat.august).toFixed(1), item.cat.september == "" ? item.cat.september : String(item.cat.september).indexOf(".") == -1 ? Number(item.cat.september) : Number(item.cat.september).toFixed(1), item.cat.october == "" ? item.cat.october : String(item.cat.october).indexOf(".") == -1 ? Number(item.cat.october) : Number(item.cat.october).toFixed(1), item.cat.november == "" ? item.cat.november : String(item.cat.november).indexOf(".") == -1 ? Number(item.cat.november) : Number(item.cat.november).toFixed(1), item.cat.december == "" ? item.cat.december : String(item.cat.december).indexOf(".") == -1 ? Number(item.cat.december) : Number(item.cat.december).toFixed(1), item.cat.total_current_year == "" ? item.cat.total_current_year : String(item.cat.total_current_year).indexOf(".") == -1 ? Number(item.cat.total_current_year) : Number(item.cat.total_current_year).toFixed(1), item.cat.total_next_year == "" ? item.cat.total_next_year : String(item.cat.total_next_year).indexOf(".") == -1 ? Number(item.cat.total_next_year) : Number(item.cat.total_next_year).toFixed(1), item.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 ]) if (item.children !== null) { if (item.children.length > 0) { item.children.map((items, indexs) => { handlePushChild(items) }) } } }) this.setState({ dataTable, loading: false, dataReal: res, editable: true }) }) } downloadTemplate = async () => { let res = await fetch( `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}` ) res = await res.blob() console.log(res) if (res.size > 0) { let url = window.URL.createObjectURL(res); let a = document.createElement('a'); a.href = url; a.download = 'Template Master Budget CAT.xlsx'; a.click(); } } async downloadAllData() { console.log('masuk') let bram = [this.props.submissionID, this.props.report_id, this.props.company.company_id, this.props.periode, this.props.revision] console.log(bram) let resReal = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let resNull = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}` let res = await fetch( this.props.submissionID == null? resNull : resReal ) res = await res.blob() console.log(res) this.setState({ loading: false }) if (res.size > 0) { let url = window.URL.createObjectURL(res); let a = document.createElement('a'); a.href = url; a.download = 'Master Budget CAT.xlsx'; a.click(); } } fileHandler = (event) => { let fileObj = event ExcelRenderer(fileObj, (err, resp) => { // console.log(resp) if (err) { console.log(err); } else { let isi = resp.rows.slice(3) console.log(isi); let payload = [] let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/; isi.map((i, index) => { if (i.length > 0) { let total = 0 let lastValz = 0 let nilaiTotal = 0 if (i[6] !== undefined) { if (i[6] == 'SUM' || i[6] == 'AVG' || i[6] == 'LAST') { i.map((items, indexs) => { if (indexs >= 8 && indexs <= 19) { let valItem = items == undefined || items == "" ? 0 : items total += Number(valItem) if (index == 19) { lastValz += Number(valItem) } } }) } nilaiTotal = i[6] == 'SUM'? total : i[6] == 'AVG'? total/12 : lastValz } console.log(nilaiTotal) payload.push({ item_report_id: i[0] === undefined ? "" : reg.test(String(i[0])) === false ? "" : String(i[0]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(), weight: i[2] === undefined ? "" : String(Number(i[2]*100) +'%'), uom: i[3] === undefined ? "" : String(i[3]).trim(), kpi_type: i[4] === undefined ? "" : String(i[4]).trim(), max_ach: i[5] === undefined ? "" : String(i[5]).toLocaleLowerCase() !== 'unlimited' ? String(Number(i[5]*100) + '%') : String(i[5]).trim(), formula: i[6] === undefined ? "" : String(i[6]).trim(), total_actual_before: i[7] === undefined ? "0.0" : reg.test(String(i[7])) === false ? "0.0" : String(Number(i[7]).toFixed(1)).trim(), january: i[8] === undefined ? "0.0" : reg.test(String(i[8])) === false ? "0.0" : String(Number(i[8]).toFixed(1)).trim(), february: i[9] === undefined ? "0.0" : reg.test(String(i[9])) === false ? "0.0" : String(Number(i[9]).toFixed(1)).trim(), march: i[10] === undefined ? "0.0" : reg.test(String(i[10])) === false ? "0.0" : String(Number(i[10].toFixed(1))).trim(), april: i[11] === undefined ? "0.0" : reg.test(String(i[11])) === false ? "0.0" : String(Number(i[11]).toFixed(1)).trim(), may: i[12] === undefined ? "0.0" : reg.test(String(i[12])) === false ? "0.0" : String(Number(i[12].toFixed(1))).trim(), june: i[13] === undefined ? "0.0" : reg.test(String(i[13])) === false ? "0.0" : String(Number(i[13].toFixed(1))).trim(), july: i[14] === undefined ? "0.0" : reg.test(String(i[14])) === false ? "0.0" : String(Number(i[14].toFixed(1))).trim(), august: i[15] === undefined ? "0.0" : reg.test(String(i[15])) === false ? "0.0" : String(Number(i[15]).toFixed(1)).trim(), september: i[16] === undefined ? "0.0" : reg.test(String(i[16])) === false ? "0.0" : String(Number(i[16]).toFixed(1)).trim(), october: i[17] === undefined ? "0.0" : reg.test(String(i[17])) === false ? "0.0" : String(Number(i[17]).toFixed(1)).trim(), november: i[18] === undefined ? "0.0" : reg.test(String(i[18])) === false ? "0.0" : String(Number(i[18]).toFixed(1)).trim(), december: i[19] === undefined ? "0.0" : reg.test(String(i[19])) === false ? "0.0" : String(Number(i[19]).toFixed(1)).trim(), total_current_year: i[20] == 0? "0.0" : String(Number(nilaiTotal).toFixed(1)).trim(), total_next_year: i[21] === undefined ? "0.0" : reg.test(String(i[21])) === false ? "0.0" : String(Number(i[21]).toFixed(1)).trim(), total_more_year: i[22] === undefined ? "0.0" : reg.test(String(i[22])) === false ? "0.0" : String(Number(i[22]).toFixed(1)).trim(), strategic: i[23] === undefined ? "" : String(i[23]).trim(), pic: i[24] === undefined ? "" : String(i[24]).trim() }) } }) let body = { company_id: this.props.company.company_id, periode: this.props.periode, report_id: this.props.report_id, status: '', cat: payload } console.log(body) this.setState({ payload: body, judul: resp.rows[1][0] }) } }); } checkUpload() { this.setState({loading: true}) let dataDelete = this.state.dataDelete api.create().getIdDeleteFromExcel(this.state.payload).then((response) => { if (response.data) { // console.log(response.data) let idDelete = response.data.data.item_report_id if (idDelete.length > 0) { idDelete.map((item, index) => { dataDelete.push(item) }) this.setState({ dataDelete }) } } }) console.log(JSON.stringify(this.state.payload)) api.create().checkUploadMB(this.state.payload).then(response => { // console.log(JSON.stringify(this.state.payload)); console.log(response) if (response.data) { if (response.data.status === 'success') { // this.setState({ visibleUpload: false, visibleCAT: false }) this.setState({ visibleUpload: false, visibleCAT: false }) let dataTable = response.data.data.map((item, index) => { return [ item.type_report_id, item.item_report_id, item.parent, item.formula, item.level == null? 1 : item.level, "", item.item_report, item.type_report_id == 1 ? `${Number(item.weight) * 100}%` : (String(item.weight).indexOf(".") == -1 ? item.weight : `${Number(item.weight) * 100}%`), item.uom, item.kpi_type == "" || item.kpi_type == null ? null : { value: item.kpi_type }, item.max_ach == "" || item.max_ach == null ? null : { value: item.max_ach }, item.formula_ytd == "" || item.formula_ytd == null ? null : { value: item.formula_ytd }, item.total_actual_before == "" ? item.total_actual_before : String(item.total_actual_before).indexOf(".") == -1 ? Number(item.total_actual_before) : Number(item.total_actual_before).toFixed(1), item.january == "" ? item.january : String(item.january).indexOf(".") == -1 ? Number(item.january) : Number(item.january).toFixed(1), item.february == "" ? item.february : String(item.february).indexOf(".") == -1 ? Number(item.february) : Number(item.february).toFixed(1), item.march == "" ? item.march : String(item.march).indexOf(".") == -1 ? Number(item.march) : Number(item.march).toFixed(1), item.april == "" ? item.april : String(item.april).indexOf(".") == -1 ? Number(item.april) : Number(item.april).toFixed(1), item.may == "" ? item.may : String(item.may).indexOf(".") == -1 ? Number(item.may) : Number(item.may).toFixed(1), item.june == "" ? item.june : String(item.june).indexOf(".") == -1 ? Number(item.june) : Number(item.june).toFixed(1), item.july == "" ? item.july : String(item.july).indexOf(".") == -1 ? Number(item.july) : Number(item.july).toFixed(1), item.august == "" ? item.august : String(item.august).indexOf(".") == -1 ? Number(item.august) : Number(item.august).toFixed(1), item.september == "" ? item.september : String(item.september).indexOf(".") == -1 ? Number(item.september) : Number(item.september).toFixed(1), item.october == "" ? item.october : String(item.october).indexOf(".") == -1 ? Number(item.october) : Number(item.october).toFixed(1), item.november == "" ? item.november : String(item.november).indexOf(".") == -1 ? Number(item.november) : Number(item.november).toFixed(1), item.december == "" ? item.december : String(item.december).indexOf(".") == -1 ? Number(item.december) : Number(item.december).toFixed(1), item.total_current_year == "" ? item.total_current_year : String(item.total_current_year).indexOf(".") == -1 ? Number(item.total_current_year) : Number(item.total_current_year).toFixed(1), item.total_next_year == "" ? item.total_next_year : String(item.total_next_year).indexOf(".") == -1 ? Number(item.total_next_year) : Number(item.total_next_year).toFixed(1), item.total_more_year == "" ? item.total_more_year : String(item.total_more_year).indexOf(".") == -1 ? Number(item.total_more_year) : Number(item.total_more_year).toFixed(1), item.strategic, item.pic, item.error ] }) console.log(dataTable) console.log(this.state.buttonError) this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => { this.state.dataTable.map(item => { if (item[30].length > 0) { console.log('masuk') this.setState({ buttonError: true, errorPreview: true, editable: true }) } }) // console.log(this.state.dataTable); }) } } }) } uploadCAT(type) { let payload = { "item_report_id": this.state.dataDelete } if (this.state.dataDelete.length > 0) { api.create().deleteAllItemReport(payload).then((response) => { this.functionUpload(type) }) } else { this.functionUpload(type) } } functionUpload(type) { let data = [] console.log(this.state.dataTable) this.state.dataTable.map(i => { data.push({ "item_report_id": i[1] == "" ? null : i[1], "item_report": String(i[6]), "weight": String(i[7]), "uom": String(i[8]), "kpi_type": i[9] == null ? "" : i[9].value, "max_ach": i[10] == null ? "" : i[10].value, "formula": i[11] == null ? "" : i[11].value, "total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]), "january": String(i[13]) == "" ? "0.0" : String(i[13]), "february": String(i[14]) == "" ? "0.0" : String(i[14]), "march": String(i[15]) == "" ? "0.0" : String(i[15]), "april": String(i[16]) == "" ? "0.0" : String(i[16]), "may": String(i[17]) == "" ? "0.0" : String(i[17]), "june": String(i[18]) == "" ? "0.0" : String(i[18]), "july": String(i[19]) == "" ? "0.0" : String(i[19]), "august": String(i[20]) == "" ? "0.0" : String(i[20]), "september": String(i[21]) == "" ? "0.0" : String(i[21]), "october": String(i[22]) == "" ? "0.0" : String(i[22]), "november": String(i[23]) == "" ? "0.0" : String(i[23]), "december": String(i[24]) == "" ? "0.0" : String(i[24]), "total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]), "total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]), "total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]), "strategic": String(i[28]), "pic": String(i[29]) }) }) let body = { "report_id": this.props.report_id, // "revision": Number(this.props.revision), "periode": this.props.periode, "company_id": this.props.company.company_id, "submission_id": this.props.submissionID, "status": type, "cat": data } console.log(data); console.log(JSON.stringify(body)) api.create('UPLOAD').uploadMasterBudget(body).then(response => { console.log(response); if (response.data) { if (response.data.status === "success") { this.props.onClickClose() this.props.getReport() } else { alert(response.data.status) } } else { alert(response.problem) } }) } handleValidate() { let data = [] console.log(this.state.dataTable) let totalWeight = 0 let dataTableBaru = this.state.dataTable let dataTampung = [] let weightReal = null this.state.dataTable.map((i, index) => { if (i[0] ==1) { dataTampung.push({ id: i[1], maxValue: i[7], valChild: 0 }) } if (i[0] !== 1 && i[0] !== 4) { totalWeight += Number(i[7] == "" || i[7] == undefined? 0 : i[7].replace('%', '')) } if (i[2] !== null) { let indexID = dataTampung.findIndex((val) => val.id == i[2]) if (indexID !== -1) { let weightParent = Number(dataTampung[indexID].maxValue == "" || dataTampung[indexID].maxValue == undefined? 0 : dataTampung[indexID].maxValue.replace('%', '')) let valChild = Number(dataTampung[indexID].valChild) let valReal = Number(i[7] == "" || i[7] == undefined? 0 : i[7].replace('%', '')) let totalBaru = valChild + valReal if (totalBaru > weightParent) { dataTableBaru[index][7] = `${(weightParent - valChild)}%` dataTampung[indexID].valChild = dataTampung[indexID].valChild + weightParent - valChild weightReal = `${(weightParent - valChild)}%` } else { dataTableBaru[index][7] = i[7] weightReal = i[7] dataTampung[indexID].valChild = dataTampung[indexID].valChild + Number(i[7] == "" || i[7] == undefined? 0 : i[7].replace('%', '')) } } } data.push({ "item_report_id": i[1] == "" ? null : i[1], "item_name": String(i[6]), "parent": i[2] == "" ? null : i[2], "weight": weightReal == null? String(i[7]) : weightReal, "uom": String(i[8]), "kpi_type": i[9] == null ? "" : i[9].value, "max_ach": i[10] == null ? "" : i[10].value, "formula": i[11] == null ? "" : i[11].value, "total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]), "january": String(i[13]) == "" ? "0.0" : String(i[13]), "february": String(i[14]) == "" ? "0.0" : String(i[14]), "march": String(i[15]) == "" ? "0.0" : String(i[15]), "april": String(i[16]) == "" ? "0.0" : String(i[16]), "may": String(i[17]) == "" ? "0.0" : String(i[17]), "june": String(i[18]) == "" ? "0.0" : String(i[18]), "july": String(i[19]) == "" ? "0.0" : String(i[19]), "august": String(i[20]) == "" ? "0.0" : String(i[20]), "september": String(i[21]) == "" ? "0.0" : String(i[21]), "october": String(i[22]) == "" ? "0.0" : String(i[22]), "november": String(i[23]) == "" ? "0.0" : String(i[23]), "december": String(i[24]) == "" ? "0.0" : String(i[24]), "total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]), "total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]), "total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]), "strategic": String(i[28]), "pic": String(i[29]) }) }) console.log(dataTableBaru) console.log(JSON.stringify(data)) let payload = { "submission_id": this.props.submissionID, "company_id": this.props.company.company_id, "periode": this.props.periode, "report_id": this.props.report_id, "status": "submitted", "cat": data } console.log(totalWeight) // this.setState({dataTable: dataTampung}) if (totalWeight < 100) { this.setState({ alert: true, messageAlert: 'Total weight less than 100%', tipeAlert: 'warning', loading: false, buttonError: true, editable: true}) } else { api.create().validateSubmitReport(payload).then((response) => { console.log(response) if (response.data.data.result) { this.setState({ loading: false, buttonError: false, editable: false }) } else { this.setState({ loading: false, buttonError: true, editable: true }) } }) } } closeAlert() { this.setState({ alert: false }) } backToMasterBudget(type) { let data = [] console.log(this.state.dataTable) this.state.dataTable.map(i => { // console.log(i[9] == null? "" : i[9].value) data.push({ "item_report_id": i[1] == "" ? null : i[1], "item_name": String(i[6]), "parent": i[2] == "" ? null : i[2], "weight": String(i[7]), "uom": String(i[8]), "kpi_type": i[9] == null ? "" : i[9].value, "max_ach": i[10] == null ? "" : i[10].value, "formula": i[11] == null ? "" : i[11].value, "total_actual_before": String(i[12]) == "" ? "0.0" : String(i[12]), "january": String(i[13]) == "" ? "0.0" : String(i[13]), "february": String(i[14]) == "" ? "0.0" : String(i[14]), "march": String(i[15]) == "" ? "0.0" : String(i[15]), "april": String(i[16]) == "" ? "0.0" : String(i[16]), "may": String(i[17]) == "" ? "0.0" : String(i[17]), "june": String(i[18]) == "" ? "0.0" : String(i[18]), "july": String(i[19]) == "" ? "0.0" : String(i[19]), "august": String(i[20]) == "" ? "0.0" : String(i[20]), "september": String(i[21]) == "" ? "0.0" : String(i[21]), "october": String(i[22]) == "" ? "0.0" : String(i[22]), "november": String(i[23]) == "" ? "0.0" : String(i[23]), "december": String(i[24]) == "" ? "0.0" : String(i[24]), "total_current_year": String(i[25]) == "" ? "0.0" : String(i[25]), "total_next_year": String(i[26]) == "" ? "0.0" : String(i[26]), "total_more_year": String(i[27]) == "" ? "0.0" : String(i[27]), "strategic": String(i[28]), "pic": String(i[29]) }) }) console.log(JSON.stringify(data)) let payload = { "submission_id": this.props.submissionID, "company_id": this.props.company.company_id, "periode": this.props.periode, "report_id": this.props.report_id, "status": type, "cat": data } console.log(JSON.stringify(payload)); this.deleteReport(payload) } deleteReport(payloadBro) { let payload = { "item_report_id": this.state.dataDelete } if (this.state.dataDelete.length > 0) { api.create().deleteAllItemReport(payload).then((response) => { console.log(response) // api.create().validateSubmitReport(payloadBro).then((response) => { // console.log(response) // if (response.data.data.result) { this.props.saveToMasterBudget(payloadBro) this.props.onClickClose() // } else { // } // }) }) } else { // console.log('sini jing') // api.create().validateSubmitReport(payloadBro).then((response) => { // console.log(response) // if (response.data.data.result) { this.props.saveToMasterBudget(payloadBro) this.props.onClickClose() // } else { // } // }) } } getKPIType() { let body = { group: 'CAT', company_id: this.props.company.company_id, type: 'KPI_TYPE' } api.create().getAllSettingByType(body).then(response => { // console.log(response) if (response.data) { if (response.ok) { if (response.data.status === 'success') { let data = response.data.data console.log(data) let inputKPI = [] data.map((item) => { inputKPI.push({ value: item.value }) }) let defaultProps = { options: inputKPI, getOptionLabel: (option) => titleCase(option.value), }; console.log(defaultProps) this.setState({ kpiTypeList: defaultProps }) } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { if (response.data.message.includes("Someone Logged In")) { setTimeout(() => { localStorage.removeItem(Constant.TOKEN) window.location.reload(); }, 1000); } }) // alert(response.data.message) } } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) } } else { this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) } }) } getMaxAch() { let body = { group: 'CAT', company_id: this.props.company.company_id, type: 'MAX_ACHIEVEMENT' } api.create().getAllSettingByType(body).then(response => { if (response.data) { if (response.ok) { if (response.data.status === 'success') { let data = response.data.data let inputMaxAch = data.map((item) => { return { value: item.value } }) let defaultProps = { options: inputMaxAch, getOptionLabel: (option) => titleCase(option.value), }; // setTimeout(() => { this.setState({ maxAchList: defaultProps }) // }, 300); } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => { if (response.data.message.includes("Someone Logged In")) { setTimeout(() => { localStorage.removeItem(Constant.TOKEN) window.location.reload(); }, 1000); } }) // alert(response.data.message) } } else { this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' }) } } else { this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' }) } this.getItemHierarki() }) } getLatestUpdate() { let payload = { "report_id": this.props.report_id, "revision": Number(this.props.revision), "periode": this.props.periode, "company_id": this.props.company.company_id, "submission_id": this.props.submissionID } api.create().getLastestUpdateMB(payload).then(response => { if (response.data) { if (response.data.status === "success") { this.setState({ updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update }) } } }) } render() { let dataTable2 = this.state.dataTable let dataDelete = this.state.dataDelete const handleChange = (value, tableMeta) => { let val = String(value).split(",").join("") // let total = 0 // let lastValz = 0 dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) // dataTable2[tableMeta.rowIndex].map((item, index) => { // if (index >= 13 && index <= 24) { // let valItem = item == undefined || item == "" ? 0 : item // total += Number(valItem) // if (index == 24) { // lastValz += Number(valItem) // } // } // }) // let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value // dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) // console.log(dataTable2[tableMeta.rowIndex]) } const handleChangeDropdown = (value, tableMeta) => { dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value let valz = value.value let total = 0 let lastValz = 0 if (valz == 'SUM' || valz == 'AVG' || valz == 'LAST') { dataTable2[tableMeta.rowIndex].map((item, index) => { if (index >= 13 && index <= 24) { let valItem = item == undefined || item == "" ? 0 : item total += Number(valItem) if (index == 24) { lastValz += Number(valItem) } } }) dataTable2[tableMeta.rowIndex][25] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) } } const handleChangePercentage = (value, tableMeta) => { // let valueReal = value.replace('%', '') // let indexParentDatatable = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2]) // let indexParentReal = this.state.dataReal.findIndex((val) => val.id == tableMeta.rowData[2]) // let valParent = dataTable2[indexParentDatatable][7] // valParent.replace('%', '') // let valChild = 0 // dataTable2.map((item, index) => { // if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) { // let weightItem = item[7] == "" ? 0 : item[7].replace('%', '') // console.log(weightItem) // valChild += Number(weightItem) // } // }) // let endVal = '' // if ((Number(valueReal) + Number(valChild)) > Number(valParent.replace('%', ''))) { // endVal = `${Number(valParent.replace('%', '')) - (Number(valChild))}%` // console.log(endVal) // } else { // endVal = `${Number(valueReal)}%` // console.log(endVal) // } // // console.log(endVal) // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = endVal dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value } const handleChangeText = (value, tableMeta) => { console.log(value) dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value // this.setState({dataTable: dataTable2}) } const handleAction = (idParent, typeReport) => { if (idParent !== null) { let indexsss = dataTable2.findIndex((val) => val[1] == idParent) if (dataTable2[indexsss][6] == 'CUSTOMER PERSPECTIVE' || dataTable2[indexsss][6] == 'INTERNAL BUSINESS PROCESS PERSPECTIVE') { return true } else { return false } } else { if (typeReport == null) { return true } else { return false } } } const handleTambah = (data, rowIndex) => { console.log(dataTable2) let newData = [] dataTable2.map((item, index) => { newData.push(item) if (index == rowIndex) { newData.push([ 3, "", item[2], item[3], item[4], "", "", "", "", null, null, null, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ]) } }) dataTable2 = newData this.setState({ dataTable: dataTable2 }, () => { setTimeout(() => { this.setState({ loading: false }) }, 500) }) } const handleDelete = (index) => { if (dataTable2[index][1] !== "") { dataDelete.push(dataTable2[index][1]) } dataTable2.splice(index, 1) this.setState({ dataTable: dataTable2, dataDelete }, () => { setTimeout(() => { this.setState({ loading: false }) }, 500) }) } const handleTotal = (tableMeta) => { // let val = String(value).split(",").join("") let total = 0 let lastValz = 0 dataTable2[tableMeta.rowIndex].map((item, index) => { if (index >= 13 && index <= 24) { let valItem = item == undefined || item == "" ? 0 : item total += Number(valItem) if (index == 24) { lastValz += Number(valItem) } } }) let valz = dataTable2[tableMeta.rowIndex][11] == null ? 'SUM' : dataTable2[tableMeta.rowIndex][11].value dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) return (valz == 'SUM' ? total : (valz == 'AVG' ? (total / 12) : lastValz)) } const columns = [{ name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { filter: false, display: this.props.isApprover ? false : true, customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (val, tableMeta) => { return ( // handleAction(tableMeta.rowData[2]) && handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) &&
{/* {tableMeta.rowData[6] === "Active" ? */} { }
); } } }, { name: "Key Performance Indicator", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style }), customBodyRender: (val, tableMeta) => { return ( tableMeta.rowData[1] == "" ?
{ console.log(event.target.value) handleChangeText(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
:
{tableMeta.rowData[30] ? tableMeta.rowData[30].length > 0 ?
{tableMeta.rowData[0] === 4 ? "" : val}
: tableMeta.rowData[4] == 0 ? {String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()} : tableMeta.rowData[1] == null ?
{tableMeta.rowData[0] === 4 ? "" : val}
:
{tableMeta.rowData[0] === 4 ? "" : val}
: tableMeta.rowData[4] == 0 ? {String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()} : tableMeta.rowData[1] == null ?
{tableMeta.rowData[0] === 4 ? "" : val}
:
{tableMeta.rowData[0] === 4 ? "" : val}
}
) } } }, { name: "Weight", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return (
{tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 1 ? value :
{ // updateValue(some) handleChangePercentage(event.target.value, tableMeta) }} /> } />
}
) } } }, { name: "UOM", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta, updateValue) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : { console.log(event.target.value) // updateValue(event.target.value) handleChangeText(event.target.value, tableMeta) console.log(dataTable2) }} /> : { console.log(event.target.value) // updateValue(event.target.value) handleChangeText(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> }
) } } }, { name: "KPI Type", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (val, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : handleChangeDropdown(newInputValue, tableMeta)} debug disableClearable disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])} value={val} style={{ padding: 0, margin: 0 }} renderInput={(params) =>
} /> }
) } } }, { name: "Max Ach.", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (val, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : handleChangeDropdown(newInputValue, tableMeta)} debug disableClearable value={val} style={{ padding: 0, margin: 0 }} disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])} renderInput={(params) =>
} // value={this.state.parent} /> }
) } } }, { name: "Formula YTD", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (val, tableMeta, updateValue) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : { // updateValue(newInputValue) handleChangeDropdown(newInputValue, tableMeta) } } debug disableClearable value={val} disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])} style={{ padding: 0, margin: 0 }} renderInput={(params) =>
} // value={this.state.parent} /> }
) } } }, { name: `${Number(this.props.periode) - 1}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Jan ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Feb ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Mar ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Apr ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `May ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Jun ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Jul ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Aug ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Sep ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Oct ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Nop ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `Dec ${this.props.periode}`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `${this.props.periode} Total`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : { // // updateValue(event.target.value) // handleChange(event.target.value, tableMeta) // console.log(dataTable2) // }} /> } /> }
) } } }, { name: `${Number(this.props.periode) + 1} Total`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: `${Number(this.props.periode) + 2} Total`, options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null :
{ // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } />
}
) } } }, { name: "Strategic Initiative", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : { console.log(event.target.value) handleChangeText(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> }
) } } }, { name: "PIC", options: { customHeadRender: (columnMeta) => ( {columnMeta.name} ), customBodyRender: (value, tableMeta) => { return (
{tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ? null : { console.log(event.target.value) // updateValue(event.target.value) handleChangeText(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> }
) } } } ] const loadingComponent = (
); return (
Master Budget Submission
{/* {this.state.loading && loadingComponent} */} this.closeAlert()}> this.closeAlert()} severity={this.state.tipeAlert}> {this.state.messageAlert}
{this.state.visibleCAT ?
Master Budget - Corporate Annual Target
{this.props.company.company_name} Period : {this.props.periode} (rev.{this.props.revision}) in IDR mn
{!this.props.isApprover &&
{((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') ) && } {((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') ) && }
}
{this.state.loading && loadingComponent}
Last Updated by : {this.state.updateBy}
{!this.props.isApprover &&
{((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') ) && } {((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') ) && } {((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') ) && }
}
:
{this.props.company.company_name} Period : {this.props.periode} in IDR mn
{this.state.dataLoaded && (
{this.state.loading && loadingComponent}
)}
{!this.props.isApprover &&
{(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && } {(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && } {(this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && }
}
}
{this.state.visibleUpload && (
Upload File
{ this.fileHandler(dt) this.setState({ uploadStatus: 'idle', percentage: '0' }) }} onUpload={() => { this.state.judul === "MASTER BUDGET - CAT" ? this.checkUpload() : this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) }} />
)}
); } }