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

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

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

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

export default class FixedAssetsMovement extends Component {
faisalhamdi's avatar
faisalhamdi committed
41 42 43
    constructor(props) {
        super(props)
        this.state = {
faisalhamdi's avatar
faisalhamdi committed
44
            dataTable: [],
faisalhamdi's avatar
faisalhamdi committed
45
            visibleFixedAssetsMovement: true,
faisalhamdi's avatar
faisalhamdi committed
46 47 48
            disabledSave: true,
            editable: false,
            buttonError: false,
faisalhamdi's avatar
faisalhamdi committed
49
            judulColumn: null,
Riri Novita's avatar
Riri Novita committed
50
            updateBy: [],
Riri Novita's avatar
Riri Novita committed
51 52
            handleDoubleClick: 0,
            defaultCurrencyUpload: this.props.defaultCurrency,
Riri Novita's avatar
Riri Novita committed
53 54
            visibleAlertSave: false,
            visibleButtonUpload: false
faisalhamdi's avatar
faisalhamdi committed
55
        }
faisalhamdi's avatar
faisalhamdi committed
56
        this.handleValue = this.handleValue.bind(this)
faisalhamdi's avatar
faisalhamdi committed
57
        this.fileHandler = this.fileHandler.bind(this);
58
        this.fileHandlerSimulasi = this.fileHandlerSimulasi.bind(this);
faisalhamdi's avatar
faisalhamdi committed
59 60 61
    }

    componentDidMount() {
faisalhamdi's avatar
faisalhamdi committed
62
        this.getItemHierarki()
faisalhamdi's avatar
faisalhamdi committed
63
        this.getLatestUpdate()
faisalhamdi's avatar
faisalhamdi committed
64 65
    }

faisalhamdi's avatar
faisalhamdi committed
66 67 68 69 70 71
    getLatestUpdate() {
        let payload = {
            "report_id": this.props.report_id,
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
            "company_id": this.props.company.company_id,
Riri Novita's avatar
Riri Novita committed
72 73
            "submission_id": this.props.submissionID,
            "currency_id": this.props.defaultCurrency.id
faisalhamdi's avatar
faisalhamdi committed
74 75 76 77 78
        }
        api.create().getLastestUpdateMB(payload).then(response => {
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
79
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail
faisalhamdi's avatar
faisalhamdi committed
80
                    })
faisalhamdi's avatar
faisalhamdi committed
81 82
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, typeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
83
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
84 85 86 87 88 89
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
faisalhamdi's avatar
faisalhamdi committed
90
                }
faisalhamdi's avatar
faisalhamdi committed
91 92
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
faisalhamdi's avatar
faisalhamdi committed
93 94 95 96
            }
        })
    }

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

    handleValue(data) {
        let total = 0
        this.state.dataTable.map((item, index) => {
            if (data.rowData[1] == item[2]) {
faisalhamdi's avatar
faisalhamdi committed
214
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
faisalhamdi's avatar
faisalhamdi committed
215 216 217 218
            }
        })
        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
d.arizona's avatar
d.arizona committed
219
        // // console.log(indexParent);
faisalhamdi's avatar
faisalhamdi committed
220 221 222
        return a
    }

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

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

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

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

343 344 345 346 347 348 349 350 351 352 353 354 355 356 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 387 388 389 390 391
    fileHandlerSimulasi = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // // console.log(resp)
            if (err) {
                // console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
                // // console.log(resp.rows[2]);
                let payload = []
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
                            total_actual_before: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
                            january: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
                            february: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            march: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            april: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            may: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            june: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            july: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            august: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            september: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            october: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            november: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            december: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            total_current_year: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            total_next_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
                            total_more_year: i[17] === undefined ? "0" : reg.test(String(i[17])) === false ? "0" : String(i[17]).trim()
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    fixed_asset_movement: payload,
                    status: 'submitted'
                }
                // // console.log(body)
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
            }
        });
    }

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

Riri Novita's avatar
Riri Novita committed
462
    checkUploadSimulasi() {
463 464 465 466
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
Riri Novita's avatar
Riri Novita committed
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565
        api.create().checkUploadMB(payload).then(response => {
            // // console.log(JSON.stringify(this.state.payload));
            // // console.log(response)
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === 'success') {
                        this.setState({ visibleUpload: false, visibleFixedAssetsMovement: false, loading: true, visibleButtonUpload: true })
                        let dataTable = response.data.data.map((item, index) => {
                            return [
                                item.type_report_id,
                                item.item_report_id,
                                item.parent,
                                item.formula,
                                item.level,
                                item.item_report,
                                item.total_actual_before,
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.january, formula: item.january_formula } : Number(item.january).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.february, formula: item.february_formula } : Number(item.february).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.march, formula: item.march_formula } : Number(item.march).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.april, formula: item.april_formula } : Number(item.april).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.may, formula: item.may_formula } : Number(item.may).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.june, formula: item.june_formula } : Number(item.june).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.july, formula: item.july_formula } : Number(item.july).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.august, formula: item.august_formula } : Number(item.august).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.september, formula: item.september_formula } : Number(item.september).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1),
                                item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1),
                                Number(item.total_current_year).toFixed(1),
                                Number(item.total_next_year).toFixed(1),
                                Number(item.total_more_year).toFixed(1),
                                item.orders,
                                item.forecast_formula,
                                item.before_formula,
                                item.error
                            ]
                        })
                        this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
                            this.state.dataTable.map(item => {
                                if (item[24].length > 0) {
                                    // // console.log('masuk')
                                    this.setState({ buttonError: true, errorPreview: true, editable: true })
                                }
                            })
                            // // console.log(this.state.dataTable);
                        })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
            }
        })
    }

    uploadSimulasi(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value).toFixed(1)) : String(Number(i[7]).toFixed(1)),
                february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value).toFixed(1)) : String(Number(i[8]).toFixed(1)),
                march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value).toFixed(1)) : String(Number(i[9]).toFixed(1)),
                april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value).toFixed(1)) : String(Number(i[10]).toFixed(1)),
                may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value).toFixed(1)) : String(Number(i[11]).toFixed(1)),
                june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value).toFixed(1)) : String(Number(i[12]).toFixed(1)),
                july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)),
                august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)),
                september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)),
                october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)),
                november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)),
                december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)),
                total_current_year: String(Number(i[19]).toFixed(1)),
                total_next_year: String(Number(i[20]).toFixed(1)),
                total_more_year: String(Number(i[21]).toFixed(1))
            })
        })
        let body = {
            submission_id: this.props.submissionID,
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
            currency_id: this.state.defaultCurrencyUpload?.id,
            fixed_asset_movement: data,
            status: type
        }
        console.log(body)
        api.create().uploadSimulasiMB(body).then(response => {
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583
            console.log(response)
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === "success") {
                        this.props.onClickClose()
                        this.props.getReport('FAM')
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
                }
            } else {
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
            }
        })
    }

