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

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

Deni Rinaldi's avatar
Deni Rinaldi committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
var ct = require("../../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable3());

const options = ct.customOptionsFixedColumn();

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

export default class BalanceSheetMR extends Component {
Deni Rinaldi's avatar
Deni Rinaldi committed
44 45 46 47
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
d.arizona's avatar
d.arizona committed
48
            loading: true,
Deni Rinaldi's avatar
Deni Rinaldi committed
49 50 51
            visibleBSMR: true,
            valueThreshold: 0,
            minValue: 0,
Deni Rinaldi's avatar
Deni Rinaldi committed
52
            maxValue: 0,
faisalhamdi's avatar
faisalhamdi committed
53
            updateBy: [],
rifkaki's avatar
rifkaki committed
54 55
            notes: "",
            judulColumn: null,
d.arizona's avatar
d.arizona committed
56
            get_for: "view",
Riri Novita's avatar
Riri Novita committed
57
            viewOnly : true,
d.arizona's avatar
d.arizona committed
58
            kansas: 0
Deni Rinaldi's avatar
Deni Rinaldi committed
59
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
60
        this.fileHandler = this.fileHandler.bind(this);
Deni Rinaldi's avatar
Deni Rinaldi committed
61
    }
Deni Rinaldi's avatar
Deni Rinaldi committed
62

Deni Rinaldi's avatar
Deni Rinaldi committed
63
    componentDidMount() {
Deni Rinaldi's avatar
Deni Rinaldi committed
64
        this.getSettingControl()
Deni Rinaldi's avatar
Deni Rinaldi committed
65
        this.getLatestUpdate()
Riri Novita's avatar
Riri Novita committed
66 67 68 69 70 71 72
        this.handleViewOnly()
    }

    handleViewOnly() {
        let checkApprover = false
        let checkLastStatus = false
        let checkStatus = false
d.arizona's avatar
d.arizona committed
73
        let checkPrevRev = false
Riri Novita's avatar
Riri Novita committed
74 75 76 77 78 79 80 81 82 83 84 85

        if (this.props.isApprover) {
            checkApprover = true
        } else {
            checkApprover = false
        }
        
        if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
            checkLastStatus = true
        } else {
            checkLastStatus = false
        } 
d.arizona's avatar
d.arizona committed
86 87 88 89 90 91
        
        if (this.props.prevRevision) {
            checkPrevRev = true
        } else {
            checkPrevRev = false
        }
Riri Novita's avatar
Riri Novita committed
92 93 94 95 96 97 98
        
        if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
            checkStatus = true
        } else {
            checkStatus = false
        }

d.arizona's avatar
d.arizona committed
99
        this.setState({viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev})
Deni Rinaldi's avatar
Deni Rinaldi committed
100 101 102 103 104 105 106 107 108 109 110
    }

    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,
            "monthly_report_id": this.props.monthlyReportId,
            "months": this.props.month.month_id
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
111 112
        api.create().getLastestUpdateMR(payload).then(response => {
            console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
113 114 115
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
faisalhamdi's avatar
faisalhamdi committed
116
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail,
Deni Rinaldi's avatar
Deni Rinaldi committed
117
                        notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
Deni Rinaldi's avatar
Deni Rinaldi committed
118 119 120
                    })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
121
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
122 123 124 125 126 127 128 129 130 131 132
                            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
133 134 135 136
    }

    getSettingControl() {
        let body = {
d.arizona's avatar
d.arizona committed
137
            group: 'THRESHOLD_VARIANCE',
Deni Rinaldi's avatar
Deni Rinaldi committed
138 139 140 141 142 143 144 145 146
            company_id: this.props.company.company_id,
            type: 'BALANCE_SHEET'
        }

        api.create().getAllSettingByType(body).then(response => {
            console.log(response);
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({
Deni Rinaldi's avatar
Deni Rinaldi committed
147 148
                        minValue: response.data.data[0] ? Number(response.data.data[0].min_value) : -5,
                        maxValue: response.data.data[0] ? Number(response.data.data[0].max_value) : 5,
Deni Rinaldi's avatar
Deni Rinaldi committed
149 150 151 152 153
                    }, () => {
                        this.getItemHierarki()
                    })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
154
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
155 156 157 158 159 160 161 162 163 164 165
                            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
166 167
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
168
    getItemHierarki() {
Deni Rinaldi's avatar
Deni Rinaldi committed
169
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
170
            "report_id": this.props.report_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
171 172 173
            "revision": Number(this.props.revision),
            "periode": this.props.periode,
            "company_id": this.props.company.company_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
174
            "monthly_report_id": this.props.monthlyReportId,
d.arizona's avatar
d.arizona committed
175 176
            "months": this.props.month.month_id,
            "get_for" : this.state.get_for
Deni Rinaldi's avatar
Deni Rinaldi committed
177
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
178
        api.create().getHierarkiMontlyReportBS(payload).then(response => {
rifkaki's avatar
rifkaki committed
179
            console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
180
            console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
181
            let dataTable = []
d.arizona's avatar
d.arizona committed
182 183
            let err = false

Deni Rinaldi's avatar
Deni Rinaldi committed
184 185 186 187
            if (response.data) {
                let res = response.data.data
                const handlePushChild = (item) => {
                    let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
rifkaki's avatar
rifkaki committed
188
                    if (item.type_report_id === 3) {    
d.arizona's avatar
d.arizona committed
189 190 191
                        // if (item.balance_sheet.mtd_vs_previous_month == "" &&  Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) {
                        //     err = true
                        // } 
d.arizona's avatar
d.arizona committed
192 193 194
                        if (item.balance_sheet.mtd_vs_mb == "" &&  Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) {
                            err = true
                        }
d.arizona's avatar
d.arizona committed
195 196 197
                        // if (item.balance_sheet.mtd_vs_rb == "" &&  Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) {
                        //     err = true
                        // }
d.arizona's avatar
d.arizona committed
198
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
199 200 201 202 203 204 205 206
                    if (indexIDzz === -1) {
                        dataTable.push([
                            item.type_report_id,
                            item.id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.description,
Deni Rinaldi's avatar
Deni Rinaldi committed
207 208 209 210
                            item.balance_sheet.rolling_outlook === null ? "0" : item.balance_sheet.rolling_outlook === "" ? "0" : item.balance_sheet.rolling_outlook,
                            item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget,
                            item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget,
                            item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual,
Deni Rinaldi's avatar
Deni Rinaldi committed
211
                            item.balance_sheet.actual_previous_month === null ? "0.0" : item.balance_sheet.actual_previous_month === "" ? "0.0" : item.balance_sheet.actual_previous_month,
Deni Rinaldi's avatar
Deni Rinaldi committed
212 213 214 215 216 217
                            item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month,
                            item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month,
                            item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb,
                            item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb,
                            item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb,
                            item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb,
Deni Rinaldi's avatar
Deni Rinaldi committed
218 219 220
                            item.balance_sheet.mtd_vs_previous_month === null ? "" : item.balance_sheet.mtd_vs_previous_month,
                            item.balance_sheet.mtd_vs_mb === null ? "" : item.balance_sheet.mtd_vs_mb,
                            item.balance_sheet.mtd_vs_rb === null ? "" : item.balance_sheet.mtd_vs_rb,
d.arizona's avatar
d.arizona committed
221
                            item.balance_sheet.actual_formula,
rifkaki's avatar
rifkaki committed
222 223 224
                            item.order,
                            item.condition_it_should_be,
                            item.condition_if_wrong
Deni Rinaldi's avatar
Deni Rinaldi committed
225 226 227 228 229 230 231 232 233 234 235
                        ])
                    }
                    if (item.children !== null) {
                        if (item.children.length > 0) {
                            item.children.map((items, indexs) => {
                                handlePushChild(items)
                            })
                        }
                    }
                }
                res.map((item, index) => {
rifkaki's avatar
rifkaki committed
236
                    if (item.type_report_id === 3) {    
d.arizona's avatar
d.arizona committed
237 238 239
                        // if (item.balance_sheet.mtd_vs_previous_month == "" &&  Number(item.balance_sheet.percent_act_vs_previous_month) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_previous_month) > this.state.maxValue) {
                        //     err = true
                        // } 
d.arizona's avatar
d.arizona committed
240 241 242
                        if (item.balance_sheet.mtd_vs_mb == "" &&  Number(item.balance_sheet.percent_act_vs_mb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_mb) > this.state.maxValue) {
                            err = true
                        }
d.arizona's avatar
d.arizona committed
243 244 245
                        // if (item.balance_sheet.mtd_vs_rb == "" &&  Number(item.balance_sheet.percent_act_vs_rb) < this.state.minValue || Number(item.balance_sheet.percent_act_vs_rb) > this.state.maxValue) {
                        //     err = true
                        // }
d.arizona's avatar
d.arizona committed
246
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
247 248 249 250 251 252 253
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
Deni Rinaldi's avatar
Deni Rinaldi committed
254 255 256 257
                        item.balance_sheet.rolling_outlook === null ? "0" : item.balance_sheet.rolling_outlook === "" ? "0" : item.balance_sheet.rolling_outlook,
                        item.balance_sheet.master_budget === "" ? "0" : item.balance_sheet.master_budget,
                        item.balance_sheet.rolling_budget === "" ? "0" : item.balance_sheet.rolling_budget,
                        item.balance_sheet.actual === "" ? "0" : item.balance_sheet.actual,
Deni Rinaldi's avatar
Deni Rinaldi committed
258
                        item.balance_sheet.actual_previous_month === null ? "0.0" : item.balance_sheet.actual_previous_month === "" ? "0.0" : item.balance_sheet.actual_previous_month,
Deni Rinaldi's avatar
Deni Rinaldi committed
259 260 261 262 263 264
                        item.balance_sheet.amount_act_vs_previous_month === "" ? "0" : item.balance_sheet.amount_act_vs_previous_month,
                        item.balance_sheet.percent_act_vs_previous_month === "" ? "0" : item.balance_sheet.percent_act_vs_previous_month,
                        item.balance_sheet.amount_act_vs_mb === "" ? "0" : item.balance_sheet.amount_act_vs_mb,
                        item.balance_sheet.percent_act_vs_mb === "" ? "0" : item.balance_sheet.percent_act_vs_mb,
                        item.balance_sheet.amount_act_vs_rb === "" ? "0" : item.balance_sheet.amount_act_vs_rb,
                        item.balance_sheet.percent_act_vs_rb === "" ? "0" : item.balance_sheet.percent_act_vs_rb,
Deni Rinaldi's avatar
Deni Rinaldi committed
265 266 267
                        item.balance_sheet.mtd_vs_previous_month === null ? "" : item.balance_sheet.mtd_vs_previous_month,
                        item.balance_sheet.mtd_vs_mb === null ? "" : item.balance_sheet.mtd_vs_mb,
                        item.balance_sheet.mtd_vs_rb === null ? "" : item.balance_sheet.mtd_vs_rb,
d.arizona's avatar
d.arizona committed
268
                        item.balance_sheet.actual_formula,
rifkaki's avatar
rifkaki committed
269 270 271
                        item.order,
                        item.condition_it_should_be,
                        item.condition_if_wrong
Deni Rinaldi's avatar
Deni Rinaldi committed
272 273 274 275 276 277 278 279 280
                    ])
                    if (item.children !== null) {
                        if (item.children.length > 0) {
                            item.children.map((items, indexs) => {
                                handlePushChild(items)
                            })
                        }
                    }
                })
d.arizona's avatar
d.arizona committed
281 282 283
                if (err === true) {
                    this.setState({ bebas: true })
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
284
                this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
285
            }
Riri Novita's avatar
Riri Novita committed
286
            console.log(dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
287 288 289
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
290 291
    downloadTemplate = async () => {
        let res = await fetch(
292
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&months=${this.props.month.month_id}`
Deni Rinaldi's avatar
Deni Rinaldi committed
293 294 295 296 297 298 299 300 301 302 303 304 305
        )
        res = await res.blob()
        // console.log(res)
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Monthly Report Balance Sheet.xlsx';
            a.click();
        }
    }

    async downloadAllData() {
rifkaki's avatar
rifkaki committed
306
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
Deni Rinaldi's avatar
Deni Rinaldi committed
307 308
        console.log(url);
        let res = await fetch(
rifkaki's avatar
rifkaki committed
309
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/monthly_report/export_monthly_report?monthly_report_id=${this.props.monthlyReportId === null ? "" : this.props.monthlyReportId}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&months=${this.props.month.month_id}`
Deni Rinaldi's avatar
Deni Rinaldi committed
310 311 312 313 314 315 316 317 318 319 320 321
        )
        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;
            a.download = 'Monthly Report Balance Sheet.xlsx';
            a.click();
        }
    }

d.arizona's avatar
d.arizona committed
322 323 324 325 326 327 328
    handleGetFor(type) {
        this.setState({get_for: type}, () => {
            this.getSettingControl()
            this.getLatestUpdate()
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
                console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
                // console.log(resp.rows[2]);
                let payload = []
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
d.arizona's avatar
d.arizona committed
344
                            orders: i[0] === undefined ? "" : String(i[0]).trim(),
Deni Rinaldi's avatar
Deni Rinaldi committed
345 346
                            item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
                            item_report: i[2] === undefined ? "" : String(i[2]).trim(),
rifkaki's avatar
rifkaki committed
347
                            actual: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
Riri Novita's avatar
Riri Novita committed
348 349 350
                            mtd_vs_previous_month: i[4] === undefined ? "" : String(i[4]).trim(),
                            mtd_vs_mb: i[5] === undefined ? "" : String(i[5]).trim(),
                            mtd_vs_rb: i[6] === undefined ? "" : String(i[6]).trim(),
Deni Rinaldi's avatar
Deni Rinaldi committed
351 352 353 354 355 356 357 358
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    balance_sheet: payload,
d.arizona's avatar
d.arizona committed
359 360
                    months: this.props.month.month_id,
                    status: 'submitted'
Deni Rinaldi's avatar
Deni Rinaldi committed
361
                }
d.arizona's avatar
d.arizona committed
362
                console.log(body)
rifkaki's avatar
rifkaki committed
363
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
Deni Rinaldi's avatar
Deni Rinaldi committed
364 365 366 367
            }
        });
    }

d.arizona's avatar
d.arizona committed
368 369 370 371 372 373 374
    checkUpload() {
        api.create().checkUploadMonthlyReportBS(this.state.payload).then(response => {
            // console.log(JSON.stringify(this.state.payload));
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleBSMR: false, loading: true })
d.arizona's avatar
d.arizona committed
375
                    let err = false
d.arizona's avatar
d.arizona committed
376
                    let dataTable = response.data.data.map((item, index) => {
d.arizona's avatar
d.arizona committed
377 378 379 380 381
                        if (item.type_report_id === 3) {    
                            if (item.mtd_vs_mb == "" &&  Number(item.percent_act_vs_mb) < this.state.minValue || Number(item.percent_act_vs_mb) > this.state.maxValue) {
                                err = true
                            }
                        }
d.arizona's avatar
d.arizona committed
382 383 384 385 386 387 388 389 390 391 392
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.rolling_outlook === null ? "" : item.rolling_outlook === "" ? "" : item.rolling_outlook,
                            item.master_budget === "" ? "" : item.master_budget,
                            item.rolling_budget === "" ? "" : item.rolling_budget,
                            item.actual === "" ? "" : item.actual,
d.arizona's avatar
d.arizona committed
393 394 395 396 397 398 399 400 401 402 403 404 405
                            item.actual_previous_month === null ? "0.0" : item.actual_previous_month === "" ? "0.0" : item.actual_previous_month,
                            item.amount_act_vs_previous_month === "" ? "0.0" : item.amount_act_vs_previous_month,
                            item.percent_act_vs_previous_month === "" ? "0.0" : item.percent_act_vs_previous_month,
                            item.amount_act_vs_mb === "" ? "0.0" : item.amount_act_vs_mb,
                            item.percent_act_vs_mb === "" ? "0.0" : item.percent_act_vs_mb,
                            item.amount_act_vs_rb === "" ? "0.0" : item.amount_act_vs_rb,
                            item.percent_act_vs_rb === "" ? "0.0" : item.percent_act_vs_rb,
                            // 0,
                            // 0,
                            // 0,
                            // 0,
                            // 0,
                            // 0,
rifkaki's avatar
rifkaki committed
406 407 408
                            item.mtd_vs_previous_month === null ? "" : item.mtd_vs_previous_month === undefined ? "" : item.mtd_vs_previous_month,
                            item.mtd_vs_mb === null ? "" : item.mtd_vs_mb === undefined ? "" : item.mtd_vs_mb,
                            item.mtd_vs_rb === null ? "" : item.mtd_vs_rb === undefined ? "" : item.mtd_vs_rb,
d.arizona's avatar
d.arizona committed
409
                            item.actual_formula,
Deni Rinaldi's avatar
Deni Rinaldi committed
410
                            item.order,
rifkaki's avatar
rifkaki committed
411 412
                            item.condition_it_should_be,
                            item.condition_if_wrong,
d.arizona's avatar
d.arizona committed
413 414 415 416
                            item.error
                        ]
                    })
                    console.log(dataTable)
Deni Rinaldi's avatar
Deni Rinaldi committed
417
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: true, isUpload: true }, () => {
d.arizona's avatar
d.arizona committed
418
                        this.state.dataTable.map(item => {
rifkaki's avatar
rifkaki committed
419
                            if (item[24].length > 0) {
d.arizona's avatar
d.arizona committed
420
                                // console.log('masuk')
Deni Rinaldi's avatar
Deni Rinaldi committed
421
                                this.setState({ buttonError: true, errorPreview: true })
d.arizona's avatar
d.arizona committed
422 423 424 425
                            }
                        })
                        // console.log(this.state.buttonError)
                    })
Riri Novita's avatar
Riri Novita committed
426 427
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
428
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
429 430 431 432 433 434
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
d.arizona's avatar
d.arizona committed
435 436 437 438 439 440 441
                }
            }
        })
    }

    uploadBalanceSheet(type) {
        let data = []
d.arizona's avatar
d.arizona committed
442
        this.setState({loading: true})
d.arizona's avatar
d.arizona committed
443 444 445
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
d.arizona's avatar
d.arizona committed
446
                item_report: String(i[5]),
d.arizona's avatar
d.arizona committed
447 448 449 450 451 452 453 454 455 456 457
                rolling_outlook: i[0] === 5 || i[0] === 6 ? String(Number(i[6]).toFixed(1)) : i[0] === 3 && i[6] === "" ? "0.0" : String(Number(i[6]).toFixed(1)),
                master_budget: i[0] === 5 || i[0] === 6 ? String(Number(i[7]).toFixed(1)) : i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7]).toFixed(1)),
                rolling_budget: i[0] === 5 || i[0] === 6 ? String(Number(i[8]).toFixed(1)) : i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8]).toFixed(1)),
                actual: i[0] === 5 || i[0] === 6 ? String(Number(i[9]).toFixed(1)) : i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9]).toFixed(1)),
                actual_previous_month: i[0] === 5 || i[0] === 6 ? String(Number(i[10]).toFixed(1)) : i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10]).toFixed(1)),
                amount_act_vs_previous_month: i[0] === 5 || i[0] === 6 ? String(Number(i[11]).toFixed(1)) : i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11]).toFixed(1)),
                percent_act_vs_previous_month: i[0] === 5 || i[0] === 6 ? String(Number(i[12]).toFixed(1)) : i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12]).toFixed(1)),
                amount_act_vs_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[13]).toFixed(1)) : i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13]).toFixed(1)),
                percent_act_vs_mb: i[0] === 5 || i[0] === 6 ? String(Number(i[14]).toFixed(1)) : i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14]).toFixed(1)),
                amount_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[15]).toFixed(1)) : i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15]).toFixed(1)),
                percent_act_vs_rb: i[0] === 5 || i[0] === 6 ? String(Number(i[16]).toFixed(1)) : i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16]).toFixed(1)),
