ProfitLoss.js 215 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,
Riri Novita's avatar
Riri Novita committed
63
            updateBy: [],
EKSAD's avatar
EKSAD committed
64
            buttonDraft: true,
65
            handleDoubleClick: 0,
Deni Rinaldi's avatar
Deni Rinaldi committed
66
            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
    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({
Riri Novita's avatar
Riri Novita committed
90
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail
EKSAD's avatar
EKSAD committed
91
                    })
Riri Novita's avatar
Riri Novita committed
92 93
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
94
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
95 96 97 98 99 100
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
EKSAD's avatar
EKSAD committed
101 102 103 104 105
                }
            }
        })
    }

EKSAD's avatar
EKSAD committed
106
    getItemHierarki() {
EKSAD's avatar
EKSAD committed
107
        this.setState({ loading: true, judulColumn: null })
EKSAD's avatar
EKSAD committed
108 109
        let payload = {
            "report_id": this.props.report_id,
EKSAD's avatar
EKSAD committed
110 111
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
EKSAD's avatar
EKSAD committed
112 113
            "company_id": this.props.company.company_id,
            "submission_id": this.props.submissionID
EKSAD's avatar
EKSAD committed
114
        }
EKSAD's avatar
EKSAD committed
115
        api.create().getDetailReportMB(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
116
            // console.log(response);
EKSAD's avatar
EKSAD committed
117
            let dataTable = []
Deni Rinaldi's avatar
Deni Rinaldi committed
118
            this.setState({ visibleProfitLoss: true })
EKSAD's avatar
EKSAD committed
119
            if (response.data) {
Riri Novita's avatar
Riri Novita committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
                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
135 136 137 138 139 140 141 142 143 144 145 146
                                    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
147 148 149 150 151 152
                                    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
153 154 155 156
                            // if (item.id === 20092) {
                            //     console.log(item);
                            //     console.log(dataTable);
                            // }
Riri Novita's avatar
Riri Novita committed
157 158 159 160 161 162 163
                            if (item.children !== null) {
                                if (item.children.length > 0) {
                                    item.children.map((items, indexs) => {
                                        handlePushChild(items)
                                    })
                                }
                            }
EKSAD's avatar
EKSAD committed
164
                        }
Riri Novita's avatar
Riri Novita committed
165 166 167 168 169 170 171 172 173 174
                        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
175 176 177 178 179 180 181 182 183 184 185 186
                                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
187 188 189 190 191 192 193 194 195 196 197 198 199
                                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
200
                        console.log(dataTable)
Riri Novita's avatar
Riri Novita committed
201 202 203
                        this.setState({ dataTable, loading: false, buttonError: true, editable: true }, () => {
                        })
                    } else {
Riri Novita's avatar
Riri Novita committed
204
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
205
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
206 207 208 209 210 211
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
EKSAD's avatar
EKSAD committed
212
                    }
Riri Novita's avatar
Riri Novita committed
213 214
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
215 216
                }
            } else {
d.arizona's avatar
d.arizona committed
217
                this.setState({ alert: true, messageAlert: 'Connection Timeout, please check your Connection', tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
218
            }
EKSAD's avatar
EKSAD committed
219

EKSAD's avatar
EKSAD committed
220 221 222
        })
    }

EKSAD's avatar
EKSAD committed
223 224
    handleValue(data) {
        let total = 0
EKSAD's avatar
EKSAD committed
225
        this.state.dataTable.map((item, index) => {
EKSAD's avatar
EKSAD committed
226
            if (data.rowData[1] == item[2]) {
EKSAD's avatar
EKSAD committed
227
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
EKSAD's avatar
EKSAD committed
228 229 230 231
            }
        })
        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
232
        // console.log(indexParent);
EKSAD's avatar
EKSAD committed
233 234 235
        return a
    }

EKSAD's avatar
EKSAD committed
236
    handleChange(value, tableMeta) {
EKSAD's avatar
EKSAD committed
237
        let val = String(value).split(",").join("")
EKSAD's avatar
EKSAD committed
238
        let data = this.state.dataTable
EKSAD's avatar
EKSAD committed
239 240
        let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
        if (indexParent > 0) {
EKSAD's avatar
EKSAD committed
241
            // console.log(indexParent)
EKSAD's avatar
EKSAD committed
242
            let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
EKSAD's avatar
EKSAD committed
243
            let jagain = data[indexParent][tableMeta.columnIndex]
EKSAD's avatar
EKSAD committed
244
            a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
EKSAD's avatar
EKSAD committed
245
        } else {
EKSAD's avatar
EKSAD committed
246
            data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
EKSAD's avatar
EKSAD committed
247
        }
EKSAD's avatar
EKSAD committed
248 249
    }