faisalhamdi's avatar
faisalhamdi committed
584
    uploadFAM(type) {
Riri Novita's avatar
Riri Novita committed
585
        console.log("masuk ga?");
faisalhamdi's avatar
faisalhamdi committed
586 587 588 589
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value).toFixed(1)) : String(Number(i[7]).toFixed(1)),
                february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value).toFixed(1)) : String(Number(i[8]).toFixed(1)),
                march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value).toFixed(1)) : String(Number(i[9]).toFixed(1)),
                april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value).toFixed(1)) : String(Number(i[10]).toFixed(1)),
                may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value).toFixed(1)) : String(Number(i[11]).toFixed(1)),
                june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value).toFixed(1)) : String(Number(i[12]).toFixed(1)),
                july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)),
                august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)),
                september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)),
                october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)),
                november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)),
                december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)),
                total_current_year: String(Number(i[19]).toFixed(1)),
                total_next_year: String(Number(i[20]).toFixed(1)),
                total_more_year: String(Number(i[21]).toFixed(1))
faisalhamdi's avatar
faisalhamdi committed
606 607 608
            })
        })
        let body = {
faisalhamdi's avatar
faisalhamdi committed
609
            submission_id: this.props.submissionID,
faisalhamdi's avatar
faisalhamdi committed
610 611 612
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
Riri Novita's avatar
Riri Novita committed
613
            currency_id: this.state.defaultCurrencyUpload?.id,
faisalhamdi's avatar
faisalhamdi committed
614 615
            fixed_asset_movement: data,
            status: type
faisalhamdi's avatar
faisalhamdi committed
616
        }
d.arizona's avatar
d.arizona committed
617
        // // console.log(JSON.stringify(body));
faisalhamdi's avatar
faisalhamdi committed
618
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
Riri Novita's avatar
Riri Novita committed
619
            console.log(response);
faisalhamdi's avatar
faisalhamdi committed
620
            if (response.data) {
faisalhamdi's avatar
faisalhamdi committed
621 622 623
                if (response.ok) {
                    if (response.data.status === "success") {
                        this.props.onClickClose()
d.arizona's avatar
d.arizona committed
624 625 626 627 628
                        if (type == 'submitted') {
                            this.props.getReport('FAM')
                        } else {
                            this.props.getReport()
                        }
faisalhamdi's avatar
faisalhamdi committed
629
                    } else {
630
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
631
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
632 633 634 635 636 637 638
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
faisalhamdi's avatar
faisalhamdi committed
639
                } else {
faisalhamdi's avatar
faisalhamdi committed
640
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
faisalhamdi's avatar
faisalhamdi committed
641 642
                }
            } else {
faisalhamdi's avatar
faisalhamdi committed
643 644
                // this.setState({ loading: false })
                // alert(response.problem)
d.arizona's avatar
d.arizona committed
645
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
faisalhamdi's avatar
faisalhamdi committed
646 647 648 649
            }
        })
    }

faisalhamdi's avatar
faisalhamdi committed
650
    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
651
        // let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
d.arizona's avatar
d.arizona committed
652
        // // console.log(url);
faisalhamdi's avatar
faisalhamdi committed
653 654
        let resReal = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=${this.props.submissionID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
        let resNull = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/export_master_budget?submission_id=&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
faisalhamdi's avatar
faisalhamdi committed
655
        let res = await fetch(
d.arizona's avatar
d.arizona committed
656
            this.props.submissionID == null ? resNull : resReal
faisalhamdi's avatar
faisalhamdi committed
657 658 659 660 661 662 663
        )
        res = await res.blob()
        this.setState({ loading: false })
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
faisalhamdi's avatar
faisalhamdi committed
664
            a.download = 'Master Budget Fixed Assets Movement.xlsx';
faisalhamdi's avatar
faisalhamdi committed
665 666 667 668
            a.click();
        }
    }

faisalhamdi's avatar
faisalhamdi committed
669 670
    handleValidate() {
        let data = []
d.arizona's avatar
d.arizona committed
671
        // // console.log(this.state.dataTable)
faisalhamdi's avatar
faisalhamdi committed
672 673 674 675
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
                total_actual_before: String(i[6]),
Deni Rinaldi's avatar
Deni Rinaldi committed
676 677 678 679 680 681 682 683 684 685 686 687
                january: i[0] === 3 && i[7] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[7].value) : String(i[7]),
                february: i[0] === 3 && i[8] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[8].value) : String(i[8]),
                march: i[0] === 3 && i[9] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[9].value) : String(i[9]),
                april: i[0] === 3 && i[10] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[10].value) : String(i[10]),
                may: i[0] === 3 && i[11] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[11].value) : String(i[11]),
                june: i[0] === 3 && i[12] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[12].value) : String(i[12]),
                july: i[0] === 3 && i[13] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[13].value) : String(i[13]),
                august: i[0] === 3 && i[14] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[14].value) : String(i[14]),
                september: i[0] === 3 && i[15] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[15].value) : String(i[15]),
                october: i[0] === 3 && i[16] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[16].value) : String(i[16]),
                november: i[0] === 3 && i[17] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[17].value) : String(i[17]),
                december: i[0] === 3 && i[18] === "" ? "0" : i[0] === 5 || i[0] === 6 ? String(i[18].value) : String(i[18]),
faisalhamdi's avatar
faisalhamdi committed
688 689 690
                total_current_year: i[0] === 3 && i[19] === "" ? "0" : String(i[19]),
                total_next_year: i[0] === 3 && i[20] === "" ? "0" : String(i[20]),
                total_more_year: i[0] === 3 && i[21] === "" ? "0" : String(i[21])
faisalhamdi's avatar
faisalhamdi committed
691 692
            })
        })
d.arizona's avatar
d.arizona committed
693
        // // console.log(JSON.stringify(data))
faisalhamdi's avatar
faisalhamdi committed
694
        let payload = {
faisalhamdi's avatar
faisalhamdi committed
695 696 697 698
            "submission_id": this.props.submissionID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
Riri Novita's avatar
Riri Novita committed
699
            "currency_id": this.props.defaultCurrency.id,
faisalhamdi's avatar
faisalhamdi committed
700 701
            "fixed_asset_movement": data,
            "status": "submitted"
faisalhamdi's avatar
faisalhamdi committed
702
        }
Riri Novita's avatar
Riri Novita committed
703
        console.log(payload);
faisalhamdi's avatar
faisalhamdi committed
704
        api.create().validateSubmitReport(payload).then((response) => {
Riri Novita's avatar
Riri Novita committed
705
            console.log(response)
faisalhamdi's avatar
faisalhamdi committed
706
            if (response.data.data.result) {
faisalhamdi's avatar
faisalhamdi committed
707
                this.setState({ loading: false, buttonError: false, editable: false })
faisalhamdi's avatar
faisalhamdi committed
708 709 710 711 712 713
            } else {
                this.setState({ loading: false, buttonError: true, editable: true })
            }
        })
    }

faisalhamdi's avatar
faisalhamdi committed
714 715 716 717
    closeAlert() {
        this.setState({ alert: false })
    }

