ProfitLossOLPA.js 198 KB
Newer Older
EKSAD's avatar
EKSAD committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
import React, { Component } from 'react';
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, TextField, Input, Tooltip, withStyles, Snackbar } from '@material-ui/core';
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
import api from '../../api';
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
import * as R from 'ramda';

const LightTooltip = withStyles((theme) => ({
    tooltip: {
        backgroundColor: theme.palette.common.white,
        color: 'rgba(0, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);

var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());

const options = ct.customOptionsFixedColumn();
const style = {
    position: "sticky",
    left: 0,
    zIndex: 101,
    background: "white",
};
const style2 = {
    position: "sticky",
    background: "white",
    zIndex: 100
};
faisalhamdi's avatar
faisalhamdi committed
38 39 40 41 42 43 44 45 46 47 48 49 50
const stylenotes = {
    position: "sticky",
    background: "white",
    zIndex: 101,
    left: 350
};

const styleNotesEmpty = {
    position: "sticky",
    background: "white",
    zIndex: 99,
    left: 0
}
EKSAD's avatar
EKSAD committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

export default class ProfitLossOLPA extends Component {
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            visibleProfitLoss: true,
            disabledSave: true,
            editable: false,
            buttonError: false,
            judulColumn: null,
            updateBy: '-',
            buttonDraft: true,
            handleTekTekTek: 0
        }
        this.handleValue = this.handleValue.bind(this)
        this.fileHandler = this.fileHandler.bind(this);
    }

    componentDidMount() {
        this.getItemHierarki()
        this.getLatestUpdate()
        console.log(this.props);
    }

    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,
faisalhamdi's avatar
faisalhamdi committed
82
            "outlook_pa_id": this.props.outlook_pa_id
EKSAD's avatar
EKSAD committed
83
        }
faisalhamdi's avatar
faisalhamdi committed
84
        api.create().getLastestUpdateOLPA(payload).then(response => {
EKSAD's avatar
EKSAD committed
85 86 87 88 89 90 91 92 93 94
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
                        updateBy: response.data.data.latest_update === null ? '-' : response.data.data.latest_update
                    })
                }
            }
        })
    }

faisalhamdi's avatar
faisalhamdi committed
95
    async getItemHierarki() {
EKSAD's avatar
EKSAD committed
96 97
        this.setState({ loading: true, judulColumn: null })
        let payload = {
faisalhamdi's avatar
faisalhamdi committed
98
            "outlook_pa_id": this.props.outlook_pa_id,
EKSAD's avatar
EKSAD committed
99
            "report_id": this.props.report_id,
faisalhamdi's avatar
faisalhamdi committed
100
            "revision": this.props.revision,
EKSAD's avatar
EKSAD committed
101
            "periode": this.props.periode,
faisalhamdi's avatar
faisalhamdi committed
102
            "company_id": this.props.company.company_id
EKSAD's avatar
EKSAD committed
103
        }
faisalhamdi's avatar
faisalhamdi committed
104 105 106 107 108 109 110 111 112
        console.log(payload)
        let response = await api.create().getDetailReportOLPA(payload)
        console.log(response);
        let dataTable = []
        if (response.data) {
            let res = response.data.data
            const handlePushChild = (item) => {
                let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                if (indexIDzz === -1) {
EKSAD's avatar
EKSAD committed
113 114 115 116 117 118 119
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
faisalhamdi's avatar
faisalhamdi committed
120
                        item.profit_loss.notes === "" ? null : item.profit_loss.notes,
EKSAD's avatar
EKSAD committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
                        item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
                        item.profit_loss.january,
                        item.profit_loss.february,
                        item.profit_loss.march,
                        item.profit_loss.april,
                        item.profit_loss.may,
                        item.profit_loss.june,
                        item.profit_loss.july,
                        item.profit_loss.august,
                        item.profit_loss.september,
                        item.profit_loss.october,
                        item.profit_loss.november,
                        item.profit_loss.december,
                        item.profit_loss.total_current_year,
                        item.order
                    ])
faisalhamdi's avatar
faisalhamdi committed
137 138 139 140 141 142
                }
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
EKSAD's avatar
EKSAD committed
143
                    }
