BalanceSheet.js 339 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';
15
import { fixNumber, titleCase } from '../../library/Utils';
Deni Rinaldi's avatar
Deni Rinaldi committed
16

17 18 19 20 21 22 23 24 25
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
26
var ct = require("../../library/CustomTable");
Deni Rinaldi's avatar
Deni Rinaldi committed
27
const getMuiTheme = () => createMuiTheme(ct.customTable3());
Deni Rinaldi's avatar
Deni Rinaldi committed
28

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

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

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

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

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

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

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

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

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

Deni Rinaldi's avatar
Deni Rinaldi committed
243 244
    backToMasterBudget(type) {
        let data = []
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
        if (this.props.defaultCurrency.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(Number(i[6]).toFixed(1)),
                    january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
                    february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
                    march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
                    april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
                    may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
                    june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
                    july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
                    august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
                    september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
                    october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
                    november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17])),
                    december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18])),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
                    total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(Number(i[20])),
                    total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(Number(i[21])),
                })
Deni Rinaldi's avatar
Deni Rinaldi committed
266
            })
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(fixNumber(Number(i[6]), 1)),
                    january: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[7].value), 1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(fixNumber(Number(i[7]), 1)),
                    february: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[8].value), 1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(fixNumber(Number(i[8]), 1)),
                    march: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[9].value), 1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(fixNumber(Number(i[9]), 1)),
                    april: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[10].value), 1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(fixNumber(Number(i[10]), 1)),
                    may: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[11].value), 1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(fixNumber(Number(i[11]), 1)),
                    june: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[12].value), 1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(fixNumber(Number(i[12]), 1)),
                    july: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[13].value), 1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(fixNumber(Number(i[13]), 1)),
                    august: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[14].value), 1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(fixNumber(Number(i[14]), 1)),
                    september: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[15].value), 1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(fixNumber(Number(i[15]), 1)),
                    october: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[16].value), 1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(fixNumber(Number(i[16]), 1)),
                    november: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[17].value), 1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(fixNumber(Number(i[17]), 1)),
                    december: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[18].value), 1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(fixNumber(Number(i[18]), 1)),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(fixNumber(Number(i[19]), 1)),
                    total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(fixNumber(Number(i[20]), 1)),
                    total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(fixNumber(Number(i[21]), 1)),
                })
            })
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
291 292 293 294 295
        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
296
            "currency_id": this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
297 298 299
            "status": type,
            "balance_sheet": data
        }
300
        console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
301
        this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
302 303
        if (type == 'submitted') {
            this.props.saveToMasterBudget(payload, 'BS')
Riri Novita's avatar
Riri Novita committed
304 305 306 307 308 309 310 311 312 313 314
            // 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
315
        } else {
Riri Novita's avatar
Riri Novita committed
316
            this.props.saveToMasterBudget(payload, 'DraftBS')
d.arizona's avatar
d.arizona committed
317
        }
318
        this.props.onClickClose()
