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

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

Deni Rinaldi's avatar
Deni Rinaldi committed
25
var ct = require("../../library/CustomTable");
Deni Rinaldi's avatar
Deni Rinaldi committed
26
const getMuiTheme = () => createMuiTheme(ct.customTable3());
Deni Rinaldi's avatar
Deni Rinaldi committed
27

Deni Rinaldi's avatar
Deni Rinaldi committed
28 29 30
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);

Deni Rinaldi's avatar
Deni Rinaldi committed
31 32 33 34 35
const options = ct.customOptionsFixedColumn();
const style = {
    position: "sticky",
    left: 0,
    zIndex: 101,
Deni Rinaldi's avatar
Deni Rinaldi committed
36
    background: "white",
Deni Rinaldi's avatar
Deni Rinaldi committed
37 38 39 40
};
const style2 = {
    position: "sticky",
    background: "white",
Deni Rinaldi's avatar
Deni Rinaldi committed
41
    zIndex: 100
Deni Rinaldi's avatar
Deni Rinaldi committed
42 43 44
};

export default class BalanceSheet extends Component {
Deni Rinaldi's avatar
Deni Rinaldi committed
45 46 47
    constructor(props) {
        super(props)
        this.state = {
Deni Rinaldi's avatar
Deni Rinaldi committed
48
            dataTable: [],
Deni Rinaldi's avatar
Deni Rinaldi committed
49
            visibleBalanceSheet: true,
Deni Rinaldi's avatar
Deni Rinaldi committed
50
            disabledSave: true,
51
            editable: false,
Deni Rinaldi's avatar
Deni Rinaldi committed
52
            buttonError: false,
53
            judulColumn: null,
Riri Novita's avatar
Riri Novita committed
54
            updateBy: [],
55
            handleDoubleClick: 0,
Deni Rinaldi's avatar
Deni Rinaldi committed
56 57
            saveDraft: true,
            minValue: "0",
Deni Rinaldi's avatar
Deni Rinaldi committed
58 59 60 61
            maxValue: "0",
            alert: false,
            tipeAlert: '',
            messageAlert: '',
Riri Novita's avatar
Riri Novita committed
62 63
            defaultCurrencyUpload: this.props.defaultCurrency,
            visibleAlertSave: false
Deni Rinaldi's avatar
Deni Rinaldi committed
64
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
65
        this.fileHandler = this.fileHandler.bind(this);
Deni Rinaldi's avatar
Deni Rinaldi committed
66 67
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
68
    componentDidMount() {
Riri Novita's avatar
Riri Novita committed
69
        console.log(this.props);
70
        this.getLatestUpdate()
Deni Rinaldi's avatar
Deni Rinaldi committed
71
        this.getSettingControl()
Deni Rinaldi's avatar
Deni Rinaldi committed
72 73
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
74 75 76 77 78 79 80 81
    getSettingControl() {
        let body = {
            group: 'THRESHOLD_CONTROL',
            company_id: this.props.company.company_id,
            type: 'BALANCE_SHEET'
        }

        api.create().getAllSettingByType(body).then(response => {
Riri Novita's avatar
Riri Novita committed
82
            console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
83 84
            if (response.data) {
                if (response.data.status === 'success') {
Deni Rinaldi's avatar
Deni Rinaldi committed
85 86 87 88 89 90
                    this.setState({
                        minValue: response.data.data[0] ? response.data.data[0].min_value : null,
                        maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
                    }, () => {
                        this.getItemHierarki()
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
91 92
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
93
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
94 95 96 97 98 99 100 101
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
102
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
103
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
104 105 106
        })
    }

107 108 109 110 111 112
    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
113 114
            "submission_id": this.props.submissionID,
            "currency_id": this.props.defaultCurrency.id
115 116 117 118 119
        }
        api.create().getLastestUpdateMB(payload).then(response => {
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
120
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail
121
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
122
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
123
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
124
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
125 126 127 128 129 130 131
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
132 133
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
134 135 136 137
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
138
    async getItemHierarki() {
Deni Rinaldi's avatar
Deni Rinaldi committed
139
        this.setState({ loading: true, judulColumn: null })
Deni Rinaldi's avatar
Deni Rinaldi committed
140 141
        let payload = {
            "report_id": this.props.report_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
142 143
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
Deni Rinaldi's avatar
Deni Rinaldi committed
144
            "company_id": this.props.company.company_id,
Riri Novita's avatar
Riri Novita committed
145 146
            "submission_id": this.props.submissionID,
            "currency_id": this.props.defaultCurrency.id
Deni Rinaldi's avatar
Deni Rinaldi committed
147
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
148
        let response = await api.create().getDetailReportMB(payload)
149
        console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
150 151 152 153 154 155
        let dataTable = []
        if (response.data) {
            let res = response.data.data
            const handlePushChild = (item) => {
                let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                if (indexIDzz === -1) {
Deni Rinaldi's avatar
Deni Rinaldi committed
156 157 158 159 160 161 162
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
Deni Rinaldi's avatar
Deni Rinaldi committed
163
                        item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.january).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.january, formula: item.balance_sheet.january_formula } : Number(item.balance_sheet.january).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.february).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.february, formula: item.balance_sheet.february_formula } : Number(item.balance_sheet.february).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.march).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.march, formula: item.balance_sheet.march_formula } : Number(item.balance_sheet.march).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.april).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.april, formula: item.balance_sheet.april_formula } : Number(item.balance_sheet.april).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.may).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.may, formula: item.balance_sheet.may_formula } : Number(item.balance_sheet.may).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.june).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.june, formula: item.balance_sheet.june_formula } : Number(item.balance_sheet.june).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.july).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.july, formula: item.balance_sheet.july_formula } : Number(item.balance_sheet.july).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.august).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.august, formula: item.balance_sheet.august_formula } : Number(item.balance_sheet.august).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.september).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.september, formula: item.balance_sheet.september_formula } : Number(item.balance_sheet.september).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
                        Number(item.balance_sheet.total_current_year).toFixed(1),
                        Number(item.balance_sheet.total_next_year).toFixed(1),
                        Number(item.balance_sheet.total_more_year).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
179 180
                        item.order,
                        item.condition_it_should_be,
Deni Rinaldi's avatar
Deni Rinaldi committed
181 182
                        item.condition_if_wrong,
                        item.balance_sheet.forecast_formula == null ? [] : item.balance_sheet.forecast_formula
