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

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

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

const options = ct.customOptionsFixedColumn();

const style = {
    position: "sticky",
    left: 0,
    zIndex: 101,
    background: "white",
};
const style2 = {
    position: "sticky",
    background: "white",
    zIndex: 100
};

export default class BalanceSheetOLPA extends Component {
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            visibleBalanceSheet: true,
            disabledSave: true,
            editable: false,
            buttonError: false,
            judulColumn: null,
Riri Novita's avatar
Riri Novita committed
51
            updateBy: [],
faisalhamdi's avatar
faisalhamdi committed
52 53
            handleTekTekTek: 0,
            viewOnly: true,
faisalhamdi's avatar
faisalhamdi committed
54 55 56 57
            get_for: 'view',
            minValue: "0",
            maxValue: "0",
            kansas: 0
Deni Rinaldi's avatar
Deni Rinaldi committed
58
        }
faisalhamdi's avatar
faisalhamdi committed
59 60
        this.handleValue = this.handleValue.bind(this)
        this.fileHandler = this.fileHandler.bind(this);
Deni Rinaldi's avatar
Deni Rinaldi committed
61 62 63
    }

    componentDidMount() {
faisalhamdi's avatar
faisalhamdi committed
64 65
        this.getLatestUpdate()
        this.handleViewOnly()
faisalhamdi's avatar
faisalhamdi committed
66
        this.getSettingControl()
Deni Rinaldi's avatar
Deni Rinaldi committed
67 68
    }

faisalhamdi's avatar
faisalhamdi committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
    handleViewOnly() {
        let checkApprover = false
        let checkLastStatus = false
        let checkStatus = false
        let checkPrevRev = false

        if (this.props.isApprover) {
            checkApprover = true
        } else {
            checkApprover = false
        }

        if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
            checkLastStatus = true
        } else {
            checkLastStatus = false
        }

        if (this.props.prevRevision) {
            checkPrevRev = true
        } else {
            checkPrevRev = false
        }

        if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
            checkStatus = true
        } else {
            checkStatus = false
        }

        this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
    }

    handleGetFor(type) {
        this.setState({ get_for: type }, () => {
            this.getLatestUpdate()
faisalhamdi's avatar
faisalhamdi committed
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
            this.getSettingControl()
        })
    }

    getSettingControl() {
        let body = {
            group: 'THRESHOLD_CONTROL',
            company_id: this.props.company.company_id,
            type: 'BALANCE_SHEET'
        }

        api.create().getAllSettingByType(body).then(response => {
            console.log(response);
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({
                        minValue: response.data.data[0] ? response.data.data[0].min_value : null,
                        maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
                    }, () => {
                        this.getItemHierarki()
                    })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
128
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
129 130 131 132 133 134 135 136 137 138
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
faisalhamdi's avatar
faisalhamdi committed
139 140 141 142
        })
    }

    getLatestUpdate() {
Deni Rinaldi's avatar
Deni Rinaldi committed
143 144 145 146
        let payload = {
            "outlook_pa_id": this.props.outlook_pa_id,
            "report_id": this.props.report_id,
            "revision": this.props.revision,
d.arizona's avatar
d.arizona committed
147
            "get_for": this.state.get_for,
Deni Rinaldi's avatar
Deni Rinaldi committed
148 149 150 151
            "periode": this.props.periode,
            "company_id": this.props.company.company_id
        }
        api.create().getLastestUpdateOLPA(payload).then(response => {
faisalhamdi's avatar
faisalhamdi committed
152
            // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
153 154 155
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
156
                        updateBy: response.data.data.detail === null ? '-' : response.data.data.detail
Deni Rinaldi's avatar
Deni Rinaldi committed
157
                    })
faisalhamdi's avatar
faisalhamdi committed
158 159
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
160
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
161 162 163 164 165 166
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
167
                }