Riri Novita's avatar
Riri Novita committed
458 459 460
                mtd_vs_previous_month: String(i[17]),
                mtd_vs_mb: String(i[18]),
                mtd_vs_rb: String(i[19])
d.arizona's avatar
d.arizona committed
461 462 463
            })
        })
        let body = {
Deni Rinaldi's avatar
Deni Rinaldi committed
464
            "monthly_report_id": this.props.monthlyReportId,
d.arizona's avatar
d.arizona committed
465 466 467 468 469 470 471
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "months": this.props.month.month_id,
            "balance_sheet": data
        }
Riri Novita's avatar
Riri Novita committed
472
        console.log(body);
d.arizona's avatar
d.arizona committed
473
        console.log(JSON.stringify(body));
rifkaki's avatar
rifkaki committed
474
        console.log(body)
d.arizona's avatar
d.arizona committed
475 476 477 478
        api.create('UPLOAD').uploadMonthlyReportBS(body).then(response => {
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
479
                    // this.props.onClickClose()
d.arizona's avatar
d.arizona committed
480 481 482 483 484
                    if (type == 'submitted') {
                        this.props.saveToMonthlyReport('BS')
                    } else {
                        this.props.saveToMonthlyReport()
                    }
d.arizona's avatar
d.arizona committed
485
                    this.setState({loading: false, handleTekTekTek: 0})
d.arizona's avatar
d.arizona committed
486
                    // this.props.getReport()
d.arizona's avatar
d.arizona committed
487
                } else {
Riri Novita's avatar
Riri Novita committed
488
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
d.arizona's avatar
d.arizona committed
489
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
d.arizona's avatar
d.arizona committed
490 491 492 493 494 495 496 497
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
Riri Novita's avatar
Riri Novita committed
498
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
d.arizona's avatar
d.arizona committed
499 500 501 502
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
503
    backToMonthlyReport(type) {
Deni Rinaldi's avatar
Deni Rinaldi committed
504
        this.setState({ loading: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
505 506 507
        let data = []
        this.state.dataTable.map(i => {
            data.push({
Deni Rinaldi's avatar
Deni Rinaldi committed
508
                "item_report_id": i[1],
d.arizona's avatar
d.arizona committed
509 510 511 512 513 514 515 516
                "rolling_outlook": String(Number(i[6]).toFixed(1)),
                "master_budget": String(Number(i[7]).toFixed(1)),
                "rolling_budget": String(Number(i[8]).toFixed(1)),
                "actual": String(Number(i[9]).toFixed(1)),
                "actual_previous_month": String(Number(i[10]).toFixed(1)),
                "amount_act_vs_previous_month": String(Number(i[11]).toFixed(1)),
                "percent_act_vs_previous_month": String(Number(i[12]).toFixed(1)),
                "amount_act_vs_mb": String(Number(i[13]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
517
                "percent_act_vs_mb": i[14],
d.arizona's avatar
d.arizona committed
518
                "amount_act_vs_rb": String(Number(i[15]).toFixed(1)),
Deni Rinaldi's avatar
Deni Rinaldi committed
519 520 521 522 523 524 525
                "percent_act_vs_rb": i[16],
                "mtd_vs_previous_month": i[17],
                "mtd_vs_mb": i[18],
                "mtd_vs_rb": i[19]
            })
        })
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
526
            "monthly_report_id": this.props.monthlyReportId,
Deni Rinaldi's avatar
Deni Rinaldi committed
527 528 529 530 531 532 533 534
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": type,
            "months": this.props.month.month_id,
            "balance_sheet": data
        }
        api.create('UPLOAD').createMonthlyReportBS(payload).then(response => {
rifkaki's avatar
rifkaki committed
535
            console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
536
            console.log(response);
d.arizona's avatar
d.arizona committed
537
            console.log(JSON.stringify(payload))
Deni Rinaldi's avatar
Deni Rinaldi committed
538 539
            if (response.data) {
                if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
540 541 542 543 544
                    if (type == 'submitted') {
                        this.props.saveToMonthlyReport('BS')
                    } else {
                        this.props.saveToMonthlyReport()
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
545
                } else {
Riri Novita's avatar
Riri Novita committed
546 547
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
                        document.body.style.overflow = 'unset';
d.arizona's avatar
d.arizona committed
548
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
549 550 551 552 553
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
554 555 556 557
                        this.props.saveToMonthlyReport()
                    })
                }
            } else {
Riri Novita's avatar
Riri Novita committed
558
                this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 })
Deni Rinaldi's avatar
Deni Rinaldi committed
559 560 561 562
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
563 564
    handleValidate() {
        let data = []
Deni Rinaldi's avatar
Deni Rinaldi committed
565
        let err = false
d.arizona's avatar
d.arizona committed
566
        let errorContrl = false
rifkaki's avatar
rifkaki committed
567
        let editAble = this.state.editAble
d.arizona's avatar
d.arizona committed
568 569 570 571
        let dataTable = this.state.dataTable
        let kansas = this.state.kansas
        console.log(dataTable[dataTable.length-1])
        dataTable.map((i, index) => {
rifkaki's avatar
rifkaki committed
572 573
            if(i[0] === 3) {
                // console.log(i);
d.arizona's avatar
d.arizona committed
574 575 576 577 578 579
                // if ( i[17] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
                //     console.log('msk 1');
                //     // console.log(i);
                //     err = true
                // } else 
                if ( i[18] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
d.arizona's avatar
d.arizona committed
580 581
                    console.log('msk 2');
                    err = true
d.arizona's avatar
d.arizona committed
582
                }
d.arizona's avatar
d.arizona committed
583
            }
rifkaki's avatar
rifkaki committed
584 585

            if (String(i[5]) == "Control (should be nil)") {
d.arizona's avatar
d.arizona committed
586 587 588 589
                if (Number(i[9]) < this.state.minValue || Number(i[9]) > this.state.maxValue ) { 
                    errorContrl = true
                    editAble = true
                }
rifkaki's avatar
rifkaki committed
590 591
            }

Deni Rinaldi's avatar
Deni Rinaldi committed
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609
            data.push({
                "item_report_id": i[1],
                "rolling_outlook": i[6],
                "master_budget": i[7],
                "rolling_budget": i[8],
                "actual": i[9],
                "actual_previous_month": i[10],
                "amount_act_vs_previous_month": i[11],
                "percent_act_vs_previous_month": i[12],
                "amount_act_vs_mb": i[13],
                "percent_act_vs_mb": i[14],
                "amount_act_vs_rb": i[15],
                "percent_act_vs_rb": i[16],
                "mtd_vs_previous_month": i[17],
                "mtd_vs_mb": i[18],
                "mtd_vs_rb": i[19]
            })
        })
rifkaki's avatar
rifkaki committed
610
        // console.log(JSON.stringify(data));
d.arizona's avatar
d.arizona committed
611 612 613 614 615 616 617 618 619 620 621 622 623
        // data.map(i => {
        //     if (i.mtd_vs_previous_month === "" && (Number(i.percent_act_vs_previous_month) < this.state.minValue || Number(i.percent_act_vs_previous_month) > this.state.maxValue)) {
        //         console.log('msk 1');
        //         console.log(i);
        //         err = true
        //     } else if (i.mtd_vs_mb === "" && (Number(i.percent_act_vs_mb) < this.state.minValue || Number(i.percent_act_vs_mb) > this.state.maxValue)) {
        //         console.log('msk 2');
        //         err = true
        //     } else if (i.mtd_vs_rb === "" && (Number(i.percent_act_vs_rb) < this.state.minValue || Number(i.percent_act_vs_rb) > this.state.maxValue)) {
        //         console.log('msk 3');
        //         err = true
        //     }
        // })
Deni Rinaldi's avatar
Deni Rinaldi committed
624 625 626 627 628 629 630
        // if (err === true) {
        //     console.log('error');
        //     this.setState({ loading: false, buttonError: true, saveDraft: false })
        // } else {
        //     console.log('g error');
        //     this.setState({ loading: false, buttonError: false, saveDraft: false })
        // }
Deni Rinaldi's avatar
Deni Rinaldi committed
631

Deni Rinaldi's avatar
Deni Rinaldi committed
632 633 634 635 636 637 638 639 640 641
        // console.log(JSON.stringify(data))
        let payload = {
            "monthly_report_id": this.props.monthlyReportId,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "status": "submitted",
            "months": this.props.month.month_id,
            "balance_sheet": data
        }
rifkaki's avatar
rifkaki committed
642
        // console.log(JSON.stringify(payload));
rifkaki's avatar
rifkaki committed
643
        // console.log(this.state.dataTable)
644
        api.create().validateSubmitReportBS(payload).then((response) => {
Riri Novita's avatar
Riri Novita committed
645 646
            console.log(response.data.data.result)
            console.log(err);
rifkaki's avatar
rifkaki committed
647
            console.log(errorContrl);
Deni Rinaldi's avatar
Deni Rinaldi committed
648 649
            if (response.data) {
                if (response.data.status === "success") {
rifkaki's avatar
rifkaki committed
650
                    if (response.data.data.result && err === false && errorContrl === false ) {
Deni Rinaldi's avatar
Deni Rinaldi committed
651
                        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
d.arizona's avatar
d.arizona committed
652 653 654 655 656 657 658
                        if (kansas == 0) {
                            this.setState({kansas: 1, loading: true}, () => {
                                this.handleValidate()
                            })
                        } else {
                            this.setState({kansas: 0})
                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
659
                    } else {
d.arizona's avatar
d.arizona committed
660
                        this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
d.arizona's avatar
d.arizona committed
661 662 663 664 665 666 667
                        if (kansas == 0) {
                            this.setState({kansas: 1, loading: true}, () => {
                                this.handleValidate()
                            })
                        } else {
                            this.setState({kansas: 0})
                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
668 669 670
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
671
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Deni Rinaldi's avatar
Deni Rinaldi committed
672 673 674 675 676 677 678 679 680 681 682 683 684
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
685 686 687 688
    closeAlert() {
        this.setState({ alert: false })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
689
    render() {
Deni Rinaldi's avatar
Deni Rinaldi committed
690
        let dataTable2 = this.state.dataTable
Riri Novita's avatar
Riri Novita committed
691
        const handleText = (value, tableMeta, type) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
692
            dataTable2[tableMeta.rowIndex][type] = value
Riri Novita's avatar
Riri Novita committed
693 694
            // console.log(dataTable2[tableMeta.rowIndex]);
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
695 696 697
        const handleChange = (value, tableMeta, type) => {
            let val = String(value).split(",").join("")
            if (type === "actual") {
Deni Rinaldi's avatar
Deni Rinaldi committed
698
                dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
d.arizona's avatar
d.arizona committed
699
                console.log(dataTable2);
Deni Rinaldi's avatar
Deni Rinaldi committed
700 701 702 703
            } else {
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
                    // console.log(indexParent)
Deni Rinaldi's avatar
Deni Rinaldi committed
704 705 706
                    dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
                    let jagain = Number(dataTable2[indexParent][9]).toFixed(1)
                    dataTable2[indexParent][9] = jagain === undefined ? (0 + Number(val)).toFixed(1) : Number(Number(jagain) + Number(val)).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
707 708 709 710 711 712 713
                    // if (tableMeta.rowData[5] === 'Cash & Bank Balance') {
                    //     console.log(value);
                    //     console.log(a);
                    //     console.log(jagain);
                    //     console.log(dataTable2[indexParent]);
                    // }
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
714
                    dataTable2[tableMeta.rowIndex][9] = Number(val).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
715 716
                }
            }
d.arizona's avatar
d.arizona committed
717
            console.log(dataTable2);
Deni Rinaldi's avatar
Deni Rinaldi committed
718 719 720 721 722
        }

        const handleValue = (data, type) => {
            let total = 0
            dataTable2.map((item, index) => {
d.arizona's avatar
d.arizona committed
723
                // if (item[2] !== null) {
Deni Rinaldi's avatar
Deni Rinaldi committed
724 725 726 727 728
                if (data.rowData[1] === item[2]) {
                    // console.log(item[data.columnIndex + type])
                    let itemVal = item[data.columnIndex + type].value !== undefined ? Number(item[data.columnIndex + type].value) : Number(item[data.columnIndex + type])
                    total = item[data.columnIndex + type] === undefined ? Number(total) + 0 : Number(total) + itemVal
                }
d.arizona's avatar
d.arizona committed
729
                // }
Deni Rinaldi's avatar
Deni Rinaldi committed
730

Deni Rinaldi's avatar
Deni Rinaldi committed
731 732
            })
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
Deni Rinaldi's avatar
Deni Rinaldi committed
733
            dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
734
            // console.log(indexParent);
Deni Rinaldi's avatar
Deni Rinaldi committed
735 736 737 738 739 740 741
            return total
        }

        const handleVariance = (tableMeta, dex, type) => {
            let total = 0
            if (dex === 1) {
                total = Number(tableMeta.rowData[9]) - Number(tableMeta.rowData[10])
Deni Rinaldi's avatar
Deni Rinaldi committed
742
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
743 744
            } else if (dex === 2) {
                total = Number(tableMeta.rowData[9]) - Number(tableMeta.rowData[7])
Deni Rinaldi's avatar
Deni Rinaldi committed
745
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
746 747
            } else if (dex === 3) {
                total = Number(tableMeta.rowData[9]) - Number(tableMeta.rowData[8])
Deni Rinaldi's avatar
Deni Rinaldi committed
748
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
749 750 751 752 753 754 755 756 757 758 759
            }
            return total
        }

        const handleVariancePercent = (tableMeta, dex, type) => {
            let total = 0
            // if (tableMeta.rowData[5] === "Cash and cash equivalent") {
            //     console.log(dataTable2);
            //     console.log(tableMeta);
            // }
            if (dex === 1) {
Riri Novita's avatar
Riri Novita committed
760
                total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])) * 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10])) * 100)
Deni Rinaldi's avatar
Deni Rinaldi committed
761
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
762 763 764 765 766
                // if (tableMeta.rowData[5] === "Cash and cash equivalent") {
                // console.log(total);
                // console.log(Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][10]));
                //     console.log(dataTable2[tableMeta.rowIndex]);
                // }
Deni Rinaldi's avatar
Deni Rinaldi committed
767
            } else if (dex === 2) {
Riri Novita's avatar
Riri Novita committed
768
                total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])) * 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][7])) * 100)
Deni Rinaldi's avatar
Deni Rinaldi committed
769
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
770
            } else if (dex === 3) {
Deni Rinaldi's avatar
Deni Rinaldi committed
771
                total = R.equals((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])), NaN) ? '0' : R.equals((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])), Infinity) ? "0" : Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])