faisalhamdi's avatar
faisalhamdi committed
718
    render() {
faisalhamdi's avatar
faisalhamdi committed
719
        let dataTable2 = this.state.dataTable
Dida Adams Arizona's avatar
Dida Adams Arizona committed
720
        const handleValueFormula = (value, tableMeta, Bfr) => {
d.arizona's avatar
d.arizona committed
721 722 723
            let splitFormula = String(tableMeta.rowData[3]).split('@')
            let baru = []
            let anjay = []
Deni Rinaldi's avatar
Deni Rinaldi committed
724 725
            splitFormula.map((item, index) => {
                let items = String(item).substr(Number(String(item).length) - 1, 1)
d.arizona's avatar
d.arizona committed
726 727 728 729
                let re = /^[a-zA-Z0-9_]+$/;
                let asd = ''
                if (item !== "") {
                    if (!re.test(items)) {
Deni Rinaldi's avatar
Deni Rinaldi committed
730 731
                        baru.push(String(item).substr(0, Number(String(item).length) - 1))
                        baru.push(String(item).substr(Number(String(item).length) - 1, 1))
d.arizona's avatar
d.arizona committed
732 733 734 735 736 737
                    } else {
                        baru.push(String(item))
                    }
                }
            })

d.arizona's avatar
d.arizona committed
738
            // if (tableMeta.columnIndex == 18) {
d.arizona's avatar
d.arizona committed
739 740
            //     // console.log(splitFormula)
            //     // console.log(baru)
d.arizona's avatar
d.arizona committed
741
            // }
d.arizona's avatar
d.arizona committed
742 743 744
            // // console.log(baru)
            let tambahan = false
            let opet = ""
Deni Rinaldi's avatar
Deni Rinaldi committed
745
            baru.map((item, index) => {
d.arizona's avatar
d.arizona committed
746 747 748
                if (item == 'X') {
                    tambahan = true
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
d.arizona's avatar
d.arizona committed
749 750 751
                    anjay.push(item)
                } else {
                    if (String(item).includes('#')) {
Dida Adams Arizona's avatar
Dida Adams Arizona committed
752 753 754 755 756 757 758 759 760 761
                        if (Bfr !== undefined) {
                            let data = 24
                            let period = Number(this.props.periode) - 1
                            anjay.push(0)
                            let indexID = dataTable2[tableMeta.rowIndex][data].findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == period)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[tableMeta.rowIndex][data][indexID].value
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        } else if (String(item).includes('[M-1]')) {
d.arizona's avatar
d.arizona committed
762
                            let tst = String(item).replace('[M-1]', '')
Deni Rinaldi's avatar
Deni Rinaldi committed
763 764
                            let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
                            let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
d.arizona's avatar
d.arizona committed
765
                            let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
d.arizona's avatar
d.arizona committed
766
                            if (indexID !== -1) {
d.arizona's avatar
d.arizona committed
767
                                let valuezz = tableMeta.rowData[data].formula[indexID].value
Deni Rinaldi's avatar
Deni Rinaldi committed
768
                                anjay.push(valuezz == "" ? 0 : valuezz)
d.arizona's avatar
d.arizona committed
769 770
                            }
                        } else {
d.arizona's avatar
d.arizona committed
771
                            let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
d.arizona's avatar
d.arizona committed
772
                            // // console.log(indexID)
d.arizona's avatar
d.arizona committed
773
                            if (indexID !== -1) {
d.arizona's avatar
d.arizona committed
774
                                // // console.log(value.formula[indexID].value)
d.arizona's avatar
d.arizona committed
775
                                let valuezz = value.formula[indexID].value
Deni Rinaldi's avatar
Deni Rinaldi committed
776
                                anjay.push(valuezz == "" ? 0 : valuezz)
d.arizona's avatar
d.arizona committed
777 778 779
                            }
                        }
                    } else {
d.arizona's avatar
d.arizona committed
780
                        // // console.log(item)
d.arizona's avatar
d.arizona committed
781
                        let indexID = dataTable2.findIndex((val) => val[22] == item)
d.arizona's avatar
d.arizona committed
782 783 784 785 786 787
                        if (item == 'X-1') {
                            anjay.push(-1)
                        } else if (tambahan) {
                            if (item == '-' || item == '+' || item == '/' || item == '*') {
                                opet = item
                            } else {
qorri_di's avatar
qorri_di committed
788
                                anjay.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
d.arizona's avatar
d.arizona committed
789 790 791
                                tambahan = false
                                opet = ""
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
792
                        } else {
d.arizona's avatar
d.arizona committed
793 794 795 796 797 798 799 800
                            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
801
                            }
d.arizona's avatar
d.arizona committed
802 803 804 805
                        }
                    }
                }
            })
d.arizona's avatar
d.arizona committed
806 807
            // // console.log(baru)
            // // console.log(anjay)
d.arizona's avatar
d.arizona committed
808 809 810 811 812 813 814 815 816 817 818 819 820

            let total = 0
            let opt = ""
            anjay.map((item, index) => {
                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
821
                    item = item == "" ? 0 : item
d.arizona's avatar
d.arizona committed
822 823 824 825 826 827 828
                    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
829
                        total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
d.arizona's avatar
d.arizona committed
830 831 832 833 834
                    } else {
                        total += Number(item)
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
835
            total = R.equals(total, NaN) ? "0.0" : total
d.arizona's avatar
d.arizona committed
836
            // // console.log(dataTable2[tableMeta.rowIndex][22])
Deni Rinaldi's avatar
Deni Rinaldi committed
837
            // // console.log(tableMeta.rowData[5])
d.arizona's avatar
d.arizona committed
838
            // if (tableMeta.rowData[5] == 'Beginning Balance') {
Deni Rinaldi's avatar
Deni Rinaldi committed
839 840
            // console.log(baru)
            // console.log(anjay)
Deni Rinaldi's avatar
Deni Rinaldi committed
841
            // console.log(total)
d.arizona's avatar
d.arizona committed
842
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
843

d.arizona's avatar
d.arizona committed
844
            if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
d.arizona's avatar
d.arizona committed
845
                // // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
d.arizona's avatar
d.arizona committed
846 847 848 849 850 851 852 853
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            } else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
            }

            return total
        }

faisalhamdi's avatar
faisalhamdi committed
854
        const handleChange = (value, tableMeta, type) => {
faisalhamdi's avatar
faisalhamdi committed
855
            let val = String(value).split(",").join("")
faisalhamdi's avatar
faisalhamdi committed
856
            if (type === "actual") {
Deni Rinaldi's avatar
Deni Rinaldi committed
857
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
faisalhamdi's avatar
faisalhamdi committed
858
            } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
859
                let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[tableMeta.rowIndex][2])
faisalhamdi's avatar
faisalhamdi committed
860
                if (indexParent > 0) {
d.arizona's avatar
d.arizona committed
861
                    let a = 0
d.arizona's avatar
d.arizona committed
862
                    // // console.log(indexParent)
d.arizona's avatar
d.arizona committed
863 864 865 866 867
                    if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(val)
                    } else {
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                    }
faisalhamdi's avatar
faisalhamdi committed
868 869 870
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
                } else {
d.arizona's avatar
d.arizona committed
871 872 873 874 875 876
                    if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(val)
                    } else {
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                    }
                    // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
faisalhamdi's avatar
faisalhamdi committed
877
                }
faisalhamdi's avatar
faisalhamdi committed
878 879
            }
        }