Deni Rinaldi's avatar
Deni Rinaldi committed
183
                    ])
Deni Rinaldi's avatar
Deni Rinaldi committed
184 185 186 187 188 189
                }
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
190
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
191
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
192
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
193 194 195 196 197 198 199 200
            res.map((item, index) => {
                dataTable.push([
                    item.type_report_id,
                    item.id,
                    item.parent,
                    item.formula,
                    item.level,
                    item.description,
Deni Rinaldi's avatar
Deni Rinaldi committed
201
                    item.balance_sheet.total_actual_before === null ? "0.0" : item.balance_sheet.total_actual_before === "" ? "0.0" : item.balance_sheet.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.january).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.january, formula: item.balance_sheet.january_formula } : Number(item.balance_sheet.january).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.february).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.february, formula: item.balance_sheet.february_formula } : Number(item.balance_sheet.february).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.march).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.march, formula: item.balance_sheet.march_formula } : Number(item.balance_sheet.march).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.april).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.april, formula: item.balance_sheet.april_formula } : Number(item.balance_sheet.april).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.may).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.may, formula: item.balance_sheet.may_formula } : Number(item.balance_sheet.may).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.june).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.june, formula: item.balance_sheet.june_formula } : Number(item.balance_sheet.june).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.july).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.july, formula: item.balance_sheet.july_formula } : Number(item.balance_sheet.july).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.august).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.august, formula: item.balance_sheet.august_formula } : Number(item.balance_sheet.august).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.september).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.september, formula: item.balance_sheet.september_formula } : Number(item.balance_sheet.september).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.october).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.november).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.december).toFixed(1) : item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
                    Number(item.balance_sheet.total_current_year).toFixed(1),
                    Number(item.balance_sheet.total_next_year).toFixed(1),
                    Number(item.balance_sheet.total_more_year).toFixed(1),
Deni Rinaldi's avatar
Deni Rinaldi committed
217 218
                    item.order,
                    item.condition_it_should_be,
Deni Rinaldi's avatar
Deni Rinaldi committed
219 220
                    item.condition_if_wrong,
                    item.balance_sheet.forecast_formula == null ? [] : item.balance_sheet.forecast_formula
Deni Rinaldi's avatar
Deni Rinaldi committed
221 222 223 224 225 226 227 228 229
                ])
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
                    }
                }
            })