Riri Novita's avatar
Riri Novita committed
772
                total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][15]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100)
Deni Rinaldi's avatar
Deni Rinaldi committed
773
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
774
                // console.log(total);
Deni Rinaldi's avatar
Deni Rinaldi committed
775 776
            }
            return total
Deni Rinaldi's avatar
Deni Rinaldi committed
777 778
        }

d.arizona's avatar
d.arizona committed
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807
        const handleValueFormula = (tableMeta, colIdx) => {
            // loading = true
            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 subForm = String(item).substr(0, Number(String(item).length) - 1)
                let re = /^[a-zA-Z0-9_]+$/;
                if (item !== "") {
                    if (items == ']') {
                        baru.push(String(item))
                    } else if (!re.test(items)) {
                        baru.push(subForm)
                        baru.push(items)
                    } else {
                        baru.push(String(item))
                    }
                }
            })

            baru.map((item, index) => {
                if (item == '-' || item == '+' || item == '/' || item == '*' || item == '(' || item == ')') {
                    anjay.push(item)
                } else {
                    if (String(item).includes('#')) {
                        if (String(item).includes('[M-1]')) {
                            let tst = String(item).replace('[M-1]', '')
d.arizona's avatar
d.arizona committed
808
                            // let indexID = dataTable2.findIndex((val) => val[21] == tst)
d.arizona's avatar
d.arizona committed
809
                            let data = tableMeta.rowData[20] == null? [] : tableMeta.rowData[20]
d.arizona's avatar
d.arizona committed
810
                            let indexID = data.findIndex((val) => val.item_formula == String(`${item}`))
d.arizona's avatar
d.arizona committed
811
                            if (indexID !== -1) {
d.arizona's avatar
d.arizona committed
812
                                let valuezz = data[indexID].value
d.arizona's avatar
d.arizona committed
813 814 815
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        } else {
d.arizona's avatar
d.arizona committed
816
                            let data = tableMeta.rowData[20] == null? [] : tableMeta.rowData[20]
d.arizona's avatar
d.arizona committed
817
                            let indexID = data.findIndex((val) => val.item_formula == String(`@${item}`))
d.arizona's avatar
d.arizona committed
818
                            if (indexID !== -1) {
rifkaki's avatar
rifkaki committed
819
                                // console.log(tableMeta)
d.arizona's avatar
d.arizona committed
820 821 822 823 824 825 826 827 828
                                let valuezz = data[indexID].value
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        }
                    } else {
                        if (String(item).includes('[M-1]')) {
                            let tst = String(item).replace('[M-1]', '')
                            let indexID = dataTable2.findIndex((val) => val[21] == tst)
                            if (indexID !== -1) {
d.arizona's avatar
d.arizona committed
829 830 831 832 833 834
                                let valuezz = dataTable2[indexID][10]
                                if (item == dataTable2[tableMeta.rowIndex][21]) {
                                    anjay.push(0)
                                } else {
                                    anjay.push(valuezz == "" ? 0 : valuezz)
                                }
d.arizona's avatar
d.arizona committed
835 836 837 838 839
                            }
                        } else {
                            let indexID = dataTable2.findIndex((val) => val[21] == item)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[indexID][colIdx]
d.arizona's avatar
d.arizona committed
840
                                if (item == dataTable2[tableMeta.rowIndex][21]) {
d.arizona's avatar
d.arizona committed
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878
                                    anjay.push(0)
                                } else {
                                    anjay.push(valuezz == "" ? 0 : valuezz)
                                }
                            } else {
                                if (item === '(-1)') {
                                    anjay.push(-1)
                                }
                            }
                        }
                    }
                }
            })

            let anjay2 = []
            let kurung = false
            let item1 = []
            anjay.map((item, index) => {
                if (item == "(") {
                    kurung = true
                } else if (item == ")") {
                    kurung = false
                    anjay2.push(item1)
                    item1 = []
                } else {
                    if (kurung) {
                        item1.push(item)
                    } else {
                        anjay2.push(item)
                    }
                }
            })

            let total = 0
            let opt = ""
            let totalPrio = 0
            let optPrio = ""
            let prio = false
d.arizona's avatar
d.arizona committed
879
            let optPrev = ""
d.arizona's avatar
d.arizona committed
880 881 882
            anjay2.map((item, index) => {
                if (Array.isArray(item)) {
                    prio = true
d.arizona's avatar
d.arizona committed
883
                    optPrev = opt
d.arizona's avatar
d.arizona committed
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924
                    item.map((items, indexs) => {
                        if (items == "+") {
                            optPrio = "tambah"
                        } else if (items == "-") {
                            optPrio = "kurang"
                        } else if (items == "*") {
                            optPrio = "kali"
                        } else if (items == "/") {
                            optPrio = "bagi"
                        } else {
                            if (optPrio == "tambah") {
                                totalPrio = Number(totalPrio) + Number(items)
                            } else if (optPrio == "kurang") {
                                totalPrio = Number(totalPrio) - Number(items)
                            } else if (optPrio == "kali") {
                                totalPrio = Number(totalPrio) * Number(items)
                            } else if (optPrio == "bagi") {
                                totalPrio = Number(totalPrio) / Number(items) == NaN ? 0 : Number(totalPrio) / Number(items)
                            } else {
                                totalPrio += Number(items)
                            }
                        }
                    })

                    if (index == anjay2.length - 1) {
                        if (opt == "tambah") {
                            total = Number(total) + Number(totalPrio)
                        } else if (opt == "kurang") {
                            total = Number(total) - Number(totalPrio)
                        } else if (opt == "kali") {
                            total = Number(total) * Number(totalPrio)
                        } else if (opt == "bagi") {
                            total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
                        } else {
                            total += Number(totalPrio)
                        }
                    }
                } else {
                    if (item == "+") {
                        opt = "tambah"
                        if (prio) {
d.arizona's avatar
d.arizona committed
925 926 927 928 929 930 931 932 933 934 935
                            if (optPrev == "tambah") {
                                total = Number(total) + Number(totalPrio)
                            } else if (optPrev == "kurang") {
                                total = Number(total) - Number(totalPrio)
                            } else if (optPrev == "kali") {
                                total = Number(total) * Number(totalPrio)
                            } else if (optPrev == "bagi") {
                                total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
                            } else {
                                total += Number(totalPrio)
                            }
d.arizona's avatar
d.arizona committed
936 937 938 939 940 941 942
                            prio = false
                            totalPrio = 0
                            optPrio = ""
                        }
                    } else if (item == "-") {
                        opt = "kurang"
                        if (prio) {
d.arizona's avatar
d.arizona committed
943 944 945 946 947 948 949 950 951 952 953
                            if (optPrev == "tambah") {
                                total = Number(total) + Number(totalPrio)
                            } else if (optPrev == "kurang") {
                                total = Number(total) - Number(totalPrio)
                            } else if (optPrev == "kali") {
                                total = Number(total) * Number(totalPrio)
                            } else if (optPrev == "bagi") {
                                total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
                            } else {
                                total += Number(totalPrio)
                            }
d.arizona's avatar
d.arizona committed
954 955 956 957 958 959 960
                            prio = false
                            totalPrio = 0
                            optPrio = ""
                        }
                    } else if (item == "*") {
                        opt = "kali"
                        if (prio) {
d.arizona's avatar
d.arizona committed
961 962 963 964 965 966 967 968 969 970 971
                            if (optPrev == "tambah") {
                                total = Number(total) + Number(totalPrio)
                            } else if (optPrev == "kurang") {
                                total = Number(total) - Number(totalPrio)
                            } else if (optPrev == "kali") {
                                total = Number(total) * Number(totalPrio)
                            } else if (optPrev == "bagi") {
                                total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
                            } else {
                                total += Number(totalPrio)
                            }
d.arizona's avatar
d.arizona committed
972 973 974 975 976 977 978
                            prio = false
                            totalPrio = 0
                            optPrio = ""
                        }
                    } else if (item == "/") {
                        opt = "bagi"
                        if (prio) {
d.arizona's avatar
d.arizona committed
979 980 981 982 983 984 985 986 987 988 989
                            if (optPrev == "tambah") {
                                total = Number(total) + Number(totalPrio)
                            } else if (optPrev == "kurang") {
                                total = Number(total) - Number(totalPrio)
                            } else if (optPrev == "kali") {
                                total = Number(total) * Number(totalPrio)
                            } else if (optPrev == "bagi") {
                                total = Number(total) / Number(totalPrio) == NaN ? 0 : Number(total) / Number(totalPrio)
                            } else {
                                total += Number(totalPrio)
                            }
d.arizona's avatar
d.arizona committed
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
                            prio = false
                            totalPrio = 0
                            optPrio = ""
                        }
                    } 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) == NaN ? 0 : Number(total) / Number(item)
                        } else {
                            total += Number(item)
                        }
                    }
                }
            })

            total = R.equals(total, NaN) ? "0.0" : total
            // // // total = R.equals(total, NaN) ? "0.0" : total
            // // // console.log(dataTable2[tableMeta.rowIndex][22])
            // // // console.log(tableMeta.rowData[5])
            // // if (tableMeta.rowData[5] == "1.5 Other non-current assets") {
            // // if (forecast !== undefined) {
            // //     if (String(tableMeta.rowData[5]) == "Depreciation & amortisation") {