faisalhamdi's avatar
faisalhamdi committed
144
                }
EKSAD's avatar
EKSAD committed
145
            }
faisalhamdi's avatar
faisalhamdi committed
146 147 148 149 150 151 152 153
            res.map((item, index) => {
                dataTable.push([
                    item.type_report_id,
                    item.id,
                    item.parent,
                    item.formula,
                    item.level,
                    item.description,
faisalhamdi's avatar
faisalhamdi committed
154
                    item.profit_loss.notes === "" ? null : item.profit_loss.notes,
faisalhamdi's avatar
faisalhamdi committed
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
                    item.profit_loss.total_actual_before === null ? "0" : item.profit_loss.total_actual_before === "" ? "0" : item.profit_loss.total_actual_before,
                    item.profit_loss.january,
                    item.profit_loss.february,
                    item.profit_loss.march,
                    item.profit_loss.april,
                    item.profit_loss.may,
                    item.profit_loss.june,
                    item.profit_loss.july,
                    item.profit_loss.august,
                    item.profit_loss.september,
                    item.profit_loss.october,
                    item.profit_loss.november,
                    item.profit_loss.december,
                    item.profit_loss.total_current_year,
                    item.order
                ])
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
                    }
                }
            })
            console.log(dataTable)
            this.setState({ dataTable, loading: false, buttonError: true, editable: true })
        } else {
            this.setState({ dataTable, loading: false, buttonError: true, editable: true })
        }
EKSAD's avatar
EKSAD committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
    }

    handleValue(data) {
        let total = 0
        this.state.dataTable.map((item, index) => {
            if (data.rowData[1] == item[2]) {
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
            }
        })
        let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
        let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
        // console.log(indexParent);
        return a
    }

    handleChange(value, tableMeta) {
        let val = String(value).split(",").join("")
        let data = this.state.dataTable
        let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
        if (indexParent > 0) {
            // console.log(indexParent)
            let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
            let jagain = data[indexParent][tableMeta.columnIndex]
            a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
        } else {
            data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
        }
    }

faisalhamdi's avatar
faisalhamdi committed
213
    backToOLPA(type) {
EKSAD's avatar
EKSAD committed
214 215 216 217
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
faisalhamdi's avatar
faisalhamdi committed
218
                notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
219 220 221 222 223 224 225 226 227 228 229 230 231 232
                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))
EKSAD's avatar
EKSAD committed
233 234 235
            })
        })
        let payload = {
faisalhamdi's avatar
faisalhamdi committed
236
            "outlook_pa_id": this.props.outlook_pa_id,
EKSAD's avatar
EKSAD committed
237 238 239 240 241 242 243 244
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "profit_loss": data
        }
        console.log(data);
        this.setState({ loading: false })
faisalhamdi's avatar
faisalhamdi committed
245
        this.props.saveToOLPA(payload)
EKSAD's avatar
EKSAD committed
246 247 248 249 250
        this.props.onClickClose()
    }

    downloadTemplate = async () => {
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
251
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
EKSAD's avatar
EKSAD committed
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280
        )
        res = await res.blob()
        console.log(res)
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Outlook Performance Appraisal Profit & Loss.xlsx';
            a.click();
        }
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
                console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
                console.log(resp.rows[2]);
                let payload = []
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
                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(),
faisalhamdi's avatar
faisalhamdi committed
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295
                            notes: i[2] === undefined ? "" : String(i[2]).trim(),
                            total_actual_before: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
                            january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim()
EKSAD's avatar
EKSAD committed
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    profit_loss: payload
                }
                console.log(body)
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
            }
        });
    }

    checkUpload() {
faisalhamdi's avatar
faisalhamdi committed
312
        api.create().checkUploadOLPA(this.state.payload).then(response => {
EKSAD's avatar
EKSAD committed
313 314 315 316 317 318 319 320 321 322 323 324 325
            // console.log(JSON.stringify(this.state.payload));
            console.log(response)
            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,
faisalhamdi's avatar
faisalhamdi committed
326
                            item.notes,
EKSAD's avatar
EKSAD committed
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
                            item.total_actual_before,
                            item.january,
                            item.february,
                            item.march,
                            item.april,
                            item.may,
                            item.june,
                            item.july,
                            item.august,
                            item.september,
                            item.october,
                            item.november,
                            item.december,
                            item.total_current_year,
                            item.orders,
                            item.error
                        ]
                    })
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
347
                            if (item[21].length > 0) {
EKSAD's avatar
EKSAD committed
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
                                console.log('masuk')
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
                            }
                        })
                        // console.log(this.state.buttonError)
                    })
                }
            }
        })
    }

    uploadProfitLoss(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
faisalhamdi's avatar
faisalhamdi committed
364
                notes: String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
365 366 367 368 369 370 371 372 373 374 375 376 377 378
                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))