faisalhamdi's avatar
faisalhamdi committed
168 169
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
170 171 172 173
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
174 175 176
    async getItemHierarki() {
        this.setState({ loading: true, judulColumn: null })
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
177
            "outlook_pa_id": this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
178
            "report_id": this.props.report_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
179
            "revision": this.props.revision,
Deni Rinaldi's avatar
Deni Rinaldi committed
180
            "periode": this.props.periode,
faisalhamdi's avatar
faisalhamdi committed
181 182
            "company_id": this.props.company.company_id,
            "get_for": this.state.get_for
Deni Rinaldi's avatar
Deni Rinaldi committed
183
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
184
        let response = await api.create().getDetailReportOLPA(payload)
faisalhamdi's avatar
faisalhamdi committed
185
        console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
186
        console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
187 188 189 190 191 192 193 194 195 196 197 198 199 200
        let dataTable = []
        if (response.data) {
            let res = response.data.data
            const handlePushChild = (item) => {
                let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                if (indexIDzz === -1) {
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
                        item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
201 202 203 204 205 206 207 208 209 210
                        Number(item.balance_sheet.january).toFixed(1),
                        Number(item.balance_sheet.february).toFixed(1),
                        Number(item.balance_sheet.march).toFixed(1),
                        Number(item.balance_sheet.april).toFixed(1),
                        Number(item.balance_sheet.may).toFixed(1),
                        Number(item.balance_sheet.june).toFixed(1),
                        Number(item.balance_sheet.july).toFixed(1),
                        Number(item.balance_sheet.august).toFixed(1),
                        Number(item.balance_sheet.september).toFixed(1),
                        Number(item.balance_sheet.october).toFixed(1),
d.arizona's avatar
d.arizona committed
211 212
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november).toFixed(1), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december).toFixed(1), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
213
                        Number(item.balance_sheet.total_current_year).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
214
                        item.order,
Deni Rinaldi's avatar
Deni Rinaldi committed
215
                        item.condition_it_should_be,
Deni Rinaldi's avatar
Deni Rinaldi committed
216 217
                        item.condition_if_wrong,
                        item.balance_sheet.forecast_formula == null ? [] : item.balance_sheet.forecast_formula
Deni Rinaldi's avatar
Deni Rinaldi committed
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
                    ])
                }
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
                    }
                }
            }
            res.map((item, index) => {
                dataTable.push([
                    item.type_report_id,
                    item.id,
                    item.parent,
                    item.formula,
                    item.level,
                    item.description,
                    item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
237 238 239 240 241 242 243 244 245 246
                    Number(item.balance_sheet.january).toFixed(1),
                    Number(item.balance_sheet.february).toFixed(1),
                    Number(item.balance_sheet.march).toFixed(1),
                    Number(item.balance_sheet.april).toFixed(1),
                    Number(item.balance_sheet.may).toFixed(1),
                    Number(item.balance_sheet.june).toFixed(1),
                    Number(item.balance_sheet.july).toFixed(1),
                    Number(item.balance_sheet.august).toFixed(1),
                    Number(item.balance_sheet.september).toFixed(1),
                    Number(item.balance_sheet.october).toFixed(1),
d.arizona's avatar
d.arizona committed
247 248
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november).toFixed(1), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december).toFixed(1), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
249
                    Number(item.balance_sheet.total_current_year).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
250 251
                    item.order,
                    item.condition_it_should_be,
Deni Rinaldi's avatar
Deni Rinaldi committed
252 253
                    item.condition_if_wrong,
                    item.balance_sheet.forecast_formula == null ? [] : item.balance_sheet.forecast_formula
Deni Rinaldi's avatar
Deni Rinaldi committed
254 255 256 257 258 259 260 261 262
                ])
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
                    }
                }
            })
faisalhamdi's avatar
faisalhamdi committed
263
            console.log(dataTable);
faisalhamdi's avatar
faisalhamdi committed
264
            this.setState({ dataTable, loading: false, buttonError: true, editable: true, saveDraft: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
265
        } else {
faisalhamdi's avatar
faisalhamdi committed
266
            this.setState({ dataTable, loading: false, buttonError: true, editable: true, saveDraft: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
267 268 269
        }
    }

faisalhamdi's avatar
faisalhamdi committed
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
    handleValue(data) {
        let total = 0
        this.state.dataTable.map((item, index) => {
            if (data.rowData[1] == item[2]) {
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
            }
        })
        let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
        let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
        // console.log(indexParent);
        return a
    }

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

    backToOLPA(type) {
Deni Rinaldi's avatar
Deni Rinaldi committed
298 299 300 301
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
302 303 304 305 306 307 308 309 310 311 312
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
                february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
                march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
                april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
                may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
                june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
                july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
                august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
                september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
                october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
d.arizona's avatar
d.arizona committed
313 314
                november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1))),
                december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1))),
Deni Rinaldi's avatar
Deni Rinaldi committed
315
                total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
316 317 318
            })
        })
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
319
            "outlook_pa_id": this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
320 321 322 323 324 325
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "balance_sheet": data
        }
faisalhamdi's avatar
faisalhamdi committed
326
        console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
327
        this.setState({ loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
328
        this.props.saveToOLPA(payload)
Deni Rinaldi's avatar
Deni Rinaldi committed
329 330 331 332 333
        this.props.onClickClose()
    }

    downloadTemplate = async () => {
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
334
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
Deni Rinaldi's avatar
Deni Rinaldi committed
335 336
        )
        res = await res.blob()
Deni Rinaldi's avatar
Deni Rinaldi committed
337
        // console.log(res)
Deni Rinaldi's avatar
Deni Rinaldi committed
338 339 340 341
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
Deni Rinaldi's avatar
Deni Rinaldi committed
342
            a.download = 'Template Outlook PA Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
343 344 345 346 347 348 349 350 351 352 353 354 355
            a.click();
        }
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
                console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
Deni Rinaldi's avatar
Deni Rinaldi committed
356
                // console.log(resp.rows[2]);
Deni Rinaldi's avatar
Deni Rinaldi committed
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
                let payload = []
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
                            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(),
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    balance_sheet: payload
                }
faisalhamdi's avatar
faisalhamdi committed
387
                console.log(body)