Deni Rinaldi's avatar
Deni Rinaldi committed
1017 1018 1019 1020 1021
            // console.log(splitFormula)
            // console.log(baru)
            // console.log(anjay)
            // console.log(anjay2)
            // console.log(total)
d.arizona's avatar
d.arizona committed
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034
            // //         console.log(dataTable2[tableMeta.rowIndex])
            // //     }
            // // }

            // if (dataTable2[tableMeta.rowIndex][colIdx].value == undefined) {
            dataTable2[tableMeta.rowIndex][colIdx] = total
            // } else {
            //     dataTable2[tableMeta.rowIndex][column].value = total
            // }
            // loading = false
            return total
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
1035
        let columns = [
Deni Rinaldi's avatar
Deni Rinaldi committed
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
Deni Rinaldi's avatar
Deni Rinaldi committed
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077
            {
                name: "Account",
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300 }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style }),
                    customBodyRender: (val, tableMeta) => {
                        return (
                            <div style={{ width: 300 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095
                                {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> :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                            <LightTooltip title={"Report Items Not Registered"} arrow>
                                                <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                            </LightTooltip>
                                        </div>
                                    :
                                    tableMeta.rowData[4] == 0 ?
                                        <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                        :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                            <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </div>
                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1096 1097 1098 1099 1100
                            </div>
                        )
                    }
                }
            },
Deni Rinaldi's avatar
Deni Rinaldi committed
1101
            {
Deni Rinaldi's avatar
Deni Rinaldi committed
1102
                name: `Rolling Outlook (FY${this.props.periode})`,
Deni Rinaldi's avatar
Deni Rinaldi committed
1103
                options: {
Deni Rinaldi's avatar
Deni Rinaldi committed
1104
                    customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1105
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#07a7d0', width: 96, borderLeft: '1px #fff solid', borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1106 1107 1108
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1109 1110 1111 1112 1113
                    setCellProps: () => ({
                        style: {
                            paddingRight: 0
                        }
                    }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1114 1115
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1116
                            <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1117
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1118
                                    null :
Riri Novita's avatar
Riri Novita committed
1119 1120 1121 1122 1123 1124 1125 1126 1127
                                    this.state.get_for == 'view' ? 
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
                                            value={Number(val).toFixed(1)}
                                        />
d.arizona's avatar
d.arizona committed
1128
                                    :
rifkaki's avatar
rifkaki committed
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
                                    <div style={{ flex: 1 }}>
                                        <FormControlLabel
                                            style={{ margin: 0 }}
                                            value={val}
                                            control={
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
                                                    value={Number(val).toFixed(1)}
                                                />
                                            }
                                        />
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1145
                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1146 1147 1148 1149 1150 1151 1152 1153 1154
                            </div>
                        )
                    }
                }
            },
            {
                name: `Month To Date (MTD)`,
                options: {
                    customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1155
                        <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
Deni Rinaldi's avatar
Deni Rinaldi committed
1156
                            {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1157 1158 1159 1160 1161
                                <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                            </TableCell> */}
                            <div style={{ borderBottom: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 40 }}>{columnMeta.name}</div>
                            <div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
                                <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1162 1163
                                    <span>{"Master Budget (MB)"}</span>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1164
                                <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1165 1166
                                    <span>{"Rolling Budget (RB)"}</span>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1167
                                <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1168 1169 1170 1171
                                    <span>{"Actual"}</span>
                                </div>
                            </div>
                        </th>
Deni Rinaldi's avatar
Deni Rinaldi committed
1172
                    ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1173 1174 1175 1176 1177 1178
                    setCellProps: () => ({
                        style: {
                            paddingLeft: 0,
                            paddingRight: 0
                        }
                    }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1179
                    customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1180
                        // console.log(tableMeta);
Deni Rinaldi's avatar
Deni Rinaldi committed
1181 1182 1183 1184 1185
                        return (
                            <div>
                                <div className="grid grid-3x content-center">
                                    <div className="col-1">
                                        <div style={{ textAlign: 'right', width: 90 }}>
rifkaki's avatar
rifkaki committed
1186
                                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1187
                                                null :
d.arizona's avatar
d.arizona committed
1188
                                                // this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1189 1190 1191 1192 1193 1194 1195 1196
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
                                                        value={Number(tableMeta.rowData[7]).toFixed(1)}
                                                    />
d.arizona's avatar
d.arizona committed
1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225
                                                // :
                                                // tableMeta.rowData[0] === 2 ?
                                                //     <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                //         <NumberFormat
                                                //             thousandSeparator={true}
                                                //             style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //             type="text"
                                                //             placeholder=""
                                                //             disabled={true}
                                                //             value={Number(handleValue(tableMeta, 0)).toFixed(1)}
                                                //         />
                                                //     </span> :
                                                //     tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
                                                //         <div style={{ flex: 1 }}>
                                                //             <FormControlLabel
                                                //                 style={{ margin: 0 }}
                                                //                 value={val}
                                                //                 control={
                                                //                     <NumberFormat
                                                //                         thousandSeparator={true}
                                                //                         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //                         type="text"
                                                //                         placeholder=""
                                                //                         disabled={true}
                                                //                         value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)}
                                                //                     />
                                                //                 }
                                                //             />
                                                //         </div> :
rifkaki's avatar
rifkaki committed
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 7)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 7)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 7)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
                                                        //         :
d.arizona's avatar
d.arizona committed
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277
                                                                // <div style={{ flex: 1 }}>
                                                                //     <FormControlLabel
                                                                //         style={{ margin: 0 }}
                                                                //         value={val}
                                                                //         control={
                                                                //             <NumberFormat
                                                                //                 thousandSeparator={true}
                                                                //                 style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                //                 type="text"
                                                                //                 placeholder=""
                                                                //                 disabled={true}
                                                                //                 value={Number(tableMeta.rowData[7]).toFixed(1)}
                                                                //             />
                                                                //         }
                                                                //     />
                                                                // </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1278
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1279 1280 1281 1282
                                        </div>
                                    </div>
                                    <div className="col-2">
                                        <div style={{ textAlign: 'right', width: 90 }}>
rifkaki's avatar
rifkaki committed
1283
                                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1284
                                                null :
d.arizona's avatar
d.arizona committed
1285
                                                // this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1286 1287 1288 1289 1290 1291 1292 1293
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
                                                        value={Number(tableMeta.rowData[8]).toFixed(1)}
                                                    />
d.arizona's avatar
d.arizona committed
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322
                                                // :
                                                // tableMeta.rowData[0] === 2 ?
                                                //     <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                //         <NumberFormat
                                                //             thousandSeparator={true}
                                                //             style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //             type="text"
                                                //             placeholder=""
                                                //             disabled={true}
                                                //             value={Number(handleValue(tableMeta, 1)).toFixed(1)}
                                                //         />
                                                //     </span> :
                                                //     tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
                                                //         <div style={{ flex: 1 }}>
                                                //             <FormControlLabel
                                                //                 style={{ margin: 0 }}
                                                //                 value={val}
                                                //                 control={
                                                //                     <NumberFormat
                                                //                         thousandSeparator={true}
                                                //                         style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                //                         type="text"
                                                //                         placeholder=""
                                                //                         disabled={true}
                                                //                         value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
                                                //                     />
                                                //                 }
                                                //             />
                                                //         </div> :
rifkaki's avatar
rifkaki committed
1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 8)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 8)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 8)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
                                                        //         :
