OperatingIndicatorDetail.js 137 KB
Newer Older
d.arizona's avatar
d.arizona committed
1
import React, { Component } from 'react';
Deni Rinaldi's avatar
Deni Rinaldi committed
2
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Snackbar, withStyles, Tooltip } from '@material-ui/core';
d.arizona's avatar
d.arizona committed
3 4 5 6 7 8 9 10 11 12
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';
d.arizona's avatar
d.arizona committed
13
import { Alert } from '@material-ui/lab';
d.arizona's avatar
d.arizona committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

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
};

Deni Rinaldi's avatar
Deni Rinaldi committed
31 32 33 34 35 36 37 38 39
const LightTooltip = withStyles((theme) => ({
    tooltip: {
        backgroundColor: theme.palette.common.white,
        color: 'rgba(0, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);

d.arizona's avatar
d.arizona committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
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"],
            ],
d.arizona's avatar
d.arizona committed
56
            visibleOI: true,
d.arizona's avatar
d.arizona committed
57 58
            disabledSave: true,
            editable: true,
EKSAD's avatar
EKSAD committed
59
            emptyData: false,
Riri Novita's avatar
Riri Novita committed
60
            updateBy: [],
EKSAD's avatar
EKSAD committed
61
            templateNull: true
d.arizona's avatar
d.arizona committed
62 63 64 65 66
        }
        this.handleValue = this.handleValue.bind(this)
        this.fileHandler = this.fileHandler.bind(this);
    }

d.arizona's avatar
d.arizona committed
67 68 69 70 71 72 73 74
    getLatestUpdate() {
        let payload = {
            "operating_indicator_id": this.props.data.operatingIndID,
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
        }
        api.create().getLastestUpdateOI(payload).then(response => {
d.arizona's avatar
d.arizona committed
75
            // // console.log(response.data)
d.arizona's avatar
d.arizona committed
76 77 78
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
79
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail
d.arizona's avatar
d.arizona committed
80 81 82 83 84 85
                    })
                }
            }
        })
    }