EKSAD's avatar
EKSAD committed
379 380 381
            })
        })
        let body = {
faisalhamdi's avatar
faisalhamdi committed
382
            outlook_pa_id: this.props.outlook_pa_id,
EKSAD's avatar
EKSAD committed
383 384 385 386 387 388
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
            profit_loss: data,
            status: type
        }
faisalhamdi's avatar
faisalhamdi committed
389 390
        console.log(JSON.stringify(body));
        api.create('UPLOAD').uploadOLPA(body).then(response => {
EKSAD's avatar
EKSAD committed
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
                    alert(response.data.status)
                }
            } else {
                this.setState({ loading: false })
                alert(response.problem)
            }
        })
    }

    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
407 408
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&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/outlook_pa/export_outlook_pa?outlook_pa_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
409 410
        console.log(url);
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
411
            this.props.outlook_pa_id == null ? sub_null : url
EKSAD's avatar
EKSAD committed
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
        )
        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;
            a.download = 'Outlook Performance Appraisal Profit & Loss.xlsx';
            a.click();
        }
    }

    handleValidate() {
        let data = []
        // console.log(this.state.dataTable)
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
faisalhamdi's avatar
faisalhamdi committed
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444
                notes: i[6] == null || i[6] == "" ? "" : String(i[6]),
                total_actual_before: String(i[7]),
                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])
EKSAD's avatar
EKSAD committed
445 446 447
            })
        })
        let payload = {
faisalhamdi's avatar
faisalhamdi committed
448
            "outlook_pa_id": this.props.outlook_pa_id,
EKSAD's avatar
EKSAD committed
449 450 451 452 453 454
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "profit_loss": data,
            "status": "submitted"
        }
faisalhamdi's avatar
faisalhamdi committed
455 456
        // console.log(payload)
        api.create().validateSubmitReportOLPA(payload).then((response) => {
EKSAD's avatar
EKSAD committed
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
            console.log(response)
            if (response.data.data.result) {
                this.setState({ loading: false, buttonError: false, editable: false })
            } else {
                this.setState({ loading: false, buttonError: true, editable: true })
            }
        })
    }

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

    render() {
        let dataTable2 = this.state.dataTable
        const handleChange = (value, tableMeta, type) => {
Riri Novita's avatar
Riri Novita committed
473
            console.log(dataTable2);
EKSAD's avatar
EKSAD committed
474
            let val = String(value).split(",").join("")
Riri Novita's avatar
Riri Novita committed
475
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
EKSAD's avatar
EKSAD committed
476 477 478 479
        }
        const handleTotal = (tableMeta) => {
            let total = 0
            dataTable2[tableMeta.rowIndex].map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
480
                if (index >= 7 && index <= 18) {
EKSAD's avatar
EKSAD committed
481 482 483 484
                    let valItem = item == undefined || item == "" ? 0 : item
                    total += Number(valItem)
                }
            })
idlanirined's avatar
idlanirined committed
485
            let indexParent = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
EKSAD's avatar
EKSAD committed
486
            if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
Deni Rinaldi's avatar
Deni Rinaldi committed
487 488
                let value = Number(dataTable2[tableMeta.rowIndex - 2][19]) / Number(dataTable2[tableMeta.rowIndex - 1][19])
                dataTable2[tableMeta.rowIndex][19] = R.equals(value, NaN) ? "0.0" : value