d.arizona's avatar
d.arizona committed
1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374
                                                                // <div style={{ flex: 1 }}>
                                                                //     <FormControlLabel
                                                                //         style={{ margin: 0 }}
                                                                //         value={val}
                                                                //         control={
                                                                //             <NumberFormat
                                                                //                 thousandSeparator={true}
                                                                //                 style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                //                 type="text"
                                                                //                 placeholder=""
                                                                //                 disabled={true}
                                                                //                 value={Number(tableMeta.rowData[8]).toFixed(1)}
                                                                //             />
                                                                //         }
                                                                //     />
                                                                // </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1375
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1376 1377 1378 1379
                                        </div>
                                    </div>
                                    <div className="col-3">
                                        <div style={{ textAlign: 'right', width: 90 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1380
                                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1381
                                                null :
d.arizona's avatar
d.arizona committed
1382
                                                this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1383 1384 1385 1386 1387 1388 1389 1390
                                                    <NumberFormat
                                                        thousandSeparator={true}
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
                                                        value={Number(tableMeta.rowData[9]).toFixed(1)}
                                                    />
d.arizona's avatar
d.arizona committed
1391
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
1392 1393 1394 1395 1396 1397 1398 1399
                                                tableMeta.rowData[0] === 3 ?
                                                    <div style={{ flex: 1 }}>
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            value={val}
                                                            control={
                                                                <NumberFormat
                                                                    thousandSeparator={true}
d.arizona's avatar
d.arizona committed
1400
                                                                    style={{ color: this.props.isApprover || this.state.get_for == 'view' ? 'black' : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1401 1402
                                                                    type="text"
                                                                    placeholder=""
d.arizona's avatar
d.arizona committed
1403
                                                                    disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1404
                                                                    value={Number(tableMeta.rowData[9]).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1405 1406 1407 1408 1409 1410 1411
                                                                    onBlur={(event) => {
                                                                        handleChange(event.target.value, tableMeta)
                                                                    }}
                                                                />
                                                            }
                                                        />
                                                    </div> :
Deni Rinaldi's avatar
Deni Rinaldi committed
1412
                                                    tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1413 1414 1415 1416 1417 1418 1419
                                                        <div style={{ flex: 1 }}>
                                                            <FormControlLabel
                                                                style={{ margin: 0 }}
                                                                value={val}
                                                                control={
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
d.arizona's avatar
d.arizona committed
1420
                                                                        style={{ color: String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.periode == 2021 && this.props.month.month_id == 1? "#5198ea" : "black", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1421 1422
                                                                        type="text"
                                                                        placeholder=""
d.arizona's avatar
d.arizona committed
1423 1424 1425 1426 1427
                                                                        disabled={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.periode == 2021 && this.props.month.month_id == 1? false : true}
                                                                        value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)" && this.props.periode == 2021 && this.props.month.month_id == 1? Number(tableMeta.rowData[9]).toFixed(1) : Number(handleValueFormula(tableMeta, 9)).toFixed(1)}
                                                                        onBlur={(event) => {
                                                                            handleChange(event.target.value, tableMeta)
                                                                        }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1428 1429 1430
                                                                    />
                                                                }
                                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442
                                                        </div> :
                                                        tableMeta.rowData[0] === 2 ?
                                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValue(tableMeta, 2)).toFixed(1)}
                                                                />
                                                            </span> :
rifkaki's avatar
rifkaki committed
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460
                                                            tableMeta.rowData[0] === 7 ?
                                                                (Number(handleValueFormula(tableMeta, 9)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 9)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValueFormula(tableMeta, 9)).toFixed(1)}
                                                                    /> :
                                                                    <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
Deni Rinaldi's avatar
Deni Rinaldi committed
1461 1462
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
rifkaki's avatar
rifkaki committed
1463 1464 1465 1466 1467 1468 1469 1470 1471
                                                                            style={{
                                                                                fontSize: 12,
                                                                                textAlign: 'right',
                                                                                borderColor: 'transparent',
                                                                                margin: 0,
                                                                                width: 96,
                                                                                backgroundColor: 'transparent',
                                                                                color: 'red'
                                                                            }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1472 1473 1474
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
rifkaki's avatar
rifkaki committed
1475
                                                                            value={Number(handleValueFormula(tableMeta, 9)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1476
                                                                        />
rifkaki's avatar
rifkaki committed
1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494
                                                                    </LightTooltip>
                                                                    :
                                                                    <div style={{ flex: 1 }}>
                                                                        <FormControlLabel
                                                                            style={{ margin: 0 }}
                                                                            value={val}
                                                                            control={
                                                                                <NumberFormat
                                                                                    thousandSeparator={true}
                                                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                    type="text"
                                                                                    placeholder=""
                                                                                    disabled={true}
                                                                                    value={Number(tableMeta.rowData[9]).toFixed(1)}
                                                                                />
                                                                            }
                                                                        />
                                                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1495
                                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506
                                        </div>
                                    </div>
                                </div>
                            </div>
                        )
                    }
                }
            },
            {
                name: "Actual Previous Month",
                options: {
Deni Rinaldi's avatar
Deni Rinaldi committed
1507
                    customHeadRender: (columnMeta) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
1508
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#37b5e6', width: 96, borderRight: '1px #fff solid' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1509 1510 1511
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1512 1513 1514 1515 1516
                    setCellProps: () => ({
                        style: {
                            paddingRight: 0
                        }
                    }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1517 1518
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
1519
                            <div style={{ textAlign: 'right' }}>
rifkaki's avatar
rifkaki committed
1520
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1521
                                    null :
d.arizona's avatar
d.arizona committed
1522
                                    this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1523 1524 1525 1526 1527 1528 1529 1530
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
                                            value={Number(tableMeta.rowData[10]).toFixed(1)}
                                        />
d.arizona's avatar
d.arizona committed
1531
                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
1532 1533 1534 1535 1536 1537 1538 1539
                                    tableMeta.rowData[0] === 2 ?
                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
1540
                                                value={Number(handleValue(tableMeta, 2)).toFixed(1)}
Deni Rinaldi's avatar
Deni Rinaldi committed
1541 1542
                                            />
                                        </span> :
rifkaki's avatar
rifkaki committed
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578
                                        // tableMeta.rowData[0] === 7 ?
                                        //     (Number(handleValueFormula(tableMeta, 10)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 10)).toFixed(1) <= Number(this.state.maxValue)) ?
                                        //         <NumberFormat
                                        //             thousandSeparator={true}
                                        //             style={{
                                        //                 fontSize: 12,
                                        //                 textAlign: 'right',
                                        //                 borderColor: 'transparent',
                                        //                 margin: 0,
                                        //                 width: 96,
                                        //                 backgroundColor: 'transparent'
                                        //             }}
                                        //             type="text"
                                        //             placeholder=""
                                        //             disabled={true}
                                        //             value={Number(handleValueFormula(tableMeta, 10)).toFixed(1)}
                                        //         /> :
                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                        //             <NumberFormat
                                        //                 thousandSeparator={true}
                                        //                 style={{
                                        //                     fontSize: 12,
                                        //                     textAlign: 'right',
                                        //                     borderColor: 'transparent',
                                        //                     margin: 0,
                                        //                     width: 96,
                                        //                     backgroundColor: 'transparent',
                                        //                     color: 'red'
                                        //                 }}
                                        //                 type="text"
                                        //                 placeholder=""
                                        //                 disabled={true}
                                        //                 value={Number(handleValueFormula(tableMeta, 10)).toFixed(1)}
                                        //             />
                                        //         </LightTooltip>
                                        //         :
rifkaki's avatar
rifkaki committed
1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[10]).toFixed(1)}
                                                            />
                                                        }
                                                    />
                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1595
                                }
Deni Rinaldi's avatar
Deni Rinaldi committed
1596 1597 1598 1599 1600 1601 1602 1603 1604 1605
                            </div>
                        )
                    }
                }
            },
            {
                name: `Variance`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
Deni Rinaldi's avatar
Deni Rinaldi committed
1606
                            <div style={{ borderBottom: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 40 }}>{columnMeta.name}</div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1607
                            <div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1608 1609
                                <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#37b5e6' }}>
                                    <div style={{ borderBottom: '1px #fff solid', backgroundColor: '#37b5e6' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1610 1611 1612
                                        <span>{"Act vs Previous Month"}</span>
                                    </div>
                                    <div className="grid grid-2x">
Deni Rinaldi's avatar
Deni Rinaldi committed
1613
                                        <div className="column-1" style={{ borderRight: '1px #fff solid', backgroundColor: '#37b5e6' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1614 1615
                                            <span>{"Amount"}</span>
                                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1616
                                        <div className="column-2" style={{ borderLeft: '1px #fff solid', backgroundColor: '#37b5e6' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1617 1618 1619 1620
                                            <span>{"%"}</span>
                                        </div>
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1621
                                <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633
                                    <div style={{ borderBottom: '1px #fff solid' }}>
                                        <span>{"Act vs MB"}</span>
                                    </div>
                                    <div className="grid grid-2x">
                                        <div className="column-1" style={{ borderRight: '1px #fff solid' }}>
                                            <span>{"Amount"}</span>
                                        </div>
                                        <div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
                                            <span>{"%"}</span>
                                        </div>
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1634
                                <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649
                                    <div style={{ borderBottom: '1px #fff solid' }}>
                                        <span>{"Act vs RB"}</span>
                                    </div>
                                    <div className="grid grid-2x">
                                        <div className="column-1" style={{ borderRight: '1px #fff solid' }}>
                                            <span>{"Amount"}</span>
                                        </div>
                                        <div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
                                            <span>{"%"}</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </th>
                    ),
Deni Rinaldi's avatar
Deni Rinaldi committed
1650 1651 1652
                    setCellProps: () => ({
                        style: {
                            paddingLeft: 0,
Deni Rinaldi's avatar
Deni Rinaldi committed
1653
                            paddingRight: 10
Deni Rinaldi's avatar
Deni Rinaldi committed
1654 1655
                        }
                    }),
Deni Rinaldi's avatar
Deni Rinaldi committed
1656
                    customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1657
                        // console.log(tableMeta);
Deni Rinaldi's avatar
Deni Rinaldi committed
1658 1659 1660
                        return (
                            <div>
                                <div className="grid grid-3x content-center">
Deni Rinaldi's avatar
Deni Rinaldi committed
1661
                                    <div className="column-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
1662
                                        <div className="grid grid-2x content-center">
Deni Rinaldi's avatar
Deni Rinaldi committed
1663
                                            <div className="column-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
1664
                                                <div style={{ textAlign: 'right', width: 120 }}>
rifkaki's avatar
rifkaki committed
1665
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1666
                                                        null :
d.arizona's avatar
d.arizona committed
1667
                                                        this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1668 1669 1670 1671 1672 1673 1674 1675
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[11]).toFixed(1)}
                                                            />
d.arizona's avatar
d.arizona committed
1676
                                                        :
rifkaki's avatar
rifkaki committed
1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 11)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 11)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 11)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 11)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
                                                        //         :
rifkaki's avatar
rifkaki committed
1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={val}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
                                                                                value={Number(handleVariance(tableMeta, 1, 2)).toFixed(1)}
                                                                            />
                                                                        }
                                                                    />
                                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1729
                                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1730 1731
                                                </div>
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1732
                                            <div className="column-2">