d.arizona's avatar
d.arizona committed
86 87 88
    componentDidMount() {
        // this.getItemHierarki()
        this.getDataDetail()
d.arizona's avatar
d.arizona committed
89
        this.getLatestUpdate()
d.arizona's avatar
d.arizona committed
90
        // // console.log(this.props);
d.arizona's avatar
d.arizona committed
91 92 93 94 95
    }

    getDataDetail() {
        this.setState({ loading: true })
        let payload = {
d.arizona's avatar
d.arizona committed
96
            "operating_indicator_id": this.props.data.operatingIndID,
d.arizona's avatar
d.arizona committed
97 98 99 100
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode
        }
Riri Novita's avatar
Riri Novita committed
101
        console.log(payload)
d.arizona's avatar
d.arizona committed
102
        api.create().getOperatingIndDetail(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
103
            console.log(response)
d.arizona's avatar
d.arizona committed
104 105
            let dataTable = []
            let res = response.data.data
d.arizona's avatar
d.arizona committed
106
            // // // console.log(res) 
d.arizona's avatar
d.arizona committed
107 108 109 110 111 112 113 114 115 116
            const handlePushChild = (item) => {
                let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                if (indexIDzz === -1) {
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
d.arizona's avatar
d.arizona committed
117
                        item.uom,
Deni Rinaldi's avatar
Deni Rinaldi committed
118 119 120 121 122 123 124 125 126 127 128 129 130 131
                        item.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
                        item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
                        item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
                        item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
                        item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
                        item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
                        item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
                        item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
                        item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
                        item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
                        item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
                        item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
                        item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
                        item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
132
                        item.order
d.arizona's avatar
d.arizona committed
133 134 135 136
                    ])
                }
                if (item.children !== null) {
                    if (item.children.length > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
137
                        item.children.map((items, indexs) => {
d.arizona's avatar
d.arizona committed
138 139 140 141 142
                            handlePushChild(items)
                        })
                    }
                }
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
143
            res.map((item, index) => {
d.arizona's avatar
d.arizona committed
144 145 146 147 148 149 150 151
                dataTable.push([
                    item.type_report_id,
                    item.id,
                    item.parent,
                    item.formula,
                    item.level,
                    item.description,
                    item.uom,
Deni Rinaldi's avatar
Deni Rinaldi committed
152 153 154 155 156 157 158 159 160 161 162 163 164 165
                    item.master_budget.total_actual_before == "" ? item.master_budget.total_actual_before : String(item.master_budget.total_actual_before).indexOf(".") == -1 ? Number(item.master_budget.total_actual_before) : Number(item.master_budget.total_actual_before).toFixed(1),
                    item.master_budget.january == "" ? item.master_budget.january : String(item.master_budget.january).indexOf(".") == -1 ? Number(item.master_budget.january) : Number(item.master_budget.january).toFixed(1),
                    item.master_budget.february == "" ? item.master_budget.february : String(item.master_budget.february).indexOf(".") == -1 ? Number(item.master_budget.february) : Number(item.master_budget.february).toFixed(1),
                    item.master_budget.march == "" ? item.master_budget.march : String(item.master_budget.march).indexOf(".") == -1 ? Number(item.master_budget.march) : Number(item.master_budget.march).toFixed(1),
                    item.master_budget.april == "" ? item.master_budget.april : String(item.master_budget.april).indexOf(".") == -1 ? Number(item.master_budget.april) : Number(item.master_budget.april).toFixed(1),
                    item.master_budget.may == "" ? item.master_budget.may : String(item.master_budget.may).indexOf(".") == -1 ? Number(item.master_budget.may) : Number(item.master_budget.may).toFixed(1),
                    item.master_budget.june == "" ? item.master_budget.june : String(item.master_budget.june).indexOf(".") == -1 ? Number(item.master_budget.june) : Number(item.master_budget.june).toFixed(1),
                    item.master_budget.july == "" ? item.master_budget.july : String(item.master_budget.july).indexOf(".") == -1 ? Number(item.master_budget.july) : Number(item.master_budget.july).toFixed(1),
                    item.master_budget.august == "" ? item.master_budget.august : String(item.master_budget.august).indexOf(".") == -1 ? Number(item.master_budget.august) : Number(item.master_budget.august).toFixed(1),
                    item.master_budget.september == "" ? item.master_budget.september : String(item.master_budget.september).indexOf(".") == -1 ? Number(item.master_budget.september) : Number(item.master_budget.september).toFixed(1),
                    item.master_budget.october == "" ? item.master_budget.october : String(item.master_budget.october).indexOf(".") == -1 ? Number(item.master_budget.october) : Number(item.master_budget.october).toFixed(1),
                    item.master_budget.november == "" ? item.master_budget.november : String(item.master_budget.november).indexOf(".") == -1 ? Number(item.master_budget.november) : Number(item.master_budget.november).toFixed(1),
                    item.master_budget.december == "" ? item.master_budget.december : String(item.master_budget.december).indexOf(".") == -1 ? Number(item.master_budget.december) : Number(item.master_budget.december).toFixed(1),
                    item.master_budget.total_current_year == "" ? item.master_budget.total_current_year : String(item.master_budget.total_current_year).indexOf(".") == -1 ? Number(item.master_budget.total_current_year) : Number(item.master_budget.total_current_year).toFixed(1),
166
                    item.order
d.arizona's avatar
d.arizona committed
167 168 169
                ])
                if (item.children !== null) {
                    if (item.children.length > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
170
                        item.children.map((items, indexs) => {
d.arizona's avatar
d.arizona committed
171 172 173 174 175
                            handlePushChild(items)
                        })
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
176 177 178
            this.setState({ dataTable, loading: false }, () => {
                if (this.state.dataTable.length == 0) {
                    this.setState({ emptyData: true })
d.arizona's avatar
d.arizona committed
179 180
                }
            })
Riri Novita's avatar
Riri Novita committed
181
            console.log(dataTable);
d.arizona's avatar
d.arizona committed
182
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
183

d.arizona's avatar
d.arizona committed
184 185
    }

d.arizona's avatar
d.arizona committed
186
    createData(type) {
d.arizona's avatar
d.arizona committed
187
        let payloadMB = []
Deni Rinaldi's avatar
Deni Rinaldi committed
188
        this.state.dataTable.map((item, index) => {
d.arizona's avatar
d.arizona committed
189 190
            payloadMB.push({
                "item_report_id": item[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204
                "total_actual_before": String(Number(item[7]).toFixed(1)),
                "january": String(Number(item[8]).toFixed(1)),
                "february": String(Number(item[9]).toFixed(1)),
                "march": String(Number(item[10]).toFixed(1)),
                "april": String(Number(item[11]).toFixed(1)),
                "may": String(Number(item[12]).toFixed(1)),
                "june": String(Number(item[13]).toFixed(1)),
                "july": String(Number(item[14]).toFixed(1)),
                "august": String(Number(item[15]).toFixed(1)),
                "september": String(Number(item[16]).toFixed(1)),
                "october": String(Number(item[17]).toFixed(1)),
                "november": String(Number(item[18]).toFixed(1)),
                "december": String(Number(item[19]).toFixed(1)),
                "total_current_year": String(Number(item[20]).toFixed(1)),
d.arizona's avatar
d.arizona committed
205 206 207
            })
        })
        let payload = {
d.arizona's avatar
d.arizona committed
208
            "operating_indicator_id": this.props.data.operatingIndID,
d.arizona's avatar
d.arizona committed
209 210 211
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
d.arizona's avatar
d.arizona committed
212
            "status": type,
d.arizona's avatar
d.arizona committed
213 214
            "master_budget": payloadMB
        }
Riri Novita's avatar
Riri Novita committed
215
        console.log(payload);
d.arizona's avatar
d.arizona committed
216
        // // console.log('=========================')
Riri Novita's avatar
Riri Novita committed
217
        // console.log(JSON.stringify(payload))
d.arizona's avatar
d.arizona committed
218 219
        this.props.saveOperatingInd(payload)
        this.props.onClickClose()
d.arizona's avatar
d.arizona committed
220 221 222 223 224 225 226 227 228 229 230
    }

    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
d.arizona's avatar
d.arizona committed
231
        // // // console.log(indexParent);
d.arizona's avatar
d.arizona committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
        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) {
            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
        // }
d.arizona's avatar
d.arizona committed
280
        // // // // console.log(data);
d.arizona's avatar
d.arizona committed
281 282 283 284 285 286
        // this.props.saveToMasterBudget(payload)
        this.props.onClickClose()
    }

    downloadTemplate = async () => {
        let res = await fetch(
Riri Novita's avatar
Riri Novita committed
287
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
d.arizona's avatar
d.arizona committed
288 289
        )
        res = await res.blob()
d.arizona's avatar
d.arizona committed
290
        // // console.log(res)
d.arizona's avatar
d.arizona committed
291 292 293 294 295 296 297 298 299 300
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Master Budget Operating Indicator.xlsx';
            a.click();
        }
    }

    async downloadAllData() {
d.arizona's avatar
d.arizona committed
301
        // // // console.log('masuk')
Deni Rinaldi's avatar
Deni Rinaldi committed
302
        let bram = [this.props.data.operatingIndID, this.props.report_id, this.props.data.company.company_id, this.props.data.periode]
d.arizona's avatar
d.arizona committed
303
        // // console.log(bram)
d.arizona's avatar
d.arizona committed
304
        let res = await fetch(
Riri Novita's avatar
Riri Novita committed
305
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/master_budget/export_master_budget?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}`
d.arizona's avatar
d.arizona committed
306
        )
Deni Rinaldi's avatar
Deni Rinaldi committed
307

d.arizona's avatar
d.arizona committed
308
        res = await res.blob()
d.arizona's avatar
d.arizona committed
309
        // // console.log(res)
d.arizona's avatar
d.arizona committed
310
        this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
311 312 313 314
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
d.arizona's avatar
d.arizona committed
315
            a.download = 'Master Budget Operating Indicator.xlsx';
d.arizona's avatar
d.arizona committed
316 317 318 319 320 321 322
            a.click();
        }
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
d.arizona's avatar
d.arizona committed
323
            // // // console.log(resp)
d.arizona's avatar
d.arizona committed
324
            if (err) {
d.arizona's avatar
d.arizona committed
325
                // // console.log(err);
d.arizona's avatar
d.arizona committed
326 327 328
            }
            else {
                let isi = resp.rows.slice(3)
d.arizona's avatar
d.arizona committed
329
                // // console.log(isi);
d.arizona's avatar
d.arizona committed
330
                let payload = []
d.arizona's avatar
d.arizona committed
331
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
d.arizona's avatar
d.arizona committed
332 333 334
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
d.arizona's avatar
d.arizona committed
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
                            order: i[0] === undefined ? "0" : String(i[0]).trim(),
                            item_report_id: i[1] === undefined ? "0" : String(i[1]).trim(),
                            item_report: i[2] === undefined ? "0" : String(i[2]).trim(),
                            uom: i[3] === undefined ? "" : String(i[3]).trim(),
                            // total_actual_before: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
d.arizona's avatar
d.arizona committed
353 354 355 356
                        })
                    }
                })
                let body = {
d.arizona's avatar
d.arizona committed
357 358 359
                    company_id: this.props.data.company.company_id,
                    periode: this.props.data.periode,
                    report_id: this.props.data.report_id,
Riri Novita's avatar
Riri Novita committed
360 361
                    master_budget: payload,
                    status: 'submitted'
d.arizona's avatar
d.arizona committed
362
                }
Riri Novita's avatar
Riri Novita committed
363
                console.log(body)
d.arizona's avatar
d.arizona committed
364 365 366 367 368 369
                this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0] })
            }
        });
    }

    checkUpload() {
d.arizona's avatar
d.arizona committed
370
        // // console.log(JSON.stringify(this.state.payload))
d.arizona's avatar
d.arizona committed
371
        api.create().checkUploadOperatingInd(this.state.payload).then(response => {
d.arizona's avatar
d.arizona committed
372 373
            // // // console.log(JSON.stringify(this.state.payload));
            // // console.log('===============')
Riri Novita's avatar
Riri Novita committed
374
            console.log(response)
d.arizona's avatar
d.arizona committed
375 376
            if (response.data) {
                if (response.data.status === 'success') {
d.arizona's avatar
d.arizona committed
377
                    this.setState({ visibleUpload: false, visibleOI: false, loading: true })
EKSAD's avatar
EKSAD committed
378
                    let total = 0
d.arizona's avatar
d.arizona committed
379
                    let dataTable = response.data.data.map((item, index) => {
EKSAD's avatar
EKSAD committed
380 381 382
                        if (item.type_report_id != null) {
                            total += 1
                        }
d.arizona's avatar
d.arizona committed
383 384 385 386 387 388 389
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
d.arizona's avatar
d.arizona committed
390
                            item.uom,
d.arizona's avatar
d.arizona committed
391 392 393 394 395 396 397 398 399 400 401 402 403 404
                            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,
405
                            item.order,
d.arizona's avatar
d.arizona committed
406 407 408
                            item.error
                        ]
                    })
EKSAD's avatar
EKSAD committed
409
                    this.setState({ dataTable, dataLoaded: true, loading: false, templateNull : total > 0 ? true : false })
d.arizona's avatar
d.arizona committed
410 411 412 413 414
                }
            }
        })
    }

d.arizona's avatar
d.arizona committed
415 416
    uploadOI(type) {
        let data = []
d.arizona's avatar
d.arizona committed
417
        // // console.log(this.state.dataTable)
d.arizona's avatar
d.arizona committed
418 419 420 421
        this.state.dataTable.map(i => {
            data.push({
                "item_report_id": i[1],
                "item_report": String(i[5]),
Deni Rinaldi's avatar
Deni Rinaldi committed
422 423 424 425 426 427 428 429 430 431 432 433 434 435
                "total_actual_before": String(Number(i[7] == null ? "0" : i[7]).toFixed(1)),
                "january": String(Number(i[8]).toFixed(1)),
                "february": String(Number(i[9]).toFixed(1)),
                "march": String(Number(i[10]).toFixed(1)),
                "april": String(Number(i[11]).toFixed(1)),
                "may": String(Number(i[12]).toFixed(1)),
                "june": String(Number(i[13]).toFixed(1)),
                "july": String(Number(i[14]).toFixed(1)),
                "august": String(Number(i[15]).toFixed(1)),
                "september": String(Number(i[16]).toFixed(1)),
                "october": String(Number(i[17]).toFixed(1)),
                "november": String(Number(i[18]).toFixed(1)),
                "december": String(Number(i[19]).toFixed(1)),
                "total_current_year": String(Number(i[20]).toFixed(1)),
d.arizona's avatar
d.arizona committed
436 437 438 439
            })
        })
        let body = {
            company_id: this.props.data.company.company_id,
d.arizona's avatar
d.arizona committed
440
            operating_indicator_id: this.props.data.operatingIndID,
d.arizona's avatar
d.arizona committed
441 442 443 444 445
            periode: this.props.data.periode,
            report_id: this.props.data.report_id,
            status: type,
            master_budget: data
        }
d.arizona's avatar
d.arizona committed
446 447
        // // console.log(data);
        // // console.log(JSON.stringify(body))
d.arizona's avatar
d.arizona committed
448
        api.create('UPLOAD').uploadOperatingInd(body).then(response => {
d.arizona's avatar
d.arizona committed
449
            // // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
450
            this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
451 452 453 454 455 456 457 458 459 460 461 462 463
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
                    alert(response.data.status)
                }
            } else {
                alert(response.problem)
            }
        })
    }

d.arizona's avatar
d.arizona committed
464 465 466
    closeAlert() {
        this.setState({ alert: false })
    }
Deni Rinaldi's avatar
Deni Rinaldi committed
467

d.arizona's avatar
d.arizona committed
468 469 470 471
    render() {
        let dataTable2 = this.state.dataTable
        const handleChange = (value, tableMeta) => {
            let val = String(value).split(",").join("")
d.arizona's avatar
d.arizona committed
472 473
            let total = 0
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
d.arizona's avatar
d.arizona committed
474 475 476 477 478 479 480
            // dataTable2[tableMeta.rowIndex].map((item,index) => {
            //     if (index >= 8 && index <= 19) {
            //         let valItem = item == undefined || item == ""? 0 : item
            //         total += Number(valItem)
            //     }
            // })
            // dataTable2[tableMeta.rowIndex][20] = total 
d.arizona's avatar
d.arizona committed
481
            // // console.log(dataTable2[tableMeta.rowIndex])
d.arizona's avatar
d.arizona committed
482
        }
d.arizona's avatar
d.arizona committed
483 484 485

        const handleValue = (value, tableMeta) => {
            let val = String(value).split(",").join("")
d.arizona's avatar
d.arizona committed
486
            let total = 0
d.arizona's avatar
d.arizona committed
487
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
Deni Rinaldi's avatar
Deni Rinaldi committed
488
            dataTable2[tableMeta.rowIndex].map((item, index) => {
d.arizona's avatar
d.arizona committed
489
                if (index >= 8 && index <= 19) {
Deni Rinaldi's avatar
Deni Rinaldi committed
490
                    let valItem = item == undefined || item == "" ? 0 : item
d.arizona's avatar
d.arizona committed
491
                    total += Number(valItem)
d.arizona's avatar
d.arizona committed
492 493
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
494
            dataTable2[tableMeta.rowIndex][20] = total
d.arizona's avatar
d.arizona committed
495
            return total
d.arizona's avatar
d.arizona committed
496
        }
d.arizona's avatar
d.arizona committed
497

d.arizona's avatar
d.arizona committed
498
        const handleParent = (tableMeta) => {
d.arizona's avatar
d.arizona committed
499
            // // console.log(tableMeta)
d.arizona's avatar
d.arizona committed
500
            let total = 0
d.arizona's avatar
d.arizona committed
501 502 503

            dataTable2.map((item, index) => {
                if (item[2] == tableMeta.rowData[1]) {
d.arizona's avatar
d.arizona committed
504 505
                    // // console.log(total)
                    // // console.log(item[tableMeta.columnIndex])
d.arizona's avatar
d.arizona committed
506 507 508 509 510 511 512
                    total += Number(item[tableMeta.columnIndex])
                }
            })

            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            return total
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
513

514
        const handleFormula = (tableMeta) => {
d.arizona's avatar
d.arizona committed
515
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
516
            let arrayFormulaConvert = []
d.arizona's avatar
d.arizona committed
517 518 519
            // // // console.log(arrayFormula)
            let opet = ""
            let tambahan = false
d.arizona's avatar
d.arizona committed
520
            arrayFormula.map((item, indexs) => {
d.arizona's avatar
d.arizona committed
521 522 523
                if (item == 'X') {
                    tambahan = true
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
524
                    arrayFormulaConvert.push(item)
d.arizona's avatar
d.arizona committed
525
                } else {
526
                    let indexID = dataTable2.findIndex((val) => val[21] == item)
d.arizona's avatar
d.arizona committed
527 528 529 530 531 532 533 534 535 536 537 538 539 540
                    if (tambahan) {
                        if (item == '-' || item == '+' || item == '/' || item == '*') {
                            opet = item
                        } else {
                            arrayFormulaConvert.push(opet == ''? Number(item) : Number(String(opet + String(item))))
                            tambahan = false
                            opet = ""
                        }
                    } else { 
                        if (indexID !== -1) {
                            let valuezz = dataTable2[indexID][tableMeta.columnIndex]
                            // // // console.log(dataTable2[indexID])
                            arrayFormulaConvert.push(valuezz == "" ? 0 : valuezz)
                        }
541
                    }
d.arizona's avatar
d.arizona committed
542 543
                }
            })
d.arizona's avatar
d.arizona committed
544 545
            // // console.log(arrayFormula)
            // // console.log(arrayFormulaConvert)
546
            let array = arrayFormulaConvert
d.arizona's avatar
d.arizona committed
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
            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 {
d.arizona's avatar
d.arizona committed
568
                        total += Number(item)
d.arizona's avatar
d.arizona committed
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
                    }
                }
            })
            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 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
613 614
                            {tableMeta.rowData[0] === null ?
                                tableMeta.rowData[1] !== null ?
d.arizona's avatar
d.arizona committed
615 616 617 618 619
                                    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>
Deni Rinaldi's avatar
Deni Rinaldi committed
620 621 622 623 624 625 626 627 628
                                        </div> :
                                    tableMeta.rowData[4] == 0 ?
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
                                            <span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(val).toUpperCase()}</span>
                                        </LightTooltip> :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                            <LightTooltip title={"Report Items Not Registered"} arrow>
                                                <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                            </LightTooltip>
d.arizona's avatar
d.arizona committed
629
                                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674
                                :
                                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[0] === 4 || tableMeta.rowData[0] === null ?
                                //     null
                                //     :
                                //     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>
                                //                     </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>
                                //                         </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>
d.arizona's avatar
d.arizona committed
675
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
676
                            {/* <ReactTooltip border={true} id="account" place="bottom" type="light" effect="solid" /> */}
d.arizona's avatar
d.arizona committed
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692
                        </div>
                    )
                }
            }
        }, {
            name: "UOM",
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
693
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
694 695
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
696
                                <FormControlLabel
d.arizona's avatar
d.arizona committed
697 698 699 700 701 702 703 704 705
                                    style={{ margin: 0 }}
                                    // value={value}
                                    control={
                                        <Input
                                            disableUnderline={true}
                                            style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', marginTop: -10 }}
                                            type="text"
                                            placeholder=""
                                            defaultValue={value}
d.arizona's avatar
d.arizona committed
706
                                            // color={"#5198ea"}
d.arizona's avatar
d.arizona committed
707 708
                                            value={value}
                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
709
                                        // onBlur={(event) => {
d.arizona's avatar
d.arizona committed
710
                                        //     // // console.log(event.target.value)
Deni Rinaldi's avatar
Deni Rinaldi committed
711 712
                                        //     // updateValue(event.target.value)
                                        //     handleChangeText(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
713
                                        //     // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
714
                                        // }}
d.arizona's avatar
d.arizona committed
715
                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
716 717
                                    }
                                />}
d.arizona's avatar
d.arizona committed
718 719 720 721 722
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
723
            name: `31 Dec ${Number(this.props.data.periode) - 1} Actual`,
d.arizona's avatar
d.arizona committed
724 725 726 727 728 729 730 731 732 733
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
734
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
735 736
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
737 738 739 740 741 742 743
                                <NumberFormat
                                    thousandSeparator={true}
                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                    type="text"
                                    placeholder=""
                                    disabled={true}
                                    decimalScale={1}
Deni Rinaldi's avatar
Deni Rinaldi committed
744
                                    value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
745
                                />}
d.arizona's avatar
d.arizona committed
746 747 748 749 750
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
751
            name: `Jan ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
752 753 754 755 756 757 758 759 760 761
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
762
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
763 764
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
765 766 767 768 769 770 771 772 773 774 775
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
776
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
795
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
796 797 798 799 800
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
801
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
802 803 804
                                                        }}
                                                    />
                                                }
805
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
806 807 808 809 810 811 812 813 814 815 816 817
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
818
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
819 820 821 822 823
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
824
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
825 826 827
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
828
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
829
                                        </div>)
