ProfitLoss.js 206 KB
Newer Older
EKSAD's avatar
EKSAD committed
1
import React, { Component } from 'react';
d.arizona's avatar
d.arizona committed
2
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Tooltip, withStyles, Snackbar } from '@material-ui/core';
EKSAD's avatar
EKSAD committed
3 4
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
EKSAD's avatar
EKSAD committed
5
import api from '../../api';
EKSAD's avatar
EKSAD committed
6 7 8
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
EKSAD's avatar
EKSAD committed
9 10
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
d.arizona's avatar
d.arizona committed
11
import { Alert } from '@material-ui/lab';
EKSAD's avatar
EKSAD committed
12
import * as R from 'ramda';
Riri Novita's avatar
Riri Novita committed
13
import Constant from '../../library/Constant';
EKSAD's avatar
EKSAD committed
14

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

EKSAD's avatar
EKSAD committed
24
var ct = require("../../library/CustomTable");
EKSAD's avatar
EKSAD committed
25
const getMuiTheme = () => createMuiTheme(ct.customTable3());
EKSAD's avatar
EKSAD committed
26 27 28 29 30 31

const options = ct.customOptionsFixedColumn();
const style = {
    position: "sticky",
    left: 0,
    zIndex: 101,
EKSAD's avatar
EKSAD committed
32
    background: "white",
EKSAD's avatar
EKSAD committed
33 34 35 36
};
const style2 = {
    position: "sticky",
    background: "white",
EKSAD's avatar
EKSAD committed
37
    zIndex: 100
EKSAD's avatar
EKSAD committed
38
};
Deni Rinaldi's avatar
Deni Rinaldi committed
39 40 41 42 43 44
const stylenotes = {
    position: "sticky",
    background: "white",
    zIndex: 101,
    left: 350
};
EKSAD's avatar
EKSAD committed
45

d.arizona's avatar
d.arizona committed
46 47 48 49 50 51 52
const styleNotesEmpty = {
    position: "sticky",
    background: "white",
    zIndex: 99,
    left: 0
}

EKSAD's avatar
EKSAD committed
53
export default class ProfitLoss extends Component {
EKSAD's avatar
EKSAD committed
54 55 56
    constructor(props) {
        super(props)
        this.state = {
EKSAD's avatar
EKSAD committed
57
            dataTable: [],
EKSAD's avatar
EKSAD committed
58
            visibleProfitLoss: true,
EKSAD's avatar
EKSAD committed
59
            disabledSave: true,
EKSAD's avatar
EKSAD committed
60
            editable: false,
EKSAD's avatar
EKSAD committed
61
            buttonError: false,
EKSAD's avatar
EKSAD committed
62
            judulColumn: null,
EKSAD's avatar
EKSAD committed
63 64
            updateBy: '-',
            buttonDraft: true,
Deni Rinaldi's avatar
Deni Rinaldi committed
65 66
            handleTekTekTek: 0,
            fromUpload: false
EKSAD's avatar
EKSAD committed
67
        }
EKSAD's avatar
EKSAD committed
68
        this.handleValue = this.handleValue.bind(this)
EKSAD's avatar
EKSAD committed
69
        this.fileHandler = this.fileHandler.bind(this);
EKSAD's avatar
EKSAD committed
70 71 72 73
    }

    componentDidMount() {
        this.getItemHierarki()
EKSAD's avatar
EKSAD committed
74
        this.getLatestUpdate()
EKSAD's avatar
EKSAD committed
75
        // console.log(this.props);
EKSAD's avatar
EKSAD committed
76 77
    }

EKSAD's avatar
EKSAD committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
    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
                    })
                }
            }
        })
    }