d.arizona's avatar
d.arizona committed
880
        const handleForecast = (tableMeta, periode) => {
d.arizona's avatar
d.arizona committed
881
            let total = 0
d.arizona's avatar
d.arizona committed
882
            if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'gain/ (loss) on fixed assets' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance' || String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
d.arizona's avatar
d.arizona committed
883
                if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
qorri_di's avatar
qorri_di committed
884
                    let indexID = dataTable2.findIndex((val, index) => String(val[5]).toLocaleLowerCase() == 'ending balance' && dataTable2[index - 1][2] == tableMeta.rowData[2])
d.arizona's avatar
d.arizona committed
885
                    if (indexID !== -1) {
d.arizona's avatar
d.arizona committed
886
                        // console.log(dataTable2)
qorri_di's avatar
qorri_di committed
887
                        total = tableMeta.columnIndex == 21 ? dataTable2[indexID][20] : dataTable2[indexID][18].value
d.arizona's avatar
d.arizona committed
888 889 890 891 892 893
                    }
                } else {
                    let indexID = dataTable2[tableMeta.rowIndex][23].findIndex((val) => val.periode == periode)
                    if (indexID !== -1) {
                        total = dataTable2[tableMeta.rowIndex][23][indexID].value
                    }
d.arizona's avatar
d.arizona committed
894 895
                }
            } else {
d.arizona's avatar
d.arizona committed
896
                total = handleValueFormula(tableMeta.columnIndex, tableMeta)
d.arizona's avatar
d.arizona committed
897
            }
d.arizona's avatar
d.arizona committed
898
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
d.arizona's avatar
d.arizona committed
899 900
            return total
        }
faisalhamdi's avatar
faisalhamdi committed
901 902
        const handleTotal = (tableMeta) => {
            let total = 0
qorri_di's avatar
qorri_di committed
903
            // console.log(tableMeta)            
faisalhamdi's avatar
faisalhamdi committed
904 905 906
            // if (tableMeta.rowData[5] == 'Beginning balance') {
            //     console.log(tableMeta.rowData)
            // }
d.arizona's avatar
d.arizona committed
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921
            if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'ending balance') {
                total = dataTable2[tableMeta.rowIndex][18].value
                dataTable2[tableMeta.rowIndex][19] = total
            } else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance') {
                total = dataTable2[tableMeta.rowIndex][7].value
                dataTable2[tableMeta.rowIndex][19] = total
            } else {
                dataTable2[tableMeta.rowIndex].map((item, index) => {
                    if (index >= 7 && index <= 18) {
                        let valItem = item.value == undefined ? item == undefined || item == "" ? 0 : item : item.value == "" ? 0 : item.value
                        total += Number(valItem)
                    }
                })
                dataTable2[tableMeta.rowIndex][19] = total
            }
faisalhamdi's avatar
faisalhamdi committed
922
            return total
d.arizona's avatar
d.arizona committed
923
            // // console.log(total);
faisalhamdi's avatar
faisalhamdi committed
924
        }
faisalhamdi's avatar
faisalhamdi committed
925 926 927 928 929 930 931 932 933
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] == item[2]) {
                    total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
d.arizona's avatar
d.arizona committed
934
            // // console.log(indexParent);
faisalhamdi's avatar
faisalhamdi committed
935 936
            return a
        }
Dida Adams Arizona's avatar
Dida Adams Arizona committed
937

qorri_di's avatar
qorri_di committed
938
        const handleBfr = (value, tableMeta) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
939
            let total = 0
Dida Adams Arizona's avatar
Dida Adams Arizona committed
940 941 942 943
            total = handleValueFormula(value, tableMeta, 'before')
            return total
        }

faisalhamdi's avatar
faisalhamdi committed
944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976
        const handleFormula = (data, tableMeta, month) => {
            let rilFormula = String(tableMeta.rowData[3])
            if (rilFormula.includes("#")) {
                if (this.props.status === "not-yet") {
                    let splitOrder = String(tableMeta.rowData[3]).split('@')
                    for (let index = 0; index < splitOrder.length; index++) {
                        if (splitOrder[index] === "") {
                        } else {
                            if (splitOrder[index].includes('#')) {

                            } else {
                                let splitOperator = splitOrder[index].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
                                let reg = /^\d+$/
                                splitOperator.map((item) => {
                                    if (reg.test(item) === true) {
                                        let i = dataTable2.findIndex((val) => val[23] == item)
                                        if (i > 0) {
                                            rilFormula = rilFormula.replace(item, dataTable2[i][tableMeta.columnIndex] === "" ? "0" : dataTable2[i][tableMeta.columnIndex])
                                        }
                                    }
                                })
                            }
                        }
                    }
                    let body = {
                        "submission_id": null,
                        "company_id": this.props.company.company_id,
                        "report_id": this.props.report_id,
                        "year": this.props.periode,
                        "month": month,
                        "formula": rilFormula
                    }
                    api.create().countingFormula(body).then(response => {
d.arizona's avatar
d.arizona committed
977
                        // // console.log(response);
faisalhamdi's avatar
faisalhamdi committed
978 979 980
                        if (response.data) {
                            if (response.data.status === "success") {
                                setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
981
                                    return response.data.data.result
faisalhamdi's avatar
faisalhamdi committed
982 983 984
                                }, 2000);
                            }
                        }
faisalhamdi's avatar
faisalhamdi committed
985
                    })
faisalhamdi's avatar
faisalhamdi committed
986
                } else {
faisalhamdi's avatar
faisalhamdi committed
987 988 989 990 991 992 993 994 995
                    let body = {
                        "submission_id": this.props.submissionID,
                        "company_id": this.props.company.company_id,
                        "report_id": this.props.report_id,
                        "year": this.props.periode,
                        "month": month,
                        "formula": rilFormula
                    }
                    api.create().countingFormula(body).then(response => {
d.arizona's avatar
d.arizona committed
996
                        // // console.log(response)
faisalhamdi's avatar
faisalhamdi committed
997 998
                        if (response.data) {
                            if (response.data.status === "success") {
faisalhamdi's avatar
faisalhamdi committed
999
                                setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1000
                                    return response.data.data.result
faisalhamdi's avatar
faisalhamdi committed
1001
                                }, 2000);
faisalhamdi's avatar
faisalhamdi committed
1002 1003 1004
                            }
                        }
                    })
faisalhamdi's avatar
faisalhamdi committed
1005
                }
faisalhamdi's avatar
faisalhamdi committed
1006 1007 1008 1009 1010 1011 1012
            } else {
                let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
                let arrayJumlah = []
                arrayFormula.map((item, indexs) => {
                    let index = dataTable2.findIndex((val) => val[1] == item)
                    if (index > 0) {
                        arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
faisalhamdi's avatar
faisalhamdi committed
1013
                    } else {
faisalhamdi's avatar
faisalhamdi committed
1014
                        arrayJumlah.push(item)
faisalhamdi's avatar
faisalhamdi committed
1015
                    }
faisalhamdi's avatar
faisalhamdi committed
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
                    // if (indexs % 2 !== 0) {
                    //     operator.push(item)
                    // }
                })
                let array = arrayJumlah
                let total = 0
                let opt = ""
                array.map((item, index) => {
                    if (item == "+") {
                        opt = "tambah"
                    } else if (item == "-") {
                        opt = "kurang"
                    } else if (item == "*") {
                        opt = "kali"
                    } else if (item == "/") {
                        opt = "bagi"
                    } else {
                        if (opt == "tambah") {
                            total = Number(total) + Number(item)
                        } else if (opt == "kurang") {
                            total = Number(total) - Number(item)
                        } else if (opt == "kali") {
                            total = Number(total) * Number(item)
                        } else if (opt == "bagi") {
                            total = Number(total) / Number(item)
                        } else {
                            total += item
                        }
                    }
                })
                let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
                return a
            }