d.arizona's avatar
d.arizona committed
830 831 832 833 834 835
                            }
                        </div>
                    )
                }
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
836
            , {
d.arizona's avatar
d.arizona committed
837
            name: `Feb ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
838 839 840 841 842 843 844 845 846 847
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
848
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
849 850
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
851 852 853 854 855 856 857 858 859 860 861
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
862
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
881
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
882 883 884 885 886
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
887
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
888 889 890
                                                        }}
                                                    />
                                                }
891
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
892 893 894 895 896 897 898 899 900 901 902 903
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
904
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
905 906 907 908 909
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
910
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
911 912 913
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
914
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
915
                                        </div>)
d.arizona's avatar
d.arizona committed
916 917 918 919 920 921
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
922
            name: `Mar ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
923 924 925 926 927 928 929 930 931 932
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
933
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
934 935
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
936 937 938 939 940 941 942 943 944 945 946
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
947
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
966
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
967 968 969 970 971
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
972
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
973 974 975
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
976
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
977 978 979 980 981 982 983 984 985 986 987 988
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
989
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
990 991 992 993 994
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
995
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
996 997 998
                                                        }}
                                                    />
                                                }
999
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1000
                                        </div>)
d.arizona's avatar
d.arizona committed
1001 1002 1003 1004 1005 1006
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1007
            name: `Apr ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1018
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1019 1020
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1032
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1051
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1052 1053 1054 1055 1056
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1057
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1058 1059 1060
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1061
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1074
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1075 1076 1077 1078 1079
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1080
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1081 1082 1083
                                                        }}
                                                    />
                                                }
1084
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1085
                                        </div>)
d.arizona's avatar
d.arizona committed
1086 1087 1088 1089 1090 1091
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1092
            name: `May ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1103
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1104 1105
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1117
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1136
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1137 1138 1139 1140 1141
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1142
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1143 1144 1145
                                                        }}
                                                    />
                                                }