EKSAD's avatar
EKSAD committed
97
    getItemHierarki() {
EKSAD's avatar
EKSAD committed
98
        this.setState({ loading: true, judulColumn: null })
EKSAD's avatar
EKSAD committed
99 100
        let payload = {
            "report_id": this.props.report_id,
EKSAD's avatar
EKSAD committed
101 102
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
EKSAD's avatar
EKSAD committed
103 104
            "company_id": this.props.company.company_id,
            "submission_id": this.props.submissionID
EKSAD's avatar
EKSAD committed
105
        }
EKSAD's avatar
EKSAD committed
106
        api.create().getDetailReportMB(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
107
            // console.log(response);
EKSAD's avatar
EKSAD committed
108
            let dataTable = []
Deni Rinaldi's avatar
Deni Rinaldi committed
109
            this.setState({ visibleProfitLoss: true })
EKSAD's avatar
EKSAD committed
110
            if (response.data) {
Riri Novita's avatar
Riri Novita committed
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
                if (response.ok) {
                    if (response.data.status === 'success') {
                        let res = response.data.data
                        const handlePushChild = (item) => {
                            let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                            if (indexIDzz === -1) {
                                dataTable.push([
                                    item.type_report_id,
                                    item.id,
                                    item.parent,
                                    item.formula,
                                    item.level,
                                    item.description,
                                    item.profit_loss.notes === "" ? null : item.profit_loss.notes,
                                    item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
126 127 128 129 130 131 132 133 134 135 136 137
                                    Number(item.profit_loss.january).toFixed(1),
                                    Number(item.profit_loss.february).toFixed(1),
                                    Number(item.profit_loss.march).toFixed(1),
                                    Number(item.profit_loss.april).toFixed(1),
                                    Number(item.profit_loss.may).toFixed(1),
                                    Number(item.profit_loss.june).toFixed(1),
                                    Number(item.profit_loss.july).toFixed(1),
                                    Number(item.profit_loss.august).toFixed(1),
                                    Number(item.profit_loss.september).toFixed(1),
                                    Number(item.profit_loss.october).toFixed(1),
                                    Number(item.profit_loss.november).toFixed(1),
                                    Number(item.profit_loss.december).toFixed(1),
Riri Novita's avatar
Riri Novita committed
138 139 140 141 142 143
                                    item.profit_loss.total_current_year,
                                    item.profit_loss.total_next_year,
                                    item.profit_loss.total_more_year,
                                    item.order
                                ])
                            }
Riri Novita's avatar
Riri Novita committed
144 145 146 147
                            // if (item.id === 20092) {
                            //     console.log(item);
                            //     console.log(dataTable);
                            // }
Riri Novita's avatar
Riri Novita committed
148 149 150 151 152 153 154
                            if (item.children !== null) {
                                if (item.children.length > 0) {
                                    item.children.map((items, indexs) => {
                                        handlePushChild(items)
                                    })
                                }
                            }
EKSAD's avatar
EKSAD committed
155
                        }
Riri Novita's avatar
Riri Novita committed
156 157 158 159 160 161 162 163 164 165
                        res.map((item, index) => {
                            dataTable.push([
                                item.type_report_id,
                                item.id,
                                item.parent,
                                item.formula,
                                item.level,
                                item.description,
                                item.profit_loss.notes === "" ? null : item.profit_loss.notes,
                                item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
166 167 168 169 170 171 172 173 174 175 176 177
                                Number(item.profit_loss.january).toFixed(1),
                                Number(item.profit_loss.february).toFixed(1),
                                Number(item.profit_loss.march).toFixed(1),
                                Number(item.profit_loss.april).toFixed(1),
                                Number(item.profit_loss.may).toFixed(1),
                                Number(item.profit_loss.june).toFixed(1),
                                Number(item.profit_loss.july).toFixed(1),
                                Number(item.profit_loss.august).toFixed(1),
                                Number(item.profit_loss.september).toFixed(1),
                                Number(item.profit_loss.october).toFixed(1),
                                Number(item.profit_loss.november).toFixed(1),
                                Number(item.profit_loss.december).toFixed(1),
Riri Novita's avatar
Riri Novita committed
178 179 180 181 182 183 184 185 186 187 188 189 190
                                item.profit_loss.total_current_year,
                                item.profit_loss.total_next_year,
                                item.profit_loss.total_more_year,
                                item.order
                            ])
                            if (item.children !== null) {
                                if (item.children.length > 0) {
                                    item.children.map((items, indexs) => {
                                        handlePushChild(items)
                                    })
                                }
                            }
                        })
Riri Novita's avatar
Riri Novita committed
191
                        console.log(dataTable)
Riri Novita's avatar
Riri Novita committed
192 193 194
                        this.setState({ dataTable, loading: false, buttonError: true, editable: true }, () => {
                        })
                    } else {
Riri Novita's avatar
Riri Novita committed
195
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
Riri Novita's avatar
Riri Novita committed
196 197 198 199 200 201 202
                            if (response.data.message.includes("Someone Logged In")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
EKSAD's avatar
EKSAD committed
203
                    }
Riri Novita's avatar
Riri Novita committed
204 205
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
206 207
                }
            } else {
d.arizona's avatar
d.arizona committed
208
                this.setState({ alert: true, messageAlert: 'Connection Timeout, please check your Connection', tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
209
            }
EKSAD's avatar
EKSAD committed
210

EKSAD's avatar
EKSAD committed
211 212 213
        })
    }

EKSAD's avatar
EKSAD committed
214 215
    handleValue(data) {
        let total = 0
EKSAD's avatar
EKSAD committed
216
        this.state.dataTable.map((item, index) => {
EKSAD's avatar
EKSAD committed
217
            if (data.rowData[1] == item[2]) {
EKSAD's avatar
EKSAD committed
218
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
EKSAD's avatar
EKSAD committed
219 220 221 222
            }
        })
        let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
        let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
EKSAD's avatar
EKSAD committed
223
        // console.log(indexParent);
EKSAD's avatar
EKSAD committed
224 225 226
        return a
    }

EKSAD's avatar
EKSAD committed
227
    handleChange(value, tableMeta) {
EKSAD's avatar
EKSAD committed
228
        let val = String(value).split(",").join("")
EKSAD's avatar
EKSAD committed
229
        let data = this.state.dataTable
EKSAD's avatar
EKSAD committed
230 231
        let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
        if (indexParent > 0) {
EKSAD's avatar
EKSAD committed
232
            // console.log(indexParent)
EKSAD's avatar
EKSAD committed
233
            let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
EKSAD's avatar
EKSAD committed
234
            let jagain = data[indexParent][tableMeta.columnIndex]
EKSAD's avatar
EKSAD committed
235
            a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
EKSAD's avatar
EKSAD committed
236
        } else {
EKSAD's avatar
EKSAD committed
237
            data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
EKSAD's avatar
EKSAD committed
238
        }
EKSAD's avatar
EKSAD committed
239 240
    }

EKSAD's avatar
EKSAD committed
241 242 243 244 245
    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
d.arizona's avatar
d.arizona committed
246
                notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
                total_actual_before: String(Number(i[7]).toFixed(1)),
                january: String(Number(i[8]).toFixed(1)),
                february: String(Number(i[9]).toFixed(1)),
                march: String(Number(i[10]).toFixed(1)),
                april: String(Number(i[11]).toFixed(1)),
                may: String(Number(i[12]).toFixed(1)),
                june: String(Number(i[13]).toFixed(1)),
                july: String(Number(i[14]).toFixed(1)),
                august: String(Number(i[15]).toFixed(1)),
                september: String(Number(i[16]).toFixed(1)),
                october: String(Number(i[17]).toFixed(1)),
                november: String(Number(i[18]).toFixed(1)),
                december: String(Number(i[19]).toFixed(1)),
                total_current_year: String(Number(i[20]).toFixed(1)),
                total_next_year: String(Number(i[21]).toFixed(1)),
                total_more_year: String(Number(i[22]).toFixed(1))
EKSAD's avatar
EKSAD committed
263 264 265 266 267 268 269 270 271 272
            })
        })
        let payload = {
            "submission_id": this.props.submissionID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "profit_loss": data
        }