Deni Rinaldi's avatar
Deni Rinaldi committed
319 320
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
321 322
    downloadTemplate = async () => {
        let res = await fetch(
323
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/master_budget/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&currency_id=${this.props.defaultCurrency.id}`
Deni Rinaldi's avatar
Deni Rinaldi committed
324
        )
Riri Novita's avatar
Riri Novita committed
325
        console.log(res);
Deni Rinaldi's avatar
Deni Rinaldi committed
326
        res = await res.blob()
Riri Novita's avatar
Riri Novita committed
327
        console.log(res)
Deni Rinaldi's avatar
Deni Rinaldi committed
328 329 330 331
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
332
            a.download = 'Template Master Budget Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
333 334 335 336
            a.click();
        }
    }

Riri Novita's avatar
Riri Novita committed
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
    // 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
354 355 356 357 358
    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
r.kurnia's avatar
r.kurnia committed
359
                // console.log(err);
Deni Rinaldi's avatar
Deni Rinaldi committed
360 361 362
            }
            else {
                let isi = resp.rows.slice(3)
Deni Rinaldi's avatar
Deni Rinaldi committed
363
                // console.log(resp.rows[2]);
Deni Rinaldi's avatar
Deni Rinaldi committed
364
                let payload = []
365
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
Deni Rinaldi's avatar
Deni Rinaldi committed
366 367 368
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
Deni Rinaldi's avatar
Deni Rinaldi committed
369 370
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
                            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
387 388 389 390 391 392 393
                        })
                    }
                })
                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
394 395
                    balance_sheet: payload,
                    status: 'submitted'
Deni Rinaldi's avatar
Deni Rinaldi committed
396
                }
397
                console.log(body)
Deni Rinaldi's avatar
Deni Rinaldi committed
398
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
Deni Rinaldi's avatar
Deni Rinaldi committed
399 400 401 402
            }
        });
    }

403
    checkUpload() {
Riri Novita's avatar
Riri Novita committed
404 405 406 407 408
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
        api.create().checkUploadMB(payload).then(response => {
r.kurnia's avatar
r.kurnia committed
409
            // console.log(response)
Deni Rinaldi's avatar
Deni Rinaldi committed
410 411
            if (response.data) {
                if (response.data.status === 'success') {
Deni Rinaldi's avatar
Deni Rinaldi committed
412 413 414 415 416 417 418 419 420 421
                    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,
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.january, formula: item.january_formula } : Number(item.january),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.february, formula: item.february_formula } : Number(item.february),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.march, formula: item.march_formula } : Number(item.march),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.april, formula: item.april_formula } : Number(item.april),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.may, formula: item.may_formula } : Number(item.may),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.june, formula: item.june_formula } : Number(item.june),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.july, formula: item.july_formula } : Number(item.july),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.august, formula: item.august_formula } : Number(item.august),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.september, formula: item.september_formula } : Number(item.september),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.october, formula: item.october_formula } : Number(item.october),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.november, formula: item.november_formula } : Number(item.november),
                            item.type_report_id == 5 || item.type_report_id == 6 ? { value: item.december, formula: item.december_formula } : Number(item.december),
                            Number(item.total_current_year),
                            Number(item.total_next_year),
                            Number(item.total_more_year),
Deni Rinaldi's avatar
Deni Rinaldi committed
437
                            item.orders,
Deni Rinaldi's avatar
Deni Rinaldi committed
438 439
                            item.condition_it_should_be,
                            item.condition_if_wrong,
Deni Rinaldi's avatar
Deni Rinaldi committed
440
                            item.forecast_formula == null ? [] : item.forecast_formula,
Deni Rinaldi's avatar
Deni Rinaldi committed
441 442 443
                            item.error
                        ]
                    })
444
                    console.log(dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
445
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true, errorPreview: false, saveDraft: true }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
446
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
447
                            if (item[26].length > 0) {
r.kurnia's avatar
r.kurnia committed
448
                                // console.log('error')
Deni Rinaldi's avatar
Deni Rinaldi committed
449
                                this.setState({ buttonError: true, errorPreview: true, editable: true, saveDraft: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
450 451 452
                            }
                        })
                        // console.log(this.state.dataTable);
453
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
454
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
455
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
456
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
457 458 459 460 461 462 463 464 465 466
                            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
467 468 469
        })
    }

470
    uploadBalanceSheet(type) {
Deni Rinaldi's avatar
Deni Rinaldi committed
471
        let data = []
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
        if (this.state.defaultCurrencyUpload?.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(Number(i[6]).toFixed(1)),
                    january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
                    february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
                    march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
                    april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
                    may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
                    june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
                    july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
                    august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
                    september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
                    october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
                    november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17])),
                    december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18])),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
                    total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(Number(i[20])),
                    total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(Number(i[21])),
                })
Deni Rinaldi's avatar
Deni Rinaldi committed
493
            })
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(Number(i[6]).toFixed(1)),
                    january: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[7].value), 1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(fixNumber(Number(i[7]), 1)),
                    february: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[8].value), 1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(fixNumber(Number(i[8]), 1)),
                    march: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[9].value), 1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(fixNumber(Number(i[9]), 1)),
                    april: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[10].value), 1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(fixNumber(Number(i[10]), 1)),
                    may: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[11].value), 1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(fixNumber(Number(i[11]), 1)),
                    june: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[12].value), 1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(fixNumber(Number(i[12]), 1)),
                    july: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[13].value), 1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(fixNumber(Number(i[13]), 1)),
                    august: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[14].value), 1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(fixNumber(Number(i[14]), 1)),
                    september: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[15].value), 1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(fixNumber(Number(i[15]), 1)),
                    october: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[16].value), 1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(fixNumber(Number(i[16]), 1)),
                    november: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[17].value), 1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(fixNumber(Number(i[17]), 1)),
                    december: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[18].value), 1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(fixNumber(Number(i[18]), 1)),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(fixNumber(Number(i[19]), 1)),
                    total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(fixNumber(Number(i[20]), 1)),
                    total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(fixNumber(Number(i[21]), 1)),
                })
            })
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
518
        let body = {
Deni Rinaldi's avatar
Deni Rinaldi committed
519
            submission_id: this.props.submissionID,
Deni Rinaldi's avatar
Deni Rinaldi committed
520 521 522
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
Riri Novita's avatar
Riri Novita committed
523
            currency_id: this.state.defaultCurrencyUpload?.id,
524 525
            balance_sheet: data,
            status: type
Deni Rinaldi's avatar
Deni Rinaldi committed
526 527
        }
        api.create('UPLOAD').uploadMasterBudget(body).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
528
            // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
529 530 531
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
d.arizona's avatar
d.arizona committed
532 533
                    if (type == 'submitted') {
                        this.props.getReport('BS')
Riri Novita's avatar
Riri Novita committed
534 535 536 537 538 539 540 541 542 543 544
                        // let bodyRatioBs = {
                        //     "report": 'ratio',
                        //     "submissionId": this.props.submissionID,
                        //     "periode": this.props.periode,
                        //     "companyId": this.props.company.company_id,
                        //     "currency_id": this.props.defaultCurrency.id,
                        // }
                        // api.create().triggerRatioMB(bodyRatioBs).then((res) => {
                        //     console.log(res)
                        //     this.setState({ loading: false })
                        // })
d.arizona's avatar
d.arizona committed
545 546 547
                    } else {
                        this.props.getReport()
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
548
                } else {
549 550 551 552 553 554 555 556 557 558 559 560
                    if (response.data.message == "Please Set Up Rate Currency First") {
                        this.setState({ visibleAlertSave: true })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
561 562
                }
            } else {
d.arizona's avatar
d.arizona committed
563
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
564 565 566 567
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
568
    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
569
        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
570
        // console.log(url);
Deni Rinaldi's avatar
Deni Rinaldi committed
571
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
572
            `${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
573 574 575 576 577 578 579
        )
        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;
580
            a.download = 'Master Budget Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
581 582 583 584
            a.click();
        }
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
585 586
    handleValidate() {
        let data = []
587
        // console.log(this.state.dataTable)
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608
        if (this.props.defaultCurrency.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(Number(i[6])),
                    january: i[0] === 5 || i[0] === 6 ? String(Number(i[7].value)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
                    february: i[0] === 5 || i[0] === 6 ? String(Number(i[8].value)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
                    march: i[0] === 5 || i[0] === 6 ? String(Number(i[9].value)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
                    april: i[0] === 5 || i[0] === 6 ? String(Number(i[10].value)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
                    may: i[0] === 5 || i[0] === 6 ? String(Number(i[11].value)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
                    june: i[0] === 5 || i[0] === 6 ? String(Number(i[12].value)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
                    july: i[0] === 5 || i[0] === 6 ? String(Number(i[13].value)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
                    august: i[0] === 5 || i[0] === 6 ? String(Number(i[14].value)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
                    september: i[0] === 5 || i[0] === 6 ? String(Number(i[15].value)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
                    october: i[0] === 5 || i[0] === 6 ? String(Number(i[16].value)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
                    november: i[0] === 5 || i[0] === 6 ? String(Number(i[17].value)) : i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17])),
                    december: i[0] === 5 || i[0] === 6 ? String(Number(i[18].value)) : i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18])),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
                    total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(Number(i[20])),
                    total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(Number(i[21])),
                })
Deni Rinaldi's avatar
Deni Rinaldi committed
609
            })
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(fixNumber(Number(i[6]), 1)),
                    january: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[7].value), 1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(fixNumber(Number(i[7]), 1)),
                    february: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[8].value), 1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(fixNumber(Number(i[8]), 1)),
                    march: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[9].value), 1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(fixNumber(Number(i[9]), 1)),
                    april: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[10].value), 1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(fixNumber(Number(i[10]), 1)),
                    may: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[11].value), 1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(fixNumber(Number(i[11]), 1)),
                    june: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[12].value), 1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(fixNumber(Number(i[12]), 1)),
                    july: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[13].value), 1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(fixNumber(Number(i[13]), 1)),
                    august: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[14].value), 1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(fixNumber(Number(i[14]), 1)),
                    september: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[15].value), 1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(fixNumber(Number(i[15]), 1)),
                    october: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[16].value), 1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(fixNumber(Number(i[16]), 1)),
                    november: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[17].value), 1)) : i[0] === 3 && i[17] === "" ? "0.0" : String(fixNumber(Number(i[17]), 1)),
                    december: i[0] === 5 || i[0] === 6 ? String(fixNumber(Number(i[18].value), 1)) : i[0] === 3 && i[18] === "" ? "0.0" : String(fixNumber(Number(i[18]), 1)),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(fixNumber(Number(i[19]), 1)),
                    total_next_year: i[0] === 3 && i[20] === "" ? "0.0" : String(fixNumber(Number(i[20]), 1)),
                    total_more_year: i[0] === 3 && i[21] === "" ? "0.0" : String(fixNumber(Number(i[21]), 1)),
                })
            })
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
634
        // console.log(JSON.stringify(data))