1146
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1159
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1160 1161 1162 1163 1164
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1165
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1166 1167 1168
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1169
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1170
                                        </div>)
d.arizona's avatar
d.arizona committed
1171 1172 1173 1174 1175 1176
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1177
            name: `Jun ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1188
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1189 1190
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1202
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1221
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1222 1223 1224 1225 1226
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1227
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1228 1229 1230
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1231
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1244
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1245 1246 1247 1248 1249
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1250
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1251 1252 1253
                                                        }}
                                                    />
                                                }
1254
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1255
                                        </div>)
d.arizona's avatar
d.arizona committed
1256 1257 1258 1259 1260 1261
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1262
            name: `Jul ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1273
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1274 1275
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1287
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1306
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1307 1308 1309 1310 1311
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1312
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1313 1314 1315
                                                        }}
                                                    />
                                                }
1316
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1329
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1330 1331 1332 1333 1334
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1335
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1336 1337 1338
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1339
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1340
                                        </div>)
d.arizona's avatar
d.arizona committed
1341 1342 1343 1344 1345 1346
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1347
            name: `Aug ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1348 1349 1350 1351 1352 1353 1354 1355 1356 1357
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1358
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1359 1360
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1372
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1391
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1392 1393 1394 1395 1396
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1397
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1398 1399 1400
                                                        }}
                                                    />
                                                }
1401
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1414
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1415 1416 1417 1418 1419
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1420
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1421 1422 1423
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1424
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1425
                                        </div>)
d.arizona's avatar
d.arizona committed
1426 1427 1428 1429 1430 1431
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1432
            name: `Sep ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1433 1434 1435 1436 1437 1438 1439 1440 1441 1442
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1443
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1444 1445
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1457
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1476
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1477 1478 1479 1480 1481
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1482
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1483 1484 1485
                                                        }}
                                                    />
                                                }