faisalhamdi's avatar
faisalhamdi committed
1049
        }
Dida Adams Arizona's avatar
Dida Adams Arizona committed
1050

faisalhamdi's avatar
faisalhamdi committed
1051
        const columns = [{
faisalhamdi's avatar
faisalhamdi committed
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1077
            name: "Account",
faisalhamdi's avatar
faisalhamdi committed
1078 1079
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1080
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
faisalhamdi's avatar
faisalhamdi committed
1081 1082 1083 1084 1085 1086
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
                setCellProps: () => ({ style }),
                customBodyRender: (val, tableMeta) => {
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1087
                        <div style={{ width: 300 }}>
Dida Adams Arizona's avatar
Dida Adams Arizona committed
1088 1089
                            {tableMeta.rowData[25] ?
                                tableMeta.rowData[25].length > 0 ?
faisalhamdi's avatar
faisalhamdi committed
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101
                                    <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
                                            <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </LightTooltip>
                                    </div>
                                    :
                                    tableMeta.rowData[4] == 0 ?
                                        <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                        :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                            <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </div>
faisalhamdi's avatar
faisalhamdi committed
1102
                                :
faisalhamdi's avatar
faisalhamdi committed
1103 1104 1105 1106 1107 1108
                                tableMeta.rowData[4] == 0 ?
                                    <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                    :
                                    <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                        <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
1109 1110 1111 1112 1113 1114
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1115
            name: `31 Dec ${Number(this.props.periode) - 1} Actual`,
faisalhamdi's avatar
faisalhamdi committed
1116 1117
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1118 1119
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
1120 1121
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1122
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1123 1124 1125
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
qorri_di's avatar
qorri_di committed
1126
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
faisalhamdi's avatar
faisalhamdi committed
1127 1128
                                null
                                :
qorri_di's avatar
qorri_di committed
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140
                                tableMeta.rowData[0] == 5 || tableMeta.rowData[0] == 6 ?
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
Riri Novita's avatar
Riri Novita committed
1141
                                                    value={Number(value).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1142
                                                // value={Number(handleBfr(value, tableMeta)).toFixed(1)}
qorri_di's avatar
qorri_di committed
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
                                                />
                                            }
                                        />
                                    </div>
                                    :
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
                                                    value={Number(value).toFixed(1)}
                                                />
                                            }
                                        />
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
1164 1165 1166 1167
                            }
                        </div>
                    )
                }
faisalhamdi's avatar
faisalhamdi committed
1168 1169
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1170
            name: `Jan ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1171 1172
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1173
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1174 1175 1176
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1177
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1178 1179 1180
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1181 1182
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1231
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1232
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1233 1234 1235 1236
                                                        onBlur={(event) => {
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1237 1238 1239 1240
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1257 1258
                                                    <NumberFormat
                                                        thousandSeparator={true}
qorri_di's avatar
qorri_di committed
1259
                                                        style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance' ? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
faisalhamdi's avatar
faisalhamdi committed
1260 1261
                                                        type="text"
                                                        placeholder=""
qorri_di's avatar
qorri_di committed
1262 1263 1264 1265 1266 1267
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') && String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance' ? false : true)}
                                                        value={String(tableMeta.rowData[5]).toLocaleLowerCase() == 'beginning balance' ? Number(value.value).toFixed(1) : Number(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                        onBlur={(event) => {
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1268
                                                    />
qorri_di's avatar
qorri_di committed
1269 1270 1271 1272 1273
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
1274 1275 1276 1277 1278 1279
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1280
            name: `Feb ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1281 1282
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1283
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1284 1285 1286
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1287
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1288
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1289
                    return (
faisalhamdi's avatar
faisalhamdi committed
1290
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1291 1292
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1341
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1342
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1343 1344 1345 1346 1347
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1348 1349 1350 1351
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1368 1369 1370 1371 1372 1373
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
1374
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1375
                                                    />
qorri_di's avatar
qorri_di committed
1376 1377 1378 1379 1380
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
1381
                            }
faisalhamdi's avatar
faisalhamdi committed
1382 1383 1384 1385 1386
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1387
            name: `Mar ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1388 1389
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1390
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1391 1392 1393
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1394
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1395
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1396
                    return (
faisalhamdi's avatar
faisalhamdi committed
1397
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1398 1399
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1448
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1449
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1450 1451 1452 1453 1454
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1455 1456 1457 1458
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1475 1476 1477 1478 1479 1480
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
1481
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1482
                                                    />
qorri_di's avatar
qorri_di committed
1483 1484 1485 1486 1487
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
1488
                            }
faisalhamdi's avatar
faisalhamdi committed
1489 1490 1491 1492 1493
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1494
            name: `Apr ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1495 1496
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1497
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1498 1499 1500
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1501
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1502
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1503
                    return (
faisalhamdi's avatar
faisalhamdi committed
1504
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1505 1506
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1555
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1556
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1557 1558 1559 1560 1561
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1562 1563 1564 1565
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1582 1583 1584 1585 1586 1587
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
1588
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1589
                                                    />
qorri_di's avatar
qorri_di committed
1590 1591 1592 1593 1594
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
1595
                            }
faisalhamdi's avatar
faisalhamdi committed
1596 1597 1598 1599 1600
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1601
            name: `May ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1602 1603
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1604
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1605 1606
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
1607 1608 1609 1610 1611 1612 1613
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1614 1615 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
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1662
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1663
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1664 1665 1666 1667 1668
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1669 1670 1671 1672
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1689 1690 1691 1692 1693 1694
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
1695
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1696
                                                    />
qorri_di's avatar
qorri_di committed
1697 1698 1699 1700 1701
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
1702
                            }
faisalhamdi's avatar
faisalhamdi committed
1703 1704 1705 1706 1707
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1708
            name: `Jun ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1709 1710
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1711
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1712 1713 1714
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1715
                setCellProps: () => ({ style2 }),
faisalhamdi's avatar
faisalhamdi committed
1716
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1717
                    return (
faisalhamdi's avatar
faisalhamdi committed
1718
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1719 1720
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1769
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1770
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1771 1772 1773 1774 1775
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1776 1777 1778 1779
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1796 1797 1798 1799 1800 1801
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
1802
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1803
                                                    />
qorri_di's avatar
qorri_di committed
1804 1805 1806 1807 1808
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
1809
                            }
faisalhamdi's avatar
faisalhamdi committed
1810 1811 1812 1813 1814
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1815
            name: `Jul ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1816 1817
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1818
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1819 1820 1821
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1822 1823
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1824
                    return (
faisalhamdi's avatar
faisalhamdi committed
1825
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1826 1827
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1876
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1877
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1878 1879 1880 1881 1882
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1883 1884 1885 1886
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
1903 1904 1905 1906 1907 1908
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
1909
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
1910
                                                    />
qorri_di's avatar
qorri_di committed
1911 1912 1913 1914 1915
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
1916
                            }
faisalhamdi's avatar
faisalhamdi committed
1917 1918 1919 1920 1921
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
1922
            name: `Aug ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