EKSAD's avatar
EKSAD committed
273
        // console.log(data);
EKSAD's avatar
EKSAD committed
274
        this.setState({ loading: false })
EKSAD's avatar
EKSAD committed
275 276 277 278
        this.props.saveToMasterBudget(payload)
        this.props.onClickClose()
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
279 280
    downloadTemplate = async () => {
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
281
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
Deni Rinaldi's avatar
Deni Rinaldi committed
282 283
        )
        res = await res.blob()
EKSAD's avatar
EKSAD committed
284
        // console.log(res)
Deni Rinaldi's avatar
Deni Rinaldi committed
285 286 287 288
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
EKSAD's avatar
EKSAD committed
289
            a.download = 'Template Master Budget Profit & Loss.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
290 291 292 293
            a.click();
        }
    }

EKSAD's avatar
EKSAD committed
294 295 296
    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
Riri Novita's avatar
Riri Novita committed
297
            // console.log(resp)
EKSAD's avatar
EKSAD committed
298
            if (err) {
EKSAD's avatar
EKSAD committed
299
                // console.log(err);
EKSAD's avatar
EKSAD committed
300 301 302
            }
            else {
                let isi = resp.rows.slice(3)
EKSAD's avatar
EKSAD committed
303
                // console.log(resp.rows[2]);
EKSAD's avatar
EKSAD committed
304
                let payload = []
EKSAD's avatar
EKSAD committed
305
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
EKSAD's avatar
EKSAD committed
306 307 308 309 310
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
EKSAD's avatar
EKSAD committed
311
                            notes: i[2] === undefined ? "" : String(i[2]).trim(),
EKSAD's avatar
EKSAD committed
312
                            total_actual_before: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
EKSAD's avatar
EKSAD committed
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
                            january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
                            total_next_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim(),
                            total_more_year: i[18] === undefined ? "0" : reg.test(String(i[18])) === false ? "0" : String(i[18]).trim()
EKSAD's avatar
EKSAD committed
328 329 330 331 332 333 334 335 336
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    profit_loss: payload
                }