Deni Rinaldi's avatar
Deni Rinaldi committed
1733
                                                <div style={{ textAlign: 'right', width: 120 }}>
rifkaki's avatar
rifkaki committed
1734
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1735
                                                        null :
d.arizona's avatar
d.arizona committed
1736
                                                        this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1737 1738 1739 1740 1741
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
d.arizona's avatar
d.arizona committed
1742
                                                                suffix={'%'}
Riri Novita's avatar
Riri Novita committed
1743 1744 1745
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[12]).toFixed(1)}
                                                            />
rifkaki's avatar
rifkaki committed
1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781
                                                        // :
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 12)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 12)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 12)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 12)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
rifkaki's avatar
rifkaki committed
1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799
                                                                :
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={val}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                suffix={'%'}
                                                                                disabled={true}
                                                                                value={Number(handleVariancePercent(tableMeta, 1, 3)).toFixed(1)}
                                                                            />
                                                                        }
                                                                    />
                                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1800
                                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1801 1802 1803 1804
                                                </div>
                                            </div>
                                        </div>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1805
                                    <div className="column-2">
Deni Rinaldi's avatar
Deni Rinaldi committed
1806
                                        <div className="grid grid-2x content-center">
Deni Rinaldi's avatar
Deni Rinaldi committed
1807
                                            <div className="column-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
1808
                                                <div style={{ textAlign: 'right', width: 120 }}>
rifkaki's avatar
rifkaki committed
1809
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1810
                                                        null :
d.arizona's avatar
d.arizona committed
1811
                                                        this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1812 1813 1814 1815 1816 1817 1818 1819
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[13]).toFixed(1)}
                                                            />
rifkaki's avatar
rifkaki committed
1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855
                                                        // :
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 13)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 13)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 13)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 13)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
rifkaki's avatar
rifkaki committed
1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872
                                                                :
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={val}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
                                                                                value={Number(handleVariance(tableMeta, 2, 4)).toFixed(1)}
                                                                            />
                                                                        }
                                                                    />
                                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1873
                                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1874 1875
                                                </div>
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1876
                                            <div className="column-2">
Deni Rinaldi's avatar
Deni Rinaldi committed
1877
                                                <div style={{ textAlign: 'right', width: 120 }}>
rifkaki's avatar
rifkaki committed
1878
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1879
                                                        null :
d.arizona's avatar
d.arizona committed
1880
                                                        this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1881 1882 1883 1884 1885
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
d.arizona's avatar
d.arizona committed
1886
                                                                suffix={'%'}
Riri Novita's avatar
Riri Novita committed
1887 1888 1889
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[14]).toFixed(1)}
                                                            />
d.arizona's avatar
d.arizona committed
1890
                                                        :
rifkaki's avatar
rifkaki committed
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 14)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 14)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 14)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 14)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
                                                        //         :
rifkaki's avatar
rifkaki committed
1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={val}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? 'red' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
                                                                                suffix={'%'}
                                                                                value={Number(handleVariancePercent(tableMeta, 2, 5)).toFixed(1)}
                                                                            />
                                                                        }
                                                                    />
                                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1944
                                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1945 1946 1947 1948
                                                </div>
                                            </div>
                                        </div>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1949
                                    <div className="column-3">
Deni Rinaldi's avatar
Deni Rinaldi committed
1950
                                        <div className="grid grid-2x content-center">
Deni Rinaldi's avatar
Deni Rinaldi committed
1951
                                            <div className="column-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
1952
                                                <div style={{ textAlign: 'right', width: 120 }}>
rifkaki's avatar
rifkaki committed
1953
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1954
                                                        null :
d.arizona's avatar
d.arizona committed
1955
                                                        this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
1956 1957 1958 1959 1960 1961 1962 1963
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[15]).toFixed(1)}
                                                            />
d.arizona's avatar
d.arizona committed
1964
                                                        :
rifkaki's avatar
rifkaki committed
1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 15)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 15)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 15)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 15)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
                                                        //         :
rifkaki's avatar
rifkaki committed
2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={val}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
                                                                                value={Number(handleVariance(tableMeta, 3, 6)).toFixed(1)}
                                                                            />
                                                                        }
                                                                    />
                                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2017
                                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2018 2019
                                                </div>
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2020
                                            <div className="column-2">
Deni Rinaldi's avatar
Deni Rinaldi committed
2021
                                                <div style={{ textAlign: 'right', width: 120 }}>
rifkaki's avatar
rifkaki committed
2022
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2023
                                                        null :
d.arizona's avatar
d.arizona committed
2024
                                                        this.state.get_for == 'view'?
Riri Novita's avatar
Riri Novita committed
2025 2026 2027 2028
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
d.arizona's avatar
d.arizona committed
2029
                                                                suffix={'%'}
Riri Novita's avatar
Riri Novita committed
2030 2031 2032 2033
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[16]).toFixed(1)}
                                                            />
d.arizona's avatar
d.arizona committed
2034
                                                        :
rifkaki's avatar
rifkaki committed
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 2065 2066 2067 2068 2069 2070
                                                        // tableMeta.rowData[0] === 7 ?
                                                        //     (Number(handleValueFormula(tableMeta, 16)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 16)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                        //         <NumberFormat
                                                        //             thousandSeparator={true}
                                                        //             style={{
                                                        //                 fontSize: 12,
                                                        //                 textAlign: 'right',
                                                        //                 borderColor: 'transparent',
                                                        //                 margin: 0,
                                                        //                 width: 96,
                                                        //                 backgroundColor: 'transparent'
                                                        //             }}
                                                        //             type="text"
                                                        //             placeholder=""
                                                        //             disabled={true}
                                                        //             value={Number(handleValueFormula(tableMeta, 16)).toFixed(1)}
                                                        //         /> :
                                                        //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{
                                                        //                     fontSize: 12,
                                                        //                     textAlign: 'right',
                                                        //                     borderColor: 'transparent',
                                                        //                     margin: 0,
                                                        //                     width: 96,
                                                        //                     backgroundColor: 'transparent',
                                                        //                     color: 'red'
                                                        //                 }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleValueFormula(tableMeta, 16)).toFixed(1)}
                                                        //             />
                                                        //         </LightTooltip>
                                                        //         :
rifkaki's avatar
rifkaki committed
2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={val}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? 'red' : 'black', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
                                                                                suffix={'%'}
                                                                                value={Number(handleVariancePercent(tableMeta, 3, 7)).toFixed(1)}
                                                                            />
                                                                        }
                                                                    />
                                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2088
                                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2089 2090 2091 2092 2093 2094 2095 2096 2097 2098
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        )
                    }
                }
            },
Deni Rinaldi's avatar
Deni Rinaldi committed
2099 2100 2101 2102 2103 2104 2105 2106
            {
                name: `MTD Explanation`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
                            {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
                                <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                            </TableCell> */}
Deni Rinaldi's avatar
Deni Rinaldi committed
2107
                            <div style={{ borderBottom: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 40 }}>{columnMeta.name}</div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2108
                            <div className="grid grid-3x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2109
                                <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2110 2111
                                    <span>{"vs Prev Month"}</span>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2112
                                <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2113 2114
                                    <span>{"vs MB"}</span>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2115
                                <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2116 2117 2118 2119 2120
                                    <span>{"vs RB"}</span>
                                </div>
                            </div>
                        </th>
                    ),
Deni Rinaldi's avatar
Deni Rinaldi committed
2121 2122 2123 2124 2125 2126
                    setCellProps: () => ({
                        style: {
                            paddingLeft: 0,
                            paddingRight: 0
                        }
                    }),
Deni Rinaldi's avatar
Deni Rinaldi committed
2127 2128 2129 2130 2131 2132
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div>
                                <div className="grid grid-3x content-center">
                                    <div className="col-1">
                                        <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
2133
                                            <div style={{ flex: 1 }}>
d.arizona's avatar
d.arizona committed
2134
                                                {tableMeta.rowData[0] !== 3 ?
rifkaki's avatar
rifkaki committed
2135
                                                null :
d.arizona's avatar
d.arizona committed
2136
                                                    (this.state.get_for == 'view'?
d.arizona's avatar
d.arizona committed
2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152
                                                        <Input
                                                            disableUnderline={true}
                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            // disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
                                                            disabled={true}
                                                            multiline={true}
                                                            defaultValue={tableMeta.rowData[17]}
                                                            inputProps={{
                                                                style: {
                                                                    color:'black',
                                                                    textAlign: 'left'
                                                                }
                                                            }}
                                                        />
d.arizona's avatar
d.arizona committed
2153
                                                    :
Riri Novita's avatar
Riri Novita committed
2154
                                                    <FormControlLabel
Deni Rinaldi's avatar
Deni Rinaldi committed
2155 2156 2157
                                                        style={{ margin: 0 }}
                                                        // value={value}
                                                        control={
d.arizona's avatar
d.arizona committed
2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181
                                                            // tableMeta.rowData[17] === "" && (Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue) ?
                                                            //     <LightTooltip title={"MTD Explanation vs Prev Month is Reqiured"} arrow>
                                                            //         <Input
                                                            //             disableUnderline={true}
                                                            //             style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //             type="text"
                                                            //             placeholder=""
                                                            //             disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                            //             // disabled={false}
                                                            //             multiline={true}
                                                            //             defaultValue={tableMeta.rowData[17]}
                                                            //             inputProps={{
                                                            //                 style: {
                                                            //                     color: "#5198ea",
                                                            //                     textAlign: 'left',
                                                            //                     backgroundColor: '#ffac99'
                                                            //                 }
                                                            //             }}
                                                            //             onBlur={(event) => {
                                                            //                 handleText(event.target.value, tableMeta, 17)
                                                            //             }}
                                                            //         />
                                                            //     </LightTooltip>
                                                            //     :
rifkaki's avatar
rifkaki committed
2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219
                                                                // tableMeta.rowData[0] === 7 ?
                                                                //     (Number(handleValueFormula(tableMeta, 17)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 17)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                //         <NumberFormat
                                                                //             thousandSeparator={true}
                                                                //             style={{
                                                                //                 fontSize: 12,
                                                                //                 textAlign: 'right',
                                                                //                 borderColor: 'transparent',
                                                                //                 margin: 0,
                                                                //                 width: 96,
                                                                //                 backgroundColor: 'transparent'
                                                                //             }}
                                                                //             type="text"
                                                                //             placeholder=""
                                                                //             disabled={true}
                                                                //             value={Number(handleValueFormula(tableMeta, 17)).toFixed(1)}
                                                                //         /> :
                                                                //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                //             <NumberFormat
                                                                //                 thousandSeparator={true}
                                                                //                 style={{
                                                                //                     fontSize: 12,
                                                                //                     textAlign: 'right',
                                                                //                     borderColor: 'transparent',
                                                                //                     margin: 0,
                                                                //                     width: 96,
                                                                //                     backgroundColor: 'transparent',
                                                                //                     color: 'red'
                                                                //                 }}
                                                                //                 type="text"
                                                                //                 placeholder=""
                                                                //                 disabled={true}
                                                                //                 value={Number(handleValueFormula(tableMeta, 17)).toFixed(1)}
                                                                //             />
                                                                //         </LightTooltip>
                                                                //         :
                                                                        <Input
                                                                            disableUnderline={true}
d.arizona's avatar
d.arizona committed
2220
                                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
rifkaki's avatar
rifkaki committed
2221 2222 2223 2224
                                                                            type="text"
                                                                            placeholder=""
                                                                            // disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
                                                                            disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
d.arizona's avatar
d.arizona committed
2225
                                                                            multiline={true}
rifkaki's avatar
rifkaki committed
2226 2227 2228 2229
                                                                            defaultValue={tableMeta.rowData[17]}
                                                                            inputProps={{
                                                                                style: {
                                                                                    color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#5198ea" : '#5198ea',
d.arizona's avatar
d.arizona committed
2230
                                                                                    textAlign: 'left'
rifkaki's avatar
rifkaki committed
2231 2232 2233 2234 2235 2236
                                                                                }
                                                                            }}
                                                                            onBlur={(event) => {
                                                                                handleText(event.target.value, tableMeta, 17)
                                                                            }}
                                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2237
                                                        }
d.arizona's avatar
d.arizona committed
2238
                                                    />)}
