BalanceSheet.js 224 KB
Newer Older
Deni Rinaldi's avatar
Deni Rinaldi committed
1
import React, { Component } from 'react';
Deni Rinaldi's avatar
Deni Rinaldi committed
2
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Tooltip, withStyles, Snackbar } from '@material-ui/core';
Deni Rinaldi's avatar
Deni Rinaldi committed
3 4
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
Deni Rinaldi's avatar
Deni Rinaldi committed
5
import api from '../../api';
Deni Rinaldi's avatar
Deni Rinaldi committed
6
import PropagateLoader from "react-spinners/PropagateLoader"
Deni Rinaldi's avatar
Deni Rinaldi committed
7 8
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
Deni Rinaldi's avatar
Deni Rinaldi committed
9 10
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
Deni Rinaldi's avatar
Deni Rinaldi committed
11
import { Alert } from '@material-ui/lab';
Deni Rinaldi's avatar
Deni Rinaldi committed
12

13 14 15 16 17 18 19 20 21
const LightTooltip = withStyles((theme) => ({
    tooltip: {
        backgroundColor: theme.palette.common.white,
        color: 'rgba(0, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);

Deni Rinaldi's avatar
Deni Rinaldi committed
22
var ct = require("../../library/CustomTable");
Deni Rinaldi's avatar
Deni Rinaldi committed
23
const getMuiTheme = () => createMuiTheme(ct.customTable3());
Deni Rinaldi's avatar
Deni Rinaldi committed
24

Deni Rinaldi's avatar
Deni Rinaldi committed
25 26 27 28 29
const options = ct.customOptionsFixedColumn();
const style = {
    position: "sticky",
    left: 0,
    zIndex: 101,
Deni Rinaldi's avatar
Deni Rinaldi committed
30
    background: "white",
Deni Rinaldi's avatar
Deni Rinaldi committed
31 32 33 34
};
const style2 = {
    position: "sticky",
    background: "white",
Deni Rinaldi's avatar
Deni Rinaldi committed
35
    zIndex: 100
Deni Rinaldi's avatar
Deni Rinaldi committed
36 37 38
};

export default class BalanceSheet extends Component {
Deni Rinaldi's avatar
Deni Rinaldi committed
39 40 41
    constructor(props) {
        super(props)
        this.state = {
Deni Rinaldi's avatar
Deni Rinaldi committed
42
            dataTable: [],
Deni Rinaldi's avatar
Deni Rinaldi committed
43
            visibleBalanceSheet: true,
Deni Rinaldi's avatar
Deni Rinaldi committed
44
            disabledSave: true,
45
            editable: false,
Deni Rinaldi's avatar
Deni Rinaldi committed
46
            buttonError: false,
47
            judulColumn: null,
Deni Rinaldi's avatar
Deni Rinaldi committed
48 49
            updateBy: '-',
            handleTekTekTek: 0
Deni Rinaldi's avatar
Deni Rinaldi committed
50
        }
51
        this.handleValue = this.handleValue.bind(this)
Deni Rinaldi's avatar
Deni Rinaldi committed
52
        this.fileHandler = this.fileHandler.bind(this);
Deni Rinaldi's avatar
Deni Rinaldi committed
53 54
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
55
    componentDidMount() {
Deni Rinaldi's avatar
Deni Rinaldi committed
56
        this.getItemHierarki()
57
        this.getLatestUpdate()
Deni Rinaldi's avatar
Deni Rinaldi committed
58 59 60
        console.log(this.props);
    }

61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
    getLatestUpdate() {
        let payload = {
            "report_id": this.props.report_id,
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
            "company_id": this.props.company.company_id,
            "submission_id": this.props.submissionID
        }
        api.create().getLastestUpdateMB(payload).then(response => {
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
                        updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
                    })
                }
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
80
    async getItemHierarki() {
Deni Rinaldi's avatar
Deni Rinaldi committed
81
        this.setState({ loading: true, judulColumn: null })
Deni Rinaldi's avatar
Deni Rinaldi committed
82 83
        let payload = {
            "report_id": this.props.report_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
84 85
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
Deni Rinaldi's avatar
Deni Rinaldi committed
86 87
            "company_id": this.props.company.company_id,
            "submission_id": this.props.submissionID
Deni Rinaldi's avatar
Deni Rinaldi committed
88
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
89 90 91 92 93 94 95 96
        let response = await api.create().getDetailReportMB(payload)
        console.log(response);
        let dataTable = []
        if (response.data) {
            let res = response.data.data
            const handlePushChild = (item) => {
                let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                if (indexIDzz === -1) {
Deni Rinaldi's avatar
Deni Rinaldi committed
97 98 99 100 101 102 103
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
104
                        item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
105 106 107 108 109 110 111 112 113 114 115 116 117 118
                        item.balance_sheet.january,
                        item.balance_sheet.february,
                        item.balance_sheet.march,
                        item.balance_sheet.april,
                        item.balance_sheet.may,
                        item.balance_sheet.june,
                        item.balance_sheet.july,
                        item.balance_sheet.august,
                        item.balance_sheet.september,
                        item.balance_sheet.october,
                        item.balance_sheet.november,
                        item.balance_sheet.december,
                        item.balance_sheet.total_current_year,
                        item.balance_sheet.total_next_year,
Deni Rinaldi's avatar
Deni Rinaldi committed
119
                        item.balance_sheet.total_more_year,
Deni Rinaldi's avatar
Deni Rinaldi committed
120 121 122
                        item.order,
                        item.condition_it_should_be,
                        item.condition_if_wrong
Deni Rinaldi's avatar
Deni Rinaldi committed
123
                    ])
Deni Rinaldi's avatar
Deni Rinaldi committed
124 125 126 127 128 129
                }
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
130
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
131
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
132
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
            res.map((item, index) => {
                dataTable.push([
                    item.type_report_id,
                    item.id,
                    item.parent,
                    item.formula,
                    item.level,
                    item.description,
                    item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
                    item.balance_sheet.january,
                    item.balance_sheet.february,
                    item.balance_sheet.march,
                    item.balance_sheet.april,
                    item.balance_sheet.may,
                    item.balance_sheet.june,
                    item.balance_sheet.july,
                    item.balance_sheet.august,
                    item.balance_sheet.september,
                    item.balance_sheet.october,
                    item.balance_sheet.november,
                    item.balance_sheet.december,
                    item.balance_sheet.total_current_year,
                    item.balance_sheet.total_next_year,
                    item.balance_sheet.total_more_year,
                    item.order,
                    item.condition_it_should_be,
                    item.condition_if_wrong
                ])
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
                    }
                }
            })
            this.setState({ dataTable, loading: false, buttonError: true, editable: true })
        } else {
            this.setState({ dataTable, loading: false, buttonError: true, editable: true })
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
173 174
    }

d.arizona's avatar
d.arizona committed
175 176
    handleValue(data) {
        let total = 0
Deni Rinaldi's avatar
Deni Rinaldi committed
177
        this.state.dataTable.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
178 179
            if (data.rowData[1] === item[2]) {
                total = item[data.columnIndex] === undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
d.arizona's avatar
d.arizona committed
180 181
            }
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
182
        let indexParent = this.state.dataTable.findIndex((val) => val[1] === this.state.dataTable[data.rowIndex][2])
Deni Rinaldi's avatar
Deni Rinaldi committed
183 184 185
        let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
        // console.log(indexParent);
        return a
d.arizona's avatar
d.arizona committed
186 187
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
188
    handleChange(value, tableMeta) {
Deni Rinaldi's avatar
Deni Rinaldi committed
189
        let val = String(value).split(",").join("")
Deni Rinaldi's avatar
Deni Rinaldi committed
190
        let data = this.state.dataTable
Deni Rinaldi's avatar
Deni Rinaldi committed
191
        let indexParent = data.findIndex((val) => val[1] === data[tableMeta.rowIndex][2])
Deni Rinaldi's avatar
Deni Rinaldi committed
192
        if (indexParent > 0) {
Deni Rinaldi's avatar
+  
Deni Rinaldi committed
193
            // console.log(indexParent)
Deni Rinaldi's avatar
Deni Rinaldi committed
194
            let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
Deni Rinaldi's avatar
Deni Rinaldi committed
195
            let jagain = data[indexParent][tableMeta.columnIndex]
Deni Rinaldi's avatar
Deni Rinaldi committed
196
            a = data[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)) : (jagain + Number(val))
Deni Rinaldi's avatar
Deni Rinaldi committed
197
        } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
198
            data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
Deni Rinaldi's avatar
Deni Rinaldi committed
199
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
200 201
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
202 203 204 205 206
    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: String(Number(i[7]).toFixed(1)),
                february: String(Number(i[8]).toFixed(1)),
                march: String(Number(i[9]).toFixed(1)),
                april: String(Number(i[10]).toFixed(1)),
                may: String(Number(i[11]).toFixed(1)),
                june: String(Number(i[12]).toFixed(1)),
                july: String(Number(i[13]).toFixed(1)),
                august: String(Number(i[14]).toFixed(1)),
                september: String(Number(i[15]).toFixed(1)),
                october: String(Number(i[16]).toFixed(1)),
                november: String(Number(i[17]).toFixed(1)),
                december: String(Number(i[18]).toFixed(1)),
                total_current_year: String(Number(i[19]).toFixed(1)),
                total_next_year: String(Number(i[20]).toFixed(1)),
                total_more_year: String(Number(i[21]).toFixed(1))
Deni Rinaldi's avatar
Deni Rinaldi committed
223
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
224
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
225 226 227 228 229 230 231 232
        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
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
233
        // console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
234
        this.setState({ loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
235
        this.props.saveToMasterBudget(payload)
Deni Rinaldi's avatar
Deni Rinaldi committed
236 237 238
        this.props.onClickClose()
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
239 240 241 242 243 244 245 246 247 248
    downloadTemplate = async () => {
        let res = await fetch(
            `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
        )
        res = await res.blob()
        console.log(res)
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
249
            a.download = 'Template Master Budget Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
250 251 252 253 254 255 256 257 258 259 260 261 262
            a.click();
        }
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
                console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
Deni Rinaldi's avatar
Deni Rinaldi committed
263
                console.log(resp.rows[2]);
Deni Rinaldi's avatar
Deni Rinaldi committed
264
                let payload = []
265
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
Deni Rinaldi's avatar
Deni Rinaldi committed
266 267 268
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
Deni Rinaldi's avatar
Deni Rinaldi committed
269 270
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286
                            total_actual_before: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
                            january: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
                            february: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            march: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            april: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            may: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            june: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            july: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            august: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            september: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            october: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            november: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            december: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            total_current_year: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            total_next_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
                            total_more_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim()
Deni Rinaldi's avatar
Deni Rinaldi committed
287 288 289 290 291 292 293 294 295
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    balance_sheet: payload
                }
296
                console.log(body)
Deni Rinaldi's avatar
Deni Rinaldi committed
297
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
Deni Rinaldi's avatar
Deni Rinaldi committed
298 299 300 301
            }
        });
    }

302
    checkUpload() {
Deni Rinaldi's avatar
Deni Rinaldi committed
303
        api.create().checkUploadMB(this.state.payload).then(response => {
304
            // console.log(JSON.stringify(this.state.payload));
Deni Rinaldi's avatar
Deni Rinaldi committed
305 306 307
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
Deni Rinaldi's avatar
Deni Rinaldi committed
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
                    this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true })
                    let dataTable = response.data.data.map((item, index) => {
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.total_actual_before,
                            item.january,
                            item.february,
                            item.march,
                            item.april,
                            item.may,
                            item.june,
                            item.july,
                            item.august,
                            item.september,
                            item.october,
                            item.november,
                            item.december,
                            item.total_current_year,
                            item.total_next_year,
                            item.total_more_year,
Deni Rinaldi's avatar
Deni Rinaldi committed
333
                            item.orders,
Deni Rinaldi's avatar
Deni Rinaldi committed
334 335
                            item.condition_it_should_be,
                            item.condition_if_wrong,
Deni Rinaldi's avatar
Deni Rinaldi committed
336 337 338
                            item.error
                        ]
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
339
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
340
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
341
                            if (item[25].length > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
342
                                console.log('masuk')
Deni Rinaldi's avatar
Deni Rinaldi committed
343
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
344 345 346
                            }
                        })
                        // console.log(this.state.dataTable);
347
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
348 349 350 351 352
                }
            }
        })
    }

353
    uploadBalanceSheet(type) {
Deni Rinaldi's avatar
Deni Rinaldi committed
354 355 356 357
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: String(Number(i[7]).toFixed(1)),
                february: String(Number(i[8]).toFixed(1)),
                march: String(Number(i[9]).toFixed(1)),
                april: String(Number(i[10]).toFixed(1)),
                may: String(Number(i[11]).toFixed(1)),
                june: String(Number(i[12]).toFixed(1)),
                july: String(Number(i[13]).toFixed(1)),
                august: String(Number(i[14]).toFixed(1)),
                september: String(Number(i[15]).toFixed(1)),
                october: String(Number(i[16]).toFixed(1)),
                november: String(Number(i[17]).toFixed(1)),
                december: String(Number(i[18]).toFixed(1)),
                total_current_year: String(Number(i[19]).toFixed(1)),
                total_next_year: String(Number(i[20]).toFixed(1)),
                total_more_year: String(Number(i[21]).toFixed(1))
Deni Rinaldi's avatar
Deni Rinaldi committed
374 375 376
            })
        })
        let body = {
Deni Rinaldi's avatar
Deni Rinaldi committed
377
            submission_id: this.props.submissionID,
Deni Rinaldi's avatar
Deni Rinaldi committed
378 379 380
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
381 382
            balance_sheet: data,
            status: type
Deni Rinaldi's avatar
Deni Rinaldi committed
383
        }
384
        // console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
385
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
386 387 388 389 390 391 392 393 394
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
                    alert(response.data.status)
                }
            } else {
395
                this.setState({ loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
396 397 398 399 400
                alert(response.problem)
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
401
    async downloadAllData() {
402
        let url = `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
Deni Rinaldi's avatar
Deni Rinaldi committed
403
        console.log(url);
Deni Rinaldi's avatar
Deni Rinaldi committed
404
        let res = await fetch(
Deni Rinaldi's avatar
Deni Rinaldi committed
405
            `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID === null ? "" : this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
Deni Rinaldi's avatar
Deni Rinaldi committed
406 407 408 409 410 411 412
        )
        res = await res.blob()
        this.setState({ loading: false })
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
413
            a.download = 'Master Budget Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
414 415 416 417
            a.click();
        }
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
418 419
    handleValidate() {
        let data = []
420
        // console.log(this.state.dataTable)
Deni Rinaldi's avatar
Deni Rinaldi committed
421 422 423 424
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
                total_actual_before: String(i[6]),
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
                january: i[0] === 3 && i[7] === "" ? "0" : String(i[7]),
                february: i[0] === 3 && i[8] === "" ? "0" : String(i[8]),
                march: i[0] === 3 && i[9] === "" ? "0" : String(i[9]),
                april: i[0] === 3 && i[10] === "" ? "0" : String(i[10]),
                may: i[0] === 3 && i[11] === "" ? "0" : String(i[11]),
                june: i[0] === 3 && i[12] === "" ? "0" : String(i[12]),
                july: i[0] === 3 && i[13] === "" ? "0" : String(i[13]),
                august: i[0] === 3 && i[14] === "" ? "0" : String(i[14]),
                september: i[0] === 3 && i[15] === "" ? "0" : String(i[15]),
                october: i[0] === 3 && i[16] === "" ? "0" : String(i[16]),
                november: i[0] === 3 && i[17] === "" ? "0" : String(i[17]),
                december: i[0] === 3 && i[18] === "" ? "0" : String(i[18]),
                total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
                total_next_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
                total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21]),
Deni Rinaldi's avatar
Deni Rinaldi committed
440 441
            })
        })
442
        // console.log(JSON.stringify(data))
Deni Rinaldi's avatar
Deni Rinaldi committed
443 444 445 446 447 448 449 450 451 452 453
        let payload = {
            "submission_id": this.props.submissionID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "balance_sheet": data,
            "status": "submitted"
        }
        api.create().validateSubmitReport(payload).then((response) => {
            console.log(response)
            if (response.data.data.result) {
Deni Rinaldi's avatar
Deni Rinaldi committed
454
                this.setState({ loading: false, buttonError: false, editable: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
455 456 457 458 459 460 461 462 463 464
            } else {
                this.setState({ loading: false, buttonError: true, editable: true })
            }
        })
    }

    closeAlert() {
        this.setState({ alert: false })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
465
    render() {
d.arizona's avatar
d.arizona committed
466
        let dataTable2 = this.state.dataTable
467
        const handleChange = (value, tableMeta, type) => {
d.arizona's avatar
d.arizona committed
468
            let val = String(value).split(",").join("")
469
            if (type === "actual") {
d.arizona's avatar
d.arizona committed
470
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
471 472 473 474 475 476 477 478 479 480
            } else {
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
                    // console.log(indexParent)
                    let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)) : (jagain + Number(val))
                } else {
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                }
d.arizona's avatar
d.arizona committed
481 482
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
483
        const handleTotal = (tableMeta) => {
484
            let total = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][18]
Deni Rinaldi's avatar
Deni Rinaldi committed
485 486 487
            return total
            // console.log(total);
        }
d.arizona's avatar
d.arizona committed
488 489 490
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
491 492
                if (data.rowData[1] === item[2]) {
                    total = item[data.columnIndex] === undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
d.arizona's avatar
d.arizona committed
493 494
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
495
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
Deni Rinaldi's avatar
Deni Rinaldi committed
496
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
d.arizona's avatar
d.arizona committed
497 498 499
            // console.log(indexParent);
            return a
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
500
        const handleFormula = (data, tableMeta) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
501 502 503
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
            arrayFormula.map((item, indexs) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
504
                let index = dataTable2.findIndex((val) => val[22] == item)
Deni Rinaldi's avatar
Deni Rinaldi committed
505
                if (index > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
506
                    arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
Deni Rinaldi's avatar
Deni Rinaldi committed
507 508 509 510 511 512 513
                } else {
                    arrayJumlah.push(item)
                }
                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539
            let array = arrayJumlah
            let total = 0
            let opt = ""
            array.map((item, index) => {
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
                    if (opt == "tambah") {
                        total = Number(total) + Number(item)
                    } else if (opt == "kurang") {
                        total = Number(total) - Number(item)
                    } else if (opt == "kali") {
                        total = Number(total) * Number(item)
                    } else if (opt == "bagi") {
                        total = Number(total) / Number(item)
                    } else {
                        total += item
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
540 541
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
            return a
Deni Rinaldi's avatar
Deni Rinaldi committed
542 543

        }
Deni Rinaldi's avatar
Deni Rinaldi committed
544

Deni Rinaldi's avatar
Deni Rinaldi committed
545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
        const handleValidation = (data, tableMeta) => {
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
            arrayFormula.map((item, indexs) => {
                let index = dataTable2.findIndex((val) => val[22] == item)
                if (index > 0) {
                    arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
                } else {
                    arrayJumlah.push(item)
                }
                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
            let array = arrayJumlah
            let total = 0
            let opt = ""
            array.map((item, index) => {
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
                    if (opt == "tambah") {
                        total = Number(total) + Number(item)
                    } else if (opt == "kurang") {
                        total = Number(total) - Number(item)
                    } else if (opt == "kali") {
                        total = Number(total) * Number(item)
                    } else if (opt == "bagi") {
                        total = Number(total) / Number(item)
                    } else {
                        total += item
                    }
                }
            })
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
            return a
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
589
        const columns = [{
Deni Rinaldi's avatar
Deni Rinaldi committed
590 591 592 593
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
594
        }, {
d.arizona's avatar
d.arizona committed
595 596 597 598
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
599
        }, {
d.arizona's avatar
d.arizona committed
600 601 602 603
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
604
        }, {
d.arizona's avatar
d.arizona committed
605 606 607 608
            name: "",
            options: {
                display: false
            }
609 610 611 612 613
        }, {
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
614
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
615
            name: "Account",
Deni Rinaldi's avatar
Deni Rinaldi committed
616 617
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
618
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
619 620 621 622 623 624
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style }),
                customBodyRender: (val, tableMeta) => {
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
625
                        <div style={{ width: 300 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
626 627
                            {tableMeta.rowData[25] ?
                                tableMeta.rowData[25].length > 0 ?
628 629 630 631 632
                                    <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
                                            <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </LightTooltip>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
633 634 635 636 637 638 639
                                    :
                                    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>
Deni Rinaldi's avatar
Deni Rinaldi committed
640
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
641 642 643 644 645 646
                                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>
Deni Rinaldi's avatar
Deni Rinaldi committed
647 648 649 650 651 652
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
653
            name: `31 Dec ${Number(this.props.periode) - 1} Actual`,
Deni Rinaldi's avatar
Deni Rinaldi committed
654 655
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
656 657
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
658 659
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
660
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
661 662 663
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
664 665
                            {tableMeta.rowData[0] === 4 ?
                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
666
                                : tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683
                                    null :
                                    <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=""
                                                    disabled={true}
                                                    value={Number(value).toFixed(1)}
                                                />
                                            }
                                        />
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
684 685 686 687
                            }
                        </div>
                    )
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
688 689
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
690
            name: `Jan ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
691 692
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
693
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
694 695 696
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
697
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
698 699 700
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
701
                            {tableMeta.rowData[0] === 3 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
702 703 704 705 706 707 708 709 710 711
                                <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
712
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
713
                                                value={Number(value).toFixed(1)}
d.arizona's avatar
d.arizona committed
714 715 716
                                                onBlur={(event) => {
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
717
                                                }}
Deni Rinaldi's avatar
Deni Rinaldi committed
718 719 720 721
                                            />
                                        }
                                    />
                                </div> :
Deni Rinaldi's avatar
Deni Rinaldi committed
722
                                tableMeta.rowData[0] === 2 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
723 724 725 726 727 728 729
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
730
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
731 732 733
                                        />
                                    </span>
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
734 735
                                    tableMeta.rowData[0] === 4 ?
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
736
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
737
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
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}
744
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
745
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
746
                                            :
Deni Rinaldi's avatar
Deni Rinaldi committed
747
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
748 749 750 751 752 753
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
754
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
755
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
756 757
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
758 759 760 761 762 763 764 765 766 767 768
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
769
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
816
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
817 818 819 820 821 822 823 824 825
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
826 827 828 829 830 831
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
832
            name: `Feb ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
833 834
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
835
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
836 837 838
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
839
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
840
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
841
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
842
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
843
                            {tableMeta.rowData[0] === 3 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
844 845 846 847 848 849 850 851 852 853
                                <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
854
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
855
                                                value={Number(value).toFixed(1)}
d.arizona's avatar
d.arizona committed
856 857 858 859
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
860 861 862 863 864 865 866 867 868 869 870 871 872
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
873
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
874 875 876
                                        />
                                    </span>
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
877 878
                                    tableMeta.rowData[0] === 4 ?
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
879
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
880
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
881 882 883 884 885 886
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
887
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
888
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
889
                                            :
Deni Rinaldi's avatar
Deni Rinaldi committed
890
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
891 892 893 894 895 896
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
897
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
898
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
899 900
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
901 902 903 904 905 906 907 908 909 910 911
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
912
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
959
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
960 961 962 963 964 965 966 967 968
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
969
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
970 971 972 973 974
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
975
            name: `Mar ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
976 977
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
978
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
979 980 981
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
982
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
983
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
984
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
985
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
+  
Deni Rinaldi committed
986
                            {tableMeta.rowData[0] === 3 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
987 988 989 990 991 992 993 994 995 996
                                <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
997
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
998
                                                value={Number(value).toFixed(1)}
d.arizona's avatar
d.arizona committed
999 1000 1001 1002
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
1016
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1017 1018 1019
                                        />
                                    </span>
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1020 1021
                                    tableMeta.rowData[0] === 4 ?
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1022
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1023
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1024 1025 1026 1027 1028 1029
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
1030
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1031
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1032
                                            :
Deni Rinaldi's avatar
Deni Rinaldi committed
1033
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1034 1035 1036 1037 1038 1039
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
1040
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1041
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1042 1043
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
1055
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
1102
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
1103 1104 1105 1106 1107 1108 1109 1110 1111
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1112
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1113 1114 1115 1116 1117
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1118
            name: `Apr ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1119 1120
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1121
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1122 1123 1124
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1125
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1126
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1127
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1128
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1129
                            {tableMeta.rowData[0] === 3 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139
                                <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
1140
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
1141
                                                value={Number(value).toFixed(1)}
d.arizona's avatar
d.arizona committed
1142 1143 1144 1145
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
1159
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1160 1161 1162
                                        />
                                    </span>
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1163 1164
                                    tableMeta.rowData[0] === 4 ?
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1165
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1166
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1167 1168 1169 1170 1171 1172
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
1173
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1174
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1175
                                            :
Deni Rinaldi's avatar
Deni Rinaldi committed
1176
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1177 1178 1179 1180 1181 1182
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
1183
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1184
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1185 1186
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
1198
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
1245
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
1246 1247 1248 1249 1250 1251 1252 1253 1254
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1255
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1256 1257 1258 1259 1260
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1261
            name: `May ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1262 1263
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1264
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1265 1266 1267
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1268
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1269
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1270
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1271
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1272
                            {tableMeta.rowData[0] === 3 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282
                                <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
1283
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
1284
                                                value={Number(value).toFixed(1)}
d.arizona's avatar
d.arizona committed
1285 1286 1287 1288
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
1302
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1303 1304 1305
                                        />
                                    </span>
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1306 1307
                                    tableMeta.rowData[0] === 4 ?
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1308
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1309
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1310 1311 1312 1313 1314 1315
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
1316
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1317
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1318
                                            :
Deni Rinaldi's avatar
Deni Rinaldi committed
1319
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1320 1321 1322 1323 1324 1325
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
1326
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1327
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1328 1329
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
1341
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
1388
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
1389 1390 1391 1392 1393 1394 1395 1396 1397
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1398
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1399 1400 1401 1402 1403
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1404
            name: `Jun ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1405 1406
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1407
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1408 1409 1410
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1411
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1412
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1413
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1414
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1426
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
1427
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
1445
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1446 1447 1448 1449 1450 1451 1452
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1453 1454 1455 1456 1457 1458
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
1459
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1460
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1461 1462
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1463 1464 1465 1466 1467 1468
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
1469
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1470
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1471 1472
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
1484
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
1531
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
1532 1533 1534 1535 1536 1537 1538 1539 1540
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1541 1542 1543 1544 1545 1546
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1547
            name: `Jul ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1548 1549
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1550
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1551 1552 1553
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1554
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1569
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
1570
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
1588
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1589 1590 1591 1592 1593 1594 1595
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1596 1597 1598 1599 1600 1601
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
1602
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1603
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1604 1605
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1606 1607 1608 1609 1610 1611
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
1612
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1613
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1614 1615
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
1627
                                                    :
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 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
1674
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
1675 1676 1677 1678 1679 1680 1681 1682 1683
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1684 1685 1686 1687 1688 1689
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1690
            name: `Aug ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1691 1692
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1693
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1694 1695 1696
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1697
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1712
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
1713
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
1731
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1732 1733 1734 1735 1736 1737 1738
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1739 1740 1741 1742 1743 1744
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
1745
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1746
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1747 1748
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1749 1750 1751 1752 1753 1754
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
1755
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1756
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1757 1758
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
1770
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
1817
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
1818 1819 1820 1821 1822 1823 1824 1825 1826
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1827 1828 1829 1830 1831 1832
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1833
            name: `Sep ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1834 1835
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1836
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1837 1838 1839
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1840
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1855
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
1856
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
1874
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1875 1876 1877 1878 1879 1880 1881
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1882 1883 1884 1885 1886 1887
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
1888
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1889
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1890 1891
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1892 1893 1894 1895 1896 1897
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
1898
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1899
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1900 1901
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
1913
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
1960
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
1961 1962 1963 1964 1965 1966 1967 1968 1969
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1970 1971 1972 1973 1974 1975
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1976
            name: `Oct ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1977 1978
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1979
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1980 1981 1982
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1983
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
1998
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
1999
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
2017
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2018 2019 2020 2021 2022 2023 2024
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2025 2026 2027 2028 2029 2030
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
2031
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2032
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2033 2034
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2035 2036 2037 2038 2039 2040
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
2041
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2042
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2043 2044
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
2056
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
2103
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
2104 2105 2106 2107 2108 2109 2110 2111 2112
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2113 2114 2115 2116 2117 2118
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2119
            name: `Nov ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2120 2121
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2122
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2123 2124 2125
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2126
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
2141
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
2142
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
2160
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2161 2162 2163 2164 2165 2166 2167
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2168 2169 2170 2171 2172 2173
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
2174
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2175
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2176 2177
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2178 2179 2180 2181 2182 2183
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
2184
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2185
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2186 2187
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
2199
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
2246
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
2247 2248 2249 2250 2251 2252 2253 2254 2255
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2256 2257 2258 2259 2260 2261
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2262
            name: `Dec ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2263 2264
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2265
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2266 2267 2268
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2269
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2270 2271 2272 2273
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2274 2275 2276 2277 2278 2279 2280 2281 2282 2283
                                <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
2284
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
2285
                                                value={Number(value).toFixed(1)}
d.arizona's avatar
d.arizona committed
2286 2287 2288 2289
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
2303
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2304 2305 2306
                                        />
                                    </span>
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2307 2308
                                    tableMeta.rowData[0] === 4 ?
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2309
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2310
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2311 2312 2313 2314 2315 2316
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
2317
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2318
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2319
                                            :
Deni Rinaldi's avatar
Deni Rinaldi committed
2320
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2321 2322 2323 2324 2325 2326
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
2327
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2328
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2329 2330
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
2342
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
2389
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
2390 2391 2392 2393 2394 2395 2396 2397 2398
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2399
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2400 2401 2402 2403 2404
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2405
            name: "Current Total",
Deni Rinaldi's avatar
Deni Rinaldi committed
2406 2407
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2408 2409
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2410 2411
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2412
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2413
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2414
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
2415
                        <div style={{ width: 96, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
2427
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438
                                                value={Number(value).toFixed(1)}
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2439 2440 2441 2442 2443 2444 2445
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
2446
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2447
                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
                                            />
                                            :
                                            tableMeta.rowData[0] === 5 ?
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
                                                />
                                                :
                                                tableMeta.rowData[0] === 1 ?
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
2532
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
2533 2534 2535 2536 2537 2538 2539 2540 2541
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2542
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2543 2544 2545 2546 2547
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2548
            name: `31 Dec ${Number(this.props.periode) + 1} Total`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2549 2550
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2551 2552
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2553 2554
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2555
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2556
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2557
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
2570
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
2571
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
2589
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2590 2591 2592 2593 2594 2595 2596
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2597 2598 2599 2600 2601 2602
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
2603
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2604
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2605 2606
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2607 2608 2609 2610 2611 2612
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
2613
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2614
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2615 2616
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
2628
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
2675
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
2676 2677 2678 2679 2680 2681 2682 2683 2684
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2685
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2686 2687 2688 2689 2690
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2691
            name: `31 Dec ${Number(this.props.periode) + 2} Total`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2692 2693
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2694 2695
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2696 2697
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2698
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2699
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2700
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
2713
                                                disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
2714
                                                value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
                                tableMeta.rowData[0] === 2 ?
                                    <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
2732
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2733 2734 2735 2736 2737 2738 2739
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2740 2741 2742 2743 2744 2745
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
2746
                                                value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2747
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2748 2749
                                            :
                                            tableMeta.rowData[0] === 5 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2750 2751 2752 2753 2754 2755
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
2756
                                                    value={Number(handleFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2757
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2758 2759
                                                :
                                                tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
Deni Rinaldi's avatar
Deni Rinaldi committed
2771
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817
                                                    tableMeta.rowData[0] === 7 ?
                                                        Number(handleValidation(value, tableMeta)).toFixed(1) === Number(tableMeta.rowData[23]).toFixed(1) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent',
                                                                    color: 'black'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                            /> : tableMeta.rowData[24] === "STOPPER" ?
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip> :
                                                                <LightTooltip title={`Value Should be ${tableMeta.rowData[23]}`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
2818
                                                                            color: 'red'
Deni Rinaldi's avatar
Deni Rinaldi committed
2819 2820 2821 2822 2823 2824 2825 2826 2827
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    />
                                                                </LightTooltip>
                                                        :
                                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2828
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2829 2830 2831 2832
                        </div>
                    )
                }
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2833
        },
Deni Rinaldi's avatar
Deni Rinaldi committed
2834 2835 2836 2837 2838 2839
        {
            name: "",
            options: {
                display: false
            }
        },
Deni Rinaldi's avatar
Deni Rinaldi committed
2840 2841 2842 2843 2844
        {
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2845 2846
        }
        ]
Deni Rinaldi's avatar
Deni Rinaldi committed
2847 2848 2849 2850 2851 2852 2853 2854 2855 2856
        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>
        );
Deni Rinaldi's avatar
Deni Rinaldi committed
2857

Deni Rinaldi's avatar
Deni Rinaldi committed
2858
        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
2859
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2860
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
2861
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2862
                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2863 2864 2865 2866 2867 2868
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                {/* {this.state.loading && loadingComponent} */}
Deni Rinaldi's avatar
Deni Rinaldi committed
2869
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2870 2871 2872
                    {this.state.visibleBalanceSheet === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
2873
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Balance Sheet</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2874 2875 2876 2877 2878
                            </div>
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2879
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2880 2881 2882
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2883
                                        {this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2884
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2885
                                                <a data-tip={'Download'} data-for="download">
Deni Rinaldi's avatar
Deni Rinaldi committed
2886 2887 2888 2889 2890 2891 2892
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
Deni Rinaldi's avatar
Deni Rinaldi committed
2893 2894 2895 2896 2897 2898
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
Deni Rinaldi's avatar
Deni Rinaldi committed
2899
                                                    >
Deni Rinaldi's avatar
Deni Rinaldi committed
2900
                                                        <img src={Images.download} />
Deni Rinaldi's avatar
Deni Rinaldi committed
2901 2902
                                                    </button>
                                                </a>
Deni Rinaldi's avatar
Deni Rinaldi committed
2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                            </div> :
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                {((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
                                                    <div>
                                                        <a data-tip={'Download Template'} data-for="template">
                                                            <button
                                                                style={{
                                                                    backgroundColor: 'transparent',
                                                                    cursor: 'pointer',
                                                                    borderColor: 'transparent',
                                                                    margin: 5
                                                                }}
                                                                onClick={() => this.downloadTemplate()}
                                                            >
                                                                <img src={Images.template} />
                                                            </button>
                                                        </a>
                                                        <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                    </div>
a.bairuha's avatar
a.bairuha committed
2923
                                                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2924
                                                {((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
Deni Rinaldi's avatar
Deni Rinaldi committed
2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940
                                                    <div>
                                                        <a data-tip={'Upload'} data-for="upload">
                                                            <button
                                                                style={{
                                                                    backgroundColor: 'transparent',
                                                                    cursor: 'pointer',
                                                                    borderColor: 'transparent',
                                                                    margin: 5
                                                                }}
                                                                onClick={() => this.setState({ visibleUpload: true })}
                                                            >
                                                                <img src={Images.upload} />
                                                            </button>
                                                        </a>
                                                        <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                    </div>
a.bairuha's avatar
a.bairuha committed
2941
                                                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962
                                                <a data-tip={'Download'} data-for="download">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                            </div>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
2963 2964
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2965

Deni Rinaldi's avatar
Deni Rinaldi committed
2966
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2967 2968
                                    {this.state.loading && loadingComponent}
                                    <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2969 2970 2971 2972 2973
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2974
                                    </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
2975
                                </div>
2976
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2977
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2978 2979 2980 2981
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
2982 2983 2984 2985 2986
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
Deni Rinaldi's avatar
Deni Rinaldi committed
2987 2988 2989 2990 2991 2992 2993 2994
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none'
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
2995
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2996 2997 2998
                                        </div>
                                    </button>
                                </div>
a.bairuha's avatar
a.bairuha committed
2999
                                {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3000
                                    (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069
                                        <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                            <button
                                                className="button"
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() => {
                                                    this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.handleValidate()
                                                        }, 100);
                                                    })
                                                }}
                                            >
                                                <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',
                                                    cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() =>
                                                    this.state.editable === true ?
                                                        null :
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                this.backToMasterBudget('draft')
                                                            })
                                                }
                                            >
                                                <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"
                                                disabled={this.state.buttonError}
                                                onClick={() =>
                                                    this.state.buttonError ?
                                                        this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                        :
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                this.backToMasterBudget('submitted')
                                                            })}
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                }}
                                            >
                                                <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>
                                        </div> : null
Deni Rinaldi's avatar
Deni Rinaldi committed
3070
                                }
3071
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3072 3073 3074 3075 3076
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3077 3078
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3079
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3080 3081
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3082
                                    {this.state.dataLoaded && (
Deni Rinaldi's avatar
Deni Rinaldi committed
3083
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3084 3085
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3086
                                                <MUIDataTable
Deni Rinaldi's avatar
Deni Rinaldi committed
3087
                                                    data={dataTable2}
Deni Rinaldi's avatar
Deni Rinaldi committed
3088 3089 3090
                                                    columns={columns}
                                                    options={options}
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
3091
                                            </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
3092 3093 3094
                                        </div>
                                    )}
                                </div>
3095 3096 3097 3098 3099 3100

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visibleBalanceSheet: true }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3101
                                                setTimeout(() => {
3102
                                                    this.getItemHierarki()
Deni Rinaldi's avatar
Deni Rinaldi committed
3103
                                                }, 100);
3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                        <button
                                            className="button"
                                            type="button"
                                            disabled={this.state.buttonError}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3127
                                                        this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
3128 3129 3130 3131 3132 3133 3134 3135 3136 3137
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <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
                                            type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
3138 3139 3140 3141 3142 3143 3144
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3145
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
3146 3147
                                                this.state.editable === true ?
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3148 3149 3150 3151 3152 3153 3154 3155
                                                    this.setState({ loading: true }, () =>
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('draft')
                                                                }, 100);
                                                            })
                                                    )
Deni Rinaldi's avatar
Deni Rinaldi committed
3156
                                            }
3157 3158 3159 3160 3161 3162 3163
                                        >
                                            <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
3164 3165 3166 3167 3168 3169
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3170
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
3171 3172
                                                this.state.editable === true ?
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3173 3174 3175 3176 3177 3178 3179 3180
                                                    this.setState({ loading: true }, () =>
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('submitted')
                                                                }, 100);
                                                            })
                                                    )
Deni Rinaldi's avatar
Deni Rinaldi committed
3181
                                            }
3182 3183 3184 3185 3186 3187
                                        >
                                            <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>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199
                                </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>
Deni Rinaldi's avatar
Deni Rinaldi committed
3200
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3201 3202 3203 3204 3205 3206 3207 3208 3209 3210
                                </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>
3211
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226
                            <UploadFile
                                type={this.state.uploadStatus}
                                percentage={this.state.percentage}
                                result={this.state.result}
                                acceptedFiles={["xlsx"]}
                                onHandle={(dt) => {
                                    this.fileHandler(dt)
                                    this.setState({ uploadStatus: 'idle', percentage: '0' })
                                }}
                                onUpload={() => {
                                    this.state.judul === "MASTER BUDGET - BALANCE SHEET" ?
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
3227
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3228 3229
                    </div>
                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
3230 3231 3232 3233
            </div>
        );
    }
}