1486
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1499
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1500 1501 1502 1503 1504
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1505
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1506 1507 1508
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1509
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1510
                                        </div>)
d.arizona's avatar
d.arizona committed
1511 1512 1513 1514 1515 1516
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1517
            name: `Oct ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1528
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1529 1530
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1542
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1561
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1562 1563 1564 1565 1566
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1567
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1568 1569 1570
                                                        }}
                                                    />
                                                }
1571
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1584
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1585 1586 1587 1588 1589
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1590
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1591 1592 1593
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1594
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1595
                                        </div>)
d.arizona's avatar
d.arizona committed
1596 1597 1598 1599 1600 1601
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1602
            name: `Nov ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1603 1604 1605 1606 1607 1608 1609 1610 1611 1612
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1613
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1614 1615
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1627
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1646
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1647 1648 1649 1650 1651
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1652
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1653 1654 1655
                                                        }}
                                                    />
                                                }
1656
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1669
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1670 1671 1672 1673 1674
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1675
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1676 1677 1678
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1679
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1680
                                        </div>)
d.arizona's avatar
d.arizona committed
1681 1682 1683 1684 1685 1686
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1687
            name: `Dec ${this.props.data.periode}`,
d.arizona's avatar
d.arizona committed
1688 1689 1690 1691 1692 1693 1694 1695 1696 1697
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1698
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1699 1700
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711
                                tableMeta.rowData[0] == 2 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1712
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1731
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1732 1733 1734 1735 1736
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1737
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1738 1739 1740
                                                        }}
                                                    />
                                                }