Riri Novita's avatar
Riri Novita committed
337
                // console.log(isi)
EKSAD's avatar
EKSAD committed
338
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
EKSAD's avatar
EKSAD committed
339 340 341 342 343 344
            }
        });
    }

    checkUpload() {
        api.create().checkUploadMB(this.state.payload).then(response => {
EKSAD's avatar
EKSAD committed
345
            // console.log(JSON.stringify(this.state.payload));
Riri Novita's avatar
Riri Novita committed
346
            console.log(response)
EKSAD's avatar
EKSAD committed
347 348 349 350 351 352 353 354 355 356 357 358
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleProfitLoss: 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.notes,
Deni Rinaldi's avatar
Deni Rinaldi committed
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
                            Number(item.total_actual_before).toFixed(1),
                            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),
EKSAD's avatar
EKSAD committed
375
                            item.orders,
EKSAD's avatar
EKSAD committed
376 377 378
                            item.error
                        ]
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
379
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, fromUpload: true }, () => {
EKSAD's avatar
EKSAD committed
380
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
381
                            if (item[24].length > 0) {
EKSAD's avatar
EKSAD committed
382
                                // console.log('masuk')
EKSAD's avatar
EKSAD committed
383
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
EKSAD's avatar
EKSAD committed
384 385
                            }
                        })
EKSAD's avatar
EKSAD committed
386
                        // console.log(this.state.buttonError)
EKSAD's avatar
EKSAD committed
387
                    })
Riri Novita's avatar
Riri Novita committed
388
                    
EKSAD's avatar
EKSAD committed
389 390 391 392 393
                }
            }
        })
    }

EKSAD's avatar
EKSAD committed
394
    uploadProfitLoss(type) {
EKSAD's avatar
EKSAD committed
395 396 397 398
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
EKSAD's avatar
EKSAD committed
399
                notes: String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
                total_actual_before: String(Number(i[7]).toFixed(1)),
                january: String(Number(i[8]).toFixed(1)),
                february: String(Number(i[9]).toFixed(1)),
                march: String(Number(i[10]).toFixed(1)),
                april: String(Number(i[11]).toFixed(1)),
                may: String(Number(i[12]).toFixed(1)),
                june: String(Number(i[13]).toFixed(1)),
                july: String(Number(i[14]).toFixed(1)),
                august: String(Number(i[15]).toFixed(1)),
                september: String(Number(i[16]).toFixed(1)),
                october: String(Number(i[17]).toFixed(1)),
                november: String(Number(i[18]).toFixed(1)),
                december: String(Number(i[19]).toFixed(1)),
                total_current_year: String(Number(i[20]).toFixed(1)),
                total_next_year: String(Number(i[21]).toFixed(1)),
                total_more_year: String(Number(i[22]).toFixed(1)),
EKSAD's avatar
EKSAD committed
416 417 418
            })
        })
        let body = {
EKSAD's avatar
EKSAD committed
419
            submission_id: this.props.submissionID,
EKSAD's avatar
EKSAD committed
420 421 422
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
EKSAD's avatar
EKSAD committed
423 424
            profit_loss: data,
            status: type
EKSAD's avatar
EKSAD committed
425
        }
Riri Novita's avatar
Riri Novita committed
426 427
        // console.log(this.state.dataTable);
        // console.log(JSON.stringify(body));
EKSAD's avatar
EKSAD committed
428
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
EKSAD's avatar
EKSAD committed
429
            // console.log(response);
EKSAD's avatar
EKSAD committed
430
            if (response.data) {
Riri Novita's avatar
Riri Novita committed
431 432 433 434 435
                if (response.ok) {
                    if (response.data.status === "success") {
                        this.props.onClickClose()
                        this.props.getReport()
                    } else {
Riri Novita's avatar
Riri Novita committed
436
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
Riri Novita's avatar
Riri Novita committed
437 438 439 440 441 442 443
                            if (response.data.message.includes("Someone Logged In")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
Riri Novita's avatar
Riri Novita committed
444
                        // alert(response.data.status)
Riri Novita's avatar
Riri Novita committed
445
                    }
EKSAD's avatar
EKSAD committed
446
                } else {
Riri Novita's avatar
Riri Novita committed
447
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
448
                }
EKSAD's avatar
EKSAD committed
449
            } else {
d.arizona's avatar
d.arizona committed
450
                this.setState({ alert: true, messageAlert: 'Data is not saved, please check your Connection', tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
451 452 453 454
            }
        })
    }