1923 1924
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
1925
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
1926 1927 1928
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
1929 1930
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
1931
                    return (
faisalhamdi's avatar
faisalhamdi committed
1932
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
1933 1934
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
1983
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1984
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
1985 1986 1987 1988 1989
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
1990 1991
                                                    />
                                                }
1992 1993
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2010 2011 2012 2013 2014 2015
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
2016
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2017
                                                    />
qorri_di's avatar
qorri_di committed
2018 2019 2020 2021 2022
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
2023
                            }
faisalhamdi's avatar
faisalhamdi committed
2024 2025 2026 2027 2028
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2029
            name: `Sep ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
2030 2031
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2032
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
2033 2034 2035
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
faisalhamdi's avatar
faisalhamdi committed
2036 2037
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
faisalhamdi's avatar
faisalhamdi committed
2038
                    return (
faisalhamdi's avatar
faisalhamdi committed
2039
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
2040 2041
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
2042 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
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
2090
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2091
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
2092 2093 2094 2095 2096
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
2097 2098 2099 2100
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2117 2118 2119 2120 2121 2122
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
2123
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2124
                                                    />
qorri_di's avatar
qorri_di committed
2125 2126 2127 2128 2129
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
2130 2131 2132 2133 2134 2135
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2136
            name: `Oct ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
2137 2138
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2139
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
2140 2141 2142 2143 2144 2145 2146
                        <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
2147 2148
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
2197
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2198
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
2199 2200 2201 2202 2203
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
2204 2205 2206 2207
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2224 2225 2226 2227 2228 2229
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
2230
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2231
                                                    />
qorri_di's avatar
qorri_di committed
2232 2233 2234 2235 2236
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
2237 2238 2239 2240 2241 2242
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2243
            name: `Nov ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
2244 2245
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2246
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
2247 2248 2249 2250 2251 2252 2253
                        <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
2254 2255
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
2304
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2305
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
2306 2307 2308 2309 2310
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
2311 2312 2313 2314
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2331 2332 2333 2334 2335 2336
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
2337
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2338
                                                    />
qorri_di's avatar
qorri_di committed
2339 2340 2341 2342 2343
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
2344 2345 2346 2347 2348 2349
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2350
            name: `Dec ${this.props.periode}`,
faisalhamdi's avatar
faisalhamdi committed
2351 2352
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2353
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
faisalhamdi's avatar
faisalhamdi committed
2354 2355 2356 2357 2358 2359 2360
                        <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
2361 2362
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
2411
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2412
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
2413 2414 2415 2416 2417
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
2418 2419 2420 2421
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleValueFormula(value, tableMeta)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2438 2439 2440 2441 2442 2443
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
2444
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2445
                                                    />
qorri_di's avatar
qorri_di committed
2446 2447 2448 2449 2450
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
2451 2452 2453 2454 2455 2456
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2457
            name: "Current Total",
faisalhamdi's avatar
faisalhamdi committed
2458 2459
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2460 2461
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2462 2463 2464 2465 2466
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
faisalhamdi's avatar
faisalhamdi committed
2467
                        <div style={{ width: 96, textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
2468 2469 2470
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 4 ?
qorri_di's avatar
qorri_di committed
2471 2472
                                        null
                                        :
faisalhamdi's avatar
faisalhamdi committed
2473 2474 2475 2476 2477 2478 2479 2480
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2481
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
faisalhamdi's avatar
faisalhamdi committed
2482 2483 2484
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2485
                                                            value={Number(handleTotal(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2501
                                                            value={Number(value).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2515
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
faisalhamdi's avatar
faisalhamdi committed
2516 2517
                                                        type="text"
                                                        placeholder=""
Deni Rinaldi's avatar
Deni Rinaldi committed
2518 2519
                                                        disabled={true}
                                                        value={Number(handleTotal(tableMeta)).toFixed(1)}
qorri_di's avatar
qorri_di committed
2520 2521 2522 2523 2524
                                                    // onBlur={(event) => {
                                                    //     // updateValue(event.target.value)
                                                    //     handleChange(event.target.value, tableMeta)
                                                    //     // // console.log(dataTable2)
                                                    // }}
faisalhamdi's avatar
faisalhamdi committed
2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536
                                                    />
                                                }
                                            />
                                        </div> :
                                        tableMeta.rowData[0] === 5 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2537
                                                    value={Number(handleTotal(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550
                                                />
                                            </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}
Deni Rinaldi's avatar
Deni Rinaldi committed
2551
                                                        value={Number(handleTotal(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2552 2553 2554 2555 2556 2557 2558
                                                    />
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
                            }
faisalhamdi's avatar
faisalhamdi committed
2559 2560 2561 2562 2563
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2564
            name: `31 Dec ${Number(this.props.periode) + 1} Total`,
faisalhamdi's avatar
faisalhamdi committed
2565 2566
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2567 2568
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2569 2570 2571 2572 2573 2574
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
2575 2576
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
2625
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2626
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
2627 2628 2629 2630 2631
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
2632 2633 2634 2635
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2652 2653 2654 2655 2656 2657
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
2658
                                                        value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2659
                                                    />
qorri_di's avatar
qorri_di committed
2660 2661 2662 2663 2664
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
2665 2666 2667 2668 2669 2670
                            }
                        </div>
                    )
                }
            }
        }, {
faisalhamdi's avatar
faisalhamdi committed
2671
            name: `31 Dec ${Number(this.props.periode) + 2} Total`,
faisalhamdi's avatar
faisalhamdi committed
2672 2673
            options: {
                customHeadRender: (columnMeta) => (
faisalhamdi's avatar
faisalhamdi committed
2674 2675
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2676 2677 2678 2679 2680 2681
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
faisalhamdi's avatar
faisalhamdi committed
2682 2683
                            {
                                this.props.status === 'CLOSED' ?
qorri_di's avatar
qorri_di committed
2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                        null
                                        :
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div> :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(value).toFixed(1)}
                                                        />
                                                    }
                                                />
                                            </div>
faisalhamdi's avatar
faisalhamdi committed
2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731
                                    :
                                    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=""
qorri_di's avatar
qorri_di committed
2732
                                                        disabled={this.props.isApprover ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2733
                                                        value={Number(value).toFixed(1)}
qorri_di's avatar
qorri_di committed
2734 2735 2736 2737 2738
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // // console.log(dataTable2)
                                                        }}
faisalhamdi's avatar
faisalhamdi committed
2739 2740 2741 2742
                                                    />
                                                }
                                            />
                                        </div> :
qorri_di's avatar
qorri_di committed
2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758
                                        tableMeta.rowData[0] === 5 ?
                                            <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(handleForecast(tableMeta, `${Number(this.props.periode) + 2}`)).toFixed(1)}
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
                                                :
                                                tableMeta.rowData[0] === 6 ?
faisalhamdi's avatar
faisalhamdi committed
2759 2760 2761 2762 2763 2764
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
qorri_di's avatar
qorri_di committed
2765
                                                        value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 2}`)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2766
                                                    />