Deni Rinaldi's avatar
Deni Rinaldi committed
635 636 637 638 639
        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
640
            "currency_id": this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
641 642 643
            "balance_sheet": data,
            "status": "submitted"
        }
Riri Novita's avatar
Riri Novita committed
644
        console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
645
        api.create().validateSubmitReport(payload).then((response) => {
Riri Novita's avatar
Riri Novita committed
646
            console.log(response)
Deni Rinaldi's avatar
Deni Rinaldi committed
647 648 649 650 651 652 653 654
            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
655
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
656
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
657 658 659 660 661 662 663 664 665 666
                            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
667 668 669
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
670
    render() {
d.arizona's avatar
d.arizona committed
671
        let dataTable2 = this.state.dataTable
672
        const handleChange = (value, tableMeta, type) => {
d.arizona's avatar
d.arizona committed
673
            let val = String(value).split(",").join("")
674
            // console.log('masuk')
675
            if (type === "actual") {
676
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val)
677
            } else {
678
                // console.log('masuk2')
679 680 681
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
                    // console.log(indexParent)
682 683 684
                    let a = 0
                    if (type == 'r/e') {
                        // console.log('masuk8')
685
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val)
686 687
                    } else {
                        // console.log('masuk9')
688
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val)
689
                    }
690
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
691
                    a = dataTable2[indexParent][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? (jagain === undefined ? (0 + fixNumber(Number(val)), 1) : Number(jagain + fixNumber(Number(val)), 1)) : (jagain === undefined ? (0 + Number(val)) : Number(jagain + Number(val)))
692
                } else {
693 694 695
                    // console.log('masuk3')
                    if (type == 'r/e') {
                        // console.log('masuk4')
696
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val)
697 698
                    } else {
                        // console.log('masuk5')
699
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val)
700
                    }
701
                }