EKSAD's avatar
EKSAD committed
489 490 491 492 493 494
                return R.equals(value, NaN) ? "0.0" : value
            } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") {
                return handleFormula(0, tableMeta, 0)
            }
            else {

Deni Rinaldi's avatar
Deni Rinaldi committed
495
                dataTable2[tableMeta.rowIndex][19] = total
EKSAD's avatar
EKSAD committed
496 497 498 499
                return total
            }
            // console.log(total);
        }
faisalhamdi's avatar
faisalhamdi committed
500 501 502 503 504
        const handleNotes = (value, tableMeta) => {
            // console.log(value)
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
            // console.log(dataTable2[tableMeta.rowIndex]);
        }
idlanirined's avatar
idlanirined committed
505

Riri Novita's avatar
Riri Novita committed
506
        const handleValue = (value, data) => {
EKSAD's avatar
EKSAD committed
507 508 509
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] == item[2]) {
Riri Novita's avatar
Riri Novita committed
510
                    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
511 512 513 514 515 516 517 518 519 520
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
            // console.log(indexParent);
            return a
        }
        const handleFormula = (data, tableMeta, month) => {
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
Riri Novita's avatar
Riri Novita committed
521 522
            let tambahan = false
            let opet = ""
EKSAD's avatar
EKSAD committed
523
            arrayFormula.map((item, indexs) => {
Riri Novita's avatar
Riri Novita committed
524 525 526
                if (item == 'X') {
                    tambahan = true
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
EKSAD's avatar
EKSAD committed
527
                    arrayJumlah.push(item)
Riri Novita's avatar
Riri Novita committed
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
                } else {
                    let index = dataTable2.findIndex((val) => val[21] == item)
                    if (tambahan) {
                        if (item == '-' || item == '+' || item == '/' || item == '*') {
                            opet = item
                        } else {
                            arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
                            tambahan = false
                            opet = ""
                        }
                    } else {
                        if (index != -1) {
                            if (item === String(tableMeta.rowData[21])) {
                                arrayJumlah.push(0)
                            } else {
                                arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
                            }
                        }
                    }
EKSAD's avatar
EKSAD committed
547
                }
Riri Novita's avatar
Riri Novita committed
548

EKSAD's avatar
EKSAD committed
549 550 551 552
                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
Riri Novita's avatar
Riri Novita committed
553 554 555 556 557
            // if (String(tableMeta.rowData[5]) == "Unit Business/ Brand/ SubCo 1") {
            // console.log(tableMeta.rowData[3])
            // console.log(arrayFormula)
            // console.log(arrayJumlah)
            // }
Riri Novita's avatar
Riri Novita committed
558

EKSAD's avatar
EKSAD committed
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
            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
579
                        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))
EKSAD's avatar
EKSAD committed
580
                    } else {
Riri Novita's avatar
Riri Novita committed
581
                        total += Number(item)
EKSAD's avatar
EKSAD committed
582 583 584
                    }
                }
            })
Riri Novita's avatar
Riri Novita committed
585 586 587 588 589 590 591 592 593
            total = R.equals(total, NaN) ? "0.0" : (R.equals(total, Infinity) ? "0.0" : (total == "-Infinity" ? "0.0" : total))
            // if (tableMeta.rowData[1] === 20092) {
            //     console.log(total);
            //     console.log(arrayJumlah);
            // }
            // if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) {
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
            // }
            return Number(total)