EKSAD's avatar
EKSAD committed
250 251 252 253 254
    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
d.arizona's avatar
d.arizona committed
255
                notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
                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
272 273 274 275 276 277 278 279 280 281
            })
        })
        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
282
        // console.log(data);
EKSAD's avatar
EKSAD committed
283
        this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
284 285 286 287 288
        if (type == 'submitted') {
            this.props.saveToMasterBudget(payload, 'PL')
        } else {
            this.props.saveToMasterBudget(payload)
        }
EKSAD's avatar
EKSAD committed
289 290 291
        this.props.onClickClose()
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
292 293
    downloadTemplate = async () => {
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
294
            `${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
295 296
        )
        res = await res.blob()
EKSAD's avatar
EKSAD committed
297
        // console.log(res)
Deni Rinaldi's avatar
Deni Rinaldi committed
298 299 300 301
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
EKSAD's avatar
EKSAD committed
302
            a.download = 'Template Master Budget Profit & Loss.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
303 304 305 306
            a.click();
        }
    }

EKSAD's avatar
EKSAD committed
307 308 309
    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
Riri Novita's avatar
Riri Novita committed
310
            // console.log(resp)
EKSAD's avatar
EKSAD committed
311
            if (err) {
EKSAD's avatar
EKSAD committed
312
                // console.log(err);
EKSAD's avatar
EKSAD committed
313 314 315
            }
            else {
                let isi = resp.rows.slice(3)
EKSAD's avatar
EKSAD committed
316
                // console.log(resp.rows[2]);
EKSAD's avatar
EKSAD committed
317
                let payload = []
EKSAD's avatar
EKSAD committed
318
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
EKSAD's avatar
EKSAD committed
319 320 321 322 323
                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
324
                            notes: i[2] === undefined ? "" : String(i[2]).trim(),
EKSAD's avatar
EKSAD committed
325
                            total_actual_before: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
EKSAD's avatar
EKSAD committed
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340
                            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
341 342 343 344 345 346 347
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
d.arizona's avatar
d.arizona committed
348 349
                    profit_loss: payload,
                    status: 'submitted'
EKSAD's avatar
EKSAD committed
350
                }
Riri Novita's avatar
Riri Novita committed
351
                // console.log(isi)
EKSAD's avatar
EKSAD committed
352
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
EKSAD's avatar
EKSAD committed
353 354 355 356 357 358
            }
        });
    }

    checkUpload() {
        api.create().checkUploadMB(this.state.payload).then(response => {
EKSAD's avatar
EKSAD committed
359
            // console.log(JSON.stringify(this.state.payload));
Riri Novita's avatar
Riri Novita committed
360
            console.log(response)
EKSAD's avatar
EKSAD committed
361 362 363 364 365 366 367 368 369 370 371 372
            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
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
                            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
389
                            item.orders,
EKSAD's avatar
EKSAD committed
390 391 392
                            item.error
                        ]
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
393
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, fromUpload: true }, () => {
EKSAD's avatar
EKSAD committed
394
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
395
                            if (item[24].length > 0) {
EKSAD's avatar
EKSAD committed
396
                                // console.log('masuk')
EKSAD's avatar
EKSAD committed
397
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
EKSAD's avatar
EKSAD committed
398 399
                            }
                        })
EKSAD's avatar
EKSAD committed
400
                        // console.log(this.state.buttonError)
EKSAD's avatar
EKSAD committed
401
                    })
d.arizona's avatar
d.arizona committed
402

Riri Novita's avatar
Riri Novita committed
403 404
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
405
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
406 407 408 409 410 411
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
EKSAD's avatar
EKSAD committed
412 413 414 415 416
                }
            }
        })
    }

EKSAD's avatar
EKSAD committed
417
    uploadProfitLoss(type) {
EKSAD's avatar
EKSAD committed
418 419 420 421
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
EKSAD's avatar
EKSAD committed
422
                notes: String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
                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
439 440 441
            })
        })
        let body = {
EKSAD's avatar
EKSAD committed
442
            submission_id: this.props.submissionID,
EKSAD's avatar
EKSAD committed
443 444 445
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
EKSAD's avatar
EKSAD committed
446 447
            profit_loss: data,
            status: type
EKSAD's avatar
EKSAD committed
448
        }
Riri Novita's avatar
Riri Novita committed
449 450
        // console.log(this.state.dataTable);
        // console.log(JSON.stringify(body));
EKSAD's avatar
EKSAD committed
451
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
EKSAD's avatar
EKSAD committed
452
            // console.log(response);
EKSAD's avatar
EKSAD committed
453
            if (response.data) {
Riri Novita's avatar
Riri Novita committed
454 455 456
                if (response.ok) {
                    if (response.data.status === "success") {
                        this.props.onClickClose()
d.arizona's avatar
d.arizona committed
457 458 459 460 461
                        if (type == 'submitted') {
                            this.props.getReport('PL')
                        } else {
                            this.props.getReport()
                        }
Riri Novita's avatar
Riri Novita committed
462
                    } else {
Riri Novita's avatar
Riri Novita committed
463
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
464
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
465 466 467 468 469 470
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
Riri Novita's avatar
Riri Novita committed
471
                        // alert(response.data.status)
Riri Novita's avatar
Riri Novita committed
472
                    }
EKSAD's avatar
EKSAD committed
473
                } else {
Riri Novita's avatar
Riri Novita committed
474
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
475
                }
EKSAD's avatar
EKSAD committed
476
            } else {
d.arizona's avatar
d.arizona committed
477
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
EKSAD's avatar
EKSAD committed
478 479 480 481
            }
        })
    }

EKSAD's avatar
EKSAD committed
482
    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
483 484
        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
485
        // console.log(url);
EKSAD's avatar
EKSAD committed
486
        let res = await fetch(
EKSAD's avatar
EKSAD committed
487
            this.props.submissionID == null ? sub_null : url
EKSAD's avatar
EKSAD committed
488 489 490 491 492 493 494
        )
        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
495
            a.download = 'Master Budget Profit & Loss.xlsx';
EKSAD's avatar
EKSAD committed
496 497 498 499
            a.click();
        }
    }

d.arizona's avatar
d.arizona committed
500 501
    handleValidate() {
        let data = []
Riri Novita's avatar
Riri Novita committed
502
        // console.log(JSON.stringify(this.state.dataTable))
d.arizona's avatar
d.arizona committed
503 504 505 506 507
        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
508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
                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
523 524 525 526 527 528 529
            })
        })
        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
530 531
            "profit_loss": data,
            "status": "submitted"
d.arizona's avatar
d.arizona committed
532
        }
EKSAD's avatar
EKSAD committed
533
        // console.log(payload)
d.arizona's avatar
d.arizona committed
534
        api.create().validateSubmitReport(payload).then((response) => {
EKSAD's avatar
EKSAD committed
535
            // console.log(response)
d.arizona's avatar
d.arizona committed
536
            if (response.data.data.result) {
EKSAD's avatar
EKSAD committed
537
                this.setState({ loading: false, buttonError: false, editable: false })
d.arizona's avatar
d.arizona committed
538 539
            } else {
                this.setState({ loading: false, buttonError: true, editable: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
540
            }
d.arizona's avatar
d.arizona committed
541 542 543
        })
    }

EKSAD's avatar
EKSAD committed
544 545 546 547
    closeAlert() {
        this.setState({ alert: false })
    }

EKSAD's avatar
EKSAD committed
548
    render() {
EKSAD's avatar
EKSAD committed
549
        let dataTable2 = this.state.dataTable
EKSAD's avatar
EKSAD committed
550
        const handleChange = (value, tableMeta, type) => {
Riri Novita's avatar
Riri Novita committed
551
            console.log(dataTable2);
EKSAD's avatar
EKSAD committed
552
            let val = String(value).split(",").join("")
Deni Rinaldi's avatar
Deni Rinaldi committed
553
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
EKSAD's avatar
EKSAD committed
554
        }
EKSAD's avatar
EKSAD committed
555 556 557
        const handleTotal = (tableMeta) => {
            let total = 0
            dataTable2[tableMeta.rowIndex].map((item, index) => {
EKSAD's avatar
EKSAD committed
558
                if (index >= 8 && index <= 19) {
EKSAD's avatar
EKSAD committed
559 560 561 562
                    let valItem = item == undefined || item == "" ? 0 : item
                    total += Number(valItem)
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
563 564 565 566
            // if (tableMeta.rowData[1] === 20092) {
            //     console.log(total);
            //     console.log(dataTable2[tableMeta.rowIndex]);
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
567
            let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
Deni Rinaldi's avatar
Deni Rinaldi committed
568
            if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
EKSAD's avatar
EKSAD committed
569
                let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
d.arizona's avatar
d.arizona committed
570
                dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
Riri Novita's avatar
Riri Novita committed
571
                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
572 573 574
            } 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
575 576 577 578
            } 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
579 580 581 582

                dataTable2[tableMeta.rowIndex][20] = total
                return total
            }
EKSAD's avatar
EKSAD committed
583
            // console.log(total);
EKSAD's avatar
EKSAD committed
584
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
585
        const handleNotes = (value, tableMeta) => {
EKSAD's avatar
EKSAD committed
586
            // console.log(value)
Deni Rinaldi's avatar
Deni Rinaldi committed
587
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
EKSAD's avatar
EKSAD committed
588
            // console.log(dataTable2[tableMeta.rowIndex]);
Deni Rinaldi's avatar
Deni Rinaldi committed
589
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
590
        const handleValue = (value, data) => {
EKSAD's avatar
EKSAD committed
591 592 593
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] == item[2]) {
Deni Rinaldi's avatar
Deni Rinaldi committed
594
                    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
595 596 597
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
d.arizona's avatar
d.arizona committed
598 599
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
            // let a = dataTable2[data.rowIndex][data.columnIndex] = Number(value)
EKSAD's avatar
EKSAD committed
600
            // console.log(indexParent);
EKSAD's avatar
EKSAD committed
601 602
            return a
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
603
        const handleFormula = (data, tableMeta, month) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
604 605
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
d.arizona's avatar
d.arizona committed
606 607
            let tambahan = false
            let opet = ""
Deni Rinaldi's avatar
Deni Rinaldi committed
608
            arrayFormula.map((item, indexs) => {
d.arizona's avatar
d.arizona committed
609
                if (item == 'X') {
Deni Rinaldi's avatar
Deni Rinaldi committed
610
                    tambahan = true
d.arizona's avatar
d.arizona committed
611
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
Deni Rinaldi's avatar
Deni Rinaldi committed
612
                    arrayJumlah.push(item)
d.arizona's avatar
d.arizona committed
613 614 615 616 617 618
                } 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
619
                            arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
d.arizona's avatar
d.arizona committed
620 621 622 623 624
                            tambahan = false
                            opet = ""
                        }
                    } else {
                        if (index != -1) {
Deni Rinaldi's avatar
Deni Rinaldi committed
625 626 627 628 629
                            if (item === String(tableMeta.rowData[23])) {
                                arrayJumlah.push(0)
                            } else {
                                arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
                            }
d.arizona's avatar
d.arizona committed
630 631
                        }
                    }
EKSAD's avatar
EKSAD committed
632
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
633

Deni Rinaldi's avatar
Deni Rinaldi committed
634 635 636 637
                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
Riri Novita's avatar
Riri Novita committed
638
            // if (String(tableMeta.rowData[5]) == "Net Income for the year (NPAT)") {
Deni Rinaldi's avatar
Deni Rinaldi committed
639 640 641
            // console.log(tableMeta.rowData[3])
            // console.log(arrayFormula)
            // console.log(arrayJumlah)
d.arizona's avatar
d.arizona committed
642
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
643

Deni Rinaldi's avatar
Deni Rinaldi committed
644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
            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
664
                        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
665
                    } else {
Riri Novita's avatar
Riri Novita committed
666
                        total += Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
667
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
668 669
                }
            })
Riri Novita's avatar
Riri Novita committed
670
            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
671
            // if (String(tableMeta.rowData[5]) == "Net Income for the year (NPAT)") {
Riri Novita's avatar
Riri Novita committed
672 673 674
            //     console.log(total);
            //     console.log(arrayJumlah);
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
675
            // if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) {
d.arizona's avatar
d.arizona committed
676 677 678
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
            // // }
            // return Number(total)
Riri Novita's avatar
Riri Novita committed
679
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
Deni Rinaldi's avatar
Deni Rinaldi committed
680
            // }
Riri Novita's avatar
Riri Novita committed
681
            return Number(total)
Deni Rinaldi's avatar
Deni Rinaldi committed
682

EKSAD's avatar
EKSAD committed
683
        }
EKSAD's avatar
EKSAD committed
684

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

EKSAD's avatar
EKSAD committed
2829 2830 2831
        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
2832
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
EKSAD's avatar
EKSAD committed
2833
                </div>
d.arizona's avatar
d.arizona committed
2834 2835 2836 2837 2838
                <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
2839
                {/* {this.state.loading && loadingComponent} */}
EKSAD's avatar
EKSAD committed
2840
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
EKSAD's avatar
EKSAD committed
2841 2842 2843
                    {this.state.visibleProfitLoss === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
EKSAD's avatar
EKSAD committed
2844
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Profit & Loss </Typography>
EKSAD's avatar
EKSAD committed
2845 2846 2847 2848 2849
                            </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
2850
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
EKSAD's avatar
EKSAD committed
2851 2852 2853
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2854
                                        {this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
EKSAD's avatar
EKSAD committed
2855
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876
                                                <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' }}>
syadziy's avatar
syadziy committed
2877 2878
                                                {((!this.props.truelyApprover) && (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
2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.downloadTemplate()}
                                                    >
                                                        <img src={Images.template} />
                                                    </button>
EKSAD's avatar
EKSAD committed
2890
                                                </a>}
EKSAD's avatar
EKSAD committed
2891
                                                <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
syadziy's avatar
syadziy committed
2892
                                                {((!this.props.truelyApprover) && (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')) &&
d.arizona's avatar
d.arizona committed
2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906
                                                    <a data-tip={'Upload'} data-for="upload">
                                                        <button
                                                            style={{
                                                                backgroundColor: 'transparent',
                                                                cursor: 'pointer',
                                                                borderColor: 'transparent',
                                                                margin: 5
                                                            }}
                                                            onClick={() => this.setState({ visibleUpload: true })}
                                                        >
                                                            <img src={Images.upload} />
                                                        </button>
                                                    </a>
                                                }
EKSAD's avatar
EKSAD committed
2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928
                                                <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
2929 2930
                                    </div>
                                </div>
EKSAD's avatar
EKSAD committed
2931

EKSAD's avatar
EKSAD committed
2932
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
EKSAD's avatar
EKSAD committed
2933
                                    {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
2934 2935 2936 2937 2938 2939 2940 2941 2942 2943
                                    {!this.state.loading && (
                                        <MuiThemeProvider theme={getMuiTheme()}>
                                            <MUIDataTable
                                                data={dataTable2}
                                                columns={columns}
                                                options={options}
                                            />
                                        </MuiThemeProvider>
                                    )}

EKSAD's avatar
EKSAD committed
2944
                                </div>
Riri Novita's avatar
Riri Novita committed
2945 2946 2947 2948 2949 2950 2951 2952 2953
                                <div style={{ display: 'flex' }}>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                    <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                        {
                                            this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
d.arizona's avatar
d.arizona committed
2954
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
2955 2956 2957
                                        }
                                    </div>
                                </div>
EKSAD's avatar
EKSAD committed
2958
                            </div>
EKSAD's avatar
EKSAD committed
2959 2960 2961 2962
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
EKSAD's avatar
EKSAD committed
2963 2964 2965 2966 2967
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
EKSAD's avatar
EKSAD committed
2968 2969 2970 2971 2972 2973 2974 2975
                                        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
2976
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
EKSAD's avatar
EKSAD committed
2977 2978 2979
                                        </div>
                                    </button>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2980
                                {this.state.dataTable.length == 0 ? null : this.props.isApprover === true ? null :
syadziy's avatar
syadziy committed
2981
                                    (!this.props.truelyApprover) && (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
2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016
                                        <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={() =>
3017 3018
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032
                                                            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' })
                                                    :
3033 3034
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048
                                                            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
3049
                                }
EKSAD's avatar
EKSAD committed
3050
                            </div>
EKSAD's avatar
EKSAD committed
3051 3052 3053 3054 3055 3056 3057
                        </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
3058
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
EKSAD's avatar
EKSAD committed
3059
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
EKSAD's avatar
EKSAD committed
3060
                                    </div>
EKSAD's avatar
EKSAD committed
3061
                                    {this.state.dataLoaded && (
EKSAD's avatar
EKSAD committed
3062
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
EKSAD's avatar
EKSAD committed
3063
                                            {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
3064 3065 3066 3067 3068 3069 3070 3071 3072
                                            {!this.state.loading && (
                                                <MuiThemeProvider theme={getMuiTheme()}>
                                                    <MUIDataTable
                                                        data={dataTable2}
                                                        columns={columns}
                                                        options={options}
                                                    />
                                                </MuiThemeProvider>
                                            )}
EKSAD's avatar
EKSAD committed
3073 3074 3075
                                        </div>
                                    )}
                                </div>
EKSAD's avatar
EKSAD committed
3076 3077 3078

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
3079
                                        <button
EKSAD's avatar
EKSAD committed
3080
                                            type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
3081
                                            onClick={() => this.setState({ loading: true, dataTable: [], fromUpload: false }, () => {
EKSAD's avatar
EKSAD committed
3082
                                                setTimeout(() => {
EKSAD's avatar
EKSAD committed
3083
                                                    this.getItemHierarki()
EKSAD's avatar
EKSAD committed
3084
                                                }, 100);
EKSAD's avatar
EKSAD committed
3085 3086 3087 3088
                                            })}
                                            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
3089
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
EKSAD's avatar
EKSAD committed
3090 3091 3092 3093
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3094
                                        <button
EKSAD's avatar
EKSAD committed
3095 3096
                                            className="button"
                                            type="button"
EKSAD's avatar
EKSAD committed
3097
                                            disabled={this.state.buttonError}
EKSAD's avatar
EKSAD committed
3098 3099 3100 3101 3102 3103 3104 3105 3106 3107
                                            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
3108
                                                        this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
EKSAD's avatar
EKSAD committed
3109 3110 3111 3112 3113 3114 3115 3116 3117 3118
                                                    }, 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
3119
                                            style={{
EKSAD's avatar
EKSAD committed
3120 3121 3122 3123
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
EKSAD's avatar
EKSAD committed
3124 3125
                                                marginRight: 20
                                            }}
EKSAD's avatar
EKSAD committed
3126
                                            onClick={() =>
EKSAD's avatar
EKSAD committed
3127
                                                this.state.editable === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3128
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3129
                                                    this.setState({ loading: true, fromUpload: false }, () =>
3130 3131
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
EKSAD's avatar
EKSAD committed
3132 3133 3134 3135 3136
                                                                setTimeout(() => {
                                                                    this.uploadProfitLoss('draft')
                                                                }, 100);
                                                            })
                                                    )
EKSAD's avatar
EKSAD committed
3137
                                            }
EKSAD's avatar
EKSAD committed
3138 3139 3140 3141 3142 3143 3144
                                        >
                                            <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
3145 3146 3147 3148 3149 3150
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3151
                                            onClick={() =>
EKSAD's avatar
EKSAD committed
3152
                                                this.state.editable === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3153
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3154
                                                    this.setState({ loading: true, fromUpload: false }, () =>
3155 3156
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
EKSAD's avatar
EKSAD committed
3157 3158 3159 3160 3161
                                                                setTimeout(() => {
                                                                    this.uploadProfitLoss('submitted')
                                                                }, 100);
                                                            })
                                                    )
EKSAD's avatar
EKSAD committed
3162
                                            }
EKSAD's avatar
EKSAD committed
3163 3164 3165 3166 3167 3168
                                        >
                                            <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
3169 3170
                                </div>
                            </div>
EKSAD's avatar
EKSAD committed
3171
                        </Paper>}
EKSAD's avatar
EKSAD committed
3172 3173 3174 3175 3176 3177 3178 3179 3180
                </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
3181
                                    </div>
EKSAD's avatar
EKSAD committed
3182 3183 3184 3185 3186 3187 3188 3189 3190 3191
                                </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
3192
                            </div>
EKSAD's avatar
EKSAD committed
3193 3194 3195 3196 3197 3198 3199 3200 3201 3202
                            <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
3203
                                    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
3204 3205 3206 3207
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
EKSAD's avatar
EKSAD committed
3208
                        </div>
EKSAD's avatar
EKSAD committed
3209 3210
                    </div>
                )}
EKSAD's avatar
EKSAD committed
3211
            </div>
EKSAD's avatar
EKSAD committed
3212 3213 3214
        );
    }
}