Deni Rinaldi's avatar
Deni Rinaldi committed
388 389 390 391 392 393
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
            }
        });
    }

    checkUpload() {
Deni Rinaldi's avatar
Deni Rinaldi committed
394
        api.create().checkUploadOLPA(this.state.payload).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
395
            // console.log(JSON.stringify(this.state.payload));
Deni Rinaldi's avatar
Deni Rinaldi committed
396
            console.log(response)
Deni Rinaldi's avatar
Deni Rinaldi committed
397 398 399 400 401 402 403 404 405 406 407 408
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true })
                    let dataTable = response.data.data.map((item, index) => {
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
409 410 411 412 413 414 415 416 417 418
                            Number(item.january).toFixed(1),
                            Number(item.february).toFixed(1),
                            Number(item.march).toFixed(1),
                            Number(item.april).toFixed(1),
                            Number(item.may).toFixed(1),
                            Number(item.june).toFixed(1),
                            Number(item.july).toFixed(1),
                            Number(item.august).toFixed(1),
                            Number(item.september).toFixed(1),
                            Number(item.october).toFixed(1),
d.arizona's avatar
d.arizona committed
419 420
                            item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.november).toFixed(1), formula: item.november_formula } : Number(item.november).toFixed(1),
                            item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.december).toFixed(1), formula: item.december_formula } : Number(item.december).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
421
                            Number(item.total_current_year).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
422 423 424
                            item.orders,
                            item.condition_it_should_be,
                            item.condition_if_wrong,
Deni Rinaldi's avatar
Deni Rinaldi committed
425
                            item.forecast_formula == null ? [] : item.forecast_formula,
Deni Rinaldi's avatar
Deni Rinaldi committed
426 427 428
                            item.error
                        ]
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
429
                    console.log(this.state.dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
430 431
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
432
                            if (item[24].length > 0) {
faisalhamdi's avatar
faisalhamdi committed
433
                                console.log('masuk')
Deni Rinaldi's avatar
Deni Rinaldi committed
434 435 436
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
                            }
                        })
faisalhamdi's avatar
faisalhamdi committed
437
                        console.log(this.state.dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
438
                    })
Riri Novita's avatar
Riri Novita committed
439 440
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
441
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
442 443 444 445 446 447
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
448 449 450 451 452 453 454 455 456 457
                }
            }
        })
    }

    uploadBalanceSheet(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
458 459 460 461 462 463 464 465 466 467 468
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
                february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
                march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
                april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
                may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
                june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
                july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
                august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
                september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
                october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
d.arizona's avatar
d.arizona committed
469 470
                november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1))),
                december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[18]).toFixed(1))),
Deni Rinaldi's avatar
Deni Rinaldi committed
471
                total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
472 473 474
            })
        })
        let body = {
Deni Rinaldi's avatar
Deni Rinaldi committed
475
            outlook_pa_id: this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
476 477 478 479 480 481
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
            balance_sheet: data,
            status: type
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
482
        // console.log(JSON.stringify(body));
Deni Rinaldi's avatar
Deni Rinaldi committed
483
        api.create('UPLOAD').uploadOLPA(body).then(response => {
faisalhamdi's avatar
faisalhamdi committed
484
            console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
485 486 487 488 489
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
Riri Novita's avatar
Riri Novita committed
490
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
491
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
492 493 494 495 496 497
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
498 499 500 501 502 503 504 505 506
                }
            } else {
                this.setState({ loading: false })
                alert(response.problem)
            }
        })
    }

    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
507
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
Deni Rinaldi's avatar
Deni Rinaldi committed
508
        // console.log(url);
Deni Rinaldi's avatar
Deni Rinaldi committed
509
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
510
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id === null ? "" : this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
Deni Rinaldi's avatar
Deni Rinaldi committed
511 512 513 514 515 516 517
        )
        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;
Deni Rinaldi's avatar
Deni Rinaldi committed
518
            a.download = 'Outlook PA Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