qorri_di's avatar
qorri_di committed
2767 2768 2769 2770 2771
                                                    :
                                                    tableMeta.rowData[0] === 1 ?
                                                        null
                                                        :
                                                        null
faisalhamdi's avatar
faisalhamdi committed
2772
                            }
faisalhamdi's avatar
faisalhamdi committed
2773 2774 2775 2776 2777 2778
                        </div>
                    )
                }
            }
        }
        ]
faisalhamdi's avatar
faisalhamdi committed
2779 2780 2781 2782 2783 2784 2785 2786 2787 2788
        const loadingComponent = (
            <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );
faisalhamdi's avatar
faisalhamdi committed
2789

faisalhamdi's avatar
faisalhamdi committed
2790 2791 2792
        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
2793
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
faisalhamdi's avatar
faisalhamdi committed
2794
                </div>
faisalhamdi's avatar
faisalhamdi committed
2795 2796 2797 2798 2799
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
faisalhamdi's avatar
faisalhamdi committed
2800
                {/* {this.state.loading && loadingComponent} */}
faisalhamdi's avatar
faisalhamdi committed
2801
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
faisalhamdi's avatar
faisalhamdi committed
2802 2803 2804
                    {this.state.visibleFixedAssetsMovement === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
faisalhamdi's avatar
faisalhamdi committed
2805
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Fixed Assets Movement</Typography>
faisalhamdi's avatar
faisalhamdi committed
2806 2807 2808 2809 2810
                            </div>
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2811
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
Riri Novita's avatar
Riri Novita committed
2812 2813 2814 2815 2816
                                        {this.props.defaultCurrency.id === 1 ?
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                            :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                        }
faisalhamdi's avatar
faisalhamdi committed
2817 2818
                                    </div>
                                    <div style={{ width: '50%' }}>
2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896
                                        <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                                            <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                            <a data-tip={'Upload Simulasi'} data-for="upload">
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.setState({ visibleUploadSimulasi: true, buttonDraft: true })}
                                                >
                                                    <img src={Images.simulasiUpload} style={{ width: 40, height: 40, marginRight: 3 }} />
                                                </button>
                                            </a>
                                            <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                            {this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
                                                null
                                                // <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="download" place="bottom" type="light" effect="solid" />
                                                // </div> 
                                                :
                                                <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                    {((!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted')) && (
                                                        <div>
                                                            <a data-tip={'Download Template'} data-for="template">
                                                                <button
                                                                    style={{
                                                                        backgroundColor: 'transparent',
                                                                        cursor: 'pointer',
                                                                        borderColor: 'transparent',
                                                                        margin: 5
                                                                    }}
                                                                    onClick={() => this.downloadTemplate()}
                                                                >
                                                                    <img src={Images.template} />
                                                                </button>
                                                            </a>
                                                            <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                        </div>
                                                    )}
                                                    {((!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted')) && (
                                                        <div>
                                                            <a data-tip={'Upload'} data-for="upload">
                                                                <button
                                                                    style={{
                                                                        backgroundColor: 'transparent',
                                                                        cursor: 'pointer',
                                                                        borderColor: 'transparent',
                                                                        margin: 5
                                                                    }}
                                                                    onClick={() => this.setState({ visibleUpload: true })}
                                                                >
                                                                    <img src={Images.upload} />
                                                                </button>
                                                            </a>
                                                            <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                        </div>
                                                    )}
                                                    {/* <a data-tip={'Download'} data-for="download">
faisalhamdi's avatar
faisalhamdi committed
2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913
                                                    <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>
qorri_di's avatar
qorri_di committed
2914
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
2915 2916 2917
                                                </div>
                                            }
                                        </div>
faisalhamdi's avatar
faisalhamdi committed
2918
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2919
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2920

faisalhamdi's avatar
faisalhamdi committed
2921
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2922
                                    {this.state.loading && loadingComponent}
faisalhamdi's avatar
faisalhamdi committed
2923
                                    <MuiThemeProvider theme={getMuiTheme()}>
faisalhamdi's avatar
faisalhamdi committed
2924 2925 2926 2927 2928
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
faisalhamdi's avatar
faisalhamdi committed
2929
                                    </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
2930
                                </div>
Riri Novita's avatar
Riri Novita committed
2931 2932 2933 2934 2935
                                <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) => {
qorri_di's avatar
qorri_di committed
2936 2937 2938 2939
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
qorri_di's avatar
qorri_di committed
2940
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
2941 2942 2943
                                        }
                                    </div>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2944
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2945
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
faisalhamdi's avatar
faisalhamdi committed
2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956
                                <div className="col-1">
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
faisalhamdi's avatar
faisalhamdi committed
2957 2958 2959 2960 2961
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
faisalhamdi's avatar
faisalhamdi committed
2962
                                    >
faisalhamdi's avatar
faisalhamdi committed
2963
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
2964
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
faisalhamdi's avatar
faisalhamdi committed
2965 2966
                                        </div>
                                    </button>
faisalhamdi's avatar
faisalhamdi committed
2967
                                </div>
a.bairuha's avatar
a.bairuha committed
2968
                                {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
syadziy's avatar
syadziy committed
2969
                                    (!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === "draft" || this.props.status === 'submitted') ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005
                                        <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                            <button
                                                className="button"
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() => {
                                                    this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.handleValidate()
                                                        }, 100);
                                                    })
                                                }}
                                            >
                                                <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                                </div>
                                            </button>
                                            <button
                                                className="button"
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() =>
                                                    this.state.editable === true ?
                                                        null :
3006 3007
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
faisalhamdi's avatar
faisalhamdi committed
3008
                                                                this.backToMasterBudget('draft')
Deni Rinaldi's avatar
Deni Rinaldi committed
3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022
                                                            })
                                                }
                                            >
                                                <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                                </div>
                                            </button>
                                            <button
                                                type="button"
                                                disabled={this.state.buttonError}
                                                onClick={() =>
                                                    this.state.buttonError ?
                                                        this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                        :
3023 3024
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038
                                                                this.backToMasterBudget('submitted')
                                                            })}
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                }}
                                            >
                                                <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                                </div>
                                            </button>
                                        </div> : null
faisalhamdi's avatar
faisalhamdi committed
3039
                                }
faisalhamdi's avatar
faisalhamdi committed
3040 3041 3042 3043 3044 3045 3046 3047
                            </div>
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
3048
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
Riri Novita's avatar
Riri Novita committed
3049 3050 3051 3052 3053
                                        {this.props.defaultCurrency.id === 1 ?
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                            :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                        }
faisalhamdi's avatar
faisalhamdi committed
3054
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
3055
                                    {this.state.dataLoaded && (
faisalhamdi's avatar
faisalhamdi committed
3056
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
faisalhamdi's avatar
faisalhamdi committed
3057 3058
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
faisalhamdi's avatar
faisalhamdi committed
3059 3060 3061 3062 3063
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
faisalhamdi's avatar
faisalhamdi committed
3064
                                            </MuiThemeProvider>
faisalhamdi's avatar
faisalhamdi committed
3065 3066 3067
                                        </div>
                                    )}
                                </div>
3068 3069 3070 3071 3072 3073

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visibleFixedAssetsMovement: true }, () => {
faisalhamdi's avatar
faisalhamdi committed
3074
                                                setTimeout(() => {
3075
                                                    this.getItemHierarki()
faisalhamdi's avatar
faisalhamdi committed
3076
                                                }, 100);
3077 3078 3079 3080
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
3081
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
3082 3083 3084 3085 3086 3087 3088
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                        <button
                                            className="button"
                                            type="button"
d.arizona's avatar
d.arizona committed
3089
                                            // disabled={this.state.buttonError}
3090 3091
                                            style={{
                                                backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
3092
                                                cursor: 'pointer',
3093 3094 3095 3096 3097 3098 3099
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3100
                                                        this.setState({ loading: false, buttonError: this.state.errorPreview === true ? true : false, editable: false })
3101 3102 3103 3104 3105 3106 3107 3108
                                                    }, 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>
Riri Novita's avatar
Riri Novita committed
3109

3110
                                        <button
faisalhamdi's avatar
faisalhamdi committed
3111
                                            className="button"
3112
                                            type="button"
Riri Novita's avatar
Riri Novita committed
3113
                                            // disabled={this.state.buttonError}
faisalhamdi's avatar
faisalhamdi committed
3114 3115
                                            style={{
                                                backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
3116 3117
                                                // cursor: this.state.editable === true ? 'default' : 'pointer',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
faisalhamdi's avatar
faisalhamdi committed
3118 3119 3120 3121
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Riri Novita's avatar
Riri Novita committed
3122 3123 3124 3125 3126 3127 3128 3129 3130 3131
                                            onClick={() =>
                                                this.state.editable === true ?
                                                    null : this.setState({ loading: true }, () =>
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
                                                                setTimeout(() => {
                                                                    this.uploadFAM('draft')
                                                                }, 100);
                                                            }))
                                            }
3132 3133 3134 3135 3136 3137 3138
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
faisalhamdi's avatar
faisalhamdi committed
3139 3140 3141 3142 3143 3144
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none'
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3145
                                            onClick={() =>
faisalhamdi's avatar
faisalhamdi committed
3146
                                                this.state.editable === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3147
                                                    null : this.setState({ loading: true }, () =>
3148 3149
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3150 3151 3152 3153
                                                                setTimeout(() => {
                                                                    this.uploadFAM('submitted')
                                                                }, 100);
                                                            })
EKSAD's avatar
EKSAD committed
3154
                                                    )
faisalhamdi's avatar
faisalhamdi committed
3155
                                            }
3156 3157 3158 3159 3160 3161
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
3162
                                </div>
faisalhamdi's avatar
faisalhamdi committed
3163
                            </div>
faisalhamdi's avatar
faisalhamdi committed
3164 3165
                        </Paper>}
                </div>
faisalhamdi's avatar
faisalhamdi committed
3166

faisalhamdi's avatar
faisalhamdi committed
3167 3168 3169 3170 3171 3172 3173
                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
faisalhamdi's avatar
faisalhamdi committed
3174
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
3175
                                </div>
faisalhamdi's avatar
faisalhamdi committed
3176 3177 3178 3179 3180 3181 3182 3183
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
faisalhamdi's avatar
faisalhamdi committed
3184 3185
                                </div>
                            </div>
Riri Novita's avatar
Riri Novita committed
3186
                            <div style={{ padding: '25px 30px' }}>
Riri Novita's avatar
Riri Novita committed
3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202
                                <UploadFile
                                    type={this.state.uploadStatus}
                                    percentage={this.state.percentage}
                                    result={this.state.result}
                                    acceptedFiles={["xlsx"]}
                                    onHandle={(dt) => {
                                        this.fileHandler(dt)
                                        this.setState({ uploadStatus: 'idle', percentage: '0' })
                                    }}
                                    onUpload={() => {
                                        String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("FIXED") && String(this.state.judul).includes("ASSETS") && String(this.state.judul).includes("MOVEMENT") ?
                                            this.checkUpload() :
                                            this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                    }}
                                />
                            </div>
Riri Novita's avatar
Riri Novita committed
3203 3204
                            <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>

Riri Novita's avatar
Riri Novita committed
3205 3206 3207 3208
                        </div>
                    </div>
                )}

3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239
                {this.state.visibleUploadSimulasi && (
                    <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 Simulasi</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({ visibleUploadSimulasi: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
                            </div>
                            <div style={{ padding: '25px 30px' }}>
                                <UploadFile
                                    type={this.state.uploadStatusSimulasi}
                                    percentage={this.state.percentageSimulasi}
                                    result={this.state.resultSimulasi}
                                    acceptedFiles={["xlsx"]}
                                    onHandle={(dt) => {
                                        this.fileHandlerSimulasi(dt)
                                        this.setState({ uploadStatusSimulasi: 'idle', percentageSimulasi: '0' })
                                    }}
                                    onUpload={() => {
                                        String(this.state.judul).includes("MASTER") && String(this.state.judul).includes("BUDGET") && String(this.state.judul).includes("FIXED") && String(this.state.judul).includes("ASSETS") && String(this.state.judul).includes("MOVEMENT") ?
Riri Novita's avatar
Riri Novita committed
3240
                                            this.checkUploadSimulasi() :
3241 3242 3243 3244
                                            this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                    }}
                                />
                            </div>
Riri Novita's avatar
Riri Novita committed
3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270
                            {this.state.visibleButtonUpload &&
                                <div style={{ display: 'flex', justifyContent: 'flex-end', margin: '0px 32px 16px' }}>
                                    <div>
                                        <button
                                            type="button"
                                            // disabled={this.state.buttonError}
                                            onClick={() =>
                                                this.setState({ handleDoubleClick: 1, loading: true }, () => {
                                                    this.uploadSimulasi('submitted')
                                                })}

                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: '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 Data</Typography>
                                            </div>
                                        </button>
                                    </div>
                                </div>
                            }
                            {/* <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div> */}
3271 3272 3273 3274 3275

                        </div>
                    </div>
                )}

Riri Novita's avatar
Riri Novita committed
3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299
                {this.state.visibleAlertSave && (
                    <div className="test app-popup-show">
                        <div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
                            <div style={{ margin: 30 }}>
                                <div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
                                    <div style={{ alignSelf: 'center', marginRight: 25 }}>
                                        <img src={Images.warning} />
                                    </div>
                                    <div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
                                        <b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
                                    </div>
                                </div>
                                <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            background: '#F6F7F9',
                                            cursor: 'pointer',
                                            border: '1px solid #3549609e',
                                            outline: 'none',
                                            marginRight: 20,
                                            borderRadius: 9
                                        }}
Riri Novita's avatar
Riri Novita committed
3300
                                        onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
Riri Novita's avatar
Riri Novita committed
3301 3302 3303 3304 3305 3306 3307
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
                                            <Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
                                        </div>
                                    </button>
                                </div>
                            </div>
faisalhamdi's avatar
faisalhamdi committed
3308
                        </div>
faisalhamdi's avatar
faisalhamdi committed
3309 3310
                    </div>
                )}
faisalhamdi's avatar
faisalhamdi committed
3311 3312 3313 3314
            </div>
        );
    }
}