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
            updateBy: '-',
Deni Rinaldi's avatar
Deni Rinaldi committed
49 50
            handleTekTekTek: 0,
            saveDraft: true
Deni Rinaldi's avatar
Deni Rinaldi committed
51
        }
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 119
                        Number(item.balance_sheet.january).toFixed(1),
                        Number(item.balance_sheet.february).toFixed(1),
                        Number(item.balance_sheet.march).toFixed(1),
                        Number(item.balance_sheet.april).toFixed(1),
                        Number(item.balance_sheet.may).toFixed(1),
                        Number(item.balance_sheet.june).toFixed(1),
                        Number(item.balance_sheet.july).toFixed(1),
                        Number(item.balance_sheet.august).toFixed(1),
                        Number(item.balance_sheet.september).toFixed(1),
                        Number(item.balance_sheet.october).toFixed(1),
                        Number(item.balance_sheet.november).toFixed(1),
                        Number(item.balance_sheet.december).toFixed(1),
                        Number(item.balance_sheet.total_current_year).toFixed(1),
                        Number(item.balance_sheet.total_next_year).toFixed(1),
                        Number(item.balance_sheet.total_more_year).toFixed(1),
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
            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,
Deni Rinaldi's avatar
Deni Rinaldi committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
                    Number(item.balance_sheet.january).toFixed(1),
                    Number(item.balance_sheet.february).toFixed(1),
                    Number(item.balance_sheet.march).toFixed(1),
                    Number(item.balance_sheet.april).toFixed(1),
                    Number(item.balance_sheet.may).toFixed(1),
                    Number(item.balance_sheet.june).toFixed(1),
                    Number(item.balance_sheet.july).toFixed(1),
                    Number(item.balance_sheet.august).toFixed(1),
                    Number(item.balance_sheet.september).toFixed(1),
                    Number(item.balance_sheet.october).toFixed(1),
                    Number(item.balance_sheet.november).toFixed(1),
                    Number(item.balance_sheet.december).toFixed(1),
                    Number(item.balance_sheet.total_current_year).toFixed(1),
                    Number(item.balance_sheet.total_next_year).toFixed(1),
                    Number(item.balance_sheet.total_more_year).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
                    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
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
175 176 177 178 179
    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
                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
196
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
197
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
198 199 200 201 202 203 204 205
        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
206
        // console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
207
        this.setState({ loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
208
        this.props.saveToMasterBudget(payload)
Deni Rinaldi's avatar
Deni Rinaldi committed
209 210 211
        this.props.onClickClose()
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
212 213 214 215 216 217 218 219 220 221
    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;
222
            a.download = 'Template Master Budget Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
223 224 225 226 227 228 229 230 231 232 233 234 235
            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
236
                console.log(resp.rows[2]);
Deni Rinaldi's avatar
Deni Rinaldi committed
237
                let payload = []
238
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
Deni Rinaldi's avatar
Deni Rinaldi committed
239 240 241
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
Deni Rinaldi's avatar
Deni Rinaldi committed
242 243
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
                            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
260 261 262 263 264 265 266 267 268
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    balance_sheet: payload
                }
269
                console.log(body)
Deni Rinaldi's avatar
Deni Rinaldi committed
270
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
Deni Rinaldi's avatar
Deni Rinaldi committed
271 272 273 274
            }
        });
    }

275
    checkUpload() {
Deni Rinaldi's avatar
Deni Rinaldi committed
276
        api.create().checkUploadMB(this.state.payload).then(response => {
277
            // console.log(JSON.stringify(this.state.payload));
Deni Rinaldi's avatar
Deni Rinaldi committed
278 279 280
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
Deni Rinaldi's avatar
Deni Rinaldi committed
281 282 283 284 285 286 287 288 289 290
                    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,
Deni Rinaldi's avatar
Deni Rinaldi committed
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
                            Number(item.january).toFixed(1),
                            Number(item.february).toFixed(1),
                            Number(item.march).toFixed(1),
                            Number(item.april).toFixed(1),
                            Number(item.may).toFixed(1),
                            Number(item.june).toFixed(1),
                            Number(item.july).toFixed(1),
                            Number(item.august).toFixed(1),
                            Number(item.september).toFixed(1),
                            Number(item.october).toFixed(1),
                            Number(item.november).toFixed(1),
                            Number(item.december).toFixed(1),
                            Number(item.total_current_year).toFixed(1),
                            Number(item.total_next_year).toFixed(1),
                            Number(item.total_more_year).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
306
                            item.orders,
Deni Rinaldi's avatar
Deni Rinaldi committed
307 308
                            item.condition_it_should_be,
                            item.condition_if_wrong,
Deni Rinaldi's avatar
Deni Rinaldi committed
309 310 311
                            item.error
                        ]
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
312
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, errorPreview: false }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
313
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
314
                            if (item[25].length > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
315
                                console.log('error')
Deni Rinaldi's avatar
Deni Rinaldi committed
316
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
317 318 319
                            }
                        })
                        // console.log(this.state.dataTable);
