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'; import UploadFile from "../../library/Upload"; import { ExcelRenderer } from 'react-excel-renderer'; 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 BalanceSheet 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"], ], visibleBalanceSheet: true, disabledSave: true } this.handleValue = this.handleValue.bind(this) this.fileHandler = this.fileHandler.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.balance_sheet.total_actual_before, item.balance_sheet.january, item.balance_sheet.february, item.balance_sheet.march, item.balance_sheet.april, item.balance_sheet.may, item.balance_sheet.june, item.balance_sheet.july, item.balance_sheet.august, item.balance_sheet.september, item.balance_sheet.october, item.balance_sheet.november, item.balance_sheet.december, item.balance_sheet.total_current_year, item.balance_sheet.total_next_year, item.balance_sheet.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.balance_sheet.total_actual_before, i.balance_sheet.january, i.balance_sheet.february, i.balance_sheet.march, i.balance_sheet.april, i.balance_sheet.may, i.balance_sheet.june, i.balance_sheet.july, i.balance_sheet.august, i.balance_sheet.september, i.balance_sheet.october, i.balance_sheet.november, i.balance_sheet.december, i.balance_sheet.total_current_year, i.balance_sheet.total_next_year, i.balance_sheet.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.balance_sheet.total_actual_before, val.balance_sheet.january, val.balance_sheet.february, val.balance_sheet.march, val.balance_sheet.april, val.balance_sheet.may, val.balance_sheet.june, val.balance_sheet.july, val.balance_sheet.august, val.balance_sheet.september, val.balance_sheet.october, val.balance_sheet.november, val.balance_sheet.december, val.balance_sheet.total_current_year, val.balance_sheet.total_next_year, val.balance_sheet.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.balance_sheet.total_actual_before, items.balance_sheet.january, items.balance_sheet.february, items.balance_sheet.march, items.balance_sheet.april, items.balance_sheet.may, items.balance_sheet.june, items.balance_sheet.july, items.balance_sheet.august, items.balance_sheet.september, items.balance_sheet.october, items.balance_sheet.november, items.balance_sheet.december, items.balance_sheet.total_current_year, items.balance_sheet.total_next_year, items.balance_sheet.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.balance_sheet.total_actual_before, itemss.balance_sheet.january, itemss.balance_sheet.february, itemss.balance_sheet.march, itemss.balance_sheet.april, itemss.balance_sheet.may, itemss.balance_sheet.june, itemss.balance_sheet.july, itemss.balance_sheet.august, itemss.balance_sheet.september, itemss.balance_sheet.october, itemss.balance_sheet.november, itemss.balance_sheet.december, itemss.balance_sheet.total_current_year, itemss.balance_sheet.total_next_year, itemss.balance_sheet.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.balance_sheet.total_actual_before, item1.balance_sheet.january, item1.balance_sheet.february, item1.balance_sheet.march, item1.balance_sheet.april, item1.balance_sheet.may, item1.balance_sheet.june, item1.balance_sheet.july, item1.balance_sheet.august, item1.balance_sheet.september, item1.balance_sheet.october, item1.balance_sheet.november, item1.balance_sheet.december, item1.balance_sheet.total_current_year, item1.balance_sheet.total_next_year, item1.balance_sheet.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.balance_sheet.total_actual_before, item2.balance_sheet.january, item2.balance_sheet.february, item2.balance_sheet.march, item2.balance_sheet.april, item2.balance_sheet.may, item2.balance_sheet.june, item2.balance_sheet.july, item2.balance_sheet.august, item2.balance_sheet.september, item2.balance_sheet.october, item2.balance_sheet.november, item2.balance_sheet.december, item2.balance_sheet.total_current_year, item2.balance_sheet.total_next_year, item2.balance_sheet.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.balance_sheet.total_actual_before, item3.balance_sheet.january, item3.balance_sheet.february, item3.balance_sheet.march, item3.balance_sheet.april, item3.balance_sheet.may, item3.balance_sheet.june, item3.balance_sheet.july, item3.balance_sheet.august, item3.balance_sheet.september, item3.balance_sheet.october, item3.balance_sheet.november, item3.balance_sheet.december, item3.balance_sheet.total_current_year, item3.balance_sheet.total_next_year, item3.balance_sheet.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.balance_sheet.total_actual_before, item4.balance_sheet.january, item4.balance_sheet.february, item4.balance_sheet.march, item4.balance_sheet.april, item4.balance_sheet.may, item4.balance_sheet.june, item4.balance_sheet.july, item4.balance_sheet.august, item4.balance_sheet.september, item4.balance_sheet.october, item4.balance_sheet.november, item4.balance_sheet.december, item4.balance_sheet.total_current_year, item4.balance_sheet.total_next_year, item4.balance_sheet.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.balance_sheet.total_actual_before, item5.balance_sheet.january, item5.balance_sheet.february, item5.balance_sheet.march, item5.balance_sheet.april, item5.balance_sheet.may, item5.balance_sheet.june, item5.balance_sheet.july, item5.balance_sheet.august, item5.balance_sheet.september, item5.balance_sheet.october, item5.balance_sheet.november, item5.balance_sheet.december, item5.balance_sheet.total_current_year, item5.balance_sheet.total_next_year, item5.balance_sheet.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.balance_sheet.total_actual_before, item6.balance_sheet.january, item6.balance_sheet.february, item6.balance_sheet.march, item6.balance_sheet.april, item6.balance_sheet.may, item6.balance_sheet.june, item6.balance_sheet.july, item6.balance_sheet.august, item6.balance_sheet.september, item6.balance_sheet.october, item6.balance_sheet.november, item6.balance_sheet.december, item6.balance_sheet.total_current_year, item6.balance_sheet.total_next_year, item6.balance_sheet.total_more_year ]) } else { dataTable.push([ item6.type_report_id, item6.id, item6.parent, item6.formula, item6.level, item6.description, item6.balance_sheet.total_actual_before, item6.balance_sheet.january, item6.balance_sheet.february, item6.balance_sheet.march, item6.balance_sheet.april, item6.balance_sheet.may, item6.balance_sheet.june, item6.balance_sheet.july, item6.balance_sheet.august, item6.balance_sheet.september, item6.balance_sheet.october, item6.balance_sheet.november, item6.balance_sheet.december, item6.balance_sheet.total_current_year, item6.balance_sheet.total_next_year, item6.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ item5.type_report_id, item5.id, item5.parent, item5.formula, item5.level, item5.description, item5.balance_sheet.total_actual_before, item5.balance_sheet.january, item5.balance_sheet.february, item5.balance_sheet.march, item5.balance_sheet.april, item5.balance_sheet.may, item5.balance_sheet.june, item5.balance_sheet.july, item5.balance_sheet.august, item5.balance_sheet.september, item5.balance_sheet.october, item5.balance_sheet.november, item5.balance_sheet.december, item5.balance_sheet.total_current_year, item5.balance_sheet.total_next_year, item5.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ item4.type_report_id, item4.id, item4.parent, item4.formula, item4.level, item4.description, item4.balance_sheet.total_actual_before, item4.balance_sheet.january, item4.balance_sheet.february, item4.balance_sheet.march, item4.balance_sheet.april, item4.balance_sheet.may, item4.balance_sheet.june, item4.balance_sheet.july, item4.balance_sheet.august, item4.balance_sheet.september, item4.balance_sheet.october, item4.balance_sheet.november, item4.balance_sheet.december, item4.balance_sheet.total_current_year, item4.balance_sheet.total_next_year, item4.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ item3.type_report_id, item3.id, item3.parent, item3.formula, item3.level, item3.description, item3.balance_sheet.total_actual_before, item3.balance_sheet.january, item3.balance_sheet.february, item3.balance_sheet.march, item3.balance_sheet.april, item3.balance_sheet.may, item3.balance_sheet.june, item3.balance_sheet.july, item3.balance_sheet.august, item3.balance_sheet.september, item3.balance_sheet.october, item3.balance_sheet.november, item3.balance_sheet.december, item3.balance_sheet.total_current_year, item3.balance_sheet.total_next_year, item3.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ item2.type_report_id, item2.id, item2.parent, item2.formula, item2.level, item2.description, item2.balance_sheet.total_actual_before, item2.balance_sheet.january, item2.balance_sheet.february, item2.balance_sheet.march, item2.balance_sheet.april, item2.balance_sheet.may, item2.balance_sheet.june, item2.balance_sheet.july, item2.balance_sheet.august, item2.balance_sheet.september, item2.balance_sheet.october, item2.balance_sheet.november, item2.balance_sheet.december, item2.balance_sheet.total_current_year, item2.balance_sheet.total_next_year, item2.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ item1.type_report_id, item1.id, item1.parent, item1.formula, item1.level, item1.description, item1.balance_sheet.total_actual_before, item1.balance_sheet.january, item1.balance_sheet.february, item1.balance_sheet.march, item1.balance_sheet.april, item1.balance_sheet.may, item1.balance_sheet.june, item1.balance_sheet.july, item1.balance_sheet.august, item1.balance_sheet.september, item1.balance_sheet.october, item1.balance_sheet.november, item1.balance_sheet.december, item1.balance_sheet.total_current_year, item1.balance_sheet.total_next_year, item1.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ itemss.type_report_id, itemss.id, itemss.parent, itemss.formula, itemss.level, itemss.description, itemss.balance_sheet.total_actual_before, itemss.balance_sheet.january, itemss.balance_sheet.february, itemss.balance_sheet.march, itemss.balance_sheet.april, itemss.balance_sheet.may, itemss.balance_sheet.june, itemss.balance_sheet.july, itemss.balance_sheet.august, itemss.balance_sheet.september, itemss.balance_sheet.october, itemss.balance_sheet.november, itemss.balance_sheet.december, itemss.balance_sheet.total_current_year, itemss.balance_sheet.total_next_year, itemss.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ items.type_report_id, items.id, items.parent, items.formula, items.level, items.description, items.balance_sheet.total_actual_before, items.balance_sheet.january, items.balance_sheet.february, items.balance_sheet.march, items.balance_sheet.april, items.balance_sheet.may, items.balance_sheet.june, items.balance_sheet.july, items.balance_sheet.august, items.balance_sheet.september, items.balance_sheet.october, items.balance_sheet.november, items.balance_sheet.december, items.balance_sheet.total_current_year, items.balance_sheet.total_next_year, items.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ val.type_report_id, val.id, val.parent, val.formula, val.level, val.description, val.balance_sheet.total_actual_before, val.balance_sheet.january, val.balance_sheet.february, val.balance_sheet.march, val.balance_sheet.april, val.balance_sheet.may, val.balance_sheet.june, val.balance_sheet.july, val.balance_sheet.august, val.balance_sheet.september, val.balance_sheet.october, val.balance_sheet.november, val.balance_sheet.december, val.balance_sheet.total_current_year, val.balance_sheet.total_next_year, val.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ i.type_report_id, i.id, i.parent, i.formula, i.level, i.description, i.balance_sheet.total_actual_before, i.balance_sheet.january, i.balance_sheet.february, i.balance_sheet.march, i.balance_sheet.april, i.balance_sheet.may, i.balance_sheet.june, i.balance_sheet.july, i.balance_sheet.august, i.balance_sheet.september, i.balance_sheet.october, i.balance_sheet.november, i.balance_sheet.december, i.balance_sheet.total_current_year, i.balance_sheet.total_next_year, i.balance_sheet.total_more_year ]) } } else { dataTable.push([ i.type_report_id, i.id, i.parent, i.formula, i.level, i.description, i.balance_sheet.total_actual_before, i.balance_sheet.january, i.balance_sheet.february, i.balance_sheet.march, i.balance_sheet.april, i.balance_sheet.may, i.balance_sheet.june, i.balance_sheet.july, i.balance_sheet.august, i.balance_sheet.september, i.balance_sheet.october, i.balance_sheet.november, i.balance_sheet.december, i.balance_sheet.total_current_year, i.balance_sheet.total_next_year, i.balance_sheet.total_more_year ]) } }) } else { dataTable.push([ item.type_report_id, item.id, item.parent, item.formula, item.level, item.description, item.balance_sheet.total_actual_before, item.balance_sheet.january, item.balance_sheet.february, item.balance_sheet.march, item.balance_sheet.april, item.balance_sheet.may, item.balance_sheet.june, item.balance_sheet.july, item.balance_sheet.august, item.balance_sheet.september, item.balance_sheet.october, item.balance_sheet.november, item.balance_sheet.december, item.balance_sheet.total_current_year, item.balance_sheet.total_next_year, item.balance_sheet.total_more_year ]) } }) console.log(dataTable); this.setState({ dataTable, loading: false }) } } 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) } } backToMasterBudget(type) { let data = [] this.state.dataTable.map(i => { data.push({ item_report_id: i[1], total_actual_before: String(i[6]), january: String(i[7]), february: String(i[8]), march: String(i[9]), april: String(i[10]), may: String(i[11]), june: String(i[12]), july: String(i[13]), august: String(i[14]), september: String(i[15]), october: String(i[16]), november: String(i[17]), december: String(i[18]), total_current_year: String(i[19]), total_next_year: String(i[20]), total_more_year: String(i[21]) }) }) 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, "balance_sheet": 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 Balance Sheet.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 = [] isi.map((i, index) => { if (i.length > 0) { payload.push({ item_report_id: i[0] === undefined ? "" : String(i[0]).trim(), item_report: i[1] === undefined ? "" : String(i[1]).trim(), total_actual_before: i[2] === undefined ? "" : String(i[2]).trim(), january: i[3] === undefined ? "" : String(i[3]).trim(), february: i[4] === undefined ? "" : String(i[4]).trim(), march: i[5] === undefined ? "" : String(i[5]).trim(), april: i[6] === undefined ? "" : String(i[6]).trim(), may: i[7] === undefined ? "" : String(i[7]).trim(), june: i[8] === undefined ? "" : String(i[8]).trim(), july: i[9] === undefined ? "" : String(i[9]).trim(), august: i[10] === undefined ? "" : String(i[10]).trim(), september: i[11] === undefined ? "" : String(i[11]).trim(), october: i[12] === undefined ? "" : String(i[12]).trim(), november: i[13] === undefined ? "" : String(i[13]).trim(), december: i[14] === undefined ? "" : String(i[14]).trim(), total_current_year: i[15] === undefined ? "" : String(i[15]).trim(), total_next_year: i[16] === undefined ? "" : String(i[16]).trim(), total_more_year: i[16] === undefined ? "" : String(i[17]).trim() }) } }) let body = { company_id: this.props.company.company_id, periode: this.props.periode, report_id: this.props.report_id, balance_sheet: payload } // console.log(JSON.stringify(body)) this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] }) } }); } checkUpload() { 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, visibleBalanceSheet: false, loading: true }) let dataTable = response.data.data.map((item, index) => { return [ item.type_report_id, item.item_report_id, item.parent, item.formula, item.level, item.item_report, item.total_actual_before, item.january, item.february, item.march, item.april, item.may, item.june, item.july, item.august, item.september, item.october, item.november, item.december, item.total_current_year, item.total_next_year, item.total_more_year, item.error ] }) this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }) } } }) } checkError(tableMeta) { if (tableMeta.rowData[22]) { if (tableMeta.rowData[22][0] === 'item') { this.setState({ buttonError: true }) } } } uploadBalanceSheet() { let data = [] this.state.dataTable.map(i => { data.push({ item_report_id: i[1], total_actual_before: String(i[6]), january: String(i[7]), february: String(i[8]), march: String(i[9]), april: String(i[10]), may: String(i[11]), june: String(i[12]), july: String(i[13]), august: String(i[14]), september: String(i[15]), october: String(i[16]), november: String(i[17]), december: String(i[18]), total_current_year: String(i[19]), total_next_year: String(i[20]), total_more_year: String(i[21]) }) }) let body = { company_id: this.props.company.company_id, periode: this.props.periode, report_id: this.props.report_id, balance_sheet: data } console.log(data); api.create('UPLOAD').uploadMasterBudget(body).then(response => { console.log(response); if (response.data) { if (response.data.status === "success") { this.props.onClickClose() this.props.getReport() this.props.getReportAttachment() } else { alert(response.data.status) } } else { alert(response.problem) } }) } 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 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[22] ? tableMeta.rowData[22].length > 0 ? tableMeta.rowData[22][0].field === 'item' ? tableMeta.rowData[4] == 0 ? <a data-tip={tableMeta.rowData[22][0].message} data-for="account"> <span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span> {this.checkError(tableMeta)} </a> : <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}> <a data-tip={tableMeta.rowData[22][0].message} data-for="account"> <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span> {this.checkError(tableMeta)} </a> </div> : 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> : 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> : 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> } <ReactTooltip border={true} id="account" place="bottom" type="light" effect="solid" /> </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> ) } } }, { name: "", options: { display: false } } ] 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%' }}> {this.state.visibleBalanceSheet === true ? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <div style={{ borderBottom: 'solid 1px #c4c4c4' }} > <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Budget Tahunan - Balance Sheet</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={() => this.setState({ visibleUpload: true })} > <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 }}> {!this.state.loading && <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', marginRight: 20 }} onClick={() => { this.props.onClickClose() }} > <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> </div> </button> <button type="button" disabled={this.state.disabledSave} onClick={() => this.backToMasterBudget('submitted')} style={{ backgroundColor: 'transparent', cursor: this.state.disabledSave === true ? 'default' : 'pointer', borderColor: 'transparent', outline: 'none', marginRight: 20 }} > <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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.setState({ loading: true }, () => { setTimeout(() => { this.setState({ loading: false, disabledSave: false }) }, 100); }) }} > <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> : <Paper style={{ paddingTop: 10, paddingBottom: 20 }}> <div> <div style={{ padding: 25 }}> <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> {this.state.dataLoaded && ( <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150), height: this.props.height - 400 }}> {!this.state.loading && <MuiThemeProvider theme={getMuiTheme()}> <MUIDataTable data={dataTable2} columns={columns} options={options} /> </MuiThemeProvider>} </div> )} </div> <div style={{ display: 'flex', width: '100%', placeContent: 'flex-end', padding: 20 }}> <button type="button" onClick={() => this.setState({ visibleBalanceSheet: true }, () => this.getItemHierarki())} style={{ marginRight: 20 }} > <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}> <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Cancel</Typography> </div> </button> <button type="button" disabled={this.state.buttonError == true ? true : false} onClick={() => this.setState({ loading: true }, () => { setTimeout(() => { this.uploadBalanceSheet() }, 100); })} style={{ marginRight: 20 }} > <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}> <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.setState({ loading: true }, () => { setTimeout(() => { this.setState({ loading: false }) }, 100); }) }} > <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> {this.state.visibleUpload && ( <div className="test app-popup-show"> <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}> <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}> <div className="popup-title"> <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span> </div> </div> <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}> <button type="button" className="btn btn-circle btn-white" onClick={() => this.setState({ visibleUpload: false })} > <img src={Images.close} /> </button> </div> </div> <UploadFile type={this.state.uploadStatus} percentage={this.state.percentage} result={this.state.result} acceptedFiles={["xlsx"]} onHandle={(dt) => { this.fileHandler(dt) this.setState({ uploadStatus: 'idle', percentage: '0' }) }} onUpload={() => { this.state.judul === "MASTER BUDGET - BALANCE SHEET" ? this.checkUpload() : this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' }) }} /> </div> </div> )} </div> ); } }