d.arizona's avatar
d.arizona committed
702 703
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
704
        const handleTotal = (tableMeta) => {
705
            let total = dataTable2[tableMeta.rowIndex][19] = dataTable2[tableMeta.rowIndex][18]
Deni Rinaldi's avatar
Deni Rinaldi committed
706 707 708
            return total
            // console.log(total);
        }
d.arizona's avatar
d.arizona committed
709 710 711
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
712 713 714
                // if (data.rowData[5] == 'Retained Earnings') {
                //     console.log(item[data.columnIndex].value)
                // }
Deni Rinaldi's avatar
Deni Rinaldi committed
715
                if (data.rowData[1] === item[2]) {
Deni Rinaldi's avatar
Deni Rinaldi committed
716 717
                    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
718 719
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
720
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
721
            let a = dataTable2[data.rowIndex][data.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(total), 1) : Number(total)
d.arizona's avatar
d.arizona committed
722 723 724
            // console.log(indexParent);
            return a
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
725 726 727 728 729 730 731
        const handleForecast = (tableMeta, periode, column) => {
            let total = 0
            // console.log(tableMeta.rowData)

            // console.log(tableMeta.rowIndex)
            // console.log(total)
            // dataTable2[tableMeta.rowIndex][column] = total
732 733 734 735 736 737
            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
738 739 740 741
            // console.log(total)
            return total
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
742
        const handleFormula = (data, tableMeta) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
743 744 745
            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
746
                let index = dataTable2.findIndex((val) => val[22] == item)
Deni Rinaldi's avatar
Deni Rinaldi committed
747
                if (index > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
748
                    arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
Deni Rinaldi's avatar
Deni Rinaldi committed
749 750 751 752
                } else {
                    arrayJumlah.push(item)
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778
            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
                    }
                }
            })