Riri Novita's avatar
Riri Novita committed
2239
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2240 2241 2242 2243
                                        </div>
                                    </div>
                                    <div className="col-2">
                                        <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
2244
                                            <div style={{ flex: 1 }}>
d.arizona's avatar
d.arizona committed
2245 2246
                                                {tableMeta.rowData[0] !== 3 ? null :
                                                    (this.state.get_for == 'view'?
d.arizona's avatar
d.arizona committed
2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262
                                                        <Input
                                                            disableUnderline={true}
                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            // disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
                                                            disabled={true}
                                                            multiline={true}
                                                            defaultValue={tableMeta.rowData[18]}
                                                            inputProps={{
                                                                style: {
                                                                    color:'black',
                                                                    textAlign: 'left'
                                                                }
                                                            }}
                                                        />
d.arizona's avatar
d.arizona committed
2263
                                                    :
Riri Novita's avatar
Riri Novita committed
2264
                                                    <FormControlLabel
Deni Rinaldi's avatar
Deni Rinaldi committed
2265 2266 2267
                                                        style={{ margin: 0 }}
                                                        // value={value}
                                                        control={
Deni Rinaldi's avatar
Deni Rinaldi committed
2268 2269 2270 2271
                                                            tableMeta.rowData[18] === "" && (Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue) ?
                                                                <LightTooltip title={"MTD Explanation vs MB is Reqiured"} arrow>
                                                                    <Input
                                                                        disableUnderline={true}
Riri Novita's avatar
Riri Novita committed
2272
                                                                        style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30, padding: 0 }}
Deni Rinaldi's avatar
Deni Rinaldi committed
2273 2274
                                                                        type="text"
                                                                        placeholder=""
d.arizona's avatar
d.arizona committed
2275
                                                                        multiline={true}
Deni Rinaldi's avatar
Deni Rinaldi committed
2276
                                                                        // disabled={false}
d.arizona's avatar
d.arizona committed
2277
                                                                        disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
Deni Rinaldi's avatar
Deni Rinaldi committed
2278 2279 2280 2281
                                                                        defaultValue={tableMeta.rowData[18]}
                                                                        inputProps={{
                                                                            style: {
                                                                                color: "#5198ea",
d.arizona's avatar
d.arizona committed
2282
                                                                                textAlign: 'left',
Riri Novita's avatar
Riri Novita committed
2283 2284 2285
                                                                                backgroundColor: '#ffac99',
                                                                                minHeight: 30,
                                                                                padding: 0
Deni Rinaldi's avatar
Deni Rinaldi committed
2286 2287 2288 2289 2290 2291 2292 2293
                                                                            }
                                                                        }}
                                                                        onBlur={(event) => {
                                                                            handleText(event.target.value, tableMeta, 18)
                                                                        }}
                                                                    />
                                                                </LightTooltip>
                                                                :
rifkaki's avatar
rifkaki committed
2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331
                                                                // tableMeta.rowData[0] === 7 ?
                                                                //     (Number(handleValueFormula(tableMeta, 18)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 18)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                //         <NumberFormat
                                                                //             thousandSeparator={true}
                                                                //             style={{
                                                                //                 fontSize: 12,
                                                                //                 textAlign: 'right',
                                                                //                 borderColor: 'transparent',
                                                                //                 margin: 0,
                                                                //                 width: 96,
                                                                //                 backgroundColor: 'transparent'
                                                                //             }}
                                                                //             type="text"
                                                                //             placeholder=""
                                                                //             disabled={true}
                                                                //             value={Number(handleValueFormula(tableMeta, 18)).toFixed(1)}
                                                                //         /> :
                                                                //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                //             <NumberFormat
                                                                //                 thousandSeparator={true}
                                                                //                 style={{
                                                                //                     fontSize: 12,
                                                                //                     textAlign: 'right',
                                                                //                     borderColor: 'transparent',
                                                                //                     margin: 0,
                                                                //                     width: 96,
                                                                //                     backgroundColor: 'transparent',
                                                                //                     color: 'red'
                                                                //                 }}
                                                                //                 type="text"
                                                                //                 placeholder=""
                                                                //                 disabled={true}
                                                                //                 value={Number(handleValueFormula(tableMeta, 18)).toFixed(1)}
                                                                //             />
                                                                //         </LightTooltip>
                                                                //         :
                                                                        <Input
                                                                            disableUnderline={true}
d.arizona's avatar
d.arizona committed
2332
                                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
rifkaki's avatar
rifkaki committed
2333
                                                                            type="text"
d.arizona's avatar
d.arizona committed
2334
                                                                            multiline={true}
rifkaki's avatar
rifkaki committed
2335 2336 2337 2338 2339 2340 2341
                                                                            placeholder=""
                                                                            // disabled={Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? false : true}
                                                                            disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                            defaultValue={tableMeta.rowData[18]}
                                                                            inputProps={{
                                                                                style: {
                                                                                    color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
d.arizona's avatar
d.arizona committed
2342
                                                                                    textAlign: 'left'
rifkaki's avatar
rifkaki committed
2343 2344 2345 2346 2347 2348
                                                                                }
                                                                            }}
                                                                            onBlur={(event) => {
                                                                                handleText(event.target.value, tableMeta, 18)
                                                                            }}
                                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2349
                                                        }
d.arizona's avatar
d.arizona committed
2350
                                                    />)}
Riri Novita's avatar
Riri Novita committed
2351
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2352 2353 2354 2355
                                        </div>
                                    </div>
                                    <div className="col-3">
                                        <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
2356
                                            <div style={{ flex: 1 }}>
d.arizona's avatar
d.arizona committed
2357 2358
                                                {tableMeta.rowData[0] !== 3 ? null :
                                                    (this.state.get_for == 'view'?
d.arizona's avatar
d.arizona committed
2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374
                                                        <Input
                                                            disableUnderline={true}
                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            // disabled={Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? false : true}
                                                            disabled={true}
                                                            multiline={true}
                                                            defaultValue={tableMeta.rowData[19]}
                                                            inputProps={{
                                                                style: {
                                                                    color:'black',
                                                                    textAlign: 'left'
                                                                }
                                                            }}
                                                        />
d.arizona's avatar
d.arizona committed
2375
                                                    :
Riri Novita's avatar
Riri Novita committed
2376
                                                    <FormControlLabel
Deni Rinaldi's avatar
Deni Rinaldi committed
2377 2378 2379
                                                        style={{ margin: 0 }}
                                                        // value={value}
                                                        control={
d.arizona's avatar
d.arizona committed
2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403
                                                            // tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue) ?
                                                            //     <LightTooltip title={"MTD Explanation vs RB is Reqiured"} arrow>
                                                            //         <Input
                                                            //             disableUnderline={true}
                                                            //             style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            //             type="text"
                                                            //             multiline={true}
                                                            //             placeholder=""
                                                            //             // disabled={false}
                                                            //             disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                            //             defaultValue={tableMeta.rowData[19]}
                                                            //             inputProps={{
                                                            //                 style: {
                                                            //                     color: "#5198ea",
                                                            //                     textAlign: 'left',
                                                            //                     backgroundColor: '#ffac99'
                                                            //                 }
                                                            //             }}
                                                            //             onBlur={(event) => {
                                                            //                 handleText(event.target.value, tableMeta, 19)
                                                            //             }}
                                                            //         />
                                                            //     </LightTooltip>
                                                            //     :
rifkaki's avatar
rifkaki committed
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 2439 2440 2441
                                                                // tableMeta.rowData[0] === 7 ?
                                                                //     (Number(handleValueFormula(tableMeta, 19)).toFixed(1) >= Number(this.state.minValue) && Number(handleValueFormula(tableMeta, 19)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                //         <NumberFormat
                                                                //             thousandSeparator={true}
                                                                //             style={{
                                                                //                 fontSize: 12,
                                                                //                 textAlign: 'right',
                                                                //                 borderColor: 'transparent',
                                                                //                 margin: 0,
                                                                //                 width: 96,
                                                                //                 backgroundColor: 'transparent'
                                                                //             }}
                                                                //             type="text"
                                                                //             placeholder=""
                                                                //             disabled={true}
                                                                //             value={Number(handleValueFormula(tableMeta, 19)).toFixed(1)}
                                                                //         /> :
                                                                //         <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[23]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                //             <NumberFormat
                                                                //                 thousandSeparator={true}
                                                                //                 style={{
                                                                //                     fontSize: 12,
                                                                //                     textAlign: 'right',
                                                                //                     borderColor: 'transparent',
                                                                //                     margin: 0,
                                                                //                     width: 96,
                                                                //                     backgroundColor: 'transparent',
                                                                //                     color: 'red'
                                                                //                 }}
                                                                //                 type="text"
                                                                //                 placeholder=""
                                                                //                 disabled={true}
                                                                //                 value={Number(handleValueFormula(tableMeta, 19)).toFixed(1)}
                                                                //             />
                                                                //         </LightTooltip>
                                                                //         :
                                                                        <Input
                                                                            disableUnderline={true}
d.arizona's avatar
d.arizona committed
2442
                                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
rifkaki's avatar
rifkaki committed
2443
                                                                            type="text"
d.arizona's avatar
d.arizona committed
2444
                                                                            multiline={true}
rifkaki's avatar
rifkaki committed
2445 2446 2447 2448 2449 2450 2451
                                                                            placeholder=""
                                                                            // disabled={Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? false : true}
                                                                            disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                            defaultValue={tableMeta.rowData[19]}
                                                                            inputProps={{
                                                                                style: {
                                                                                    color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea',
d.arizona's avatar
d.arizona committed
2452
                                                                                    textAlign: 'left'
rifkaki's avatar
rifkaki committed
2453 2454 2455 2456 2457 2458
                                                                                }
                                                                            }}
                                                                            onBlur={(event) => {
                                                                                handleText(event.target.value, tableMeta, 19)
                                                                            }}
                                                                        />
Deni Rinaldi's avatar
Deni Rinaldi committed
2459
                                                        }
d.arizona's avatar
d.arizona committed
2460
                                                    />)}
