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

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

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

const options = ct.customOptionsFixedColumn();
const style = {
    position: "sticky",
    left: 0,
    background: "white",
    zIndex: 101,
};
const style2 = {
    position: "sticky",
    background: "white",
faisalhamdi's avatar
faisalhamdi committed
35
    zIndex: 100
faisalhamdi's avatar
faisalhamdi committed
36 37 38
};

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

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

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

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

    handleValue(data) {
        let total = 0
        this.state.dataTable.map((item, index) => {
            if (data.rowData[1] == item[2]) {
faisalhamdi's avatar
faisalhamdi committed
176
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
faisalhamdi's avatar
faisalhamdi committed
177 178 179 180 181 182 183 184
            }
        })
        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
    }

faisalhamdi's avatar
faisalhamdi committed
185
    handleChange(value, tableMeta) {
faisalhamdi's avatar
faisalhamdi committed
186
        let val = String(value).split(",").join("")
faisalhamdi's avatar
faisalhamdi committed
187
        let data = this.state.dataTable
faisalhamdi's avatar
faisalhamdi committed
188 189
        let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
        if (indexParent > 0) {
faisalhamdi's avatar
faisalhamdi committed
190
            // console.log(indexParent)
faisalhamdi's avatar
faisalhamdi committed
191 192 193 194 195 196
            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
197 198
    }

faisalhamdi's avatar
faisalhamdi committed
199 200 201 202 203
    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
faisalhamdi's avatar
faisalhamdi committed
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: String(Number(i[7]).toFixed(1)),
                february: String(Number(i[8]).toFixed(1)),
                march: String(Number(i[9]).toFixed(1)),
                april: String(Number(i[10]).toFixed(1)),
                may: String(Number(i[11]).toFixed(1)),
                june: String(Number(i[12]).toFixed(1)),
                july: String(Number(i[13]).toFixed(1)),
                august: String(Number(i[14]).toFixed(1)),
                september: String(Number(i[15]).toFixed(1)),
                october: String(Number(i[16]).toFixed(1)),
                november: String(Number(i[17]).toFixed(1)),
                december: String(Number(i[18]).toFixed(1)),
                total_current_year: String(Number(i[19]).toFixed(1)),
                total_next_year: String(Number(i[20]).toFixed(1)),
                total_more_year: String(Number(i[21]).toFixed(1))
faisalhamdi's avatar
faisalhamdi committed
220 221 222 223 224 225 226 227 228 229
            })
        })
        let payload = {
            "submission_id": this.props.submissionID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "fixed_asset_movement": data
        }
faisalhamdi's avatar
faisalhamdi committed
230
        // console.log(data);
faisalhamdi's avatar
faisalhamdi committed
231 232 233 234
        this.props.saveToMasterBudget(payload)
        this.props.onClickClose()
    }