1741
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1754
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1755 1756 1757 1758 1759
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1760
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1761 1762 1763
                                                        }}
                                                    />
                                                }
d.arizona's avatar
d.arizona committed
1764
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1765
                                        </div>)
d.arizona's avatar
d.arizona committed
1766 1767 1768 1769 1770 1771
                            }
                        </div>
                    )
                }
            }
        }, {
d.arizona's avatar
d.arizona committed
1772
            name: `31 Dec ${this.props.data.periode}\nTotal`,
d.arizona's avatar
d.arizona committed
1773 1774 1775 1776 1777 1778 1779 1780 1781 1782
            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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1783
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === null ?
d.arizona's avatar
d.arizona committed
1784 1785
                                null
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1786
                                tableMeta.rowData[0] == 2 ?
d.arizona's avatar
d.arizona committed
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1797
                                                    value={Number(handleParent(tableMeta)).toFixed(1)}
d.arizona's avatar
d.arizona committed
1798 1799 1800 1801 1802 1803 1804
                                                    disabled={true}
                                                    decimalScale={1}
                                                />
                                            }
                                        />
                                    </div>
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815
                                    (tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1816
                                                        value={Number(handleFormula(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1817 1818 1819 1820 1821
                                                        disabled={true}
                                                        decimalScale={1}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1822
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838
                                                        }}
                                                    />
                                                }
                                            />
                                        </div>
                                        :
                                        <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=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1839
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1840 1841 1842 1843 1844
                                                        decimalScale={1}
                                                        disabled={!this.props.permission.create || !this.props.permission.edit || !this.props.isSubmit}
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
d.arizona's avatar
d.arizona committed
1845
                                                            // // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1846 1847 1848 1849 1850
                                                        }}
                                                    />
                                                }
                                            />
                                        </div>)