320
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
321 322 323 324 325
                }
            }
        })
    }

326
    uploadBalanceSheet(type) {
Deni Rinaldi's avatar
Deni Rinaldi committed
327 328 329 330
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
                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
347 348 349
            })
        })
        let body = {
Deni Rinaldi's avatar
Deni Rinaldi committed
350
            submission_id: this.props.submissionID,
Deni Rinaldi's avatar
Deni Rinaldi committed
351 352 353
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
354 355
            balance_sheet: data,
            status: type
Deni Rinaldi's avatar
Deni Rinaldi committed
356
        }
357
        // console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
358
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
359 360 361 362 363 364 365 366 367
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
                    alert(response.data.status)
                }
            } else {
368
                this.setState({ loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
369 370 371 372 373
                alert(response.problem)
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
374
    async downloadAllData() {
375
        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
376
        console.log(url);
Deni Rinaldi's avatar
Deni Rinaldi committed
377
        let res = await fetch(
Deni Rinaldi's avatar
Deni Rinaldi committed
378
            `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
379 380 381 382 383 384 385
        )
        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;
386
            a.download = 'Master Budget Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
387 388 389 390
            a.click();
        }
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
391 392
    handleValidate() {
        let data = []
393
        // console.log(this.state.dataTable)
Deni Rinaldi's avatar
Deni Rinaldi committed
394 395 396
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 3 && i[7] === "" ? "0" : String(Number(i[7]).toFixed(1)),
                february: i[0] === 3 && i[8] === "" ? "0" : String(Number(i[8]).toFixed(1)),
                march: i[0] === 3 && i[9] === "" ? "0" : String(Number(i[9]).toFixed(1)),
                april: i[0] === 3 && i[10] === "" ? "0" : String(Number(i[10]).toFixed(1)),
                may: i[0] === 3 && i[11] === "" ? "0" : String(Number(i[11]).toFixed(1)),
                june: i[0] === 3 && i[12] === "" ? "0" : String(Number(i[12]).toFixed(1)),
                july: i[0] === 3 && i[13] === "" ? "0" : String(Number(i[13]).toFixed(1)),
                august: i[0] === 3 && i[14] === "" ? "0" : String(Number(i[14]).toFixed(1)),
                september: i[0] === 3 && i[15] === "" ? "0" : String(Number(i[15]).toFixed(1)),
                october: i[0] === 3 && i[16] === "" ? "0" : String(Number(i[16]).toFixed(1)),
                november: i[0] === 3 && i[17] === "" ? "0" : String(Number(i[17]).toFixed(1)),
                december: i[0] === 3 && i[18] === "" ? "0" : String(Number(i[18]).toFixed(1)),
                total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(Number(i[19]).toFixed(1)),
                total_next_year: i[0] === 3 && i[20] === "" ? "0" : String(Number(i[20]).toFixed(1)),
                total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(Number(i[21]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
413 414
            })
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
415
        console.log(JSON.stringify(data))
Deni Rinaldi's avatar
Deni Rinaldi committed
416 417 418 419 420 421 422 423 424 425 426
        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
427
                this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
428
            } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
429
                this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
430 431 432 433 434 435 436 437
            }
        })
    }

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

Deni Rinaldi's avatar
Deni Rinaldi committed
438
    render() {
d.arizona's avatar
d.arizona committed
439
        let dataTable2 = this.state.dataTable
440
        const handleChange = (value, tableMeta, type) => {
d.arizona's avatar
d.arizona committed
441
            let val = String(value).split(",").join("")
442
            if (type === "actual") {
Deni Rinaldi's avatar
Deni Rinaldi committed
443
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
444 445 446 447 448 449
            } 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]
Deni Rinaldi's avatar
Deni Rinaldi committed
450
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)).toFixed(1) : Number(jagain + Number(val)).toFixed(1)
451
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
452
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
453
                }
d.arizona's avatar
d.arizona committed
454 455
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
456
        const handleTotal = (tableMeta) => {
457
            let total = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][18]
Deni Rinaldi's avatar
Deni Rinaldi committed
458 459 460
            return total
            // console.log(total);
        }
d.arizona's avatar
d.arizona committed
461 462 463
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
464 465
                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
466 467
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
468
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
Deni Rinaldi's avatar
Deni Rinaldi committed
469
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total).toFixed(1)
d.arizona's avatar
d.arizona committed
470 471 472
            // console.log(indexParent);
            return a
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
473
        const handleFormula = (data, tableMeta) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
474 475 476
            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
477
                let index = dataTable2.findIndex((val) => val[22] == item)
Deni Rinaldi's avatar
Deni Rinaldi committed
478
                if (index > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
479
                    arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
Deni Rinaldi's avatar
Deni Rinaldi committed
480 481 482 483 484 485 486
                } else {
                    arrayJumlah.push(item)
                }
                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
            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
513
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
514
            return a
Deni Rinaldi's avatar
Deni Rinaldi committed
515 516

        }
Deni Rinaldi's avatar
Deni Rinaldi committed
517

Deni Rinaldi's avatar
Deni Rinaldi committed
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
        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
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
558
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
559 560 561
            return a
        }

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

Deni Rinaldi's avatar
Deni Rinaldi committed
2827
        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
2828
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2829
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
2830
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2831
                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2832 2833 2834 2835 2836 2837
                <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
2838
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2839 2840 2841
                    {this.state.visibleBalanceSheet === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
2842
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Balance Sheet</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2843 2844 2845 2846 2847
                            </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
2848
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2849 2850 2851
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2852
                                        {this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2853
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2854
                                                <a data-tip={'Download'} data-for="download">
Deni Rinaldi's avatar
Deni Rinaldi committed
2855 2856 2857 2858 2859 2860 2861
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
Deni Rinaldi's avatar
Deni Rinaldi committed
2862 2863 2864 2865 2866 2867
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
Deni Rinaldi's avatar
Deni Rinaldi committed
2868
                                                    >
Deni Rinaldi's avatar
Deni Rinaldi committed
2869
                                                        <img src={Images.download} />
Deni Rinaldi's avatar
Deni Rinaldi committed
2870 2871
                                                    </button>
                                                </a>
Deni Rinaldi's avatar
Deni Rinaldi committed
2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891
                                                <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
2892
                                                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2893
                                                {((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
2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909
                                                    <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
2910
                                                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931
                                                <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
2932 2933
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2934

Deni Rinaldi's avatar
Deni Rinaldi committed
2935
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2936 2937
                                    {this.state.loading && loadingComponent}
                                    <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2938 2939 2940 2941 2942
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2943
                                    </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
2944
                                </div>
2945
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2946
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2947 2948 2949 2950
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
2951 2952 2953 2954 2955
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
Deni Rinaldi's avatar
Deni Rinaldi committed
2956 2957 2958 2959 2960 2961 2962 2963
                                        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' }}>
2964
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2965 2966 2967
                                        </div>
                                    </button>
                                </div>
a.bairuha's avatar
a.bairuha committed
2968
                                {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
Deni Rinaldi's avatar
Deni Rinaldi committed
2969
                                    (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
2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997
                                        <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',
Deni Rinaldi's avatar
Deni Rinaldi committed
2998
                                                    cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
Deni Rinaldi's avatar
Deni Rinaldi committed
2999 3000 3001 3002 3003
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
3004
                                                    this.state.saveDraft === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
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
                                                        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
3039
                                }
3040
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3041 3042 3043 3044 3045
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3046 3047
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3048
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3049 3050
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3051
                                    {this.state.dataLoaded && (
Deni Rinaldi's avatar
Deni Rinaldi committed
3052
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3053 3054
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3055
                                                <MUIDataTable
Deni Rinaldi's avatar
Deni Rinaldi committed
3056
                                                    data={dataTable2}
Deni Rinaldi's avatar
Deni Rinaldi committed
3057 3058 3059
                                                    columns={columns}
                                                    options={options}
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
3060
                                            </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
3061 3062 3063
                                        </div>
                                    )}
                                </div>
3064 3065 3066 3067 3068 3069

                                <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
3070
                                                setTimeout(() => {
3071
                                                    this.getItemHierarki()
Deni Rinaldi's avatar
Deni Rinaldi committed
3072
                                                }, 100);
3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086
                                            })}
                                            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"
                                            style={{
                                                backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
3087
                                                cursor: 'pointer',
3088 3089 3090 3091 3092 3093 3094
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3095
                                                        this.handleValidate()
3096 3097 3098 3099 3100 3101 3102 3103 3104 3105
                                                    }, 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
3106 3107
                                            style={{
                                                backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
3108
                                                cursor: this.state.errorPreview !== true ? 'pointer' : 'default',
Deni Rinaldi's avatar
Deni Rinaldi committed
3109 3110 3111 3112
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3113
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
3114
                                                this.state.errorPreview === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3115
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3116 3117 3118 3119 3120 3121 3122 3123
                                                    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
3124
                                            }
3125 3126 3127 3128 3129 3130 3131
                                        >
                                            <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
3132 3133 3134 3135 3136 3137
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3138
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
3139 3140
                                                this.state.editable === true ?
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3141 3142 3143 3144 3145 3146 3147 3148
                                                    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
3149
                                            }
3150 3151 3152 3153 3154 3155
                                        >
                                            <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
3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167
                                </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
3168
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3169 3170 3171 3172 3173 3174 3175 3176 3177 3178
                                </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>
3179
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194
                            <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' })
                                }}
                            />
3195
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3196 3197
                    </div>
                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
3198 3199 3200 3201
            </div>
        );
    }
}