779
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(total), 1) : Number(total)
Deni Rinaldi's avatar
Deni Rinaldi committed
780
            return a
Deni Rinaldi's avatar
Deni Rinaldi committed
781 782

        }
Deni Rinaldi's avatar
Deni Rinaldi committed
783

Deni Rinaldi's avatar
Deni Rinaldi committed
784
        const handleValidation = (data, tableMeta) => {
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 808 809 810 811 812 813 814 815 816 817 818
            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
819
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854
                    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
855
                        if (tableMeta.columnIndex === 7 || tableMeta.columnIndex === 19) {
Deni Rinaldi's avatar
Deni Rinaldi committed
856 857 858 859 860
                            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
861 862 863 864 865 866
                            // } 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
867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889
                        } 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
890 891
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
892 893 894
            // console.log(baru)
            // console.log(anjay)

Deni Rinaldi's avatar
Deni Rinaldi committed
895 896
            let total = 0
            let opt = ""
Deni Rinaldi's avatar
Deni Rinaldi committed
897
            anjay.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
898 899 900 901 902 903 904 905 906
                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
907
                    item = item == "" ? 0 : item
Deni Rinaldi's avatar
Deni Rinaldi committed
908 909 910 911 912 913 914
                    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
915
                        total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
916
                    } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
917
                        total += Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
918 919 920
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
921 922
            total = R.equals(total, NaN) ? "0.0" : total
            // console.log(dataTable2[tableMeta.rowIndex][22])
Deni Rinaldi's avatar
Deni Rinaldi committed
923
            // console.log(tableMeta.rowData[5])
Deni Rinaldi's avatar
Deni Rinaldi committed
924 925 926 927 928 929 930 931 932 933 934 935 936 937
            // 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
938 939
        }

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

Deni Rinaldi's avatar
Deni Rinaldi committed
3875
        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
3876
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3877
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
3878
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Master Budget Submission</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3879
                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3880 3881 3882 3883 3884 3885
                <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