d.arizona's avatar
d.arizona committed
1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877
                            }
                        </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 }}>
d.arizona's avatar
d.arizona committed
1878
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
d.arizona's avatar
d.arizona committed
1879
                </div>
d.arizona's avatar
d.arizona committed
1880 1881 1882 1883 1884
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
d.arizona's avatar
d.arizona committed
1885
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
d.arizona's avatar
d.arizona committed
1886
                    {this.state.visibleOI === true ?
d.arizona's avatar
d.arizona committed
1887 1888
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
d.arizona's avatar
d.arizona committed
1889
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Operating Indicator</Typography>
d.arizona's avatar
d.arizona committed
1890 1891
                            </div>
                            <div style={{ padding: 20 }}>
d.arizona's avatar
d.arizona committed
1892
                                {!this.state.emptyData && <div style={{ display: 'flex', justifyContent: 'space-between' }}>
d.arizona's avatar
d.arizona committed
1893 1894
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
d.arizona's avatar
d.arizona committed
1895
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography>
d.arizona's avatar
d.arizona committed
1896 1897 1898 1899
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
                                        <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
d.arizona's avatar
d.arizona committed
1900
                                            {(this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Download Template'} data-for="template">
d.arizona's avatar
d.arizona committed
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.downloadTemplate()}
                                                >
                                                    <img src={Images.template} />
                                                </button>
d.arizona's avatar
d.arizona committed
1912
                                            </a>}
d.arizona's avatar
d.arizona committed
1913
                                            <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
d.arizona's avatar
d.arizona committed
1914
                                            {(this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <a data-tip={'Upload'} data-for="upload">
d.arizona's avatar
d.arizona committed
1915 1916 1917 1918 1919 1920 1921
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
d.arizona's avatar
d.arizona committed
1922
                                                    onClick={() => this.setState({ visibleUpload: true, editable: true })}
d.arizona's avatar
d.arizona committed
1923 1924 1925
                                                >
                                                    <img src={Images.upload} />
                                                </button>
d.arizona's avatar
d.arizona committed
1926
                                            </a>}
d.arizona's avatar
d.arizona committed
1927 1928 1929 1930 1931 1932 1933 1934 1935
                                            <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
                                                    }}
d.arizona's avatar
d.arizona committed
1936
                                                    onClick={() => this.downloadAllData()}
d.arizona's avatar
d.arizona committed
1937 1938 1939 1940 1941 1942 1943
                                                >
                                                    <img src={Images.download} />
                                                </button>
                                            </a>
                                            <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                        </div>
                                    </div>
d.arizona's avatar
d.arizona committed
1944
                                </div>}
d.arizona's avatar
d.arizona committed
1945

d.arizona's avatar
d.arizona committed
1946
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
d.arizona's avatar
d.arizona committed
1947 1948
                                    {this.state.loading && loadingComponent}
                                    <MuiThemeProvider theme={getMuiTheme()}>
d.arizona's avatar
d.arizona committed
1949 1950 1951 1952 1953
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
d.arizona's avatar
d.arizona committed
1954
                                    </MuiThemeProvider>
d.arizona's avatar
d.arizona committed
1955
                                </div>
Riri Novita's avatar
Riri Novita committed
1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968
                                <div style={{ display: 'flex' }}>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                    <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                        {
                                            this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
                                        }
                                    </div>
                                </div>
d.arizona's avatar
d.arizona committed
1969
                            </div>
d.arizona's avatar
d.arizona committed
1970
                            <div className="grid grid-2x">
d.arizona's avatar
d.arizona committed
1971 1972
                                <div className="col-1">
                                    <button
d.arizona's avatar
d.arizona committed
1973
                                        className="button"
d.arizona's avatar
d.arizona committed
1974 1975 1976 1977 1978 1979
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                        }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1980 1981 1982 1983
                                        onClick={() => {
                                            this.props.onClickClose()
                                            this.props.getReport()
                                        }
d.arizona's avatar
d.arizona committed
1984
                                        }
d.arizona's avatar
d.arizona committed
1985 1986
                                    >
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
1987
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
d.arizona's avatar
d.arizona committed
1988 1989 1990
                                        </div>
                                    </button>
                                </div>
d.arizona's avatar
d.arizona committed
1991
                                {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && this.props.isSubmit && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
d.arizona's avatar
d.arizona committed
1992 1993
                                    <button
                                        type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
1994
                                        onClick={() =>
d.arizona's avatar
d.arizona committed
1995
                                            this.setState({ loading: true, editable: false }, () => {
d.arizona's avatar
d.arizona committed
1996 1997 1998 1999 2000 2001
                                                setTimeout(() => {
                                                    this.setState({ loading: false, buttonError: false })
                                                }, 100);
                                            })
                                        }
                                        style={{ marginRight: 20 }}
d.arizona's avatar
d.arizona committed
2002 2003
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
d.arizona's avatar
d.arizona committed
2004
                                            <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
d.arizona's avatar
d.arizona committed
2005 2006 2007 2008 2009
                                        </div>
                                    </button>
                                    <button
                                        className="button"
                                        type="button"
d.arizona's avatar
d.arizona committed
2010
                                        disabled={this.state.editable}
d.arizona's avatar
d.arizona committed
2011 2012
                                        style={{
                                            backgroundColor: 'transparent',
d.arizona's avatar
d.arizona committed
2013
                                            cursor: this.state.editable === true ? 'default' : 'pointer',
d.arizona's avatar
d.arizona committed
2014
                                            borderColor: 'transparent',
d.arizona's avatar
d.arizona committed
2015 2016
                                            outline: 'none',
                                            marginRight: 20
d.arizona's avatar
d.arizona committed
2017
                                        }}
d.arizona's avatar
d.arizona committed
2018 2019 2020 2021 2022
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.createData("draft")
                                            }, 100);
                                        })}