EKSAD's avatar
EKSAD committed
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633

        }

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

        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Outlook Performance Appraisal Submission</Typography>
                </div>
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                {/* {this.state.loading && loadingComponent} */}
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
                    {this.state.visibleProfitLoss === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Outlook Performance Appraisal - Profit & Loss </Typography>
                            </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>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
                                        {this.props.isApprover == true || this.state.dataTable.length == 0 ? null :
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
idlanirined's avatar
idlanirined committed
2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538
                                                {((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
                                                    <div>
                                                        <a data-tip={'Download Template'} data-for="template">
                                                            <button
                                                                style={{
                                                                    backgroundColor: 'transparent',
                                                                    cursor: 'pointer',
                                                                    borderColor: 'transparent',
                                                                    margin: 5
                                                                }}
                                                                onClick={() => this.downloadTemplate()}
                                                            >
                                                                <img src={Images.template} />
                                                            </button>
                                                        </a>
                                                        <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2539
                                                )}
idlanirined's avatar
idlanirined committed
2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556
                                                {((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
                                                    <div>
                                                        <a data-tip={'Upload'} data-for="upload">
                                                            <button
                                                                style={{
                                                                    backgroundColor: 'transparent',
                                                                    cursor: 'pointer',
                                                                    borderColor: 'transparent',
                                                                    margin: 5
                                                                }}
                                                                onClick={() => this.setState({ visibleUpload: true })}
                                                            >
                                                                <img src={Images.upload} />
                                                            </button>
                                                        </a>
                                                        <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2557
                                                )}
EKSAD's avatar
EKSAD committed
2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615
                                                <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>
                                </div>

                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                    {this.state.loading && loadingComponent}
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
                                </div>
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
                            </div>
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
                                        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' }}>
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
                                        </div>
                                    </button>
                                </div>
                                {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
faisalhamdi's avatar
faisalhamdi committed
2616
                                    (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') ?
idlanirined's avatar
idlanirined committed
2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683
                                        <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                            <button
                                                className="button"
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() => {
                                                    this.setState({ loading: true, dataTable: dataTable2, buttonDraft: false }, () => {
                                                        setTimeout(() => {
                                                            this.handleValidate()
                                                        }, 100);
                                                    })
                                                }}
                                            >
                                                <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                                </div>
                                            </button>
                                            <button
                                                className="button"
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                disabled={this.state.buttonDraft}
                                                onClick={() =>
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1 }, () => {
                                                            this.backToOLPA('draft')
                                                        })
                                                }
                                            >
                                                <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                                </div>
                                            </button>
                                            <button
                                                type="button"
                                                disabled={this.state.buttonError}
                                                onClick={() => this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1 }, () => {
                                                            this.backToOLPA('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
2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711
                                }
                            </div>
                        </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>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    {this.state.dataLoaded && (
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
                                            </MuiThemeProvider>
                                        </div>
                                    )}
                                </div>

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
idlanirined's avatar
idlanirined committed
2712
                                        <button
EKSAD's avatar
EKSAD committed
2713
                                            type="button"
idlanirined's avatar
idlanirined committed
2714
                                            onClick={() => this.setState({ loading: true, dataTable: [] }, () => {
EKSAD's avatar
EKSAD committed
2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726
                                                setTimeout(() => {
                                                    this.getItemHierarki()
                                                }, 100);
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
idlanirined's avatar
idlanirined committed
2727
                                        <button
EKSAD's avatar
EKSAD committed
2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760
                                            className="button"
                                            type="button"
                                            disabled={this.state.buttonError}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
                                                        this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
                                                    }, 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"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
                                                this.state.editable === true ?
idlanirined's avatar
idlanirined committed
2761 2762
                                                    null :
                                                    this.setState({ loading: true }, () =>
EKSAD's avatar
EKSAD committed
2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadProfitLoss('draft')
                                                                }, 100);
                                                            })
                                                    )
                                            }
                                        >
                                            <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"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
idlanirined's avatar
idlanirined committed
2784
                                            onClick={() =>
EKSAD's avatar
EKSAD committed
2785
                                                this.state.editable === true ?
idlanirined's avatar
idlanirined committed
2786 2787
                                                    null :
                                                    this.setState({ loading: true }, () =>
EKSAD's avatar
EKSAD committed
2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadProfitLoss('submitted')
                                                                }, 100);
                                                            })
                                                    )
                                            }
                                        >
                                            <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>
                                </div>
                            </div>
                        </Paper>}
                </div>

                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
                                    </div>
                                </div>
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
                            </div>
                            <UploadFile
                                type={this.state.uploadStatus}
                                percentage={this.state.percentage}
                                result={this.state.result}
                                acceptedFiles={["xlsx"]}
                                onHandle={(dt) => {
                                    this.fileHandler(dt)
                                    this.setState({ uploadStatus: 'idle', percentage: '0' })
                                }}
                                onUpload={() => {
r.kurnia's avatar
r.kurnia committed
2836
                                    String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("PROFIT") && String(this.state.judul).includes("LOSS") ?
EKSAD's avatar
EKSAD committed
2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
                        </div>
                    </div>
                )}
            </div>
        );
    }
}