3886
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3887 3888 3889
                    {this.state.visibleBalanceSheet === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
3890
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Master Budget - Balance Sheet</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
3891 3892 3893 3894 3895
                            </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
3896
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
Riri Novita's avatar
Riri Novita committed
3897 3898 3899 3900 3901
                                        {this.props.defaultCurrency.id === 1 ?
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                            :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
3902 3903
                                    </div>
                                    <div style={{ width: '50%' }}>
3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965
                                        {this.state.dataTable.length == 0 ? null : this.props.isApprover == true ?
                                            null
                                            // <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                            //     <a data-tip={'Download'} data-for="download">
                                            //         <button
                                            //             style={{
                                            //                 backgroundColor: 'transparent',
                                            //                 cursor: 'pointer',
                                            //                 borderColor: 'transparent',
                                            //                 margin: 5
                                            //             }}
                                            //             onClick={() =>
                                            //                 this.setState({ loading: true }, () => {
                                            //                     setTimeout(() => {
                                            //                         this.downloadAllData()
                                            //                     }, 100);
                                            //                 })}
                                            //         >
                                            //             <img src={Images.download} />
                                            //         </button>
                                            //     </a>
                                            //     <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                            // </div> 
                                            :
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                {((!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
                                                    <div>
                                                        <a data-tip={'Download Template'} data-for="template">
                                                            <button
                                                                style={{
                                                                    backgroundColor: 'transparent',
                                                                    cursor: 'pointer',
                                                                    borderColor: 'transparent',
                                                                    margin: 5
                                                                }}
                                                                onClick={() => this.downloadTemplate()}
                                                            >
                                                                <img src={Images.template} />
                                                            </button>
                                                        </a>
                                                        <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                    </div>
                                                )}
                                                {((!this.props.truelyApprover) && (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted')) && (
                                                    <div>
                                                        <a data-tip={'Upload'} data-for="upload">
                                                            <button
                                                                style={{
                                                                    backgroundColor: 'transparent',
                                                                    cursor: 'pointer',
                                                                    borderColor: 'transparent',
                                                                    margin: 5
                                                                }}
                                                                onClick={() => this.setState({ visibleUpload: true })}
                                                            >
                                                                <img src={Images.upload} />
                                                            </button>
                                                        </a>
                                                        <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                    </div>
                                                )}
                                                {/* <a data-tip={'Download'} data-for="download">
Deni Rinaldi's avatar
Deni Rinaldi committed
3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982
                                                    <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
3983
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
3984 3985
                                            </div>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
3986 3987
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
3988

Deni Rinaldi's avatar
Deni Rinaldi committed
3989
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3990 3991
                                    {this.state.loading && loadingComponent}
                                    <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
3992 3993 3994 3995 3996
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
3997
                                    </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
3998
                                </div>
Riri Novita's avatar
Riri Novita committed
3999 4000 4001 4002 4003
                                <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) => {
fahrur huzain's avatar
fahrur huzain committed
4004 4005 4006 4007
                                                    return (
                                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                    )
                                                }) :
Faisal Hamdi's avatar
Faisal Hamdi committed
4008
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
4009 4010 4011
                                        }
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
4012
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
4013 4014 4015 4016
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
4017 4018 4019 4020 4021
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
Deni Rinaldi's avatar
Deni Rinaldi committed
4022 4023 4024 4025 4026 4027 4028 4029
                                        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
4030
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
4031 4032 4033
                                        </div>
                                    </button>
                                </div>
d.arizona's avatar
d.arizona committed
4034
                                {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
syadziy's avatar
syadziy committed
4035
                                    (!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
4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051
                                        <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
4052
                                                    })
d.arizona's avatar
d.arizona committed
4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071
                                                }}
                                            >
                                                <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 :
4072 4073
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
d.arizona's avatar
d.arizona committed
4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088
                                                                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' })
                                                        :
4089 4090
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
d.arizona's avatar
d.arizona committed
4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105
                                                                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
                                }
4106
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
4107 4108 4109 4110 4111
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
4112 4113
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
d.arizona's avatar
d.arizona committed
4114
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
Riri Novita's avatar
Riri Novita committed
4115 4116 4117 4118 4119
                                        {this.props.defaultCurrency.id === 1 ?
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                            :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
4120
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
4121
                                    {this.state.dataLoaded && (
Deni Rinaldi's avatar
Deni Rinaldi committed
4122
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
4123 4124
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
Deni Rinaldi's avatar
Deni Rinaldi committed
4125
                                                <MUIDataTable
Deni Rinaldi's avatar
Deni Rinaldi committed
4126
                                                    data={dataTable2}
Deni Rinaldi's avatar
Deni Rinaldi committed
4127 4128 4129
                                                    columns={columns}
                                                    options={options}
                                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
4130
                                            </MuiThemeProvider>
Deni Rinaldi's avatar
Deni Rinaldi committed
4131 4132 4133
                                        </div>
                                    )}
                                </div>
4134 4135 4136 4137 4138 4139

                                <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
4140
                                                setTimeout(() => {
4141
                                                    this.getItemHierarki()
Deni Rinaldi's avatar
Deni Rinaldi committed
4142
                                                }, 100);
4143 4144 4145 4146
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
idlanirined's avatar
idlanirined committed
4147
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
4148 4149 4150 4151 4152 4153 4154 4155 4156
                                            </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
4157
                                                cursor: 'pointer',
4158 4159 4160 4161 4162 4163 4164
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
4165
                                                        this.handleValidate()
4166 4167 4168 4169 4170 4171 4172 4173 4174 4175
                                                    }, 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
4176 4177
                                            style={{
                                                backgroundColor: 'transparent',
Deni Rinaldi's avatar
Deni Rinaldi committed
4178
                                                cursor: this.state.saveDraft !== true ? 'pointer' : 'default',
Deni Rinaldi's avatar
Deni Rinaldi committed
4179 4180 4181 4182
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
4183
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
4184
                                                this.state.saveDraft === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
4185
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
4186
                                                    this.setState({ loading: true }, () =>
4187 4188
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
4189 4190 4191 4192 4193
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('draft')
                                                                }, 100);
                                                            })
                                                    )
Deni Rinaldi's avatar
Deni Rinaldi committed
4194
                                            }
4195 4196 4197 4198 4199 4200 4201
                                        >
                                            <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
4202 4203 4204 4205 4206 4207
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
4208
                                            onClick={() =>
Deni Rinaldi's avatar
Deni Rinaldi committed
4209 4210
                                                this.state.editable === true ?
                                                    null :
Deni Rinaldi's avatar
Deni Rinaldi committed
4211
                                                    this.setState({ loading: true }, () =>
4212 4213
                                                        this.state.handleDoubleClick == 1 ? null :
                                                            this.setState({ handleDoubleClick: 1 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
4214 4215 4216 4217 4218
                                                                setTimeout(() => {
                                                                    this.uploadBalanceSheet('submitted')
                                                                }, 100);
                                                            })
                                                    )
Deni Rinaldi's avatar
Deni Rinaldi committed
4219
                                            }
4220 4221 4222 4223 4224 4225
                                        >
                                            <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
4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237
                                </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
4238
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
4239 4240 4241 4242 4243 4244 4245 4246 4247 4248
                                </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>
4249
                            </div>
Riri Novita's avatar
Riri Novita committed
4250
                            <div style={{ padding: '25px 30px' }}>
Riri Novita's avatar
Riri Novita committed
4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266
                                <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>
4267
                            <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data in <b>{this.props.defaultCurrency.id == 1 ? "IDR mn" : "thousand USD"}</b></div>
Riri Novita's avatar
Riri Novita committed
4268

Riri Novita's avatar
Riri Novita committed
4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296
                        </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
                                        }}
4297
                                        onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0, loading : false })}
Riri Novita's avatar
Riri Novita committed
4298 4299 4300 4301 4302 4303 4304
                                    >
                                        <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>
4305
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
4306 4307
                    </div>
                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
4308 4309 4310
            </div>
        );
    }
d.arizona's avatar
d.arizona committed
4311
}