faisalhamdi's avatar
faisalhamdi committed
235 236 237 238 239 240 241 242 243 244
    downloadTemplate = async () => {
        let res = await fetch(
            `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
        )
        res = await res.blob()
        console.log(res)
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
faisalhamdi's avatar
faisalhamdi committed
245
            a.download = 'Template Master Budget Fixed Assets Movement.xlsx';
faisalhamdi's avatar
faisalhamdi committed
246 247 248 249 250 251 252 253 254 255 256 257 258
            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)
faisalhamdi's avatar
faisalhamdi committed
259
                console.log(resp.rows[2]);
faisalhamdi's avatar
faisalhamdi committed
260
                let payload = []
faisalhamdi's avatar
faisalhamdi committed
261
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
faisalhamdi's avatar
faisalhamdi committed
262 263 264 265 266
                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
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
                            total_actual_before: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
                            january: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
                            february: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            march: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            april: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            may: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            june: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            july: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            august: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            september: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            october: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            november: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            december: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            total_current_year: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            total_next_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
                            total_more_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim()
faisalhamdi's avatar
faisalhamdi committed
283 284 285 286 287 288 289
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
290
                    fixed_asset_movement: payload                    
faisalhamdi's avatar
faisalhamdi committed
291
                }
faisalhamdi's avatar
faisalhamdi committed
292 293
                console.log(body)
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
faisalhamdi's avatar
faisalhamdi committed
294 295 296 297 298 299
            }
        });
    }

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

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

faisalhamdi's avatar
faisalhamdi committed
395
    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
396 397
        let url =  `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
        console.log(url);
faisalhamdi's avatar
faisalhamdi committed
398
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
399
            `https://tia.eksad.com/tia-reporting-dev/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
faisalhamdi's avatar
faisalhamdi committed
400 401 402 403 404 405 406
        )
        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;
faisalhamdi's avatar
faisalhamdi committed
407
            a.download = 'Master Budget Fixed Assets Movement.xlsx';
faisalhamdi's avatar
faisalhamdi committed
408 409 410 411
            a.click();
        }
    }

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

faisalhamdi's avatar
faisalhamdi committed
455 456 457 458
    closeAlert() {
        this.setState({ alert: false })
    }

faisalhamdi's avatar
faisalhamdi committed
459
    render() {
faisalhamdi's avatar
faisalhamdi committed
460
        let dataTable2 = this.state.dataTable
faisalhamdi's avatar
faisalhamdi committed
461
        const handleChange = (value, tableMeta, type) => {
faisalhamdi's avatar
faisalhamdi committed
462
            let val = String(value).split(",").join("")
faisalhamdi's avatar
faisalhamdi committed
463 464
            if (type === "actual") {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)            
faisalhamdi's avatar
faisalhamdi committed
465
            } else {
faisalhamdi's avatar
faisalhamdi committed
466 467 468 469 470 471 472 473 474
                let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])            
                if (indexParent > 0) {
                    // console.log(indexParent)
                    let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
                } else {
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                }
faisalhamdi's avatar
faisalhamdi committed
475 476
            }
        }
faisalhamdi's avatar
faisalhamdi committed
477 478 479 480 481 482 483 484 485 486 487 488
        const handleTotal = (tableMeta) => {
            let total = 0
            dataTable2[tableMeta.rowIndex].map((item, index) => {
                if (index >= 7 && index <= 18) {
                    let valItem = item == undefined || item == "" ? 0 : item
                    total += Number(valItem)
                }
            })
            dataTable2[tableMeta.rowIndex][19] = total
            return total
            // console.log(total);
        }
faisalhamdi's avatar
faisalhamdi committed
489 490 491 492 493 494 495 496 497 498 499 500
        const handleValue = (data) => {
            let total = 0
            dataTable2.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 = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
            // console.log(indexParent);
            return a
        }
faisalhamdi's avatar
faisalhamdi committed
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533
        const handleFormula = (data, tableMeta, month) => {
            let rilFormula = String(tableMeta.rowData[3])
            if (rilFormula.includes("#")) {
                if (this.props.status === "not-yet") {
                    let splitOrder = String(tableMeta.rowData[3]).split('@')
                    for (let index = 0; index < splitOrder.length; index++) {
                        if (splitOrder[index] === "") {
                        } else {
                            if (splitOrder[index].includes('#')) {

                            } else {
                                let splitOperator = splitOrder[index].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
                                let reg = /^\d+$/
                                splitOperator.map((item) => {
                                    if (reg.test(item) === true) {
                                        let i = dataTable2.findIndex((val) => val[23] == item)
                                        if (i > 0) {
                                            rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
                                        }
                                    }
                                })
                            }
                        }
                    }
                    let body = {
                        "submission_id": null,
                        "company_id": this.props.company.company_id,
                        "report_id": this.props.report_id,
                        "year": this.props.periode,
                        "month": month,
                        "formula": rilFormula
                    }
                    api.create().countingFormula(body).then(response => {
faisalhamdi's avatar
faisalhamdi committed
534
                        // console.log(response);
faisalhamdi's avatar
faisalhamdi committed
535 536 537 538 539 540 541
                        if (response.data) {
                            if (response.data.status === "success") {
                                setTimeout(() => {
                                    return response.data.data.result                                    
                                }, 2000);
                            }
                        }
faisalhamdi's avatar
faisalhamdi committed
542
                    })
faisalhamdi's avatar
faisalhamdi committed
543
                } else {
faisalhamdi's avatar
faisalhamdi committed
544 545 546 547 548 549 550 551 552
                    let body = {
                        "submission_id": this.props.submissionID,
                        "company_id": this.props.company.company_id,
                        "report_id": this.props.report_id,
                        "year": this.props.periode,
                        "month": month,
                        "formula": rilFormula
                    }
                    api.create().countingFormula(body).then(response => {
faisalhamdi's avatar
faisalhamdi committed
553
                        // console.log(response)
faisalhamdi's avatar
faisalhamdi committed
554 555
                        if (response.data) {
                            if (response.data.status === "success") {
faisalhamdi's avatar
faisalhamdi committed
556 557 558
                                setTimeout(() => {
                                    return response.data.data.result                                    
                                }, 2000);
faisalhamdi's avatar
faisalhamdi committed
559 560 561
                            }
                        }
                    })
faisalhamdi's avatar
faisalhamdi committed
562
                }
faisalhamdi's avatar
faisalhamdi committed
563 564 565 566 567 568 569
            } else {
                let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
                let arrayJumlah = []
                arrayFormula.map((item, indexs) => {
                    let index = dataTable2.findIndex((val) => val[1] == item)
                    if (index > 0) {
                        arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
faisalhamdi's avatar
faisalhamdi committed
570
                    } else {
faisalhamdi's avatar
faisalhamdi committed
571
                        arrayJumlah.push(item)
faisalhamdi's avatar
faisalhamdi committed
572
                    }
faisalhamdi's avatar
faisalhamdi committed
573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
                    // if (indexs % 2 !== 0) {
                    //     operator.push(item)
                    // }
                })
                let array = arrayJumlah
                let total = 0
                let opt = ""
                array.map((item, index) => {
                    if (item == "+") {
                        opt = "tambah"
                    } else if (item == "-") {
                        opt = "kurang"
                    } else if (item == "*") {
                        opt = "kali"
                    } else if (item == "/") {
                        opt = "bagi"
                    } else {
                        if (opt == "tambah") {
                            total = Number(total) + Number(item)
                        } else if (opt == "kurang") {
                            total = Number(total) - Number(item)
                        } else if (opt == "kali") {
                            total = Number(total) * Number(item)
                        } else if (opt == "bagi") {
                            total = Number(total) / Number(item)
                        } else {
                            total += item
                        }
                    }
                })
                let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
                return a
            }
faisalhamdi's avatar
faisalhamdi committed
606
        }
faisalhamdi's avatar
faisalhamdi committed
607
        const columns = [{
faisalhamdi's avatar
faisalhamdi committed
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
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
633
            name: "Account",
faisalhamdi's avatar
faisalhamdi committed
634 635
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
636
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
faisalhamdi's avatar
faisalhamdi committed
637 638 639 640 641 642
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style }),
                customBodyRender: (val, tableMeta) => {
                    return (
faisalhamdi's avatar
faisalhamdi committed
643
                       <div style={{ width: 300 }}>
644 645
                            {tableMeta.rowData[23] ?
                                tableMeta.rowData[23].length > 0 ?
faisalhamdi's avatar
faisalhamdi committed
646 647 648 649 650 651 652 653 654 655 656 657
                                    <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>
faisalhamdi's avatar
faisalhamdi committed
658
                                :
faisalhamdi's avatar
faisalhamdi committed
659 660 661 662 663 664
                                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>
faisalhamdi's avatar
faisalhamdi committed
665 666 667 668 669 670
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
671
            name: `31 Dec ${Number(this.props.periode) - 1} Actual`,
faisalhamdi's avatar
faisalhamdi committed
672 673
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
674 675
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
676 677
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
678
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
679 680 681
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
682 683 684
                            {tableMeta.rowData[0] === 4 ?
                                null
                                :
faisalhamdi's avatar
faisalhamdi committed
685 686 687 688 689 690 691
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
692
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
faisalhamdi's avatar
faisalhamdi committed
693 694
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
695
                                                disabled={true}
faisalhamdi's avatar
faisalhamdi committed
696
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
697 698 699
                                            />
                                        }
                                    />
faisalhamdi's avatar
faisalhamdi committed
700
                                </div>
faisalhamdi's avatar
faisalhamdi committed
701 702 703 704
                            }
                        </div>
                    )
                }
faisalhamdi's avatar
faisalhamdi committed
705 706
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
707
            name: `Jan ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
708 709
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
710
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
711 712 713
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
714
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
715 716 717
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
718
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
719 720 721 722 723 724 725 726 727 728
                                <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=""
faisalhamdi's avatar
faisalhamdi committed
729
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
730
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
731 732 733
                                                onBlur={(event) => {
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
734
                                                }}
faisalhamdi's avatar
faisalhamdi committed
735 736 737 738
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
739
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
740 741 742 743 744 745 746
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
747
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
748 749 750
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
751 752
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
753
                                        :
faisalhamdi's avatar
faisalhamdi committed
754
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
755 756 757 758 759 760 761 762
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
763 764
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
765 766 767 768 769 770 771 772 773
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
774 775
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
776 777 778 779 780 781 782 783 784 785 786
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
787
                                                    :
faisalhamdi's avatar
faisalhamdi committed
788
                                                    null
faisalhamdi's avatar
faisalhamdi committed
789 790 791 792 793 794
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
795
            name: `Feb ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
796 797
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
798
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
799 800 801
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
802
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
803
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
804
                    return (
faisalhamdi's avatar
faisalhamdi committed
805
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
806
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
807 808 809 810 811 812 813 814 815 816
                                <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=""
faisalhamdi's avatar
faisalhamdi committed
817
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
818
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
819 820 821 822
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
823 824 825 826 827
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
828
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
829 830 831 832 833 834 835
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
836
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
837 838 839
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
840 841
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
842
                                        :
faisalhamdi's avatar
faisalhamdi committed
843
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
844 845 846 847 848 849 850 851
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
852 853
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
854 855 856 857 858 859 860 861 862
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
863 864
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
865 866 867 868 869 870 871 872 873 874 875
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
876
                                                    :
faisalhamdi's avatar
faisalhamdi committed
877
                                                    null
faisalhamdi's avatar
faisalhamdi committed
878
                            }
faisalhamdi's avatar
faisalhamdi committed
879 880 881 882 883
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
884
            name: `Mar ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
885 886
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
887
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
888 889 890
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
891
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
892
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
893
                    return (
faisalhamdi's avatar
faisalhamdi committed
894
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
895
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
896 897 898 899 900 901 902 903 904 905
                                <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=""
faisalhamdi's avatar
faisalhamdi committed
906
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
907
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
908 909 910 911
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
912 913 914 915 916
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
917
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
918 919 920 921 922 923 924
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
925
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
926 927 928
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
929 930
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
931
                                        :
faisalhamdi's avatar
faisalhamdi committed
932
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
933 934 935 936 937 938 939 940
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
941 942
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
943 944 945 946 947 948 949 950 951
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
952 953
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
954 955 956 957 958 959 960 961 962 963 964
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
965
                                                    :
faisalhamdi's avatar
faisalhamdi committed
966
                                                    null
faisalhamdi's avatar
faisalhamdi committed
967
                            }
faisalhamdi's avatar
faisalhamdi committed
968 969 970 971 972
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
973
            name: `Apr ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
974 975
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
976
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
977 978 979
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
980
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
981
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
982
                    return (
faisalhamdi's avatar
faisalhamdi committed
983
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
984
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
985 986 987 988 989 990 991 992 993 994
                                <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=""
faisalhamdi's avatar
faisalhamdi committed
995
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
996
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
997 998 999 1000
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1001 1002 1003 1004 1005
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1006
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1007 1008 1009 1010 1011 1012 1013
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1014
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1015 1016 1017
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1018 1019
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1020
                                        :
faisalhamdi's avatar
faisalhamdi committed
1021
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1022 1023 1024 1025 1026 1027 1028 1029
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(handleFormula(value, tableMeta, 4)).toFixed(1)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1030 1031
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1032 1033 1034 1035 1036 1037 1038 1039 1040
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1041 1042
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1054
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1055
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1056
                            }
faisalhamdi's avatar
faisalhamdi committed
1057 1058 1059 1060 1061
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1062
            name: `May ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1063 1064
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1065
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1066 1067 1068
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1069
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1070
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1071
                    return (
faisalhamdi's avatar
faisalhamdi committed
1072
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1073
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083
                                <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=""
faisalhamdi's avatar
faisalhamdi committed
1084
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1085
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1086 1087 1088 1089
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1090 1091 1092 1093 1094
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1095
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1096 1097 1098 1099 1100 1101 1102
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1103
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1104 1105 1106
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1107 1108
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1109
                                        :
faisalhamdi's avatar
faisalhamdi committed
1110
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1111 1112 1113 1114 1115 1116 1117 1118
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1119 1120
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1121 1122 1123 1124 1125 1126 1127 1128 1129
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1130 1131
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1143
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1144
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1145
                            }
faisalhamdi's avatar
faisalhamdi committed
1146 1147 1148 1149 1150
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1151
            name: `Jun ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1152 1153
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1154
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1155 1156 1157
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1158
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1159
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1160
                    return (
faisalhamdi's avatar
faisalhamdi committed
1161
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1162
                            {tableMeta.rowData[0] === 3 ?
faisalhamdi's avatar
faisalhamdi committed
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172
                                <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=""
faisalhamdi's avatar
faisalhamdi committed
1173
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1174
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1175 1176 1177 1178
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
faisalhamdi's avatar
faisalhamdi committed
1179 1180 1181 1182 1183
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1184
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1185 1186 1187 1188 1189 1190 1191
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1192
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1193 1194 1195
                                        />
                                    </span>
                                    :
faisalhamdi's avatar
faisalhamdi committed
1196 1197
                                    tableMeta.rowData[0] === 4 ?
                                        null
faisalhamdi's avatar
faisalhamdi committed
1198
                                        :
faisalhamdi's avatar
faisalhamdi committed
1199
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1200 1201 1202 1203 1204 1205 1206 1207
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1208 1209
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1210 1211 1212 1213 1214 1215 1216 1217 1218
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1219 1220
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1232
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1233
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1234
                            }
faisalhamdi's avatar
faisalhamdi committed
1235 1236 1237 1238 1239
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1240
            name: `Jul ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1241 1242
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1243
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1244 1245 1246
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1247 1248
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1249
                    return (
faisalhamdi's avatar
faisalhamdi committed
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1262
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1263
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1264 1265 1266 1267 1268 1269 1270 1271 1272
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1273
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1274 1275 1276 1277 1278 1279 1280
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1281
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1282 1283 1284 1285 1286 1287 1288
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1289 1290 1291 1292 1293 1294 1295 1296
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1297 1298
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1299 1300 1301 1302 1303 1304 1305 1306 1307
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1308 1309
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1321
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1322
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1323
                            }
faisalhamdi's avatar
faisalhamdi committed
1324 1325 1326 1327 1328
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1329
            name: `Aug ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1330 1331
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1332
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1333 1334 1335
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1336 1337
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1338
                    return (
faisalhamdi's avatar
faisalhamdi committed
1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1351
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1352
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1353 1354 1355 1356 1357 1358 1359 1360 1361
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1362
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1363 1364 1365 1366 1367 1368 1369
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1370
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1371 1372 1373 1374 1375 1376 1377
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1378 1379 1380 1381 1382 1383 1384 1385
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1386 1387
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1388 1389 1390 1391 1392 1393 1394 1395 1396
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1397 1398
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1410
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1411
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1412
                            }
faisalhamdi's avatar
faisalhamdi committed
1413 1414 1415 1416 1417
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1418
            name: `Sep ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1419 1420
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1421
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1422 1423 1424
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1425 1426
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1427
                    return (
faisalhamdi's avatar
faisalhamdi committed
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1440
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1441
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1442 1443 1444 1445 1446 1447 1448 1449 1450
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1451
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1452 1453 1454 1455 1456 1457 1458
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1459
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1460 1461 1462 1463 1464 1465 1466
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1467 1468 1469 1470 1471 1472 1473 1474
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1475 1476
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1477 1478 1479 1480 1481 1482 1483 1484 1485
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1486 1487
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1499
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1500
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1501 1502 1503 1504 1505 1506
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1507
            name: `Oct ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1508 1509
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1510
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528
                        <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' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1529
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1530
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1531 1532 1533 1534 1535 1536 1537 1538 1539
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1540
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1541 1542 1543 1544 1545 1546 1547
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1548
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1549 1550 1551 1552 1553 1554 1555
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1556 1557 1558 1559 1560 1561 1562 1563
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1564 1565
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
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={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1575 1576
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1588
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1589
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1590 1591 1592 1593 1594 1595
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1596
            name: `Nov ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1597 1598
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1599
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617
                        <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' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1618
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1619
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1620 1621 1622 1623 1624 1625 1626 1627 1628
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1629
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1630 1631 1632 1633 1634 1635 1636
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1637
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1638 1639 1640 1641 1642 1643 1644
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1645 1646 1647 1648 1649 1650 1651 1652
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1653 1654
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1655 1656 1657 1658 1659 1660 1661 1662 1663
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1664 1665
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1677
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1678
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1679 1680 1681 1682 1683 1684
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1685
            name: `Dec ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1686 1687
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1688
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706
                        <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' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1707
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1708
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1709 1710 1711 1712 1713 1714 1715 1716 1717
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1718
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1719 1720 1721 1722 1723 1724 1725
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1726
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1727 1728 1729 1730 1731 1732 1733
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1734 1735 1736 1737 1738 1739 1740 1741
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1742 1743
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1744 1745 1746 1747 1748 1749 1750 1751 1752
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1753 1754
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1766
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1767
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1768 1769 1770 1771 1772 1773
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1774
            name: "Current Total",
faisalhamdi's avatar
faisalhamdi committed
1775 1776
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1777 1778
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
1779 1780 1781 1782 1783
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
faisalhamdi's avatar
faisalhamdi committed
1784 1785 1786
                        <div style={{ width: 96, textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
                                null : tableMeta.rowData[0] === 2 ?
faisalhamdi's avatar
faisalhamdi committed
1787 1788 1789 1790 1791 1792 1793
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1794
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1795
                                        />
faisalhamdi's avatar
faisalhamdi committed
1796 1797 1798 1799 1800 1801 1802 1803
                                    </span> :
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1804
                                            value={Number(handleTotal(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1805 1806
                                        />
                                    </span>}
faisalhamdi's avatar
faisalhamdi committed
1807 1808 1809 1810 1811
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1812
            name: `31 Dec ${Number(this.props.periode) + 1} Total`,
faisalhamdi's avatar
faisalhamdi committed
1813 1814
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1815 1816
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1834
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1835
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1836 1837 1838 1839 1840 1841 1842 1843 1844
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1845
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1846 1847 1848 1849 1850 1851 1852
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1853
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1854 1855 1856 1857 1858 1859 1860
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1861 1862 1863 1864 1865 1866 1867 1868
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1869 1870
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1871 1872 1873 1874 1875 1876 1877 1878 1879
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1880 1881
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1893
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1894
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1895 1896 1897 1898 1899 1900
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1901
            name: `31 Dec ${Number(this.props.periode) + 2} Total`,
faisalhamdi's avatar
faisalhamdi committed
1902 1903
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1904 1905
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 3 ?
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={value}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1923
                                                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)}
faisalhamdi's avatar
faisalhamdi committed
1924
                                                value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1925 1926 1927 1928 1929 1930 1931 1932 1933
                                                onBlur={(event) => {
                                                    // updateValue(event.target.value)
                                                    handleChange(event.target.value, tableMeta)
                                                    console.log(dataTable2)
                                                }}
                                            />
                                        }
                                    />
                                </div> :
faisalhamdi's avatar
faisalhamdi committed
1934
                                tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1935 1936 1937 1938 1939 1940 1941
                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1942
                                            value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1943 1944 1945 1946 1947 1948 1949
                                        />
                                    </span>
                                    :
                                    tableMeta.rowData[0] === 4 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1950 1951 1952 1953 1954 1955 1956 1957
                                            <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)}
                                            />
faisalhamdi's avatar
faisalhamdi committed
1958 1959
                                            :
                                            tableMeta.rowData[0] === 5 ?
faisalhamdi's avatar
faisalhamdi committed
1960 1961 1962 1963 1964 1965 1966 1967 1968
                                                // <NumberFormat
                                                //     thousandSeparator={true}
                                                //     style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //     type="text"
                                                //     placeholder=""
                                                //     disabled={true}
                                                //     value={handleFormula(value, tableMeta)}
                                                // />
                                                null
faisalhamdi's avatar
faisalhamdi committed
1969 1970
                                                :
                                                tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981
                                                    // value === "" ?
                                                    //     null :
                                                    //     <NumberFormat
                                                    //         thousandSeparator={true}
                                                    //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    //         type="text"
                                                    //         placeholder=""
                                                    //         disabled={true}
                                                    //         value={Number(value)}
                                                    //     />
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1982
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1983
                                                    null
faisalhamdi's avatar
faisalhamdi committed
1984
                            }
faisalhamdi's avatar
faisalhamdi committed
1985 1986 1987 1988 1989 1990
                        </div>
                    )
                }
            }
        }
        ]
faisalhamdi's avatar
faisalhamdi committed
1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
        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>
        );
faisalhamdi's avatar
faisalhamdi committed
2001

faisalhamdi's avatar
faisalhamdi committed
2002 2003 2004
        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 }}>
faisalhamdi's avatar
faisalhamdi committed
2005
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
faisalhamdi's avatar
faisalhamdi committed
2006
                </div>
faisalhamdi's avatar
faisalhamdi committed
2007 2008 2009 2010 2011
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
faisalhamdi's avatar
faisalhamdi committed
2012
                {/* {this.state.loading && loadingComponent} */}
faisalhamdi's avatar
faisalhamdi committed
2013
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
faisalhamdi's avatar
faisalhamdi committed
2014 2015 2016
                    {this.state.visibleFixedAssetsMovement === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
faisalhamdi's avatar
faisalhamdi committed
2017
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Fixed Assets Movement</Typography>
faisalhamdi's avatar
faisalhamdi committed
2018 2019 2020 2021 2022
                            </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>
faisalhamdi's avatar
faisalhamdi committed
2023
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
faisalhamdi's avatar
faisalhamdi committed
2024 2025 2026
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
a.bairuha's avatar
a.bairuha committed
2027
                                        {this.props.isApprover == true || this.state.dataTable.length == 0 ? null :
faisalhamdi's avatar
faisalhamdi committed
2028
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
faisalhamdi's avatar
faisalhamdi committed
2029
                                                {((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ) && (
a.bairuha's avatar
a.bairuha committed
2030
                                                <div>
faisalhamdi's avatar
faisalhamdi committed
2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044
                                                <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" />
a.bairuha's avatar
a.bairuha committed
2045 2046
                                                </div>
                                                )}
faisalhamdi's avatar
faisalhamdi committed
2047
                                                {((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ) && (
a.bairuha's avatar
a.bairuha committed
2048
                                                <div>
faisalhamdi's avatar
faisalhamdi committed
2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062
                                                <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" />
a.bairuha's avatar
a.bairuha committed
2063 2064
                                                </div>
                                                )}
faisalhamdi's avatar
faisalhamdi committed
2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085
                                                <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>
                                        }
faisalhamdi's avatar
faisalhamdi committed
2086
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2087
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2088

faisalhamdi's avatar
faisalhamdi committed
2089
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
faisalhamdi's avatar
faisalhamdi committed
2090 2091
                                    {this.state.loading && loadingComponent} 
                                    <MuiThemeProvider theme={getMuiTheme()}>
faisalhamdi's avatar
faisalhamdi committed
2092 2093 2094 2095 2096
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
faisalhamdi's avatar
faisalhamdi committed
2097
                                    </MuiThemeProvider>
faisalhamdi's avatar
faisalhamdi committed
2098
                                </div> 
faisalhamdi's avatar
faisalhamdi committed
2099
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : {this.state.updateBy}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2100
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2101
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
faisalhamdi's avatar
faisalhamdi committed
2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112
                                <div className="col-1">
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
faisalhamdi's avatar
faisalhamdi committed
2113 2114 2115 2116 2117
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
faisalhamdi's avatar
faisalhamdi committed
2118
                                    >
faisalhamdi's avatar
faisalhamdi committed
2119
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
faisalhamdi's avatar
faisalhamdi committed
2120
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
faisalhamdi's avatar
faisalhamdi committed
2121 2122
                                        </div>
                                    </button>
faisalhamdi's avatar
faisalhamdi committed
2123
                                </div>
a.bairuha's avatar
a.bairuha committed
2124
                                {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
faisalhamdi's avatar
faisalhamdi committed
2125
                                    (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') ?
faisalhamdi's avatar
faisalhamdi committed
2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137
                                    <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={() => {
faisalhamdi's avatar
faisalhamdi committed
2138 2139
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
faisalhamdi's avatar
faisalhamdi committed
2140
                                                        this.handleValidate()
faisalhamdi's avatar
faisalhamdi committed
2141 2142
                                                    }, 100);
                                                })
faisalhamdi's avatar
faisalhamdi committed
2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158
                                            }}
                                        >
                                            <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
                                            }}
faisalhamdi's avatar
faisalhamdi committed
2159 2160 2161 2162 2163 2164 2165 2166
                                            onClick={() => 
                                                this.state.editable === true ?
                                                    null :
                                                        this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1 }, () => {
                                                                this.backToMasterBudget('draft')
                                                        })
                                            }
faisalhamdi's avatar
faisalhamdi committed
2167 2168 2169 2170 2171 2172 2173 2174
                                        >
                                            <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}
faisalhamdi's avatar
faisalhamdi committed
2175
                                            onClick={() => 
faisalhamdi's avatar
faisalhamdi committed
2176
                                                this.state.buttonError ?
faisalhamdi's avatar
faisalhamdi committed
2177 2178
                                                    this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                    :
faisalhamdi's avatar
faisalhamdi committed
2179
                                                    this.state.handleTekTekTek == 1 ? null :   
faisalhamdi's avatar
faisalhamdi committed
2180 2181 2182
                                                        this.setState({ handleTekTekTek: 1 }, () => {
                                                            this.backToMasterBudget('submitted')
                                                        })}
faisalhamdi's avatar
faisalhamdi committed
2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193
                                            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>
faisalhamdi's avatar
faisalhamdi committed
2194
                                    </div> : null
faisalhamdi's avatar
faisalhamdi committed
2195
                                }
faisalhamdi's avatar
faisalhamdi committed
2196 2197 2198 2199 2200 2201 2202 2203
                            </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>
faisalhamdi's avatar
faisalhamdi committed
2204
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2205
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
faisalhamdi's avatar
faisalhamdi committed
2206
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2207
                                    {this.state.dataLoaded && (
faisalhamdi's avatar
faisalhamdi committed
2208
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
faisalhamdi's avatar
faisalhamdi committed
2209 2210
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
faisalhamdi's avatar
faisalhamdi committed
2211 2212 2213 2214 2215
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
faisalhamdi's avatar
faisalhamdi committed
2216
                                            </MuiThemeProvider>
faisalhamdi's avatar
faisalhamdi committed
2217 2218 2219
                                        </div>
                                    )}
                                </div>
2220 2221 2222 2223 2224 2225

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visibleFixedAssetsMovement: true }, () => {
faisalhamdi's avatar
faisalhamdi committed
2226
                                                setTimeout(() => {
2227
                                                    this.getItemHierarki()
faisalhamdi's avatar
faisalhamdi committed
2228
                                                }, 100);
2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                        <button
                                            className="button"
                                            type="button"
                                            disabled={this.state.buttonError}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
faisalhamdi's avatar
faisalhamdi committed
2252
                                                        this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false})
2253 2254 2255 2256 2257 2258 2259 2260 2261
                                                    }, 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
faisalhamdi's avatar
faisalhamdi committed
2262
                                            className="button"
2263 2264
                                            type="button"
                                            disabled={this.state.buttonError}
faisalhamdi's avatar
faisalhamdi committed
2265 2266
                                            style={{
                                                backgroundColor: 'transparent',
faisalhamdi's avatar
faisalhamdi committed
2267
                                                cursor: this.state.editable === true ? 'default' : 'pointer',
faisalhamdi's avatar
faisalhamdi committed
2268 2269 2270 2271
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
faisalhamdi's avatar
faisalhamdi committed
2272
                                            onClick={() => this.state.editable === true ?
EKSAD's avatar
EKSAD committed
2273
                                                null : this.setState({ loading: true}, () =>
faisalhamdi's avatar
faisalhamdi committed
2274
                                                this.state.handleTekTekTek == 1 ? null : 
faisalhamdi's avatar
faisalhamdi committed
2275
                                                this.setState({ handleTekTekTek: 1 }, () => {
faisalhamdi's avatar
faisalhamdi committed
2276 2277 2278
                                                    setTimeout(() => {
                                                        this.uploadFAM('draft')
                                                    }, 100);
EKSAD's avatar
EKSAD committed
2279
                                                }))}
2280 2281 2282 2283 2284 2285 2286
                                        >
                                            <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"
faisalhamdi's avatar
faisalhamdi committed
2287 2288 2289 2290 2291 2292 2293 2294
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none'
                                            }}
                                            onClick={() => 
                                                this.state.editable === true ?
EKSAD's avatar
EKSAD committed
2295
                                                    null : this.setState({ loading: true}, () =>
faisalhamdi's avatar
faisalhamdi committed
2296 2297 2298 2299 2300 2301
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({handleTekTekTek: 1}, () => {
                                                            setTimeout(() => {
                                                                this.uploadFAM('submitted')
                                                            }, 100);
                                                        })
EKSAD's avatar
EKSAD committed
2302
                                                    )
faisalhamdi's avatar
faisalhamdi committed
2303
                                            }
2304 2305 2306 2307 2308 2309
                                        >
                                            <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>
faisalhamdi's avatar
faisalhamdi committed
2310
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2311
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2312 2313
                        </Paper>}
                </div>
faisalhamdi's avatar
faisalhamdi committed
2314

faisalhamdi's avatar
faisalhamdi committed
2315 2316 2317 2318 2319 2320 2321
                {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>
faisalhamdi's avatar
faisalhamdi committed
2322
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2323
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2324 2325 2326 2327 2328 2329 2330 2331
                                <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>
faisalhamdi's avatar
faisalhamdi committed
2332 2333
                                </div>
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348
                            <UploadFile
                                type={this.state.uploadStatus}
                                percentage={this.state.percentage}
                                result={this.state.result}
                                acceptedFiles={["xlsx"]}
                                onHandle={(dt) => {
                                    this.fileHandler(dt)
                                    this.setState({ uploadStatus: 'idle', percentage: '0' })
                                }}
                                onUpload={() => {
                                    this.state.judul === "MASTER BUDGET - FIXED ASSETS MOVEMENT" ?
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
faisalhamdi's avatar
faisalhamdi committed
2349
                        </div>
faisalhamdi's avatar
faisalhamdi committed
2350 2351
                    </div>
                )}
faisalhamdi's avatar
faisalhamdi committed
2352 2353 2354 2355
            </div>
        );
    }
}