Riri Novita's avatar
Riri Novita committed
2461
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2462 2463 2464 2465 2466 2467 2468
                                        </div>
                                    </div>
                                </div>
                            </div>
                        )
                    }
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
                }
            }, {
                name: "",
                options: {
                    display: false
d.arizona's avatar
d.arizona committed
2513 2514 2515 2516 2517 2518
                }
            },
            {
                name: "",
                options: {
                    display: false
Deni Rinaldi's avatar
Deni Rinaldi committed
2519 2520
                }
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2521
        ]
Deni Rinaldi's avatar
Deni Rinaldi committed
2522

Deni Rinaldi's avatar
Deni Rinaldi committed
2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533
        const loadingComponent = (
            <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)' }}>
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );

Deni Rinaldi's avatar
Deni Rinaldi committed
2534 2535
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2536
                {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
2537 2538 2539
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report</Typography>
                </div>
Riri Novita's avatar
Riri Novita committed
2540 2541 2542 2543 2544
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
Deni Rinaldi's avatar
Deni Rinaldi committed
2545
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2546
                    {this.state.visibleBSMR ? <Paper style={{ paddingTop: 10 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2547 2548 2549 2550 2551 2552 2553
                        <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                            <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
                        </div>
                        <div style={{ padding: 20 }}>
                            <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                <div>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
d.arizona's avatar
d.arizona committed
2554
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2555 2556 2557
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                </div>
                                <div style={{ width: '50%' }}>
d.arizona's avatar
d.arizona committed
2558
                                    {this.props.isApprover === true || this.state.get_for == 'view'?
Deni Rinaldi's avatar
Deni Rinaldi committed
2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629
                                        <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' }}>
                                            <a data-tip={'Download Template'} data-for="template">
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.downloadTemplate()}
                                                >
                                                    <img src={Images.template} />
                                                </button>
                                            </a>
                                            <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                            <a data-tip={'Upload'} data-for="upload">
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.setState({ visibleUpload: true })}
                                                >
                                                    <img src={Images.upload} />
                                                </button>
                                            </a>
                                            <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                            <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>
                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2630 2631 2632 2633
                                </div>
                            </div>

                            <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
rifkaki's avatar
rifkaki committed
2634
                                {!this.state.loading && (
Deni Rinaldi's avatar
Deni Rinaldi committed
2635 2636
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
d.arizona's avatar
d.arizona committed
2637
                                            data={dataTable2}
Deni Rinaldi's avatar
Deni Rinaldi committed
2638 2639 2640 2641
                                            columns={columns}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
rifkaki's avatar
rifkaki committed
2642
                                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2643
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2644

faisalhamdi's avatar
faisalhamdi committed
2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658
                            <div style={{display: 'flex'}}>
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                <div style={{marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10}}>
                                    {
                                        this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
                                            return (
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                            )
                                        }) :
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>

                                    }
                                </div>
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2659
                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2660 2661 2662

                        </div>
                        {/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
Deni Rinaldi's avatar
Deni Rinaldi committed
2663
                                (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
Deni Rinaldi's avatar
Deni Rinaldi committed
2664
                        <div className="grid grid-2x" style={{ padding: 20 }}>
Riri Novita's avatar
Riri Novita committed
2665
                            <div className="col-1" style={{ paddingLeft: 0 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676
                                <button
                                    type="button"
                                    onClick={() => this.setState({ loading: true }, () => {
                                        setTimeout(() => {
                                            this.props.onClickClose()
                                        }, 100);
                                    })}
                                    style={{
                                        backgroundColor: 'transparent',
                                        cursor: 'pointer',
                                        borderColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
2677
                                        outline: 'none',
Deni Rinaldi's avatar
Deni Rinaldi committed
2678 2679 2680 2681 2682 2683 2684
                                    }}
                                >
                                    <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                        <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
                                    </div>
                                </button>
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2685 2686 2687
                            {this.props.isApprover === true ?
                                <div className="col-2">
                                </div> :
Riri Novita's avatar
Riri Novita committed
2688
                                <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Riri Novita's avatar
Riri Novita committed
2689
                                    {this.state.get_for == 'view' && this.state.viewOnly && <button
d.arizona's avatar
d.arizona committed
2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
                                        onClick={() => {
                                            this.setState({loading: true}, () => {
                                                this.handleGetFor('edit')
                                            })
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                            <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography>
                                        </div>
                                    </button>}
                                    {this.state.get_for == 'edit' && <button
Deni Rinaldi's avatar
Deni Rinaldi committed
2710 2711 2712 2713 2714 2715 2716 2717 2718 2719
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
                                        onClick={() => {
d.arizona's avatar
d.arizona committed
2720
                                            this.setState({ loading: true, dataTable: dataTable2 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2721
                                                setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2722
                                                    this.handleValidate()
Deni Rinaldi's avatar
Deni Rinaldi committed
2723 2724 2725 2726 2727 2728 2729
                                                }, 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>
d.arizona's avatar
d.arizona committed
2730 2731
                                    </button>}
                                    {this.state.get_for === 'edit' && <button
Deni Rinaldi's avatar
Deni Rinaldi committed
2732 2733 2734 2735
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
rifkaki's avatar
rifkaki committed
2736
                                            cursor: 'pointer',
Deni Rinaldi's avatar
Deni Rinaldi committed
2737 2738 2739 2740 2741
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
                                        onClick={() =>
d.arizona's avatar
d.arizona committed
2742 2743 2744
                                            this.state.saveDraft ?
                                                this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' }) 
                                                :
Deni Rinaldi's avatar
Deni Rinaldi committed
2745
                                                this.state.handleTekTekTek == 1 ? null :
rifkaki's avatar
rifkaki committed
2746
                                                    this.setState({ handleTekTekTek: 1, loading: true }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2747 2748 2749 2750 2751
                                                        this.backToMonthlyReport('draft')
                                                    })
                                        }
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
rifkaki's avatar
rifkaki committed
2752
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2753
                                        </div>
d.arizona's avatar
d.arizona committed
2754 2755
                                    </button>}
                                    {this.state.get_for === 'edit' && <button
Deni Rinaldi's avatar
Deni Rinaldi committed
2756
                                        type="button"
rifkaki's avatar
rifkaki committed
2757
                                        // disabled={this.state.buttonError}
Deni Rinaldi's avatar
Deni Rinaldi committed
2758 2759
                                        onClick={() =>
                                            this.state.buttonError ?
rifkaki's avatar
rifkaki committed
2760
                                                this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
Deni Rinaldi's avatar
Deni Rinaldi committed
2761 2762 2763 2764 2765 2766 2767
                                                :
                                                this.state.handleTekTekTek == 1 ? null :
                                                    this.setState({ handleTekTekTek: 1 }, () => {
                                                        this.backToMonthlyReport('submitted')
                                                    })}
                                        style={{
                                            backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
2768
                                            cursor: 'pointer',
Deni Rinaldi's avatar
Deni Rinaldi committed
2769 2770 2771 2772 2773
                                            borderColor: 'transparent',
                                            outline: 'none',
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
rifkaki's avatar
rifkaki committed
2774
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2775
                                        </div>
d.arizona's avatar
d.arizona committed
2776
                                    </button>}
Deni Rinaldi's avatar
Deni Rinaldi committed
2777 2778
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2779
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2780 2781
                        {/* : null
                            } */}
Deni Rinaldi's avatar
Deni Rinaldi committed
2782 2783 2784 2785
                    </Paper> :
                        <Paper style={{ paddingTop: 10 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Balance Sheet</Typography>
d.arizona's avatar
d.arizona committed
2786
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2787 2788 2789
                            <div style={{ padding: 20 }}>
                                <div>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
d.arizona's avatar
d.arizona committed
2790
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {String(this.props.month.month_value).toLocaleUpperCase()} {this.props.periode} (rev.{this.props.revision})</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2791
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
d.arizona's avatar
d.arizona committed
2792
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2793
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
rifkaki's avatar
rifkaki committed
2794
                                    {this.state.dataLoaded && !this.state.loading && (
Deni Rinaldi's avatar
Deni Rinaldi committed
2795 2796 2797 2798 2799 2800 2801
                                        <MuiThemeProvider theme={getMuiTheme()}>
                                            <MUIDataTable
                                                data={dataTable2}
                                                columns={columns}
                                                options={options}
                                            />
                                        </MuiThemeProvider>
Riri Novita's avatar
Riri Novita committed
2802
                                     )} 
Deni Rinaldi's avatar
Deni Rinaldi committed
2803
                                </div>
d.arizona's avatar
d.arizona committed
2804 2805 2806
                            </div>
                            <div className="grid grid-2x" style={{ marginTop: 10, padding: 20}}>
                                    <div className="col-1" style={{paddingLeft: 0}}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2807 2808
                                        <button
                                            type="button"
d.arizona's avatar
d.arizona committed
2809
                                            onClick={() => this.setState({ loading: true, visibleBSMR: true }, () => {
d.arizona's avatar
d.arizona committed
2810
                                                setTimeout(() => {
Riri Novita's avatar
Riri Novita committed
2811
                                                    this.getItemHierarki()
d.arizona's avatar
d.arizona committed
2812
                                                }, 100);
Deni Rinaldi's avatar
Deni Rinaldi committed
2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825
                                            })}
                                            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' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
                                            </div>
                                        </button>
                                    </div>
d.arizona's avatar
d.arizona committed
2826
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
d.arizona's avatar
d.arizona committed
2838
                                                this.setState({ loading: true, dataTable: dataTable2 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2839
                                                    setTimeout(() => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2840
                                                        this.handleValidate()
Deni Rinaldi's avatar
Deni Rinaldi committed
2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
rifkaki's avatar
rifkaki committed
2854
                                                cursor: 'pointer',
Deni Rinaldi's avatar
Deni Rinaldi committed
2855 2856 2857 2858 2859 2860
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
                                                this.state.saveDraft === true ?
rifkaki's avatar
rifkaki committed
2861
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
d.arizona's avatar
d.arizona committed
2862
                                                    :
Deni Rinaldi's avatar
Deni Rinaldi committed
2863 2864 2865 2866 2867 2868 2869
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1 }, () => {
                                                            this.uploadBalanceSheet('draft')
                                                        })
                                            }
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
2870
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2871 2872 2873 2874
                                            </div>
                                        </button>
                                        <button
                                            type="button"
rifkaki's avatar
rifkaki committed
2875
                                            // disabled={this.state.buttonError}
Deni Rinaldi's avatar
Deni Rinaldi committed
2876 2877
                                            onClick={() =>
                                                this.state.buttonError ?
rifkaki's avatar
rifkaki committed
2878
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
Deni Rinaldi's avatar
Deni Rinaldi committed
2879 2880 2881 2882 2883 2884 2885
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1 }, () => {
                                                            this.uploadBalanceSheet('submitted')
                                                        })}
                                            style={{
                                                backgroundColor: 'transparent',
rifkaki's avatar
rifkaki committed
2886
                                                cursor: 'pointer',
Deni Rinaldi's avatar
Deni Rinaldi committed
2887 2888 2889 2890 2891
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
2892
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2893 2894 2895
                                            </div>
                                        </button>
                                    </div>
d.arizona's avatar
d.arizona committed
2896
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2897
                        </Paper>
d.arizona's avatar
d.arizona committed
2898
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2899
                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928
                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
                                    </div>
                                </div>
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
                            </div>
                            <UploadFile
                                type={this.state.uploadStatus}
                                percentage={this.state.percentage}
                                result={this.state.result}
                                acceptedFiles={["xlsx"]}
                                onHandle={(dt) => {
                                    this.fileHandler(dt)
                                    this.setState({ uploadStatus: 'idle', percentage: '0' })
                                }}
                                onUpload={() => {
rifkaki's avatar
rifkaki committed
2929
                                    String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
Deni Rinaldi's avatar
Deni Rinaldi committed
2930 2931 2932 2933 2934 2935 2936
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
                        </div>
                    </div>
                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2937 2938 2939 2940
            </div>
        )
    }
}