519 520 521 522 523 524
            a.click();
        }
    }

    handleValidate() {
        let data = []
faisalhamdi's avatar
faisalhamdi committed
525 526 527
        let err = false
        let dataTable = this.state.dataTable
        let kansas = this.state.kansas
Deni Rinaldi's avatar
Deni Rinaldi committed
528
        // console.log(this.state.dataTable)
faisalhamdi's avatar
faisalhamdi committed
529 530
        dataTable.map((i, index) => {
            if (String(i[5]) == "Control (should be nil)") {
faisalhamdi's avatar
faisalhamdi committed
531
                if (Number(i[17]) < this.state.minValue || Number(i[17]) > this.state.maxValue) {
faisalhamdi's avatar
faisalhamdi committed
532 533 534 535 536 537 538 539
                    err = true
                } else if (Number(i[18]) < this.state.minValue || Number(i[18]) > this.state.maxValue) {
                    err = true
                } else if (Number(i[19]) < this.state.minValue || Number(i[19]) > this.state.maxValue) {
                    err = true
                }
            }

Deni Rinaldi's avatar
Deni Rinaldi committed
540 541 542
            data.push({
                item_report_id: i[1],
                total_actual_before: String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
543 544 545 546 547 548 549 550 551 552 553 554 555
                january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
                february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
                march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
                april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
                may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
                june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
                july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
                august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
                september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
                october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
                november: i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
                december: i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
                total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
556 557 558 559
            })
        })
        // console.log(JSON.stringify(data))
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
560
            "outlook_pa_id": this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
561 562 563 564 565 566
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "balance_sheet": data,
            "status": "submitted"
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
567
        api.create().validateSubmitReportOLPA(payload).then((response) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
568
            // console.log(response)
faisalhamdi's avatar
faisalhamdi committed
569 570 571 572 573 574 575
            // console.log(response.data.data.result)
            // console.log(err);
            if (response.data) {
                if (response.data.status === "success") {
                    if (response.data.data.result && err === false) {
                        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
                        if (kansas == 0) {
faisalhamdi's avatar
faisalhamdi committed
576
                            this.setState({ kansas: 1, loading: true }, () => {
faisalhamdi's avatar
faisalhamdi committed
577 578 579
                                this.handleValidate()
                            })
                        } else {
faisalhamdi's avatar
faisalhamdi committed
580
                            this.setState({ kansas: 0 })
faisalhamdi's avatar
faisalhamdi committed
581 582 583 584
                        }
                    } else {
                        this.setState({ loading: false, buttonError: true, editable: true, saveDraft: true })
                        if (kansas == 0) {
faisalhamdi's avatar
faisalhamdi committed
585
                            this.setState({ kansas: 1, loading: true }, () => {
faisalhamdi's avatar
faisalhamdi committed
586 587 588
                                this.handleValidate()
                            })
                        } else {
faisalhamdi's avatar
faisalhamdi committed
589
                            this.setState({ kansas: 0 })
faisalhamdi's avatar
faisalhamdi committed
590 591 592 593
                        }
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
594
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
595 596 597 598 599 600 601
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
602
            } else {
faisalhamdi's avatar
faisalhamdi committed
603
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
604 605 606 607 608 609 610 611 612 613 614
            }
        })
    }

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

    render() {
        let dataTable2 = this.state.dataTable
        const handleChange = (value, tableMeta, type) => {
faisalhamdi's avatar
faisalhamdi committed
615
            console.log(dataTable2);
Deni Rinaldi's avatar
Deni Rinaldi committed
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630
            let val = String(value).split(",").join("")
            if (type === "actual") {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
            } else {
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
                    // console.log(indexParent)
                    let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)) : (jagain + Number(val))
                } else {
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                }
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
631

Deni Rinaldi's avatar
Deni Rinaldi committed
632 633 634 635
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] === item[2]) {
Deni Rinaldi's avatar
Deni Rinaldi committed
636 637
                    let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex])
                    total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal
Deni Rinaldi's avatar
Deni Rinaldi committed
638 639 640 641 642 643 644
                }
            })
            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
        }
idlanirined's avatar
idlanirined committed
645