d.arizona's avatar
d.arizona committed
2023 2024
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
2025
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
d.arizona's avatar
d.arizona committed
2026 2027
                                        </div>
                                    </button>
d.arizona's avatar
d.arizona committed
2028 2029
                                    <button
                                        type="button"
d.arizona's avatar
d.arizona committed
2030
                                        disabled={this.state.editable}
d.arizona's avatar
d.arizona committed
2031 2032 2033 2034 2035
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.createData("submitted")
                                            }, 100);
                                        })}
d.arizona's avatar
d.arizona committed
2036 2037 2038 2039 2040 2041 2042
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: this.state.editable === true ? 'default' : 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
d.arizona's avatar
d.arizona committed
2043
                                    >
d.arizona's avatar
d.arizona committed
2044 2045
                                        <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 & Complete</Typography>
d.arizona's avatar
d.arizona committed
2046 2047
                                        </div>
                                    </button>
d.arizona's avatar
d.arizona committed
2048
                                </div>}
d.arizona's avatar
d.arizona committed
2049 2050 2051 2052 2053 2054 2055
                            </div>
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
d.arizona's avatar
d.arizona committed
2056 2057
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode}</Typography>
d.arizona's avatar
d.arizona committed
2058 2059 2060
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    {this.state.dataLoaded && (
Deni Rinaldi's avatar
Deni Rinaldi committed
2061
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
d.arizona's avatar
d.arizona committed
2062 2063
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
d.arizona's avatar
d.arizona committed
2064 2065 2066 2067 2068
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
d.arizona's avatar
d.arizona committed
2069
                                            </MuiThemeProvider>
d.arizona's avatar
d.arizona committed
2070 2071 2072
                                        </div>
                                    )}
                                </div>
d.arizona's avatar
d.arizona committed
2073 2074 2075 2076 2077 2078 2079 2080 2081 2082
                                <div className="grid grid-2x">
                                    <div className="col-1">
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
2083
                                            onClick={() =>
d.arizona's avatar
d.arizona committed
2084
                                                this.setState({ loading: true, visibleOI: true }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2085 2086 2087 2088
                                                    setTimeout(() => {
                                                        this.getDataDetail()
                                                    }, 100)
                                                })}
d.arizona's avatar
d.arizona committed
2089 2090
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
2091
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
d.arizona's avatar
d.arizona committed
2092 2093 2094
                                            </div>
                                        </button>
                                    </div>
EKSAD's avatar
EKSAD committed
2095
                                    {!this.state.emptyData && this.state.templateNull && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
d.arizona's avatar
d.arizona committed
2096 2097
                                        <button
                                            type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
2098
                                            onClick={() =>
d.arizona's avatar
d.arizona committed
2099
                                                this.setState({ loading: true, editable: false }, () => {
d.arizona's avatar
d.arizona committed
2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115
                                                    setTimeout(() => {
                                                        this.setState({ loading: false, buttonError: false })
                                                    }, 100);
                                                })
                                            }
                                            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' }}>Calculate</Typography>
                                            </div>
                                        </button>
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
d.arizona's avatar
d.arizona committed
2116
                                                cursor: this.state.editable === true ? 'default' : 'pointer',
d.arizona's avatar
d.arizona committed
2117 2118 2119 2120
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
d.arizona's avatar
d.arizona committed
2121
                                            disabled={this.state.editable}
Deni Rinaldi's avatar
Deni Rinaldi committed
2122 2123 2124 2125 2126 2127 2128
                                            onClick={() =>
                                                this.state.editable === true ?
                                                    null : this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.uploadOI("draft")
                                                        }, 100);
                                                    })}
d.arizona's avatar
d.arizona committed
2129 2130 2131 2132 2133 2134 2135
                                        >
                                            <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 as Draft</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
2136 2137 2138 2139 2140 2141 2142 2143
                                            onClick={() =>
                                                this.state.editable === true ?
                                                    null :
                                                    this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.uploadOI("submitted")
                                                        }, 100);
                                                    })}
d.arizona's avatar
d.arizona committed
2144
                                            disabled={this.state.editable}
d.arizona's avatar
d.arizona committed
2145 2146 2147 2148 2149 2150 2151
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable === true ? 'default' : 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
d.arizona's avatar
d.arizona committed
2152 2153 2154 2155 2156
                                        >
                                            <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 & Complete</Typography>
                                            </div>
                                        </button>
d.arizona's avatar
d.arizona committed
2157
                                    </div>}
d.arizona's avatar
d.arizona committed
2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191
                                </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={() => {
d.arizona's avatar
d.arizona committed
2192
                                    this.state.judul === "MASTER BUDGET - OPERATING INDICATOR" ?
d.arizona's avatar
d.arizona committed
2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
                        </div>
                    </div>
                )}
            </div>
        );
    }
}