Riri Novita's avatar
Riri Novita committed
230
            console.log(dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
231 232 233 234
            this.setState({ dataTable, loading: false, buttonError: true, editable: true })
        } else {
            this.setState({ dataTable, loading: false, buttonError: true, editable: true })
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
235 236
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
237 238 239 240
    closeAlert() {
        this.setState({ alert: false })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
241 242 243 244 245
    backToMasterBudget(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value).toFixed(1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
                february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value).toFixed(1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
                march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value).toFixed(1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
                april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value).toFixed(1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
                may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value).toFixed(1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
                june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value).toFixed(1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
                july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value).toFixed(1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
                august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
                september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
                october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
                november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
                december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
                total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
                total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(Number(i[20]).toFixed(1)),
                total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
262
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
263
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
264 265 266 267 268
        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
269
            "currency_id": this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
270 271 272
            "status": type,
            "balance_sheet": data
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
273
        // console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
274
        this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
275 276
        if (type == 'submitted') {
            this.props.saveToMasterBudget(payload, 'BS')
Riri Novita's avatar
Riri Novita committed
277 278 279 280 281 282 283 284 285 286 287
            // let bodyRatioBs = {
            //     "report": 'ratio',
            //     "submissionId": this.props.submissionID,
            //     "periode": this.props.periode,
            //     "companyId": this.props.company.company_id
            // }
            // console.log(bodyRatioBs);
            // api.create().triggerRatioMB(bodyRatioBs).then((res) => {
            //     console.log(res)
            //     this.setState({ loading: false })
            // })
d.arizona's avatar
d.arizona committed
288 289 290
        } else {
            this.props.saveToMasterBudget(payload)
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
291 292 293
        this.props.onClickClose()
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
294 295
    downloadTemplate = async () => {
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
296
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}`
Deni Rinaldi's avatar
Deni Rinaldi committed
297
        )
Riri Novita's avatar
Riri Novita committed
298
        console.log(res);
Deni Rinaldi's avatar
Deni Rinaldi committed
299
        res = await res.blob()
Riri Novita's avatar
Riri Novita committed
300
        console.log(res)
Deni Rinaldi's avatar
Deni Rinaldi committed
301 302 303 304
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
305
            a.download = 'Template Master Budget Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
306 307 308 309
            a.click();
        }
    }

Riri Novita's avatar
Riri Novita committed
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
    // downloadTemplate = async () => {
    //     let res = await fetch(
    //         `${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}`
    //     )
    //     console.log(res)
    //     res = await res.blob()
    //     console.log(res)
    //     if (res.size > 0) {
    //         let url = window.URL.createObjectURL(res);
    //         console.log(url);
    //         let a = document.createElement('a');
    //         a.href = url;
    //         a.download = 'Template Master Budget Balance Sheet.xlsx';
    //         a.click();
    //     }
    // }

Deni Rinaldi's avatar
Deni Rinaldi committed
327 328 329 330 331
    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
r.kurnia's avatar
r.kurnia committed
332
                // console.log(err);
Deni Rinaldi's avatar
Deni Rinaldi committed
333 334 335
            }
            else {
                let isi = resp.rows.slice(3)
Deni Rinaldi's avatar
Deni Rinaldi committed
336
                // console.log(resp.rows[2]);
Deni Rinaldi's avatar
Deni Rinaldi committed
337
                let payload = []
338
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
Deni Rinaldi's avatar
Deni Rinaldi committed
339 340 341
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
Deni Rinaldi's avatar
Deni Rinaldi committed
342 343
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
                            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()
Deni Rinaldi's avatar
Deni Rinaldi committed
360 361 362 363 364 365 366
                        })
                    }
                })
                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
367 368
                    balance_sheet: payload,
                    status: 'submitted'
Deni Rinaldi's avatar
Deni Rinaldi committed
369
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
370
                // console.log(body)
Deni Rinaldi's avatar
Deni Rinaldi committed
371
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
Deni Rinaldi's avatar
Deni Rinaldi committed
372 373 374 375
            }
        });
    }

376
    checkUpload() {
Riri Novita's avatar
Riri Novita committed
377 378 379 380 381
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
        api.create().checkUploadMB(payload).then(response => {
r.kurnia's avatar
r.kurnia committed
382
            // console.log(response)
Deni Rinaldi's avatar
Deni Rinaldi committed
383 384
            if (response.data) {
                if (response.data.status === 'success') {
Deni Rinaldi's avatar
Deni Rinaldi committed
385 386 387 388 389 390 391 392 393 394
                    this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true })
                    let dataTable = response.data.data.map((item, index) => {
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.total_actual_before,
Deni Rinaldi's avatar
Deni Rinaldi committed
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
                            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),
Deni Rinaldi's avatar
Deni Rinaldi committed
410
                            item.orders,
Deni Rinaldi's avatar
Deni Rinaldi committed
411 412
                            item.condition_it_should_be,
                            item.condition_if_wrong,
Deni Rinaldi's avatar
Deni Rinaldi committed
413
                            item.forecast_formula == null ? [] : item.forecast_formula,
Deni Rinaldi's avatar
Deni Rinaldi committed
414 415 416
                            item.error
                        ]
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
417
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, errorPreview: false, saveDraft: true }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
418
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
419
                            if (item[26].length > 0) {
r.kurnia's avatar
r.kurnia committed
420
                                // console.log('error')
Deni Rinaldi's avatar
Deni Rinaldi committed
421
                                this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
422 423 424
                            }
                        })
                        // console.log(this.state.dataTable);
425
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
426
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
427
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
428
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
429 430 431 432 433 434 435 436 437 438
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
439 440 441
        })
    }

442
    uploadBalanceSheet(type) {
Deni Rinaldi's avatar
Deni Rinaldi committed
443 444 445 446
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value).toFixed(1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
                february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value).toFixed(1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
                march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value).toFixed(1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
                april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value).toFixed(1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
                may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value).toFixed(1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
                june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value).toFixed(1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
                july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value).toFixed(1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
                august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
                september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
                october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
                november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
                december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
                total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
                total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(Number(i[20]).toFixed(1)),
                total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
463 464 465
            })
        })
        let body = {
Deni Rinaldi's avatar
Deni Rinaldi committed
466
            submission_id: this.props.submissionID,
Deni Rinaldi's avatar
Deni Rinaldi committed
467 468 469
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
Riri Novita's avatar
Riri Novita committed
470
            currency_id: this.state.defaultCurrencyUpload?.id,
471 472
            balance_sheet: data,
            status: type
Deni Rinaldi's avatar
Deni Rinaldi committed
473
        }
474
        // console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
475
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
476
            // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
477 478 479
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
d.arizona's avatar
d.arizona committed
480 481
                    if (type == 'submitted') {
                        this.props.getReport('BS')
Faisal Hamdi's avatar
Faisal Hamdi committed
482 483 484 485 486 487 488 489 490 491
                        let bodyRatioBs = {
                            "report": 'ratio',
                            "submissionId": this.props.submissionID,
                            "periode": this.props.periode,
                            "companyId": this.props.company.company_id
                        }
                        api.create().triggerRatioMB(bodyRatioBs).then((res) => {
                            console.log(res)
                            this.setState({ loading: false })
                        })
d.arizona's avatar
d.arizona committed
492 493 494
                    } else {
                        this.props.getReport()
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
495
                } else {
Riri Novita's avatar
Riri Novita committed
496
                    this.setState({ visibleAlertSave: true, alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
497
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
498 499 500 501 502 503
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
504 505
                }
            } else {
d.arizona's avatar
d.arizona committed
506
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
507 508 509 510
            }
        })
    }

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

Deni Rinaldi's avatar
Deni Rinaldi committed
528 529
    handleValidate() {
        let data = []
530
        // console.log(this.state.dataTable)
Deni Rinaldi's avatar
Deni Rinaldi committed
531 532 533
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
Deni Rinaldi's avatar
Deni Rinaldi committed
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549
                total_actual_before: String(Number(i[6]).toFixed(1)),
                january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value).toFixed(1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
                february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value).toFixed(1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
                march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value).toFixed(1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
                april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value).toFixed(1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
                may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value).toFixed(1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
                june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value).toFixed(1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
                july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value).toFixed(1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
                august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
                september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
                october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value).toFixed(1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
                november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value).toFixed(1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17]).toFixed(1)),
                december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value).toFixed(1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18]).toFixed(1)),
                total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19]).toFixed(1)),
                total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(Number(i[20]).toFixed(1)),
                total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(Number(i[21]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
550 551
            })
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
552
        // console.log(JSON.stringify(data))
Deni Rinaldi's avatar
Deni Rinaldi committed
553 554 555 556 557
        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
558
            "currency_id": this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
559 560 561
            "balance_sheet": data,
            "status": "submitted"
        }
Riri Novita's avatar
Riri Novita committed
562
        console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
563
        api.create().validateSubmitReport(payload).then((response) => {
Riri Novita's avatar
Riri Novita committed
564
            console.log(response)
Deni Rinaldi's avatar
Deni Rinaldi committed
565 566 567 568 569 570 571 572
            if (response.data) {
                if (response.data.status === "success") {
                    if (response.data.data.result) {
                        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
                    } else {
                        this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
                    }
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
573
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
574
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
575 576 577 578 579 580 581 582 583 584
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
585 586 587
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
588
    render() {
d.arizona's avatar
d.arizona committed
589
        let dataTable2 = this.state.dataTable
590
        const handleChange = (value, tableMeta, type) => {
d.arizona's avatar
d.arizona committed
591
            let val = String(value).split(",").join("")
592
            // console.log('masuk')
593
            if (type === "actual") {
Deni Rinaldi's avatar
Deni Rinaldi committed
594
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
595
            } else {
596
                // console.log('masuk2')
597 598 599
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
                    // console.log(indexParent)
600 601 602 603 604 605 606 607
                    let a = 0
                    if (type == 'r/e') {
                        // console.log('masuk8')
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(val).toFixed(1)
                    } else {
                        // console.log('masuk9')
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
                    }
608
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
Deni Rinaldi's avatar
Deni Rinaldi committed
609
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)).toFixed(1) : Number(jagain + Number(val)).toFixed(1)
610
                } else {
611 612 613 614 615 616 617 618
                    // console.log('masuk3')
                    if (type == 'r/e') {
                        // console.log('masuk4')
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(val).toFixed(1)
                    } else {
                        // console.log('masuk5')
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
                    }
619
                }
d.arizona's avatar
d.arizona committed
620 621
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
622
        const handleTotal = (tableMeta) => {
623
            let total = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][18]
Deni Rinaldi's avatar
Deni Rinaldi committed
624 625 626
            return total
            // console.log(total);
        }
d.arizona's avatar
d.arizona committed
627 628 629
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
630 631 632
                // if (data.rowData[5] == 'Retained Earnings') {
                //     console.log(item[data.columnIndex].value)
                // }
Deni Rinaldi's avatar
Deni Rinaldi committed
633
                if (data.rowData[1] === item[2]) {
Deni Rinaldi's avatar
Deni Rinaldi committed
634 635
                    let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex])
                    total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal
d.arizona's avatar
d.arizona committed
636 637
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
638
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
Deni Rinaldi's avatar
Deni Rinaldi committed
639
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total).toFixed(1)
d.arizona's avatar
d.arizona committed
640 641 642
            // console.log(indexParent);
            return a
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
643 644 645 646 647 648 649
        const handleForecast = (tableMeta, periode, column) => {
            let total = 0
            // console.log(tableMeta.rowData)

            // console.log(tableMeta.rowIndex)
            // console.log(total)
            // dataTable2[tableMeta.rowIndex][column] = total
650 651 652 653 654 655
            if (column == 19 && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)") {
                total = tableMeta.rowData[7].value
                dataTable2[tableMeta.rowIndex][column] = tableMeta.rowData[7].value
            } else {
                total = handleValueFormula(dataTable2[tableMeta.rowIndex][column], tableMeta, column, periode, dataTable2[tableMeta.rowIndex][25])
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
656 657 658 659
            // console.log(total)
            return total
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
660
        const handleFormula = (data, tableMeta) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
661 662 663
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
            arrayFormula.map((item, indexs) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
664
                let index = dataTable2.findIndex((val) => val[22] == item)
Deni Rinaldi's avatar
Deni Rinaldi committed
665
                if (index > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
666
                    arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
Deni Rinaldi's avatar
Deni Rinaldi committed
667 668 669 670
                } else {
                    arrayJumlah.push(item)
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696
            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
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
697
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
698
            return a
Deni Rinaldi's avatar
Deni Rinaldi committed
699 700

        }
Deni Rinaldi's avatar
Deni Rinaldi committed
701

Deni Rinaldi's avatar
Deni Rinaldi committed
702
        const handleValidation = (data, tableMeta) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
            let a = handleValueFormula(data, tableMeta)
            return a
        }

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

            // if (tableMeta.columnIndex == 7) {
            //     console.log(splitFormula)
            //     console.log(baru)
            // }
            // console.log(baru)
            baru.map((item, index) => {
                if (item == '-' || item == '+' || item == '/' || item == '*') {
                    anjay.push(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
737
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
                    if (String(item).includes('#')) {
                        if (forecast !== undefined) {
                            let forecastt = 0
                            forecast.map((items, index) => {
                                if (items.periode == periode) {
                                    forecastt += Number(items.value)
                                }
                            })
                            anjay.push(forecastt)
                        } else if (String(item).includes('[M-1]')) {
                            let tst = String(item).replace('[M-1]', '')
                            let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
                            let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
                            // console.log(tableMeta.columnIndex)
                            let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
                            // console.log(indexID)
                            if (indexID !== -1) {
                                let valuezz = tableMeta.rowData[data].formula[indexID].value
                                // baru.push(valuezz)
                                anjay.push(valuezz == "" ? 0 : valuezz)
                                // console.log(valuezz)
                            }
                        } else {
                            // console.log(baru);
                            // console.log(value);
                            let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
                            // console.log(indexID)
                            if (indexID !== -1) {
                                // console.log(value.formula[indexID].value)
                                let valuezz = value.formula[indexID].value
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        }
                    } else if (String(item).includes('[M-1]')) {
                        let tst = String(item).replace('[M-1]', '')
Deni Rinaldi's avatar
Deni Rinaldi committed
773
                        if (tableMeta.columnIndex === 7 || tableMeta.columnIndex === 19) {
Deni Rinaldi's avatar
Deni Rinaldi committed
774 775 776 777 778
                            let indexID = dataTable2.findIndex((val) => val[22] == tst)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[indexID][6]
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
779 780 781 782 783 784
                            // } else if (tableMeta.columnIndex === 19) {
                            //     let indexID = dataTable2.findIndex((val) => val[22] == tst)
                            //     if (indexID !== -1) {
                            //         let valuezz = dataTable2[indexID][7].value !== undefined ? dataTable2[indexID][7].value : dataTable2[indexID][7]
                            //         anjay.push(valuezz == "" ? 0 : valuezz)
                            //     }
Deni Rinaldi's avatar
Deni Rinaldi committed
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807
                        } else {
                            let data = tableMeta.columnIndex - 1
                            let indexID = dataTable2.findIndex((val) => val[22] == tst)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[indexID][data].value !== undefined ? dataTable2[indexID][data].value : dataTable2[indexID][data]
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                            // console.log(tst, data, tableMeta.rowData[data]);
                        }
                    } else {
                        let indexID = dataTable2.findIndex((val) => val[22] == item)
                        // console.log(dataTable2[indexID])
                        if (indexID !== -1) {
                            let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
                            anjay.push(valuezz == "" ? 0 : valuezz)
                        } else {
                            if (item === '(-1)') {
                                anjay.push(-1)
                            }
                            // console.log(item);

                        }
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
808 809
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
810 811 812
            // console.log(baru)
            // console.log(anjay)

Deni Rinaldi's avatar
Deni Rinaldi committed
813 814
            let total = 0
            let opt = ""
Deni Rinaldi's avatar
Deni Rinaldi committed
815
            anjay.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
816 817 818 819 820 821 822 823 824
                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
825
                    item = item == "" ? 0 : item
Deni Rinaldi's avatar
Deni Rinaldi committed
826 827 828 829 830 831 832
                    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
833
                        total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
834
                    } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
835
                        total += Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
836 837 838
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
839 840
            total = R.equals(total, NaN) ? "0.0" : total
            // console.log(dataTable2[tableMeta.rowIndex][22])
Deni Rinaldi's avatar
Deni Rinaldi committed
841
            // console.log(tableMeta.rowData[5])
Deni Rinaldi's avatar
Deni Rinaldi committed
842 843 844 845 846 847 848 849 850 851 852 853 854 855
            // if (tableMeta.rowData[5] == 'Beginning Balance') {
            // console.log(baru)
            // console.log(anjay)
            // console.log(total)
            // }

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

            return total
Deni Rinaldi's avatar
Deni Rinaldi committed
856 857
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
858
        const columns = [{
Deni Rinaldi's avatar
Deni Rinaldi committed
859 860 861 862
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
863
        }, {
d.arizona's avatar
d.arizona committed
864 865 866 867
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
868
        }, {
d.arizona's avatar
d.arizona committed
869 870 871 872
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
873
        }, {
d.arizona's avatar
d.arizona committed
874 875 876 877
            name: "",
            options: {
                display: false
            }
878 879 880 881 882
        }, {
            name: "",
            options: {
                display: false
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
883
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
884
            name: "Account",
Deni Rinaldi's avatar
Deni Rinaldi committed
885 886
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
887
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
888 889 890 891 892 893
                        <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
894
                        <div style={{ width: 300 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
895 896 897 898 899
                            {tableMeta.rowData[0] === null ?
                                tableMeta.rowData[4] == 0 ?
                                    <LightTooltip title={"Report Items Not Registered"} arrow>
                                        <span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(val).toUpperCase()}</span>
                                    </LightTooltip> :
900 901 902 903 904
                                    <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>
Deni Rinaldi's avatar
Deni Rinaldi committed
905
                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
906 907 908 909 910 911
                                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>
Deni Rinaldi's avatar
Deni Rinaldi committed
912 913 914 915 916 917
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
918
            name: `31 Dec ${Number(this.props.periode) - 1} Actual`,
Deni Rinaldi's avatar
Deni Rinaldi committed
919 920
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
921 922
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
923 924
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
925
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
926 927 928
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
929 930
                            {tableMeta.rowData[0] === 4 ?
                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
931
                                : tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
932 933 934 935 936 937 938 939 940 941 942 943
                                    null :
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={value}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
944
                                                    value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
945 946 947 948
                                                />
                                            }
                                        />
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
949 950 951 952
                            }
                        </div>
                    )
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
953 954
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
955
            name: `Jan ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
956 957
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
958
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
959 960 961
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
962
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
963 964 965
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
966 967 968
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
969
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
970
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
971 972 973 974 975 976 977 978 979 980 981 982
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
983
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
984 985 986 987 988 989 990 991 992 993 994 995 996 997 998
                                                        />
                                                    }
                                                />
                                            </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
999
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
1017
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1018 1019
                                                        onBlur={(event) => {
                                                            handleChange(event.target.value, tableMeta)
r.kurnia's avatar
r.kurnia committed
1020
                                                            // console.log(dataTable2)
Deni Rinaldi's avatar
Deni Rinaldi committed
1021 1022 1023
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1024
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1025 1026 1027
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1028 1029 1030 1031 1032 1033
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
1034
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1035
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1036 1037 1038 1039
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1040
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1041 1042 1043
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
d.arizona's avatar
d.arizona committed
1044
                                                        style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? '#5198ea' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1045
                                                        type="text"
Faisal Hamdi's avatar
Faisal Hamdi committed
1046
                                                        placeholder=""
1047
                                                        disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
d.arizona's avatar
d.arizona committed
1048
                                                        value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value).toFixed(1) : Number(handleValueFormula(value, tableMeta)).toFixed(1)}
1049 1050 1051 1052
                                                        onBlur={(event) => {
                                                            handleChange(event.target.value, tableMeta, 'r/e')
                                                            // console.log(dataTable2)
                                                        }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1053
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
1054
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1055 1056 1057
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
d.arizona's avatar
d.arizona committed
1058
                                                            style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? '#5198ea' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1059 1060
                                                            type="text"
                                                            placeholder=""
1061
                                                            disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
d.arizona's avatar
d.arizona committed
1062
                                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" ? Number(value.value).toFixed(1) : Number(handleValueFormula(value, tableMeta)).toFixed(1)}
1063
                                                            onBlur={(event) => {
Faisal Hamdi's avatar
Faisal Hamdi committed
1064 1065 1066 1067
                                                                handleChange(event.target.value, tableMeta, 'r/e')
                                                                // console.log(dataTable2)
                                                            }}
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1068
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1069 1070 1071
                                                        tableMeta.rowData[0] === 1 ?
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
1072 1073
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1109 1110 1111 1112 1113 1114
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1115
            name: `Feb ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1116 1117
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1118
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1119 1120 1121
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1122
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1123
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1124
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1125
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1126 1127 1128
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1129
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1130
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1143
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158
                                                        />
                                                    }
                                                />
                                            </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
1159
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
1177
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1178 1179 1180 1181 1182 1183 1184
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1185
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1186 1187 1188
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1189 1190 1191 1192 1193 1194
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
1195
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1196
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1197 1198 1199 1200
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1201
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1202 1203 1204 1205 1206 1207 1208
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1209
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1210
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
1211
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1212 1213 1214 1215 1216 1217 1218
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
1219
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1220
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1221
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
1235 1236
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1272
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1273 1274 1275 1276 1277
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1278
            name: `Mar ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1279 1280
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1281
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1282 1283 1284
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1285
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1286
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1287
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1288
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1289 1290 1291
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1292
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1293
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1306
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321
                                                        />
                                                    }
                                                />
                                            </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
1322
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
d.arizona's avatar
d.arizona committed
1339
                                                        disabled={this.props.isApprover == true ? true : ((this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1340
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1341 1342 1343 1344 1345 1346 1347
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1348
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1349 1350 1351
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1352 1353 1354 1355 1356 1357
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
1358
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1359
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1360 1361 1362 1363
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1364
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1365 1366 1367 1368 1369 1370 1371
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1372
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1373
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
1374
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1375 1376 1377 1378 1379 1380 1381
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
1382
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1383
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1384
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
1398 1399
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1435
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1436 1437 1438 1439 1440
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1441
            name: `Apr ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1442 1443
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1444
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1445 1446 1447
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1448
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1449
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1450
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1451
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1452 1453 1454
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1455
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1456
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1469
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484
                                                        />
                                                    }
                                                />
                                            </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
1485
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
1503
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1504 1505 1506 1507 1508 1509 1510
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1511
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1512 1513 1514
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1515 1516 1517 1518 1519 1520
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
1521
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1522
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1523 1524 1525 1526
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1527
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1528 1529 1530 1531 1532 1533 1534
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1535
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1536
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
1537
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1538 1539 1540 1541 1542 1543 1544
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
1545
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1546
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1547
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
1561 1562
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1598
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1599 1600 1601 1602 1603
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1604
            name: `May ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1605 1606
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1607
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1608 1609 1610
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1611
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1612
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1613
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1614
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1615 1616 1617
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1618
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
1619
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1632
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647
                                                        />
                                                    }
                                                />
                                            </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
1648
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
1666
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1667 1668 1669 1670 1671 1672 1673
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1674
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1675 1676 1677
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1678 1679 1680 1681 1682 1683
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
1684
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1685
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1686 1687 1688 1689
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1690
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1691 1692 1693 1694 1695 1696 1697
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1698
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1699
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
1700
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1701 1702 1703 1704 1705 1706 1707
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
1708
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1709
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1710
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
1724 1725
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1761
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1762 1763 1764 1765 1766
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1767
            name: `Jun ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1768 1769
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1770
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1771 1772 1773
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1774
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1775
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1776
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1777
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1778 1779 1780
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1781 1782
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1795
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810
                                                        />
                                                    }
                                                />
                                            </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
1811
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
1829
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1830 1831 1832 1833 1834 1835 1836
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1837
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1838 1839 1840
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1841 1842 1843 1844 1845 1846
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
1847
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1848
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
1849 1850 1851 1852
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1853
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1854 1855 1856 1857 1858 1859 1860
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1861
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1862
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
1863
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1864 1865 1866 1867 1868 1869 1870
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
1871
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1872
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
1873
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
1887 1888
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
1924 1925 1926 1927 1928 1929
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
1930
            name: `Jul ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1931 1932
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1933
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1934 1935 1936
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1937
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1938 1939 1940
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1941 1942 1943
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1944 1945
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1958
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973
                                                        />
                                                    }
                                                />
                                            </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
1974
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
1992
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1993 1994 1995 1996 1997 1998 1999
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2000
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2001 2002 2003
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2004 2005 2006 2007 2008 2009
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
2010
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2011
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2012 2013 2014 2015
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2016
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2017 2018 2019 2020 2021 2022 2023
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2024
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2025
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
2026
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2027 2028 2029 2030 2031 2032 2033
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
2034
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2035
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2036
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
2050 2051
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2087 2088 2089 2090 2091 2092
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2093
            name: `Aug ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2094 2095
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2096
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2097 2098 2099
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2100
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2101 2102 2103
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2104 2105 2106
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2107 2108
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2121
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136
                                                        />
                                                    }
                                                />
                                            </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
2137
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
2155
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2156 2157 2158 2159 2160 2161 2162
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2163
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2164 2165 2166
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2167 2168 2169 2170 2171 2172
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
2173
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2174
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2175 2176 2177 2178
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2179
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2180 2181 2182 2183 2184 2185 2186
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2187
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2188
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
2189
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2190 2191 2192 2193 2194 2195 2196
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
2197
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2198
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2199
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
2213 2214
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2250 2251 2252 2253 2254 2255
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2256
            name: `Sep ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2257 2258
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2259
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2260 2261 2262
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2263
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2264 2265 2266
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2267 2268 2269
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2270 2271
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2284
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299
                                                        />
                                                    }
                                                />
                                            </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
2300
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
2318
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2319 2320 2321 2322 2323 2324 2325
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2326
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2327 2328 2329
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2330 2331 2332 2333 2334 2335
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
2336
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2337
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2338 2339 2340 2341
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2342
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2343 2344 2345 2346 2347 2348 2349
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2350
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2351
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
2352
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2353 2354 2355 2356 2357 2358 2359
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
2360
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2361
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2362
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
2376 2377
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2413 2414 2415 2416 2417 2418
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2419
            name: `Oct ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2420 2421
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2422
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2423 2424 2425
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2426
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2427 2428 2429
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2430 2431 2432
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2433 2434
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2447
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462
                                                        />
                                                    }
                                                />
                                            </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
2463
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
2481
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2482 2483 2484 2485 2486 2487 2488
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2489
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2490 2491 2492
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2493 2494 2495 2496 2497 2498
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
2499
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2500
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2501 2502 2503 2504
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2505
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2506 2507 2508 2509 2510 2511 2512
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2513
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2514
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
2515
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2516 2517 2518 2519 2520 2521 2522
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
2523
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2524
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2525
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
2539 2540
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2576 2577 2578 2579 2580 2581
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2582
            name: `Nov ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2583 2584
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2585
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2586 2587 2588
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2589
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2590 2591 2592
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2593 2594 2595
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2596 2597
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2610
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625
                                                        />
                                                    }
                                                />
                                            </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
2626
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
2644
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2645 2646 2647 2648 2649 2650 2651
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2652
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2653 2654 2655
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2656 2657 2658 2659 2660 2661
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
2662
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2663
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2664 2665 2666 2667
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2668
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2669 2670 2671 2672 2673 2674 2675
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2676
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2677
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
2678
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2679 2680 2681 2682 2683 2684 2685
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
2686
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2687
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2688
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
2702 2703
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2739 2740 2741 2742 2743 2744
                            }
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2745
            name: `Dec ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
2746 2747
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2748
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2749 2750 2751
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2752
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2753 2754 2755
                customBodyRender: (value, tableMeta, updateValue) => {
                    return (
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2756 2757 2758
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2759
                                        null
Deni Rinaldi's avatar
Deni Rinaldi committed
2760
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2773
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788
                                                        />
                                                    }
                                                />
                                            </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
2789
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
2807
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2808 2809 2810 2811 2812 2813 2814
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2815
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2816 2817 2818
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2819 2820 2821 2822 2823 2824
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
2825
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2826
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2827 2828 2829 2830
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2831
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2832 2833 2834 2835 2836 2837 2838
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2839
                                                        value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2840
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
2841
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2842 2843 2844 2845 2846 2847 2848
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
2849
                                                            value={Number(handleValueFormula(value, tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2850
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2851
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
2865 2866
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2902
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2903 2904 2905 2906 2907
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
2908
            name: "Current Total",
Deni Rinaldi's avatar
Deni Rinaldi committed
2909 2910
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
2911 2912
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2913 2914
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2915
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2916
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2917
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
2918
                        <div style={{ width: 96, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2919 2920 2921
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2922 2923
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2936
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951
                                                        />
                                                    }
                                                />
                                            </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
2952
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
2970
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2971 2972 2973 2974 2975 2976 2977
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2978
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
2979 2980 2981
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2982 2983 2984 2985 2986 2987
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
2988
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2989
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
2990 2991 2992 2993
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
2994
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2995 2996 2997 2998 2999 3000 3001
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
3002
                                                        value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3003
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
3004
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
3005 3006 3007 3008 3009 3010 3011
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
3012
                                                            value={Number(handleForecast(tableMeta, `${Number(this.props.periode)}`, 19)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3013
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
3014
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
3028 3029
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
3065
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
3066 3067 3068 3069 3070
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
3071
            name: `31 Dec ${Number(this.props.periode) + 1} Total`,
Deni Rinaldi's avatar
Deni Rinaldi committed
3072 3073
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
3074 3075
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3076 3077
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
3078
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
3079
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3080
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
3081
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3082 3083 3084
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3085 3086
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
3099
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114
                                                        />
                                                    }
                                                />
                                            </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
3115
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
3133
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3134 3135 3136 3137 3138 3139 3140
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
3141
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
3142 3143 3144
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3145 3146 3147 3148 3149 3150
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
3151
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3152
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
3153 3154 3155 3156
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
3157
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
3158 3159 3160 3161 3162 3163 3164
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
3165
                                                        value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`, 20)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3166
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
3167
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
3168 3169 3170 3171 3172 3173 3174
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
3175
                                                            value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 1}`, 20)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3176
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
3177
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
3191 3192
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
d.arizona's avatar
d.arizona committed
3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
3228
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
3229 3230 3231 3232 3233
                        </div>
                    )
                }
            }
        }, {
Deni Rinaldi's avatar
Deni Rinaldi committed
3234
            name: `31 Dec ${Number(this.props.periode) + 2} Total`,
Deni Rinaldi's avatar
Deni Rinaldi committed
3235 3236
            options: {
                customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
3237 3238
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96 }}>
                        <Typography style={{ color: 'black', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3239 3240
                    </TableCell>
                ),
Deni Rinaldi's avatar
Deni Rinaldi committed
3241
                setCellProps: () => ({ style2 }),
Deni Rinaldi's avatar
Deni Rinaldi committed
3242
                customBodyRender: (value, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3243
                    return (
Deni Rinaldi's avatar
Deni Rinaldi committed
3244
                        <div style={{ textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3245 3246 3247
                            {
                                this.props.status === 'CLOSED' ?
                                    tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3248 3249
                                        null
                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261
                                        tableMeta.rowData[0] === 3 ?
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={value}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
3262
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277
                                                        />
                                                    }
                                                />
                                            </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
3278
                                                            value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295
                                                        />
                                                    }
                                                />
                                            </div>
                                    :
                                    tableMeta.rowData[0] === 3 ?
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={value}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={this.props.isApprover == true ? 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
3296
                                                        value={Number(value).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3297 3298 3299 3300 3301 3302 3303
                                                        onBlur={(event) => {
                                                            // updateValue(event.target.value)
                                                            handleChange(event.target.value, tableMeta)
                                                            // console.log(dataTable2)
                                                        }}
                                                    />
                                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
3304
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
3305 3306 3307
                                        </div> :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3308 3309 3310 3311 3312 3313
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
d.arizona's avatar
d.arizona committed
3314
                                                    value={Number(handleValue(tableMeta)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3315
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
3316 3317 3318 3319
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 4 ?
                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
3320
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
3321 3322 3323 3324 3325 3326 3327
                                                tableMeta.rowData[0] === 6 ?
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
d.arizona's avatar
d.arizona committed
3328
                                                        value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 2}`, 21)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3329
                                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