EKSAD's avatar
EKSAD committed
455
    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
456 457
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/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}`
        let sub_null = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
EKSAD's avatar
EKSAD committed
458
        // console.log(url);
EKSAD's avatar
EKSAD committed
459
        let res = await fetch(
EKSAD's avatar
EKSAD committed
460
            this.props.submissionID == null ? sub_null : url
EKSAD's avatar
EKSAD committed
461 462 463 464 465 466 467
        )
        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;
EKSAD's avatar
EKSAD committed
468
            a.download = 'Master Budget Profit & Loss.xlsx';
EKSAD's avatar
EKSAD committed
469 470 471 472
            a.click();
        }
    }

d.arizona's avatar
d.arizona committed
473 474
    handleValidate() {
        let data = []
Riri Novita's avatar
Riri Novita committed
475
        // console.log(JSON.stringify(this.state.dataTable))
d.arizona's avatar
d.arizona committed
476 477 478 479 480
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
                notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
                total_actual_before: String(i[7]),
EKSAD's avatar
EKSAD committed
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
                january: i[0] === 3 && i[8] === "" ? "0" : String(i[8]),
                february: i[0] === 3 && i[9] === "" ? "0" : String(i[9]),
                march: i[0] === 3 && i[10] === "" ? "0" : String(i[10]),
                april: i[0] === 3 && i[11] === "" ? "0" : String(i[11]),
                may: i[0] === 3 && i[12] === "" ? "0" : String(i[12]),
                june: i[0] === 3 && i[13] === "" ? "0" : String(i[13]),
                july: i[0] === 3 && i[14] === "" ? "0" : String(i[14]),
                august: i[0] === 3 && i[15] === "" ? "0" : String(i[15]),
                september: i[0] === 3 && i[16] === "" ? "0" : String(i[16]),
                october: i[0] === 3 && i[17] === "" ? "0" : String(i[17]),
                november: i[0] === 3 && i[18] === "" ? "0" : String(i[18]),
                december: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
                total_current_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
                total_next_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21]),
                total_more_year: i[0] === 3 && i[22] === "" ? "0" : String(i[22])
d.arizona's avatar
d.arizona committed
496 497 498 499 500 501 502
            })
        })
        let payload = {
            "submission_id": this.props.submissionID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
EKSAD's avatar
EKSAD committed
503 504
            "profit_loss": data,
            "status": "submitted"
d.arizona's avatar
d.arizona committed
505
        }
EKSAD's avatar
EKSAD committed
506
        // console.log(payload)
d.arizona's avatar
d.arizona committed
507
        api.create().validateSubmitReport(payload).then((response) => {
EKSAD's avatar
EKSAD committed
508
            // console.log(response)
d.arizona's avatar
d.arizona committed
509
            if (response.data.data.result) {
EKSAD's avatar
EKSAD committed
510
                this.setState({ loading: false, buttonError: false, editable: false })
d.arizona's avatar
d.arizona committed
511 512
            } else {
                this.setState({ loading: false, buttonError: true, editable: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
513
            }
d.arizona's avatar
d.arizona committed
514 515 516
        })
    }

EKSAD's avatar
EKSAD committed
517 518 519 520
    closeAlert() {
        this.setState({ alert: false })
    }

EKSAD's avatar
EKSAD committed
521
    render() {
EKSAD's avatar
EKSAD committed
522
        let dataTable2 = this.state.dataTable
EKSAD's avatar
EKSAD committed
523
        const handleChange = (value, tableMeta, type) => {
Riri Novita's avatar
Riri Novita committed
524
            console.log(dataTable2);
EKSAD's avatar
EKSAD committed
525
            let val = String(value).split(",").join("")
Deni Rinaldi's avatar
Deni Rinaldi committed
526
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
EKSAD's avatar
EKSAD committed
527
        }
EKSAD's avatar
EKSAD committed
528 529 530
        const handleTotal = (tableMeta) => {
            let total = 0
            dataTable2[tableMeta.rowIndex].map((item, index) => {
EKSAD's avatar
EKSAD committed
531
                if (index >= 8 && index <= 19) {
EKSAD's avatar
EKSAD committed
532 533 534 535
                    let valItem = item == undefined || item == "" ? 0 : item
                    total += Number(valItem)
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
536 537 538 539
            // if (tableMeta.rowData[1] === 20092) {
            //     console.log(total);
            //     console.log(dataTable2[tableMeta.rowIndex]);
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
540
            let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
Deni Rinaldi's avatar
Deni Rinaldi committed
541
            if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
EKSAD's avatar
EKSAD committed
542
                let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
Riri Novita's avatar
Riri Novita committed
543 544
                dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" :  (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
                return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
Riri Novita's avatar
Riri Novita committed
545 546 547
            } else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") {
                let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19]
                return totalTMP
EKSAD's avatar
EKSAD committed
548 549 550 551
            } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") {
                return handleFormula(0, tableMeta, 0)
            }
            else {
EKSAD's avatar
EKSAD committed
552 553 554 555

                dataTable2[tableMeta.rowIndex][20] = total
                return total
            }
EKSAD's avatar
EKSAD committed
556
            // console.log(total);
EKSAD's avatar
EKSAD committed
557
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
558
        const handleNotes = (value, tableMeta) => {
EKSAD's avatar
EKSAD committed
559
            // console.log(value)
Deni Rinaldi's avatar
Deni Rinaldi committed
560
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
EKSAD's avatar
EKSAD committed
561
            // console.log(dataTable2[tableMeta.rowIndex]);
Deni Rinaldi's avatar
Deni Rinaldi committed
562
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
563
        const handleValue = (value, data) => {
EKSAD's avatar
EKSAD committed
564 565 566
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] == item[2]) {
Deni Rinaldi's avatar
Deni Rinaldi committed
567
                    total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(String(item[data.columnIndex]).includes('-') ? Number(String(item[data.columnIndex]).substr(1, String(item[data.columnIndex]).length)) * -1 : Number(item[data.columnIndex])))
EKSAD's avatar
EKSAD committed
568 569 570
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
EKSAD's avatar
EKSAD committed
571
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
EKSAD's avatar
EKSAD committed
572
            // console.log(indexParent);
EKSAD's avatar
EKSAD committed
573 574
            return a
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
575
        const handleFormula = (data, tableMeta, month) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
576 577
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
d.arizona's avatar
d.arizona committed
578 579
            let tambahan = false
            let opet = ""
Deni Rinaldi's avatar
Deni Rinaldi committed
580
            arrayFormula.map((item, indexs) => {
d.arizona's avatar
d.arizona committed
581
                if (item == 'X') {
Deni Rinaldi's avatar
Deni Rinaldi committed
582
                    tambahan = true
d.arizona's avatar
d.arizona committed
583
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
Deni Rinaldi's avatar
Deni Rinaldi committed
584
                    arrayJumlah.push(item)
d.arizona's avatar
d.arizona committed
585 586 587 588 589 590
                } else {
                    let index = dataTable2.findIndex((val) => val[23] == item)
                    if (tambahan) {
                        if (item == '-' || item == '+' || item == '/' || item == '*') {
                            opet = item
                        } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
591
                            arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
d.arizona's avatar
d.arizona committed
592 593 594 595 596
                            tambahan = false
                            opet = ""
                        }
                    } else {
                        if (index != -1) {
Deni Rinaldi's avatar
Deni Rinaldi committed
597 598 599 600 601
                            if (item === String(tableMeta.rowData[23])) {
                                arrayJumlah.push(0)
                            } else {
                                arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
                            }
d.arizona's avatar
d.arizona committed
602 603
                        }
                    }
EKSAD's avatar
EKSAD committed
604
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
605

Deni Rinaldi's avatar
Deni Rinaldi committed
606 607 608 609
                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
610
            // if (String(tableMeta.rowData[5]) == "Net Trading Profit (TPAT)") {
Deni Rinaldi's avatar
Deni Rinaldi committed
611 612 613
            // console.log(tableMeta.rowData[3])
            // console.log(arrayFormula)
            // console.log(arrayJumlah)
d.arizona's avatar
d.arizona committed
614
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
615

Deni Rinaldi's avatar
Deni Rinaldi committed
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
            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") {
Riri Novita's avatar
Riri Novita committed
636
                        total = R.equals((Number(total) / Number(item)), NaN) ? '0' : (R.equals((Number(total) / Number(item)), Infinity) ? '0' : (Number(total) / Number(item) == "-Infinity") ? "0.0" : Number(total) / Number(item))
Deni Rinaldi's avatar
Deni Rinaldi committed
637
                    } else {
Riri Novita's avatar
Riri Novita committed
638
                        total += Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
639
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
640 641
                }
            })
Riri Novita's avatar
Riri Novita committed
642
            total = R.equals(total, NaN) ? "0.0" : (R.equals(total, Infinity) ? "0.0" : (total == "-Infinity" ? "0.0" : total))
Riri Novita's avatar
Riri Novita committed
643 644 645 646
            // if (tableMeta.rowData[1] === 20092) {
            //     console.log(total);
            //     console.log(arrayJumlah);
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
647 648 649 650
            // if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) {
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
            // }
            return Number(total)
Deni Rinaldi's avatar
Deni Rinaldi committed
651

EKSAD's avatar
EKSAD committed
652
        }
EKSAD's avatar
EKSAD committed
653

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

EKSAD's avatar
EKSAD committed
2708 2709 2710
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
EKSAD's avatar
EKSAD committed
2711
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
EKSAD's avatar
EKSAD committed
2712
                </div>
d.arizona's avatar
d.arizona committed
2713 2714 2715 2716 2717
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
EKSAD's avatar
EKSAD committed
2718
                {/* {this.state.loading && loadingComponent} */}
EKSAD's avatar
EKSAD committed
2719
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
EKSAD's avatar
EKSAD committed
2720 2721 2722
                    {this.state.visibleProfitLoss === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
EKSAD's avatar
EKSAD committed
2723
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Profit & Loss </Typography>
EKSAD's avatar
EKSAD committed
2724 2725 2726 2727 2728
                            </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>
EKSAD's avatar
EKSAD committed
2729
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
EKSAD's avatar
EKSAD committed
2730 2731 2732
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2733
                                        {this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
EKSAD's avatar
EKSAD committed
2734
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756
                                                <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> :
                                            <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')) && <a data-tip={'Download Template'} data-for="template">
EKSAD's avatar
EKSAD committed
2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.downloadTemplate()}
                                                    >
                                                        <img src={Images.template} />
                                                    </button>
EKSAD's avatar
EKSAD committed
2768
                                                </a>}
EKSAD's avatar
EKSAD committed
2769
                                                <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
Deni Rinaldi's avatar
Deni Rinaldi committed
2770
                                                {((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')) && <a data-tip={'Upload'} data-for="upload">
EKSAD's avatar
EKSAD committed
2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.setState({ visibleUpload: true })}
                                                    >
                                                        <img src={Images.upload} />
                                                    </button>
EKSAD's avatar
EKSAD committed
2782
                                                </a>}
EKSAD's avatar
EKSAD committed
2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804
                                                <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                <a data-tip={'Download'} data-for="download">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            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>
                                        }
EKSAD's avatar
EKSAD committed
2805 2806
                                    </div>
                                </div>
EKSAD's avatar
EKSAD committed
2807

EKSAD's avatar
EKSAD committed
2808
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
EKSAD's avatar
EKSAD committed
2809
                                    {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
2810 2811 2812 2813 2814 2815 2816 2817 2818 2819
                                    {!this.state.loading && (
                                        <MuiThemeProvider theme={getMuiTheme()}>
                                            <MUIDataTable
                                                data={dataTable2}
                                                columns={columns}
                                                options={options}
                                            />
                                        </MuiThemeProvider>
                                    )}

EKSAD's avatar
EKSAD committed
2820
                                </div>
EKSAD's avatar
EKSAD committed
2821
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
EKSAD's avatar
EKSAD committed
2822
                            </div>
EKSAD's avatar
EKSAD committed
2823 2824 2825 2826
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
EKSAD's avatar
EKSAD committed
2827 2828 2829 2830 2831
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
EKSAD's avatar
EKSAD committed
2832 2833 2834 2835 2836 2837 2838 2839
                                        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' }}>
Riri Novita's avatar
Riri Novita committed
2840
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
EKSAD's avatar
EKSAD committed
2841 2842 2843
                                        </div>
                                    </button>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2844
                                {this.state.dataTable.length == 0 ? null : this.props.isApprover === true ? null :
Deni Rinaldi's avatar
Deni Rinaldi committed
2845
                                    (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
2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912
                                        <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, dataTable: dataTable2, buttonDraft: false }, () => {
                                                        setTimeout(() => {
                                                            this.handleValidate()
                                                        }, 100);
                                                    })
                                                }}
                                            >
                                                <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                                </div>
                                            </button>
                                            <button
                                                className="button"
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                disabled={this.state.buttonDraft}
                                                onClick={() =>
                                                    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
EKSAD's avatar
EKSAD committed
2913
                                }
EKSAD's avatar
EKSAD committed
2914
                            </div>
EKSAD's avatar
EKSAD committed
2915 2916 2917 2918 2919 2920 2921
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
EKSAD's avatar
EKSAD committed
2922
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
EKSAD's avatar
EKSAD committed
2923
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
EKSAD's avatar
EKSAD committed
2924
                                    </div>
EKSAD's avatar
EKSAD committed
2925
                                    {this.state.dataLoaded && (
EKSAD's avatar
EKSAD committed
2926
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
EKSAD's avatar
EKSAD committed
2927
                                            {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
2928 2929 2930 2931 2932 2933 2934 2935 2936
                                            {!this.state.loading && (
                                                <MuiThemeProvider theme={getMuiTheme()}>
                                                    <MUIDataTable
                                                        data={dataTable2}
                                                        columns={columns}
                                                        options={options}
                                                    />
                                                </MuiThemeProvider>
                                            )}
EKSAD's avatar
EKSAD committed
2937 2938 2939
                                        </div>
                                    )}
                                </div>
EKSAD's avatar
EKSAD committed
2940 2941 2942

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
2943
                                        <button
EKSAD's avatar
EKSAD committed
2944
                                            type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
2945
                                            onClick={() => this.setState({ loading: true, dataTable: [], fromUpload: false }, () => {
EKSAD's avatar
EKSAD committed
2946
                                                setTimeout(() => {
EKSAD's avatar
EKSAD committed
2947
                                                    this.getItemHierarki()
EKSAD's avatar
EKSAD committed
2948
                                                }, 100);
EKSAD's avatar
EKSAD committed
2949 2950 2951 2952
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
Riri Novita's avatar
Riri Novita committed
2953
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
EKSAD's avatar
EKSAD committed
2954 2955 2956 2957
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2958
                                        <button
EKSAD's avatar
EKSAD committed
2959 2960
                                            className="button"
                                            type="button"
EKSAD's avatar
EKSAD committed
2961
                                            disabled={this.state.buttonError}
EKSAD's avatar
EKSAD committed
2962 2963 2964 2965 2966 2967 2968 2969 2970 2971
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
EKSAD's avatar
EKSAD committed
2972
                                                        this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
EKSAD's avatar
EKSAD committed
2973 2974 2975 2976 2977 2978 2979 2980 2981 2982
                                                    }, 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"
EKSAD's avatar
EKSAD committed
2983
                                            style={{
EKSAD's avatar
EKSAD committed
2984 2985 2986 2987
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
EKSAD's avatar
EKSAD committed
2988 2989
                                                marginRight: 20
                                            }}
EKSAD's avatar
EKSAD committed
2990
                                            onClick={() =>
EKSAD's avatar
EKSAD committed
2991
                                                this.state.editable === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2992
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
2993
                                                    this.setState({ loading: true, fromUpload: false }, () =>
EKSAD's avatar
EKSAD committed
2994 2995 2996 2997 2998 2999 3000
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadProfitLoss('draft')
                                                                }, 100);
                                                            })
                                                    )
EKSAD's avatar
EKSAD committed
3001
                                            }
EKSAD's avatar
EKSAD committed
3002 3003 3004 3005 3006 3007 3008
                                        >
                                            <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"
EKSAD's avatar
EKSAD committed
3009 3010 3011 3012 3013 3014
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3015
                                            onClick={() =>
EKSAD's avatar
EKSAD committed
3016
                                                this.state.editable === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3017
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3018
                                                    this.setState({ loading: true, fromUpload: false }, () =>
EKSAD's avatar
EKSAD committed
3019 3020 3021 3022 3023 3024 3025
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadProfitLoss('submitted')
                                                                }, 100);
                                                            })
                                                    )
EKSAD's avatar
EKSAD committed
3026
                                            }
EKSAD's avatar
EKSAD committed
3027 3028 3029 3030 3031 3032
                                        >
                                            <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>
EKSAD's avatar
EKSAD committed
3033 3034
                                </div>
                            </div>
EKSAD's avatar
EKSAD committed
3035
                        </Paper>}
EKSAD's avatar
EKSAD committed
3036 3037 3038 3039 3040 3041 3042 3043 3044
                </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>
EKSAD's avatar
EKSAD committed
3045
                                    </div>
EKSAD's avatar
EKSAD committed
3046 3047 3048 3049 3050 3051 3052 3053 3054 3055
                                </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>
EKSAD's avatar
EKSAD committed
3056
                            </div>
EKSAD's avatar
EKSAD committed
3057 3058 3059 3060 3061 3062 3063 3064 3065 3066
                            <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={() => {
r.kurnia's avatar
r.kurnia committed
3067
                                    String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("PROFIT") && String(this.state.judul).includes("LOSS") ?
EKSAD's avatar
EKSAD committed
3068 3069 3070 3071
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
EKSAD's avatar
EKSAD committed
3072
                        </div>
EKSAD's avatar
EKSAD committed
3073 3074
                    </div>
                )}
EKSAD's avatar
EKSAD committed
3075
            </div>
EKSAD's avatar
EKSAD committed
3076 3077 3078
        );
    }
}