Deni Rinaldi's avatar
Deni Rinaldi committed
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662

        const handleValueFormula = (value, tableMeta, column, periode, forecast) => {
            let splitFormula = String(tableMeta.rowData[3]).split('@')
            let baru = []
            let anjay = []
            splitFormula.map((item, index) => {
                let items = String(item).substr(Number(String(item).length) - 1, 1)
                let re = /^[a-zA-Z0-9]+$/;
                let asd = ''
                if (item !== "") {
                    if (!re.test(items)) {
                        if (String(item).substr(Number(String(item).length) - 1, 1) === ']') {
                            baru.push(String(item))
                        } else {
                            baru.push(String(item).substr(0, Number(String(item).length) - 1))
                            baru.push(String(item).substr(Number(String(item).length) - 1, 1))
                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
663
                    } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
664
                        baru.push(String(item))
Deni Rinaldi's avatar
Deni Rinaldi committed
665 666 667 668
                    }
                }
            })

Deni Rinaldi's avatar
Deni Rinaldi committed
669 670 671
            baru.map((item, index) => {
                if (item == '-' || item == '+' || item == '/' || item == '*') {
                    anjay.push(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
672
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
                    if (String(item).includes('#')) {
                        if (forecast !== undefined) {
                            let forecastt = 0
                            forecast.map((items, index) => {
                                if (items.periode == periode) {
                                    forecastt += Number(items.value)
                                }
                            })
                            anjay.push(forecastt)
                        } else if (String(item).includes('[M-1]')) {
                            let tst = String(item).replace('[M-1]', '')
                            let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
                            let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
                            // console.log(tableMeta.columnIndex)
                            let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
                            // console.log(indexID)
                            if (indexID !== -1) {
                                let valuezz = tableMeta.rowData[data].formula[indexID].value
                                // baru.push(valuezz)
                                anjay.push(valuezz == "" ? 0 : valuezz)
                                // console.log(valuezz)
                            }
d.arizona's avatar
d.arizona committed
695 696 697 698 699 700 701 702 703 704
                        } else {
                            // console.log(baru);
                            // console.log(value);
                            let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
                            // console.log(indexID)
                            if (indexID !== -1) {
                                // console.log(value.formula[indexID].value)
                                let valuezz = value.formula[indexID].value
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
                        }
                    } else if (String(item).includes('[M-1]')) {
                        let tst = String(item).replace('[M-1]', '')
                        if (tableMeta.columnIndex === 7 || tableMeta.columnIndex === 19) {
                            let indexID = dataTable2.findIndex((val) => val[20] == tst)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[indexID][6]
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        } else {
                            let data = tableMeta.columnIndex - 1
                            let indexID = dataTable2.findIndex((val) => val[20] == tst)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[indexID][data].value !== undefined ? dataTable2[indexID][data].value : dataTable2[indexID][data]
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                            // console.log(tst, data, tableMeta.rowData[data]);
                        }
                    } else {
                        let indexID = dataTable2.findIndex((val) => val[20] == item)
                        // console.log(dataTable2[indexID])
                        if (indexID !== -1) {
                            let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
                            anjay.push(valuezz == "" ? 0 : valuezz)
                        } else {
                            if (item === '(-1)') {
                                anjay.push(-1)
                            }
                            // console.log(item);

                        }
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
737 738
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
739 740
            // console.log(baru)
            // console.log(anjay)
d.arizona's avatar
d.arizona committed
741 742 743 744 745
            // if (tableMeta.rowData[5] == 'Profit (loss) MTD') {
            //     console.log(splitFormula)
            //     console.log(baru)
            //     console.log(anjay)
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
746 747
            let total = 0
            let opt = ""
Deni Rinaldi's avatar
Deni Rinaldi committed
748
            anjay.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
749 750 751 752 753 754 755 756 757
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
758
                    item = item == "" ? 0 : item
Deni Rinaldi's avatar
Deni Rinaldi committed
759 760 761 762 763 764 765
                    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") {
Deni Rinaldi's avatar
Deni Rinaldi committed
766
                        total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
767
                    } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
768
                        total += Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
769 770 771
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
772 773 774 775 776 777 778 779 780 781 782 783 784 785
            total = R.equals(total, NaN) ? "0.0" : total

            if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
                // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            } else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
            }

            return total
        }

        const handleValidation = (data, tableMeta) => {
            let a = handleValueFormula(data, tableMeta)
Deni Rinaldi's avatar
Deni Rinaldi committed
786 787 788
            return a
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
789 790 791 792 793 794 795
        const handleForecast = (tableMeta, periode, column) => {
            let total = 0
            total = handleValueFormula(dataTable2[tableMeta.rowIndex][column], tableMeta, column, periode, dataTable2[tableMeta.rowIndex][23])
            // console.log(total)
            return total
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859
        const columns = [{
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "Account",
            options: {
                customHeadRender: (columnMeta) => (
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style }),
                customBodyRender: (val, tableMeta) => {
                    return (
                        <div style={{ width: 300 }}>
                            {tableMeta.rowData[4] == 0 ?
                                <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                :
                                <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                    <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                </div>
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `31 Dec ${Number(this.props.periode) - 1} Actual`,
            options: {
                customHeadRender: (columnMeta) => (
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 4 ?
                                null
                                : tableMeta.rowData[0] === 1 ?
                                    null :
idlanirined's avatar
idlanirined committed
860 861 862 863 864 865 866 867 868 869 870
                                    // <div style={{ flex: 1 }}>
                                    //     <FormControlLabel
                                    //         style={{ margin: 0 }}
                                    //         value={value}
                                    //         control={
                                    //             <NumberFormat
                                    //                 thousandSeparator={true}
                                    //                 style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                    //                 type="text"
                                    //                 placeholder=""
                                    //                 disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
871
                                    //                 value={Number(value).toFixed(1)}
idlanirined's avatar
idlanirined committed
872 873 874 875
                                    //             />
                                    //         }
                                    //     />
                                    // </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
876 877 878 879 880 881 882
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
883
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
Deni Rinaldi's avatar
Deni Rinaldi committed
884 885
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
886 887
                                                    disabled={true}
                                                    // disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
888
                                                    value={Number(value).toFixed(1)}
idlanirined's avatar
idlanirined committed
889 890 891 892
                                                    onBlur={(event) => {
                                                        handleChange(event.target.value, tableMeta)
                                                        // console.log(dataTable2)
                                                    }}
Deni Rinaldi's avatar
Deni Rinaldi committed
893 894 895 896 897 898 899 900 901 902 903 904 905
                                                />
                                            }
                                        />
                                    </div>
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Jan ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
906
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
907 908 909 910 911 912 913
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
914 915 916 917 918 919 920 921 922 923
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
924
                                    />
faisalhamdi's avatar
faisalhamdi committed
925
                                    :
idlanirined's avatar
idlanirined committed
926 927 928 929 930 931 932
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
933
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
934 935
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
936
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
937
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
938
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
939 940
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
941
                                        />
idlanirined's avatar
idlanirined committed
942
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
943 944 945 946 947 948 949 950 951
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Feb ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
952
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
953 954 955 956 957 958 959
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
960 961 962 963 964 965 966 967 968 969
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
970
                                    />
faisalhamdi's avatar
faisalhamdi committed
971
                                    :
idlanirined's avatar
idlanirined committed
972 973 974 975 976 977 978
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
979
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
980 981
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
982
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
983
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
984
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
985 986
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
987
                                        />
idlanirined's avatar
idlanirined committed
988
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
989 990 991 992 993 994 995 996 997
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Mar ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
998
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
999 1000 1001 1002 1003 1004 1005
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1016
                                    />
faisalhamdi's avatar
faisalhamdi committed
1017
                                    :
idlanirined's avatar
idlanirined committed
1018 1019 1020 1021 1022 1023 1024
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1025
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1026 1027
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1028
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1029
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1030
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1031 1032
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1033
                                        />
idlanirined's avatar
idlanirined committed
1034
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1035 1036 1037 1038 1039 1040 1041 1042 1043
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Apr ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1044
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1045 1046 1047 1048 1049 1050 1051
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1062
                                    />
faisalhamdi's avatar
faisalhamdi committed
1063
                                    :
idlanirined's avatar
idlanirined committed
1064 1065 1066 1067 1068 1069 1070
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1071
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1072 1073
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1074
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1075
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1076
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1077 1078
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1079
                                        />
idlanirined's avatar
idlanirined committed
1080
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1081 1082 1083 1084 1085 1086 1087 1088 1089
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `May ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1090
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1091 1092 1093 1094 1095 1096 1097
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1108
                                    />
faisalhamdi's avatar
faisalhamdi committed
1109
                                    :
idlanirined's avatar
idlanirined committed
1110 1111 1112 1113 1114 1115 1116
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1117
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1118 1119
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1120
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1121
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1122
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1123 1124
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1125
                                        />
idlanirined's avatar
idlanirined committed
1126
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1127 1128 1129 1130 1131 1132 1133 1134 1135
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Jun ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1136
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1137 1138 1139 1140 1141 1142 1143
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1154
                                    />
faisalhamdi's avatar
faisalhamdi committed
1155
                                    :
idlanirined's avatar
idlanirined committed
1156 1157 1158 1159 1160 1161 1162
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1163
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1164 1165
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1166
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1167
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1168
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1169 1170
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1171
                                        />
idlanirined's avatar
idlanirined committed
1172
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1173 1174 1175 1176 1177 1178 1179 1180 1181
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Jul ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1182
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1183 1184 1185 1186 1187 1188 1189
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1190 1191 1192 1193 1194 1195 1196 1197 1198 1199
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1200
                                    />
faisalhamdi's avatar
faisalhamdi committed
1201
                                    :
idlanirined's avatar
idlanirined committed
1202 1203 1204 1205 1206 1207 1208
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1209
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1210 1211
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1212
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1213
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1214
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1215 1216
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1217
                                        />
idlanirined's avatar
idlanirined committed
1218
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1219 1220 1221 1222 1223 1224 1225 1226 1227
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Aug ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1228
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1229 1230 1231 1232 1233 1234 1235
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1246
                                    />
faisalhamdi's avatar
faisalhamdi committed
1247
                                    :
idlanirined's avatar
idlanirined committed
1248 1249 1250 1251 1252 1253 1254
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1255
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1256 1257
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1258
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1259
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1260
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1261 1262
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1263
                                        />
idlanirined's avatar
idlanirined committed
1264
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1265 1266 1267 1268 1269 1270 1271 1272 1273
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Sep ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1274
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1275 1276 1277 1278 1279 1280 1281
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1292
                                    />
faisalhamdi's avatar
faisalhamdi committed
1293
                                    :
idlanirined's avatar
idlanirined committed
1294 1295 1296 1297 1298 1299 1300
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1301
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1302 1303
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1304
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1305
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1306
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1307 1308
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1309
                                        />
idlanirined's avatar
idlanirined committed
1310
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1311 1312 1313 1314 1315 1316 1317 1318 1319
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Oct ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1320
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1321 1322 1323 1324 1325 1326 1327
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1338
                                    />
faisalhamdi's avatar
faisalhamdi committed
1339
                                    :
idlanirined's avatar
idlanirined committed
1340 1341 1342 1343 1344 1345 1346
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1347
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1348 1349
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1350
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1351
                                                    value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1352
                                                    decimalScale={1}
idlanirined's avatar
idlanirined committed
1353 1354
                                                />
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1355
                                        />
idlanirined's avatar
idlanirined committed
1356
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1357 1358 1359 1360 1361 1362 1363 1364 1365
                            }
                        </div>
                    )
                }
            }
        }, {
            name: `Nov ${this.props.periode}`,
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1366
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1367 1368 1369 1370 1371 1372 1373
                        <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' }}>
faisalhamdi's avatar
faisalhamdi committed
1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null
                                :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1385 1386
                                    />
                                    :
faisalhamdi's avatar
faisalhamdi committed
1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
                                                        value={Number(value).toFixed(1)}
                                                        onBlur={(event) => {
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1406
                                            />
faisalhamdi's avatar
faisalhamdi committed
1407 1408 1409
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
idlanirined's avatar
idlanirined committed
1410 1411
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1412
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1413 1414
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1415
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1416
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
idlanirined's avatar
idlanirined committed
1417
                                                />
faisalhamdi's avatar
faisalhamdi committed
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                    />
                                                    :
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1442
                                                        :
faisalhamdi's avatar
faisalhamdi committed
1443 1444 1445 1446
                                                        tableMeta.rowData[0] === 1 ?
                                                            null
                                                            :
                                                            tableMeta.rowData[0] === 7 ?
faisalhamdi's avatar
faisalhamdi committed
1447
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
faisalhamdi's avatar
faisalhamdi committed
1448 1449 1450 1451 1452 1453 1454 1455
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
faisalhamdi's avatar
faisalhamdi committed
1456
                                                                            backgroundColor: 'transparent'
faisalhamdi's avatar
faisalhamdi committed
1457 1458 1459 1460 1461
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
faisalhamdi's avatar
faisalhamdi committed
1481 1482
                                                                :
                                                                null
faisalhamdi's avatar
faisalhamdi committed
1483
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1484 1485 1486 1487 1488
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1489
            name: `Dec ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1490 1491
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1492 1493
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
1494 1495 1496 1497 1498 1499
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null
                                :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1511
                                    />
faisalhamdi's avatar
faisalhamdi committed
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
                                                        value={Number(value).toFixed(1)}
                                                        onBlur={(event) => {
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
                                            />
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
idlanirined's avatar
idlanirined committed
1536 1537
                                                <NumberFormat
                                                    thousandSeparator={true}
faisalhamdi's avatar
faisalhamdi committed
1538
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
idlanirined's avatar
idlanirined committed
1539 1540
                                                    type="text"
                                                    placeholder=""
faisalhamdi's avatar
faisalhamdi committed
1541
                                                    disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1542
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
idlanirined's avatar
idlanirined committed
1543
                                                />
faisalhamdi's avatar
faisalhamdi committed
1544
                                            </span>
Deni Rinaldi's avatar
Deni Rinaldi committed
1545
                                            :
faisalhamdi's avatar
faisalhamdi committed
1546 1547
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1548
                                                :
faisalhamdi's avatar
faisalhamdi committed
1549 1550 1551 1552 1553 1554 1555 1556 1557
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
1558
                                                    :
faisalhamdi's avatar
faisalhamdi committed
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                        />
                                                        :
                                                        tableMeta.rowData[0] === 1 ?
                                                            null
                                                            :
                                                            tableMeta.rowData[0] === 7 ?
faisalhamdi's avatar
faisalhamdi committed
1573
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
faisalhamdi's avatar
faisalhamdi committed
1574 1575 1576 1577 1578 1579 1580 1581
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
faisalhamdi's avatar
faisalhamdi committed
1582
                                                                            backgroundColor: 'transparent'
Faisal Hamdi's avatar
Faisal Hamdi committed
1583
                                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1584 1585 1586 1587
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
faisalhamdi's avatar
faisalhamdi committed
1607 1608 1609 1610 1611 1612 1613 1614
                                                                :
                                                                null
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1615
            name: `31 Dec ${this.props.periode} Total`,
faisalhamdi's avatar
faisalhamdi committed
1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660
            options: {
                customHeadRender: (columnMeta) => (
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                null
                                :
                                this.state.get_for == 'view' ?
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(value).toFixed(1)}
                                    />
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
                                                        value={Number(value).toFixed(1)}
                                                        onBlur={(event) => {
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
                                            />
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
faisalhamdi's avatar
faisalhamdi committed
1661 1662 1663 1664 1665 1666 1667 1668
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1669
                                                />
faisalhamdi's avatar
faisalhamdi committed
1670
                                            </span>
faisalhamdi's avatar
faisalhamdi committed
1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1682
                                                        value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1683 1684 1685 1686 1687 1688 1689 1690 1691
                                                    />
                                                    :
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
1692
                                                            value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1693
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1694
                                                        :
faisalhamdi's avatar
faisalhamdi committed
1695 1696 1697 1698
                                                        tableMeta.rowData[0] === 1 ?
                                                            null
                                                            :
                                                            tableMeta.rowData[0] === 7 ?
faisalhamdi's avatar
faisalhamdi committed
1699
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
faisalhamdi's avatar
faisalhamdi committed
1700 1701 1702 1703 1704 1705 1706 1707
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
faisalhamdi's avatar
faisalhamdi committed
1708
                                                                            backgroundColor: 'transparent'
faisalhamdi's avatar
faisalhamdi committed
1709 1710 1711 1712 1713
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
faisalhamdi's avatar
faisalhamdi committed
1733 1734
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1735 1736 1737 1738 1739
                            }
                        </div>
                    )
                }
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751
        },
        {
            name: "",
            options: {
                display: false
            }
        },
        {
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767
        }]

        const loadingComponent = (
            <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );

        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
faisalhamdi's avatar
faisalhamdi committed
1768
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Outlook Performance Appraisal Submission</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789
                </div>
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                {/* {this.state.loading && loadingComponent} */}
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
                    {this.state.visibleBalanceSheet === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Outlook Performance Appraisal - Balance Sheet</Typography>
                            </div>
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
faisalhamdi's avatar
faisalhamdi committed
1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812
                                        {/* {this.props.isApprover == true || this.state.dataTable.length == 0 ? null : */}
                                        {this.props.isApprover == true || this.state.get_for == 'view' ?
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                <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="template" place="bottom" type="light" effect="solid" />
                                            </div> :
Deni Rinaldi's avatar
Deni Rinaldi committed
1813
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
faisalhamdi's avatar
faisalhamdi committed
1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841
                                                <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 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" />
Deni Rinaldi's avatar
Deni Rinaldi committed
1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875
                                                <a data-tip={'Download'} data-for="download">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                            </div>
                                        }
                                    </div>
                                </div>

                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                    {this.state.loading && loadingComponent}
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
                                </div>
Riri Novita's avatar
Riri Novita committed
1876 1877 1878 1879 1880 1881 1882 1883 1884
                                <div style={{ display: 'flex' }}>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                    <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                        {
                                            this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
faisalhamdi's avatar
faisalhamdi committed
1885
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
1886 1887 1888
                                        }
                                    </div>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
1889
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notes}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907
                            </div>
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none'
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
faisalhamdi's avatar
faisalhamdi committed
1908
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
1909 1910 1911
                                        </div>
                                    </button>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
1912 1913
                                {this.props.isApprover === true ?
                                    <div className="col-2">
faisalhamdi's avatar
faisalhamdi committed
1914
                                    </div> :
faisalhamdi's avatar
faisalhamdi committed
1915
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Riri Novita's avatar
Riri Novita committed
1916
                                        {this.state.get_for == 'view' && this.state.viewOnly && <button
faisalhamdi's avatar
faisalhamdi committed
1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true, refresh: true }, () => {
                                                    this.handleGetFor('edit')
                                                })
                                            }}
                                        >
                                            <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' }}>Edit</Typography>
                                            </div>
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
faisalhamdi's avatar
faisalhamdi committed
1947
                                                this.setState({ loading: true, dataTable: dataTable2 }, () => {
faisalhamdi's avatar
faisalhamdi committed
1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968
                                                    setTimeout(() => {
                                                        this.handleValidate()
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
faisalhamdi's avatar
faisalhamdi committed
1969 1970 1971 1972 1973 1974 1975
                                                this.state.saveDraft ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1, loading: true }, () => {
                                                            this.backToOLPA('draft')
                                                        })
faisalhamdi's avatar
faisalhamdi committed
1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
                                            }
                                        >
                                            <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>}
                                        {this.state.get_for == 'edit' && <button
                                            type="button"
                                            disabled={this.state.buttonError}
                                            onClick={() => this.state.buttonError ?
                                                this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                :
                                                this.state.handleTekTekTek == 1 ? null :
                                                    this.setState({ handleTekTekTek: 1 }, () => {
                                                        this.backToOLPA('submitted')
                                                    })}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>}
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041
                                }
                            </div>
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    {this.state.dataLoaded && (
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
                                            </MuiThemeProvider>
                                        </div>
                                    )}
                                </div>

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visibleBalanceSheet: true }, () => {
                                                setTimeout(() => {
                                                    this.getItemHierarki()
                                                }, 100);
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
faisalhamdi's avatar
faisalhamdi committed
2042
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155
                                            </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(() => {
                                                        this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
                                                this.state.editable === true ?
                                                    null :
                                                    this.setState({ loading: true }, () =>
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('draft')
                                                                }, 100);
                                                            })
                                                    )
                                            }
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
                                            onClick={() =>
                                                this.state.editable === true ?
                                                    null :
                                                    this.setState({ loading: true }, () =>
                                                        this.state.handleTekTekTek == 1 ? null :
                                                            this.setState({ handleTekTekTek: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('submitted')
                                                                }, 100);
                                                            })
                                                    )
                                            }
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </Paper>}
                </div>

                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
                                    </div>
                                </div>
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
                            </div>
                            <UploadFile
                                type={this.state.uploadStatus}
                                percentage={this.state.percentage}
                                result={this.state.result}
                                acceptedFiles={["xlsx"]}
                                onHandle={(dt) => {
                                    this.fileHandler(dt)
                                    this.setState({ uploadStatus: 'idle', percentage: '0' })
                                }}
                                onUpload={() => {
r.kurnia's avatar
r.kurnia committed
2156
                                    String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
                        </div>
                    </div>
                )}
            </div>
        )
    }
}