3330
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
3331 3332 3333 3334 3335 3336 3337
                                                    tableMeta.rowData[0] === 5 ?
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
d.arizona's avatar
d.arizona committed
3338
                                                            value={Number(handleForecast(tableMeta, `${Number(this.props.periode) + 2}`, 21)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
3339
                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
3340
                                                        :
Deni Rinaldi's avatar
Deni Rinaldi committed
3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353
                                                        tableMeta.rowData[0] === 1 ?
                                                            // value === "" ?
                                                            //     null :
                                                            //     <NumberFormat
                                                            //         thousandSeparator={true}
                                                            //         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //         type="text"
                                                            //         placeholder=""
                                                            //         disabled={true}
                                                            //         value={Number(value)}
                                                            //     />
                                                            null
                                                            :
d.arizona's avatar
d.arizona committed
3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValidation(value, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(value, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleValidation(value, tableMeta)).toFixed(1)}
                                                                        />
                                                                    </LightTooltip>
                                                                :
                                                                null
Deni Rinaldi's avatar
Deni Rinaldi committed
3391
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
3392 3393 3394 3395
                        </div>
                    )
                }
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
3396
        },
qorri_di's avatar
qorri_di committed
3397 3398 3399 3400 3401 3402 3403 3404 3405 3406
        {
            name: "",
            options: {
                display: false
            }
        },
        {
            name: "",
            options: {
                display: false
Deni Rinaldi's avatar
Deni Rinaldi committed
3407
            }
qorri_di's avatar
qorri_di committed
3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420
        },
        {
            name: "",
            options: {
                display: false
            }
        },
        {
            name: "",
            options: {
                display: false
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
3421
        ]
Deni Rinaldi's avatar
Deni Rinaldi committed
3422
        const loadingComponent = (
Deni Rinaldi's avatar
Deni Rinaldi committed
3423
            <div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3424 3425 3426 3427 3428 3429 3430 3431
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );
Deni Rinaldi's avatar
Deni Rinaldi committed
3432

Deni Rinaldi's avatar
Deni Rinaldi committed
3433
        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
3434
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3435
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
3436
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3437
                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3438 3439 3440 3441 3442 3443
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                {/* {this.state.loading && loadingComponent} */}
Deni Rinaldi's avatar
Deni Rinaldi committed
3444
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3445 3446 3447
                    {this.state.visibleBalanceSheet === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
3448
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Balance Sheet</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3449 3450 3451 3452 3453
                            </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>
d.arizona's avatar
d.arizona committed
3454
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3455 3456 3457
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3458
                                        {this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
qorri_di's avatar
qorri_di committed
3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479
                                            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" />
qorri_di's avatar
qorri_di committed
3480
                                            // </div> 
qorri_di's avatar
qorri_di committed
3481
                                            :
Deni Rinaldi's avatar
Deni Rinaldi committed
3482
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
syadziy's avatar
syadziy committed
3483
                                                {((!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
3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499
                                                    <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>
a.bairuha's avatar
a.bairuha committed
3500
                                                )}
syadziy's avatar
syadziy committed
3501
                                                {((!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
3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517
                                                    <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.bairuha's avatar
a.bairuha committed
3518
                                                )}
qorri_di's avatar
qorri_di committed
3519
                                                {/* <a data-tip={'Download'} data-for="download">
Deni Rinaldi's avatar
Deni Rinaldi committed
3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536
                                                    <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
3537
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
Deni Rinaldi's avatar
Deni Rinaldi committed
3538 3539
                                            </div>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
3540 3541
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3542

Deni Rinaldi's avatar
Deni Rinaldi committed
3543
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3544 3545
                                    {this.state.loading && loadingComponent}
                                    <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3546 3547 3548 3549 3550
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
3551
                                    </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
3552
                                </div>
Riri Novita's avatar
Riri Novita committed
3553 3554 3555 3556 3557
                                <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
3558 3559 3560 3561
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
Faisal Hamdi's avatar
Faisal Hamdi committed
3562
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
3563 3564 3565
                                        }
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3566
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3567 3568 3569 3570
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
3571 3572 3573 3574 3575
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
Deni Rinaldi's avatar
Deni Rinaldi committed
3576 3577 3578 3579 3580 3581 3582 3583
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none'
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
idlanirined's avatar
idlanirined committed
3584
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3585 3586 3587
                                        </div>
                                    </button>
                                </div>
d.arizona's avatar
d.arizona committed
3588
                                {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
syadziy's avatar
syadziy committed
3589
                                    (!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ?
d.arizona's avatar
d.arizona committed
3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605
                                        <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);
Deni Rinaldi's avatar
Deni Rinaldi committed
3606
                                                    })
d.arizona's avatar
d.arizona committed
3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625
                                                }}
                                            >
                                                <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.saveDraft !== true ? 'pointer' : 'default',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() =>
                                                    this.state.saveDraft === true ?
                                                        null :
3626 3627
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
d.arizona's avatar
d.arizona committed
3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642
                                                                this.backToMasterBudget('draft')
                                                            })
                                                }
                                            >
                                                <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                                </div>
                                            </button>
                                            <button
                                                type="button"
                                                disabled={this.state.buttonError}
                                                onClick={() =>
                                                    this.state.buttonError ?
                                                        this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                        :
3643 3644
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
d.arizona's avatar
d.arizona committed
3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659
                                                                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
                                }
3660
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3661 3662 3663 3664 3665
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3666 3667
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
d.arizona's avatar
d.arizona committed
3668
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3669 3670
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3671
                                    {this.state.dataLoaded && (
Deni Rinaldi's avatar
Deni Rinaldi committed
3672
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3673 3674
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3675
                                                <MUIDataTable
Deni Rinaldi's avatar
Deni Rinaldi committed
3676
                                                    data={dataTable2}
Deni Rinaldi's avatar
Deni Rinaldi committed
3677 3678 3679
                                                    columns={columns}
                                                    options={options}
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
3680
                                            </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
3681 3682 3683
                                        </div>
                                    )}
                                </div>
3684 3685 3686 3687 3688 3689

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visibleBalanceSheet: true }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3690
                                                setTimeout(() => {
3691
                                                    this.getItemHierarki()
Deni Rinaldi's avatar
Deni Rinaldi committed
3692
                                                }, 100);
3693 3694 3695 3696
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
idlanirined's avatar
idlanirined committed
3697
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
3698 3699 3700 3701 3702 3703 3704 3705 3706
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
3707
                                                cursor: 'pointer',
3708 3709 3710 3711 3712 3713 3714
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3715
                                                        this.handleValidate()
3716 3717 3718 3719 3720 3721 3722 3723 3724 3725
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
3726 3727
                                            style={{
                                                backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
3728
                                                cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
Deni Rinaldi's avatar
Deni Rinaldi committed
3729 3730 3731 3732
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3733
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
3734
                                                this.state.saveDraft === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
3735
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3736
                                                    this.setState({ loading: true }, () =>
3737 3738
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3739 3740 3741 3742 3743
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('draft')
                                                                }, 100);
                                                            })
                                                    )
Deni Rinaldi's avatar
Deni Rinaldi committed
3744
                                            }
3745 3746 3747 3748 3749 3750 3751
                                        >
                                            <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"
Deni Rinaldi's avatar
Deni Rinaldi committed
3752 3753 3754 3755 3756 3757
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
3758
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
3759 3760
                                                this.state.editable === true ?
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
3761
                                                    this.setState({ loading: true }, () =>
3762 3763
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
3764 3765 3766 3767 3768
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('submitted')
                                                                }, 100);
                                                            })
                                                    )
Deni Rinaldi's avatar
Deni Rinaldi committed
3769
                                            }
3770 3771 3772 3773 3774 3775
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787
                                </div>
                            </div>
                        </Paper>}
                </div>

                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
Deni Rinaldi's avatar
Deni Rinaldi committed
3788
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3789 3790 3791 3792 3793 3794 3795 3796 3797 3798
                                </div>
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
3799
                            </div>
Riri Novita's avatar
Riri Novita committed
3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823
                            <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 30px' }}>
                                <div className="column-1">
                                    <Autocomplete
                                        id="tipe"
                                        disableClearable
                                        options={this.props.currency}
                                        getOptionLabel={(option) => option.value}
                                        value={this.state.defaultCurrencyUpload}
                                        onChange={(event, newInputValue) => this.setState({ defaultCurrencyUpload: newInputValue })}
                                        renderInput={(params) =>
                                            <TextField
                                                {...params}
                                                variant="standard"
                                                label="Default Currency"
                                                margin="normal"
                                                style={{ marginBottom: 10 }}
                                            // InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                            // InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                            />
                                        }

                                    />
                                </div>
                            </div>
Riri Novita's avatar
Riri Novita committed
3824
                            <div style={{ padding: '15px 30px 55px' }}>
Riri Novita's avatar
Riri Novita committed
3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876
                                <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("BALANCE") && String(this.state.judul).includes("SHEET") ?
                                            this.checkUpload() :
                                            this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                    }}
                                />
                            </div>
                        </div>
                    </div>
                )}

                {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
                                        }}
                                        onClick={() => this.setState({ visibleAlertSave: false })}
                                    >
                                        <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>
3877
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3878 3879
                    </div>
                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
3880 3881 3882
            </div>
        );
    }
d.arizona's avatar
d.arizona committed
3883
}