import React, { Component } from 'react'; import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input } 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'; var ct = require("../../library/CustomTable"); const getMuiTheme = () => createMuiTheme(ct.customTable3()); const options = ct.customOptionsFixedColumn(); const style = { position: "sticky", left: 0, zIndex: 101, background: "white", }; const style2 = { position: "sticky", background: "white", zIndex: 100 }; export default class ProfitLoss extends Component { constructor(props) { super(props) this.state = { dataTable: [ // ["TOTAL ASSETS", "11,247,249", "10,702,196"], // ["TOTAL CURRENT ASSETS", "2,647,647", "2,058,898"], // ["Cash & Cash Equivalent", "1,464,571", "729,743"], // ["Cash & Bank Balance", "938,707", "265,584"], // ["Time & Call Deposit", "525,864", "464,159"], // ["BI Deposit", "", ""], // ["Marketable Securities", "150,250", "154,500"], // ["Notes Receivable", "", ""], // ["Accounts Receivable", "172,031", "97,112"], // ["Trade Receivables - Third Party", "142,668", "77,480"], ] } this.handleValue = this.handleValue.bind(this) } componentDidMount() { this.getItemHierarki() console.log(this.props); } 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 } api.create().getDetailReportMB(payload).then(response => { console.log(response); if (response.data) { if (response.data.status === "success") { let dataTable = [] response.data.data.map((item, index) => { if (item.children && item.children.length > 0) { dataTable.push([ item.type_report_id, item.id, item.parent, item.formula, item.level, item.description, item.profit_loss.notes === "" ? null : item.profit_loss.notes, item.profit_loss.total_actual_before, item.profit_loss.january, item.profit_loss.february, item.profit_loss.march, item.profit_loss.april, item.profit_loss.may, item.profit_loss.june, item.profit_loss.july, item.profit_loss.august, item.profit_loss.september, item.profit_loss.october, item.profit_loss.november, item.profit_loss.december, item.profit_loss.total_current_year, item.profit_loss.total_next_year, item.profit_loss.total_more_year ]) item.children.map(i => { if (i.children) { if (i.children.length > 0) { dataTable.push([ i.type_report_id, i.id, i.parent, i.formula, i.level, i.description, i.profit_loss.notes === "" ? null : item.profit_loss.notes, i.profit_loss.total_actual_before, i.profit_loss.january, i.profit_loss.february, i.profit_loss.march, i.profit_loss.april, i.profit_loss.may, i.profit_loss.june, i.profit_loss.july, i.profit_loss.august, i.profit_loss.september, i.profit_loss.october, i.profit_loss.november, i.profit_loss.december, i.profit_loss.total_current_year, i.profit_loss.total_next_year, i.profit_loss.total_more_year ]) i.children.map(val => { if (val.children && val.children.length > 0) { dataTable.push([ val.type_report_id, val.id, val.parent, val.formula, val.level, val.description, val.profit_loss.notes === "" ? null : item.profit_loss.notes, val.profit_loss.total_actual_before, val.profit_loss.january, val.profit_loss.february, val.profit_loss.march, val.profit_loss.april, val.profit_loss.may, val.profit_loss.june, val.profit_loss.july, val.profit_loss.august, val.profit_loss.september, val.profit_loss.october, val.profit_loss.november, val.profit_loss.december, val.profit_loss.total_current_year, val.profit_loss.total_next_year, val.profit_loss.total_more_year ]) val.children.map(items => { if (items.children && items.children.length > 0) { dataTable.push([ items.type_report_id, items.id, items.parent, items.formula, items.level, items.description, items.profit_loss.notes === "" ? null : item.profit_loss.notes, items.profit_loss.total_actual_before, items.profit_loss.january, items.profit_loss.february, items.profit_loss.march, items.profit_loss.april, items.profit_loss.may, items.profit_loss.june, items.profit_loss.july, items.profit_loss.august, items.profit_loss.september, items.profit_loss.october, items.profit_loss.november, items.profit_loss.december, items.profit_loss.total_current_year, items.profit_loss.total_next_year, items.profit_loss.total_more_year ]) items.children.map(itemss => { if (itemss.children && itemss.children.length > 0) { dataTable.push([ itemss.type_report_id, itemss.id, itemss.parent, itemss.formula, itemss.level, itemss.description, itemss.profit_loss.notes === "" ? null : item.profit_loss.notes, itemss.profit_loss.total_actual_before, itemss.profit_loss.january, itemss.profit_loss.february, itemss.profit_loss.march, itemss.profit_loss.april, itemss.profit_loss.may, itemss.profit_loss.june, itemss.profit_loss.july, itemss.profit_loss.august, itemss.profit_loss.september, itemss.profit_loss.october, itemss.profit_loss.november, itemss.profit_loss.december, itemss.profit_loss.total_current_year, itemss.profit_loss.total_next_year, itemss.profit_loss.total_more_year ]) itemss.children.map(item1 => { if (item1.children && item1.children.length > 0) { dataTable.push([ item1.type_report_id, item1.id, item1.parent, item1.formula, item1.level, item1.description, item1.profit_loss.notes === "" ? null : item.profit_loss.notes, item1.profit_loss.total_actual_before, item1.profit_loss.january, item1.profit_loss.february, item1.profit_loss.march, item1.profit_loss.april, item1.profit_loss.may, item1.profit_loss.june, item1.profit_loss.july, item1.profit_loss.august, item1.profit_loss.september, item1.profit_loss.october, item1.profit_loss.november, item1.profit_loss.december, item1.profit_loss.total_current_year, item1.profit_loss.total_next_year, item1.profit_loss.total_more_year ]) item1.children.map(item2 => { if (item2.children && item2.children.length > 0) { dataTable.push([ item2.type_report_id, item2.id, item2.parent, item2.formula, item2.level, item2.description, item2.profit_loss.notes === "" ? null : item.profit_loss.notes, item2.profit_loss.total_actual_before, item2.profit_loss.january, item2.profit_loss.february, item2.profit_loss.march, item2.profit_loss.april, item2.profit_loss.may, item2.profit_loss.june, item2.profit_loss.july, item2.profit_loss.august, item2.profit_loss.september, item2.profit_loss.october, item2.profit_loss.november, item2.profit_loss.december, item2.profit_loss.total_current_year, item2.profit_loss.total_next_year, item2.profit_loss.total_more_year ]) item2.children.map(item3 => { if (item3.children && item3.children.length > 0) { dataTable.push([ item3.type_report_id, item3.id, item3.parent, item3.formula, item3.level, item3.description, item3.profit_loss.notes === "" ? null : item.profit_loss.notes, item3.profit_loss.total_actual_before, item3.profit_loss.january, item3.profit_loss.february, item3.profit_loss.march, item3.profit_loss.april, item3.profit_loss.may, item3.profit_loss.june, item3.profit_loss.july, item3.profit_loss.august, item3.profit_loss.september, item3.profit_loss.october, item3.profit_loss.november, item3.profit_loss.december, item3.profit_loss.total_current_year, item3.profit_loss.total_next_year, item3.profit_loss.total_more_year ]) item3.children.map(item4 => { if (item4.children && item4.children.length > 0) { dataTable.push([ item4.type_report_id, item4.id, item4.parent, item4.formula, item4.level, item4.description, item4.profit_loss.notes === "" ? null : item.profit_loss.notes, item4.profit_loss.total_actual_before, item4.profit_loss.january, item4.profit_loss.february, item4.profit_loss.march, item4.profit_loss.april, item4.profit_loss.may, item4.profit_loss.june, item4.profit_loss.july, item4.profit_loss.august, item4.profit_loss.september, item4.profit_loss.october, item4.profit_loss.november, item4.profit_loss.december, item4.profit_loss.total_current_year, item4.profit_loss.total_next_year, item4.profit_loss.total_more_year ]) item4.children.map(item5 => { if (item5.children && item5.children.length > 0) { dataTable.push([ item5.type_report_id, item5.id, item5.parent, item5.formula, item5.level, item5.description, item5.profit_loss.notes === "" ? null : item.profit_loss.notes, item5.profit_loss.total_actual_before, item5.profit_loss.january, item5.profit_loss.february, item5.profit_loss.march, item5.profit_loss.april, item5.profit_loss.may, item5.profit_loss.june, item5.profit_loss.july, item5.profit_loss.august, item5.profit_loss.september, item5.profit_loss.october, item5.profit_loss.november, item5.profit_loss.december, item5.profit_loss.total_current_year, item5.profit_loss.total_next_year, item5.profit_loss.total_more_year ]) item5.children.map(item6 => { if (item6.children && item.children.length > 0) { dataTable.push([ item6.type_report_id, item6.id, item6.parent, item6.formula, item6.level, item6.description, item6.profit_loss.notes === "" ? null : item.profit_loss.notes, item6.profit_loss.total_actual_before, item6.profit_loss.january, item6.profit_loss.february, item6.profit_loss.march, item6.profit_loss.april, item6.profit_loss.may, item6.profit_loss.june, item6.profit_loss.july, item6.profit_loss.august, item6.profit_loss.september, item6.profit_loss.october, item6.profit_loss.november, item6.profit_loss.december, item6.profit_loss.total_current_year, item6.profit_loss.total_next_year, item6.profit_loss.total_more_year ]) } else { dataTable.push([ item6.type_report_id, item6.id, item6.parent, item6.formula, item6.level, item6.description, item6.profit_loss.notes === "" ? null : item.profit_loss.notes, item6.profit_loss.total_actual_before, item6.profit_loss.january, item6.profit_loss.february, item6.profit_loss.march, item6.profit_loss.april, item6.profit_loss.may, item6.profit_loss.june, item6.profit_loss.july, item6.profit_loss.august, item6.profit_loss.september, item6.profit_loss.october, item6.profit_loss.november, item6.profit_loss.december, item6.profit_loss.total_current_year, item6.profit_loss.total_next_year, item6.profit_loss.total_more_year ]) } }) } else { dataTable.push([ item5.type_report_id, item5.id, item5.parent, item5.formula, item5.level, item5.description, item5.profit_loss.notes === "" ? null : item.profit_loss.notes, item5.profit_loss.total_actual_before, item5.profit_loss.january, item5.profit_loss.february, item5.profit_loss.march, item5.profit_loss.april, item5.profit_loss.may, item5.profit_loss.june, item5.profit_loss.july, item5.profit_loss.august, item5.profit_loss.september, item5.profit_loss.october, item5.profit_loss.november, item5.profit_loss.december, item5.profit_loss.total_current_year, item5.profit_loss.total_next_year, item5.profit_loss.total_more_year ]) } }) } else { dataTable.push([ item4.type_report_id, item4.id, item4.parent, item4.formula, item4.level, item4.description, item4.profit_loss.notes === "" ? null : item.profit_loss.notes, item4.profit_loss.total_actual_before, item4.profit_loss.january, item4.profit_loss.february, item4.profit_loss.march, item4.profit_loss.april, item4.profit_loss.may, item4.profit_loss.june, item4.profit_loss.july, item4.profit_loss.august, item4.profit_loss.september, item4.profit_loss.october, item4.profit_loss.november, item4.profit_loss.december, item4.profit_loss.total_current_year, item4.profit_loss.total_next_year, item4.profit_loss.total_more_year ]) } }) } else { dataTable.push([ item3.type_report_id, item3.id, item3.parent, item3.formula, item3.level, item3.description, item3.profit_loss.notes === "" ? null : item.profit_loss.notes, item3.profit_loss.total_actual_before, item3.profit_loss.january, item3.profit_loss.february, item3.profit_loss.march, item3.profit_loss.april, item3.profit_loss.may, item3.profit_loss.june, item3.profit_loss.july, item3.profit_loss.august, item3.profit_loss.september, item3.profit_loss.october, item3.profit_loss.november, item3.profit_loss.december, item3.profit_loss.total_current_year, item3.profit_loss.total_next_year, item3.profit_loss.total_more_year ]) } }) } else { dataTable.push([ item2.type_report_id, item2.id, item2.parent, item2.formula, item2.level, item2.description, item2.profit_loss.notes === "" ? null : item.profit_loss.notes, item2.profit_loss.total_actual_before, item2.profit_loss.january, item2.profit_loss.february, item2.profit_loss.march, item2.profit_loss.april, item2.profit_loss.may, item2.profit_loss.june, item2.profit_loss.july, item2.profit_loss.august, item2.profit_loss.september, item2.profit_loss.october, item2.profit_loss.november, item2.profit_loss.december, item2.profit_loss.total_current_year, item2.profit_loss.total_next_year, item2.profit_loss.total_more_year ]) } }) } else { dataTable.push([ item1.type_report_id, item1.id, item1.parent, item1.formula, item1.level, item1.description, item1.profit_loss.notes === "" ? null : item.profit_loss.notes, item1.profit_loss.total_actual_before, item1.profit_loss.january, item1.profit_loss.february, item1.profit_loss.march, item1.profit_loss.april, item1.profit_loss.may, item1.profit_loss.june, item1.profit_loss.july, item1.profit_loss.august, item1.profit_loss.september, item1.profit_loss.october, item1.profit_loss.november, item1.profit_loss.december, item1.profit_loss.total_current_year, item1.profit_loss.total_next_year, item1.profit_loss.total_more_year ]) } }) } else { dataTable.push([ itemss.type_report_id, itemss.id, itemss.parent, itemss.formula, itemss.level, itemss.description, itemss.profit_loss.notes === "" ? null : item.profit_loss.notes, itemss.profit_loss.total_actual_before, itemss.profit_loss.january, itemss.profit_loss.february, itemss.profit_loss.march, itemss.profit_loss.april, itemss.profit_loss.may, itemss.profit_loss.june, itemss.profit_loss.july, itemss.profit_loss.august, itemss.profit_loss.september, itemss.profit_loss.october, itemss.profit_loss.november, itemss.profit_loss.december, itemss.profit_loss.total_current_year, itemss.profit_loss.total_next_year, itemss.profit_loss.total_more_year ]) } }) } else { dataTable.push([ items.type_report_id, items.id, items.parent, items.formula, items.level, items.description, items.profit_loss.notes === "" ? null : item.profit_loss.notes, items.profit_loss.total_actual_before, items.profit_loss.january, items.profit_loss.february, items.profit_loss.march, items.profit_loss.april, items.profit_loss.may, items.profit_loss.june, items.profit_loss.july, items.profit_loss.august, items.profit_loss.september, items.profit_loss.october, items.profit_loss.november, items.profit_loss.december, items.profit_loss.total_current_year, items.profit_loss.total_next_year, items.profit_loss.total_more_year ]) } }) } else { dataTable.push([ val.type_report_id, val.id, val.parent, val.formula, val.level, val.description, val.profit_loss.notes === "" ? null : item.profit_loss.notes, val.profit_loss.total_actual_before, val.profit_loss.january, val.profit_loss.february, val.profit_loss.march, val.profit_loss.april, val.profit_loss.may, val.profit_loss.june, val.profit_loss.july, val.profit_loss.august, val.profit_loss.september, val.profit_loss.october, val.profit_loss.november, val.profit_loss.december, val.profit_loss.total_current_year, val.profit_loss.total_next_year, val.profit_loss.total_more_year ]) } }) } else { dataTable.push([ i.type_report_id, i.id, i.parent, i.formula, i.level, i.description, i.profit_loss.notes === "" ? null : item.profit_loss.notes, i.profit_loss.total_actual_before, i.profit_loss.january, i.profit_loss.february, i.profit_loss.march, i.profit_loss.april, i.profit_loss.may, i.profit_loss.june, i.profit_loss.july, i.profit_loss.august, i.profit_loss.september, i.profit_loss.october, i.profit_loss.november, i.profit_loss.december, i.profit_loss.total_current_year, i.profit_loss.total_next_year, i.profit_loss.total_more_year ]) } } else { dataTable.push([ i.type_report_id, i.id, i.parent, i.formula, i.level, i.description, i.profit_loss.notes === "" ? null : item.profit_loss.notes, i.profit_loss.total_actual_before, i.profit_loss.january, i.profit_loss.february, i.profit_loss.march, i.profit_loss.april, i.profit_loss.may, i.profit_loss.june, i.profit_loss.july, i.profit_loss.august, i.profit_loss.september, i.profit_loss.october, i.profit_loss.november, i.profit_loss.december, i.profit_loss.total_current_year, i.profit_loss.total_next_year, i.profit_loss.total_more_year ]) } }) } else { dataTable.push([ item.type_report_id, item.id, item.parent, item.formula, item.level, item.description, item.profit_loss.notes === "" ? null : item.profit_loss.notes, item.profit_loss.total_actual_before, item.profit_loss.january, item.profit_loss.february, item.profit_loss.march, item.profit_loss.april, item.profit_loss.may, item.profit_loss.june, item.profit_loss.july, item.profit_loss.august, item.profit_loss.september, item.profit_loss.october, item.profit_loss.november, item.profit_loss.december, item.profit_loss.total_current_year, item.profit_loss.total_next_year, item.profit_loss.total_more_year ]) } }) // console.log(dataTable); this.setState({ loading: false, dataTable }) } } else { this.setState({ loading: false }) } }) } handleValue(data) { let total = 0 this.state.dataTable.map((item, index) => { if (data.rowData[1] == item[2]) { total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex])) } }) let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2]) let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total // console.log(indexParent); return a } handleChange(value, tableMeta) { let val = String(value).split(",").join("") let data = this.state.dataTable let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2]) if (indexParent > 0) { // console.log(indexParent) let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let jagain = data[indexParent][tableMeta.columnIndex] a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) } else { data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) } // this.forceUpdate() // console.log(this.state.dataTable) // this.setState({ // data: a, // }, () => console.log(this.state.dataTable)) } backToMasterBudget(type) { let data = [] console.log(this.state.dataTable) this.state.dataTable.map(i => { data.push({ item_report_id: i[1], notes: String(i[6]), total_actual_before: String(i[7]), january: String(i[8]), february: String(i[9]), march: String(i[10]), april: String(i[11]), may: String(i[12]), june: String(i[13]), july: String(i[14]), august: String(i[15]), september: String(i[16]), october: String(i[17]), november: String(i[18]), december: String(i[19]), total_current_year: String(i[20]), total_next_year: String(i[21]), total_more_year: String(i[22]) }) }) 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, "profit_loss": data } console.log(data); this.props.saveToMasterBudget(payload) this.props.onClickClose() } 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 Profit Loss.xlsx'; a.click(); } } render() { let dataTable2 = this.state.dataTable const handleChange = (value, tableMeta) => { let val = String(value).split(",").join("") // let data = this.state.dataTable2 let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2]) if (indexParent > 0) { // console.log(indexParent) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) let jagain = dataTable2[indexParent][tableMeta.columnIndex] a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val)) } else { dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val) } } const handleNotes = (value, tableMeta) => { console.log(value) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value console.log(dataTable2[tableMeta.rowIndex]); } const handleValue = (data) => { let total = 0 dataTable2.map((item, index) => { if (data.rowData[1] == item[2]) { total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex])) } }) let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2]) let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total) // console.log(indexParent); return a } const handleFormula = (data, tableMeta) => { let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g) let arrayJumlah = [] arrayFormula.map((item, indexs) => { let index = dataTable2.findIndex((val) => val[1] == item) if (index > 0) { arrayJumlah.push(dataTable2[index][tableMeta.columnIndex]) } else { arrayJumlah.push(item) } // if (indexs % 2 !== 0) { // operator.push(item) // } }) let array = arrayJumlah let total = 0 let opt = "" array.map((item, index) => { if (item == "+") { opt = "tambah" } else if (item == "-") { opt = "kurang" } else if (item == "*") { opt = "kali" } else if (item == "/") { opt = "bagi" } else { if (opt == "tambah") { total = Number(total) + Number(item) } else if (opt == "kurang") { total = Number(total) - Number(item) } else if (opt == "kali") { total = Number(total) * Number(item) } else if (opt == "bagi") { total = Number(total) / Number(item) } else { total += item } } }) let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total) return a } const columns = [{ name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "", options: { display: false } }, { name: "Account", options: { customHeadRender: (columnMeta) => ( <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style }), customBodyRender: (val, tableMeta) => { return ( <div style={{ width: 300 }}> {tableMeta.rowData[4] == 0 ? <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> : <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> </div> } </div> ) } } }, { name: "Notes", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> <div style={{ flex: 1 }}> {tableMeta.rowData[4] === 0 ? null : tableMeta.rowData[4] === 1 ? null : <FormControlLabel style={{ margin: 0 }} value={value} control={ <Input disableUnderline={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleNotes(event.target.value, tableMeta) console.log(dataTable2) }} /> } />} </div> </div> ) } } }, { name: "31 Dec 2020 Actual", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Jan 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Feb 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Mar 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Apr 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "May 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Jun 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Jul 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Aug 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Sep 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Oct 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Nov 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Dec 2021", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}> <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "Current Total", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "31 Dec 2022 Total", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } }, { name: "31 Dec 2023 Total", options: { customHeadRender: (columnMeta) => ( <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}> <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography> </TableCell> ), setCellProps: () => ({ style2 }), customBodyRender: (value, tableMeta, updateValue) => { return ( <div style={{ textAlign: 'right' }}> {tableMeta.rowData[0] === 3 ? <div style={{ flex: 1 }}> <FormControlLabel style={{ margin: 0 }} value={value} control={ <NumberFormat thousandSeparator={true} style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" value={value} onBlur={(event) => { // updateValue(event.target.value) handleChange(event.target.value, tableMeta) console.log(dataTable2) }} /> } /> </div> : tableMeta.rowData[0] === 2 ? <span style={{ fontSize: 12, textAlign: 'right' }}> <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleValue(tableMeta)} /> </span> : tableMeta.rowData[0] === 4 ? null : tableMeta.rowData[0] === 6 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 5 ? <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={handleFormula(value, tableMeta)} /> : tableMeta.rowData[0] === 1 ? value === "" ? null : <NumberFormat thousandSeparator={true} style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} type="text" placeholder="" disabled={true} value={Number(value)} /> : <span>validasi</span> } </div> ) } } } ] const loadingComponent = ( <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}> <PropagateLoader // css={override} size={20} color={"#274B80"} loading={this.state.loading} /> </div> ); return ( <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}> <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}> <Typography style={{ fontSize: '16px', color: 'white' }}>Pengajuan Budget Tahunan</Typography> </div> {this.state.loading && loadingComponent} <div style={{ flex: 1, padding: 20, width: '100%' }}> <Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Profit & Loss</Typography> </div> <div style={{ padding: 20 }}> <div style={{ display: 'flex', justifyContent: 'space-between' }}> <div> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Periode : {this.props.periode}</Typography> <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography> </div> <div style={{ width: '50%' }}> <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}> <a data-tip={'Download Template'} data-for="template"> <button style={{ backgroundColor: 'transparent', cursor: 'pointer', borderColor: 'transparent', margin: 5 }} onClick={() => this.downloadTemplate()} > <img src={Images.template} /> </button> </a> <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" /> <a data-tip={'Upload'} data-for="upload"> <button style={{ backgroundColor: 'transparent', cursor: 'pointer', borderColor: 'transparent', margin: 5 }} onClick={() => null} > <img src={Images.upload} /> </button> </a> <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" /> <a data-tip={'Download'} data-for="download"> <button style={{ backgroundColor: 'transparent', cursor: 'pointer', borderColor: 'transparent', margin: 5 }} onClick={() => null} > <img src={Images.download} /> </button> </a> <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> </div> </div> </div> <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> <MuiThemeProvider theme={getMuiTheme()}> <MUIDataTable data={dataTable2} columns={columns} options={options} /> </MuiThemeProvider> </div> </div> <div className="grid grid-2x" style={{ marginTop: 20 }}> <div className="col-1"> <button type="button" onClick={() => this.backToMasterBudget('draft')} style={{ backgroundColor: 'transparent', cursor: 'pointer', borderColor: 'transparent', outline: 'none' }} > <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography> </div> </button> </div> <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}> <button className="button" type="button" style={{ backgroundColor: 'transparent', cursor: 'pointer', borderColor: 'transparent', outline: 'none' }} onClick={() => { this.props.onClickClose() }} > <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960', marginRight: 20 }}> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> </div> </button> <button type="button" onClick={() => this.backToMasterBudget('submitted')} style={{ backgroundColor: 'transparent', cursor: 'pointer', borderColor: 'transparent', outline: 'none' }} > <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', marginRight: 20 }}> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save</Typography> </div> </button> <button className="button" type="button" style={{ backgroundColor: 'transparent', cursor: 'pointer', borderColor: 'transparent', outline: 'none' }} onClick={() => { this.forceUpdate() }} > <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Calculate</Typography> </div> </button> </div> </div> </Paper> </div> </div > ); } }