BalanceSheetRO.js 190 KB
Newer Older
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
import MUIDataTable from 'mui-datatables'
import React, { Component } from 'react'
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images';
import api from '../../api';
import NumberFormat from 'react-number-format';
import { type } from 'ramda';
import { PropagateLoader } from 'react-spinners';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant';
import * as R from 'ramda';
import { Alert } from '@material-ui/lab';

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
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

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

const options = ct.customOptionsFixedColumn();

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

export default class BalanceSheetRO extends Component {
43 44 45 46 47 48
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            loading: true,
            get_for: "view",
faisalhamdi's avatar
faisalhamdi committed
49
            viewOnly: true,
Riri Novita's avatar
Riri Novita committed
50
            updateBy: [],
51 52 53 54 55 56 57 58
            editable: false,
            handleTekTekTek: 0,
            saveDraft: true,
            minValue: 0,
            maxValue: 0,
            alert: false,
            tipeAlert: '',
            messageAlert: '',
d.arizona's avatar
d.arizona committed
59 60
            visibleUpload: false,
            visibleBSRO: true
61 62 63 64
        }
    }

    componentDidMount() {
Deni Rinaldi's avatar
Deni Rinaldi committed
65
        console.log(this.props);
66
        // this.getItemHierarki()
d.arizona's avatar
d.arizona committed
67
        this.getLatestUpdate()
68
        this.getSettingControl()
d.arizona's avatar
d.arizona committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
        this.handleViewOnly()
    }

    handleViewOnly() {
        let checkApprover = false
        let checkLastStatus = false
        let checkStatus = false
        let checkPrevRev = false

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

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

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

        if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
            checkStatus = true
        } else {
            checkStatus = false
        }
Riri Novita's avatar
Riri Novita committed
101 102 103 104
        // console.log(this.props.isApprover);
        // console.log(this.props.lastStatus);
        // console.log(this.props.prevRevision);
        // console.log(this.props.status);
faisalhamdi's avatar
faisalhamdi committed
105

Riri Novita's avatar
Riri Novita committed
106 107 108 109
        // console.log(!checkApprover);
        // console.log(checkLastStatus);
        // console.log(checkStatus);
        // console.log(checkPrevRev);
d.arizona's avatar
d.arizona committed
110
        this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
    }

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

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

d.arizona's avatar
d.arizona committed
146 147 148 149 150 151 152 153 154 155 156 157 158 159
    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,
            "rolling_outlook_id": this.props.rollingOutlookID,
            "quartal": this.props.quarter
        }
        api.create().getRollingOutlookLastUpdate(payload).then(response => {
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
160
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail,
d.arizona's avatar
d.arizona committed
161 162 163 164
                        notes: response.data.data.notes_update === null ? "" : response.data.data.notes_update
                    })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
165
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
d.arizona's avatar
d.arizona committed
166 167 168 169 170 171 172 173 174 175 176 177 178
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
        })
    }

179 180 181 182 183 184 185 186 187
    getItemHierarki() {
        this.setState({ loading: true, judulColumn: null })
        let payload = {
            "company_id": this.props.company.company_id,
            "get_for": this.state.get_for,
            "months": 0,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "revision": Number(this.props.revision),
d.arizona's avatar
d.arizona committed
188
            "quartal": this.props.quarter,
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
            "rolling_outlook_id": this.props.rollingOutlookID
        }
        api.create().getRollingOutlookBS(payload).then(response => {
            console.log(response);
            let dataTable = []
            if (response.data) {
                if (response.data.status == 'success') {
                    let res = response.data.data
                    const handlePushChild = (item) => {
                        let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                        if (indexIDzz === -1) {
                            dataTable.push([
                                item.type_report_id,
                                item.id,
                                item.parent,
                                item.formula,
                                item.level,
                                item.description,
d.arizona's avatar
d.arizona committed
207
                                item.balance_sheet.total_last_year === "" ? "0" : item.balance_sheet.total_last_year,
faisalhamdi's avatar
faisalhamdi committed
208 209 210 211 212 213 214 215 216 217 218 219
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.january, formula: item.balance_sheet.january_formula } : Number(item.balance_sheet.january).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.february, formula: item.balance_sheet.february_formula } : Number(item.balance_sheet.february).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.march, formula: item.balance_sheet.march_formula } : Number(item.balance_sheet.march).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.april, formula: item.balance_sheet.april_formula } : Number(item.balance_sheet.april).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.may, formula: item.balance_sheet.may_formula } : Number(item.balance_sheet.may).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.june, formula: item.balance_sheet.june_formula } : Number(item.balance_sheet.june).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.july, formula: item.balance_sheet.july_formula } : Number(item.balance_sheet.july).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.august, formula: item.balance_sheet.august_formula } : Number(item.balance_sheet.august).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.september, formula: item.balance_sheet.september_formula } : Number(item.balance_sheet.september).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
                                String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
d.arizona's avatar
d.arizona committed
220
                                item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year,
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
                                item.order,
                                item.condition_it_should_be,
                                item.condition_if_wrong
                            ])
                        }
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
                        }
                    }
                    res.map((item, index) => {
                        dataTable.push([
                            item.type_report_id,
                            item.id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.description,
d.arizona's avatar
d.arizona committed
242
                            item.balance_sheet.total_last_year === "" ? "0" : item.balance_sheet.total_last_year,
faisalhamdi's avatar
faisalhamdi committed
243 244 245 246 247 248 249 250 251 252 253 254
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.january, formula: item.balance_sheet.january_formula } : Number(item.balance_sheet.january).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.february, formula: item.balance_sheet.february_formula } : Number(item.balance_sheet.february).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.march, formula: item.balance_sheet.march_formula } : Number(item.balance_sheet.march).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.april, formula: item.balance_sheet.april_formula } : Number(item.balance_sheet.april).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.may, formula: item.balance_sheet.may_formula } : Number(item.balance_sheet.may).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.june, formula: item.balance_sheet.june_formula } : Number(item.balance_sheet.june).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.july, formula: item.balance_sheet.july_formula } : Number(item.balance_sheet.july).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.august, formula: item.balance_sheet.august_formula } : Number(item.balance_sheet.august).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.september, formula: item.balance_sheet.september_formula } : Number(item.balance_sheet.september).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.october, formula: item.balance_sheet.october_formula } : Number(item.balance_sheet.october).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.november, formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november).toFixed(1),
                            String(item.description).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.balance_sheet.december, formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december).toFixed(1),
d.arizona's avatar
d.arizona committed
255
                            item.balance_sheet.total_current_year === "" ? "0" : item.balance_sheet.total_current_year,
256 257 258 259 260 261 262 263 264 265 266 267
                            item.order,
                            item.condition_it_should_be,
                            item.condition_if_wrong
                        ])
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
                        }
                    })
rifkaki's avatar
rifkaki committed
268
                    console.log(dataTable)
269 270 271
                    this.setState({ dataTable, loading: false, buttonError: true, editable: true })
                } else {
                    this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
272
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
273 274 275 276 277 278 279 280 281 282 283 284 285
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ dataTable, loading: false, buttonError: true, editable: true })
            }
        })
    }

rifkaki's avatar
rifkaki committed
286
    downloadTemplate = async () => {
d.arizona's avatar
d.arizona committed
287 288 289 290 291
        // alert('Coming Soon ...')
        let res = await fetch(
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`
        )
        res = await res.blob()
d.arizona's avatar
d.arizona committed
292
        console.log(`${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&quartal=${this.props.quarter}`)
d.arizona's avatar
d.arizona committed
293 294 295 296 297 298 299
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Rolling Outlook Balance Sheet.xlsx';
            a.click();
        }
d.arizona's avatar
d.arizona committed
300
        setTimeout(() => {
faisalhamdi's avatar
faisalhamdi committed
301
            this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
302
        }, 500);
rifkaki's avatar
rifkaki committed
303 304 305
    }

    async downloadAllData() {
d.arizona's avatar
d.arizona committed
306 307 308 309 310 311 312 313 314 315 316 317 318 319
        // alert('Coming Soon ...')
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${this.props.rollingOutlookID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}`
        console.log(url);
        let res = await fetch(
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/balance_sheet/rolling_outlook/export_rolling_outlook?rolling_outlook_id=${this.props.rollingOutlookID === null ? "" : this.props.rollingOutlookID}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}&&quartal=${this.props.quarter}`
        )
        res = await res.blob()
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Rolling Outlook Balance Sheet.xlsx';
            a.click();
        }
d.arizona's avatar
d.arizona committed
320
        setTimeout(() => {
faisalhamdi's avatar
faisalhamdi committed
321
            this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
322
        }, 500);
rifkaki's avatar
rifkaki committed
323 324 325
    }

    handleGetFor(type) {
rifkaki's avatar
rifkaki committed
326
        console.log(type)
faisalhamdi's avatar
faisalhamdi committed
327
        this.setState({ get_for: type }, () => {
rifkaki's avatar
rifkaki committed
328
            // this.getSettingControl()
d.arizona's avatar
d.arizona committed
329
            this.getLatestUpdate()
rifkaki's avatar
rifkaki committed
330 331 332 333
            this.getItemHierarki()
        })
    }

rifkaki's avatar
rifkaki committed
334 335 336 337 338 339 340 341

    backToRollingOutlook(type) {
        this.setState({ loading: true })
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                "item_report_id": i[1],
                "total_december_last_year": String(Number(i[6]).toFixed(1)),
faisalhamdi's avatar
faisalhamdi committed
342 343 344 345 346 347 348 349 350 351 352 353
                "january": i[7].value !== undefined  ? String(Number(i[7].value).toFixed(1)) : String(Number(i[7]).toFixed(1)),
                "february": i[8].value !== undefined  ? String(Number(i[8].value).toFixed(1)) : String(Number(i[8]).toFixed(1)),
                "march": i[9].value !== undefined  ? String(Number(i[9].value).toFixed(1)) : String(Number(i[9]).toFixed(1)),
                "april": i[10].value !== undefined  ? String(Number(i[10].value).toFixed(1)) : String(Number(i[10]).toFixed(1)),
                "may": i[11].value !== undefined  ? String(Number(i[11].value).toFixed(1)) : String(Number(i[11]).toFixed(1)),
                "june": i[12].value !== undefined  ? String(Number(i[12].value).toFixed(1)) : String(Number(i[12]).toFixed(1)),
                "july": i[13].value !== undefined  ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)),
                "august": i[14].value !== undefined  ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)),
                "september": i[15].value !== undefined  ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)),
                "october": i[16].value !== undefined  ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)),
                "november": i[17].value !== undefined  ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)),
                "december": i[18].value !== undefined  ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)),
rifkaki's avatar
rifkaki committed
354 355 356 357 358 359 360 361
                "total_december_year": String(Number(i[19]).toFixed(1))
            })
        })
        let payload = {
            "rolling_outlook_id": this.props.rollingOutlookID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
d.arizona's avatar
d.arizona committed
362
            "quartal": this.props.quarter,
rifkaki's avatar
rifkaki committed
363 364 365 366 367 368 369 370 371
            "status": type,
            "balance_sheet": data
        }
        api.create('UPLOAD').createRollingOutlookBS(payload).then(response => {
            console.log(payload);
            console.log(response);
            // console.log(JSON.stringify(payload))
            if (response.data) {
                if (response.data.status === "success") {
faisalhamdi's avatar
faisalhamdi committed
372 373
                    this.props.onClickClose()
                    this.props.refresh()
rifkaki's avatar
rifkaki committed
374
                } else {
Riri Novita's avatar
Riri Novita committed
375 376
                    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
377
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
378 379 380 381 382
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
rifkaki's avatar
rifkaki committed
383
                        this.props.onClickClose()
d.arizona's avatar
d.arizona committed
384
                        this.props.refresh()
rifkaki's avatar
rifkaki committed
385 386
                    })
                }
Riri Novita's avatar
Riri Novita committed
387 388 389 390 391 392 393
                // else {
                //     this.setState({ loading: false, handleTekTekTek: 0 }, () => {
                //         // this.props.saveToMonthlyReport()
                //         this.props.onClickClose()
                //         this.props.refresh()
                //     })
                // }
rifkaki's avatar
rifkaki committed
394 395 396 397 398 399 400 401 402 403 404 405 406
            } else {
                this.setState({ loading: false, handleTekTekTek: 0 })
            }
        })
    }

    handleValidate() {
        let data = []
        let err = false
        let errorContrl = false
        let editAble = this.state.editAble
        let dataTable = this.state.dataTable
        let kansas = this.state.kansas
faisalhamdi's avatar
faisalhamdi committed
407
        console.log(dataTable[dataTable.length - 1])
rifkaki's avatar
rifkaki committed
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
        // dataTable.map((i, index) => {
        //     if(i[0] === 3) {
        //         if ( i[18] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
        //             console.log('msk 2');
        //             err = true
        //         }
        //     }

        //     if (String(i[5]) == "Control (should be nil)") {
        //         if (Number(i[9]) < this.state.minValue || Number(i[9]) > this.state.maxValue ) { 
        //             errorContrl = true
        //             editAble = true
        //         }
        //     }

        //     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]
        //     })
        // })

        // 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
        // }

        // api.create().validateSubmitReportBS(payload).then((response) => {
        //     console.log(response.data.data.result)
        //     console.log(err);
        //     console.log(errorContrl);
        //     if (response.data) {
        //         if (response.data.status === "success") {
        //             if (response.data.data.result && err === false && errorContrl === false ) {
faisalhamdi's avatar
faisalhamdi committed
459
        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
rifkaki's avatar
rifkaki committed
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
        //                 if (kansas == 0) {
        //                     this.setState({kansas: 1, loading: true}, () => {
        //                         this.handleValidate()
        //                     })
        //                 } else {
        //                     this.setState({kansas: 0})
        //                 }
        //             } else {
        //                 this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
        //                 if (kansas == 0) {
        //                     this.setState({kansas: 1, loading: true}, () => {
        //                         this.handleValidate()
        //                     })
        //                 } else {
        //                     this.setState({kansas: 0})
        //                 }
        //             }
        //         } else {
        //             this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
479
        //                 if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
rifkaki's avatar
rifkaki committed
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
        //                     setTimeout(() => {
        //                         localStorage.removeItem(Constant.TOKEN)
        //                         window.location.reload();
        //                     }, 1000);
        //                 }
        //             })
        //         }
        //     } else {
        //         this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
        //     }
        // })
    }

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

d.arizona's avatar
d.arizona committed
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
    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({
                            orders: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
                            item_report: i[2] === undefined ? "" : String(i[2]).trim(),
d.arizona's avatar
d.arizona committed
515 516 517 518 519 520 521 522 523 524 525 526 527
                            "january": i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            "february": i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            "march": i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            "april": i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            "may": i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            "june": i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            "july": i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            "august": i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            "september": i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            "october": i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            "november": i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            "december": i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            "total_december_year": i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
d.arizona's avatar
d.arizona committed
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    balance_sheet: payload,
                    rolling_outlook_id: this.props.rollingOutlookID,
                    quartal: this.props.quarter,
                    status: 'submitted'
                }
                console.log(body)
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
            }
        });
    }

    checkUpload() {
        api.create().checkImportRollingOutlookBS(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, visibleBSRO: false, loading: true })
                    let err = false
                    let dataTable = response.data.data.map((item, index) => {
                        // 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
                        //     }
                        // }
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.total_december_last_year === "" ? "0" : item.total_december_last_year,
faisalhamdi's avatar
faisalhamdi committed
568 569 570 571 572 573 574 575 576 577 578 579
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.january, formula: item.january_formula } : Number(item.january).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.february, formula: item.february_formula } : Number(item.february).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.march, formula: item.march_formula } : Number(item.march).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.april, formula: item.april_formula } : Number(item.april).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.may, formula: item.may_formula } : Number(item.may).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.june, formula: item.june_formula } : Number(item.june).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.july, formula: item.july_formula } : Number(item.july).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.august, formula: item.august_formula } : Number(item.august).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.september, formula: item.september_formula } : Number(item.september).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.october, formula: item.october_formula } : Number(item.october).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.november, formula: item.november_formula } : Number(item.november).toFixed(1),
                            String(item.item_report).toLocaleLowerCase() == "profit (loss) mtd" ? { value: item.december, formula: item.december_formula } : Number(item.december).toFixed(1),
d.arizona's avatar
d.arizona committed
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606
                            item.total_december_year === "" ? "0" : item.total_december_year,
                            item.order,
                            item.condition_it_should_be,
                            item.condition_if_wrong
                        ]
                    })
                    console.log(dataTable)
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: true, isUpload: true }, () => {
                        this.state.dataTable.map(item => {
                            // if (item[24].length > 0) {
                            //     // console.log('masuk')
                            //     this.setState({ buttonError: true, errorPreview: true })
                            // }
                        })
                        // console.log(this.state.buttonError)
                    })
                }
            }
        })
    }

    uploadBSRO(type) {
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                "item_report_id": i[1],
                "total_december_last_year": String(Number(i[6]).toFixed(1)),
faisalhamdi's avatar
faisalhamdi committed
607 608 609 610 611 612 613 614 615 616 617 618
                "january": i[7].value !== undefined  ? String(Number(i[7].value).toFixed(1)) : String(Number(i[7]).toFixed(1)),
                "february": i[8].value !== undefined  ? String(Number(i[8].value).toFixed(1)) : String(Number(i[8]).toFixed(1)),
                "march": i[9].value !== undefined  ? String(Number(i[9].value).toFixed(1)) : String(Number(i[9]).toFixed(1)),
                "april": i[10].value !== undefined  ? String(Number(i[10].value).toFixed(1)) : String(Number(i[10]).toFixed(1)),
                "may": i[11].value !== undefined  ? String(Number(i[11].value).toFixed(1)) : String(Number(i[11]).toFixed(1)),
                "june": i[12].value !== undefined  ? String(Number(i[12].value).toFixed(1)) : String(Number(i[12]).toFixed(1)),
                "july": i[13].value !== undefined  ? String(Number(i[13].value).toFixed(1)) : String(Number(i[13]).toFixed(1)),
                "august": i[14].value !== undefined  ? String(Number(i[14].value).toFixed(1)) : String(Number(i[14]).toFixed(1)),
                "september": i[15].value !== undefined  ? String(Number(i[15].value).toFixed(1)) : String(Number(i[15]).toFixed(1)),
                "october": i[16].value !== undefined  ? String(Number(i[16].value).toFixed(1)) : String(Number(i[16]).toFixed(1)),
                "november": i[17].value !== undefined  ? String(Number(i[17].value).toFixed(1)) : String(Number(i[17]).toFixed(1)),
                "december": i[18].value !== undefined  ? String(Number(i[18].value).toFixed(1)) : String(Number(i[18]).toFixed(1)),
d.arizona's avatar
d.arizona committed
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636
                "total_december_year": String(Number(i[19]).toFixed(1))
            })
        })
        let payload = {
            "rolling_outlook_id": this.props.rollingOutlookID,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "quartal": this.props.quarter,
            "status": type,
            "balance_sheet": data
        }
        api.create('UPLOAD').importRollingOutlookBS(payload).then(response => {
            console.log(payload);
            console.log(response);
            // console.log(JSON.stringify(payload))
            if (response.data) {
                if (response.data.status === "success") {
faisalhamdi's avatar
faisalhamdi committed
637 638
                    this.props.onClickClose()
                    this.props.refresh()
d.arizona's avatar
d.arizona committed
639 640 641 642 643 644 645 646 647 648 649 650 651
                } else {
                    this.setState({ loading: false, handleTekTekTek: 0 }, () => {
                        // this.props.saveToMonthlyReport()
                        this.props.onClickClose()
                        this.props.refresh()
                    })
                }
            } else {
                this.setState({ loading: false, handleTekTekTek: 0 })
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
652
    render() {
rifkaki's avatar
rifkaki committed
653
        let dataTable2 = this.state.dataTable
rifkaki's avatar
rifkaki committed
654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687

        const handleChange = (value, tableMeta, type) => {
            let val = String(value).split(",").join("")
            if (type === "actual") {
                console.log('masuk')
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
            } else {
                console.log('masuk2')
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
                    // console.log(indexParent)
                    let a = 0
                    if (type == 'r/e') {
                        // console.log('masuk8')
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(val).toFixed(1)
                    } else {
                        // console.log('masuk9')
                        a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
                    }
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)).toFixed(1) : Number(jagain + Number(val)).toFixed(1)
                } else {
                    // console.log('masuk3')
                    if (type == 'r/e') {
                        // console.log('masuk4')
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = Number(val).toFixed(1)
                    } else {
                        // console.log('masuk5')
                        dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val).toFixed(1)
                    }
                }
            }
        }

faisalhamdi's avatar
faisalhamdi committed
688
        const handleValue = (data) => {
rifkaki's avatar
rifkaki committed
689 690
            let total = 0
            dataTable2.map((item, index) => {
faisalhamdi's avatar
faisalhamdi committed
691 692 693
                // if (data.rowData[5] == 'Retained Earnings') {
                //     console.log(item[data.columnIndex].value)
                // }
rifkaki's avatar
rifkaki committed
694
                if (data.rowData[1] === item[2]) {
faisalhamdi's avatar
faisalhamdi committed
695 696
                    let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex])
                    total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal
rifkaki's avatar
rifkaki committed
697 698 699
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
faisalhamdi's avatar
faisalhamdi committed
700
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total).toFixed(1)
rifkaki's avatar
rifkaki committed
701
            // console.log(indexParent);
faisalhamdi's avatar
faisalhamdi committed
702 703 704 705 706 707
            return a
        }

        const handleValidation = (data, tableMeta) => {
            let a = handleValueFormula(data, tableMeta)
            return a
rifkaki's avatar
rifkaki committed
708 709
        }

710
        const handleTotal = (tableMeta) => {
faisalhamdi's avatar
faisalhamdi committed
711 712 713
            let total = 0
            
            tableMeta.rowData.map((item,index) => {
714 715 716 717 718 719 720
                if (index == 18) {
                    total = isNaN(item) ? Number(item.value) : Number(item)
                    // if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd") {
                    //     total = Number(item.value)
                    // } else {                        
                        // total = Number(item)
                    // }
faisalhamdi's avatar
faisalhamdi committed
721 722 723 724 725 726
                }
            })
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            return total
        }

faisalhamdi's avatar
faisalhamdi committed
727
        const handleValueFormula = (value, tableMeta, colIdx) => {
rifkaki's avatar
rifkaki committed
728 729 730 731 732 733 734 735
            let splitFormula = String(tableMeta.rowData[3]).split(/([()@])/)
            let baru = []
            let anjay = []

            splitFormula.map((item, index) => {
                let items = String(item).substr(Number(String(item).length) - 1, 1)
                let re = /^[a-zA-Z0-9_]+$/;
                if (item !== "") {
faisalhamdi's avatar
faisalhamdi committed
736 737 738 739 740 741 742
                    if (!re.test(items)) {
                        if (String(item).substr(Number(String(item).length) - 1, 1) === ']') {
                            baru.push(String(item))
                        } else {
                            baru.push(String(item).substr(0, Number(String(item).length) - 1))
                            baru.push(String(item).substr(Number(String(item).length) - 1, 1))
                        }
rifkaki's avatar
rifkaki committed
743 744 745 746 747 748
                    } else {
                        baru.push(String(item))
                    }
                }
            })

faisalhamdi's avatar
faisalhamdi committed
749 750 751 752 753 754
            // if (tableMeta.columnIndex == 7) {
            //     console.log(splitFormula)
            //     console.log(baru)
            // }
            // console.log(baru)

rifkaki's avatar
rifkaki committed
755
            baru.map((item, index) => {
faisalhamdi's avatar
faisalhamdi committed
756
                if (item == '-' || item == '+' || item == '/' || item == '*') {
rifkaki's avatar
rifkaki committed
757 758 759 760 761
                    anjay.push(item)
                } else {
                    if (String(item).includes('#')) {
                        if (String(item).includes('[M-1]')) {
                            let tst = String(item).replace('[M-1]', '')
faisalhamdi's avatar
faisalhamdi committed
762 763 764 765 766
                            let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
                            let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
                            // console.log(tableMeta.columnIndex)
                            let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
                            // console.log(indexID)
rifkaki's avatar
rifkaki committed
767
                            if (indexID !== -1) {
faisalhamdi's avatar
faisalhamdi committed
768 769
                                let valuezz = tableMeta.rowData[data].formula[indexID].value
                                // baru.push(valuezz)
rifkaki's avatar
rifkaki committed
770
                                anjay.push(valuezz == "" ? 0 : valuezz)
faisalhamdi's avatar
faisalhamdi committed
771
                                // console.log(valuezz)
rifkaki's avatar
rifkaki committed
772 773
                            }
                        } else {
faisalhamdi's avatar
faisalhamdi committed
774 775
                            let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
                            // console.log(indexID)
rifkaki's avatar
rifkaki committed
776
                            if (indexID !== -1) {
faisalhamdi's avatar
faisalhamdi committed
777 778
                                // console.log(value.formula[indexID].value)
                                let valuezz = value.formula[indexID].value
rifkaki's avatar
rifkaki committed
779 780 781
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        }
faisalhamdi's avatar
faisalhamdi committed
782 783 784
                    } else if (String(item).includes('[M-1]')) {
                        let tst = String(item).replace('[M-1]', '')
                        if (tableMeta.columnIndex === 7) {
faisalhamdi's avatar
faisalhamdi committed
785
                            let indexID = dataTable2.findIndex((val) => val[20] == tst)
rifkaki's avatar
rifkaki committed
786
                            if (indexID !== -1) {
faisalhamdi's avatar
faisalhamdi committed
787 788
                                let valuezz = dataTable2[indexID][6]
                                anjay.push(valuezz == "" ? 0 : valuezz)
rifkaki's avatar
rifkaki committed
789 790
                            }
                        } else {
faisalhamdi's avatar
faisalhamdi committed
791 792
                            let data = tableMeta.columnIndex - 1
                            let indexID = dataTable2.findIndex((val) => val[20] == tst)
rifkaki's avatar
rifkaki committed
793
                            if (indexID !== -1) {
faisalhamdi's avatar
faisalhamdi committed
794 795
                                let valuezz = dataTable2[indexID][data].value !== undefined ? dataTable2[indexID][data].formula[0].value : dataTable2[indexID][data]
                                anjay.push(valuezz == "" ? 0 : valuezz)
rifkaki's avatar
rifkaki committed
796
                            }
faisalhamdi's avatar
faisalhamdi committed
797
                            // console.log(tst, data, tableMeta.rowData[data]);
rifkaki's avatar
rifkaki committed
798 799
                        }
                    } else {
faisalhamdi's avatar
faisalhamdi committed
800 801 802 803 804 805 806 807 808 809 810 811
                        let indexID = dataTable2.findIndex((val) => val[20] == item)
                        // console.log(dataTable2[indexID])
                        if (indexID !== -1) {
                            let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
                            anjay.push(valuezz == "" ? 0 : valuezz)
                        } else {
                            if (item === '(-1)') {
                                anjay.push(-1)
                            }
                            // console.log(item);

                        }
rifkaki's avatar
rifkaki committed
812 813 814
                    }
                }
            })
faisalhamdi's avatar
faisalhamdi committed
815
            // console.log(anjay)
rifkaki's avatar
rifkaki committed
816 817 818

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

            if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
                // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            } else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
            }
rifkaki's avatar
rifkaki committed
858 859 860

            return total
        }
861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892
        let columns = [
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
faisalhamdi's avatar
faisalhamdi committed
893 894 895 896 897 898 899 900 901 902 903 904 905
                name: "Account",
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'left' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style }),
                    customBodyRender: (val, tableMeta) => {
                        return (
                            <div style={{ width: 300 }}>
                                {tableMeta.rowData[0] === null ?
                                    tableMeta.rowData[4] == 0 ?
906
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
faisalhamdi's avatar
faisalhamdi committed
907 908 909 910 911 912 913
                                            <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>
914
                                    :
faisalhamdi's avatar
faisalhamdi committed
915 916 917 918 919 920 921 922 923 924
                                    tableMeta.rowData[4] == 0 ?
                                        <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                        :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                            <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
925
                }
faisalhamdi's avatar
faisalhamdi committed
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940
            }, {
                name: `31 Dec ${Number(this.props.periode) - 1} Actual`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
941 942 943 944 945 946
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
947
                                            value={Number(val).toFixed(1)}
948
                                        />
faisalhamdi's avatar
faisalhamdi committed
949
                                        :
950 951 952 953 954 955 956
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                value={val}
                                                control={
                                                    <NumberFormat
                                                        thousandSeparator={true}
d.arizona's avatar
d.arizona committed
957
                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
958 959
                                                        type="text"
                                                        placeholder=""
d.arizona's avatar
d.arizona committed
960
                                                        disabled={true}
faisalhamdi's avatar
faisalhamdi committed
961
                                                        value={Number(val).toFixed(1)}
962 963
                                                    />
                                                }
964
                                            />
faisalhamdi's avatar
faisalhamdi committed
965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994
                                        </div>
                                }
                            </div>
                        )
                    }
                }
            }, {
                name: `Jan ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
                                        />
                                        :
faisalhamdi's avatar
faisalhamdi committed
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006
                                        <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=""
                                                        value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
                                                        disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1007
                                                    />
faisalhamdi's avatar
faisalhamdi committed
1008 1009 1010
                                                }
                                            />
                                        </div>
faisalhamdi's avatar
faisalhamdi committed
1011 1012 1013 1014
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1015
                }
faisalhamdi's avatar
faisalhamdi committed
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030
            }, {
                name: `Feb ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1031 1032 1033 1034 1035 1036
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1037
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1038
                                        />
faisalhamdi's avatar
faisalhamdi committed
1039
                                        :
faisalhamdi's avatar
faisalhamdi committed
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
                                        <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=""
                                                        value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
                                                        disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1052
                                                    />
faisalhamdi's avatar
faisalhamdi committed
1053 1054 1055
                                                }
                                            />
                                        </div>
faisalhamdi's avatar
faisalhamdi committed
1056 1057 1058 1059
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1060
                }
faisalhamdi's avatar
faisalhamdi committed
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075
            }, {
                name: `Mar ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1076 1077 1078 1079 1080 1081
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1082
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1083
                                        />
faisalhamdi's avatar
faisalhamdi committed
1084
                                        :
faisalhamdi's avatar
faisalhamdi committed
1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096
                                        <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=""
                                                        value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
                                                        disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1097
                                                    />
faisalhamdi's avatar
faisalhamdi committed
1098 1099 1100
                                                }
                                            />
                                        </div>
faisalhamdi's avatar
faisalhamdi committed
1101 1102 1103 1104
                                }
                            </div>
                        )
                    }
1105
                }
faisalhamdi's avatar
faisalhamdi committed
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
            }, {
                name: `Apr ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1121 1122 1123 1124 1125 1126
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1127
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1128
                                        />
faisalhamdi's avatar
faisalhamdi committed
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
                                        :
                                        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)).toFixed(1)}
1139
                                                />
faisalhamdi's avatar
faisalhamdi committed
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={this.props.quarter == 'q1' ? false : true}
                                                                value={this.props.quarter == 'q2' || this.props.quarter == 'q3' ? (val == "" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1175
                                                                    value={this.props.quarter == 'q2' || this.props.quarter == 'q3' ? (val == "" ? "" : Number(handleValueFormula(val, tableMeta)).toFixed(1)) : Number(handleValueFormula(val, tableMeta)).toFixed(1)}
1176 1177 1178
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        this.props.quarter === 'q2' || this.props.quarter === 'q3' ? null :
                                                            (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                /> :
                                                                <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                    />
                                                                </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
1237
                }
faisalhamdi's avatar
faisalhamdi committed
1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252
            }, {
                name: `May ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1253 1254 1255 1256 1257 1258
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1259
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1260
                                        />
faisalhamdi's avatar
faisalhamdi committed
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
                                        :
                                        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)).toFixed(1)}
1271
                                                />
faisalhamdi's avatar
faisalhamdi committed
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={this.props.quarter == 'q1' ? false : true}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1307
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
1308 1309 1310
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 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 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        this.props.quarter === 'q2' || this.props.quarter === 'q3' ? null :
                                                            (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                /> :
                                                                <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                    />
                                                                </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1369
                }
faisalhamdi's avatar
faisalhamdi committed
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384
            }, {
                name: `Jun ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
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}
faisalhamdi's avatar
faisalhamdi committed
1391
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1392
                                        />
faisalhamdi's avatar
faisalhamdi committed
1393 1394 1395 1396 1397 1398 1399 1400 1401 1402
                                        :
                                        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)).toFixed(1)}
1403
                                                />
faisalhamdi's avatar
faisalhamdi committed
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: this.props.quarter == 'q1' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={this.props.quarter == 'q1' ? false : true}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1439
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
1440 1441 1442
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        this.props.quarter === 'q2' || this.props.quarter === 'q3' ? null :
                                                            (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                /> :
                                                                <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                    />
                                                                </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1501
                }
faisalhamdi's avatar
faisalhamdi committed
1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516
            }, {
                name: `Jul ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1517 1518 1519 1520 1521 1522
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1523
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1524
                                        />
faisalhamdi's avatar
faisalhamdi committed
1525 1526 1527 1528 1529 1530 1531 1532 1533 1534
                                        :
                                        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)).toFixed(1)}
1535
                                                />
faisalhamdi's avatar
faisalhamdi committed
1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: this.props.quarter == 'q1' || this.props.quarter == 'q2' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2' ? false : true}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1571
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
1572 1573 1574
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        this.props.quarter === 'q3' ? null :
                                                            (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                /> :
                                                                <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                    />
                                                                </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1633
                }
faisalhamdi's avatar
faisalhamdi committed
1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648
            }, {
                name: `Aug ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1649 1650 1651 1652 1653 1654
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1655
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1656
                                        />
faisalhamdi's avatar
faisalhamdi committed
1657 1658 1659 1660 1661 1662 1663 1664 1665 1666
                                        :
                                        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)).toFixed(1)}
1667
                                                />
faisalhamdi's avatar
faisalhamdi committed
1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: this.props.quarter == 'q1' || this.props.quarter == 'q2' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2' ? false : true}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1703
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
1704 1705 1706
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        this.props.quarter === 'q3' ? null :
                                                            (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                /> :
                                                                <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                    />
                                                                </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1765
                }
faisalhamdi's avatar
faisalhamdi committed
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780
            }, {
                name: `Sep ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1781 1782 1783 1784 1785 1786
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1787
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1788
                                        />
faisalhamdi's avatar
faisalhamdi committed
1789 1790 1791 1792 1793 1794 1795 1796 1797 1798
                                        :
                                        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)).toFixed(1)}
1799
                                                />
faisalhamdi's avatar
faisalhamdi committed
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: this.props.quarter == 'q1' || this.props.quarter == 'q2' ? "#5198ea" : '#555252', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2' ? false : true}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1835
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
1836 1837 1838
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        this.props.quarter === 'q3' ? null :
                                                            (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                /> :
                                                                <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{
                                                                            fontSize: 12,
                                                                            textAlign: 'right',
                                                                            borderColor: 'transparent',
                                                                            margin: 0,
                                                                            width: 96,
                                                                            backgroundColor: 'transparent',
                                                                            color: 'red'
                                                                        }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                    />
                                                                </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1897
                }
faisalhamdi's avatar
faisalhamdi committed
1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912
            }, {
                name: `Oct ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
1913 1914 1915 1916 1917 1918
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
1919
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
1920
                                        />
faisalhamdi's avatar
faisalhamdi committed
1921 1922 1923 1924 1925 1926 1927 1928 1929 1930
                                        :
                                        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)).toFixed(1)}
1931
                                                />
faisalhamdi's avatar
faisalhamdi committed
1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={false}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
1967
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
1968 1969 1970
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
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 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                            /> :
                                                            <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent',
                                                                        color: 'red'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                />
                                                            </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2028
                }
faisalhamdi's avatar
faisalhamdi committed
2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043
            }, {
                name: `Nov ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
2044 2045 2046 2047 2048 2049
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2050
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
2051
                                        />
faisalhamdi's avatar
faisalhamdi committed
2052 2053 2054 2055 2056 2057 2058 2059 2060 2061
                                        :
                                        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)).toFixed(1)}
2062
                                                />
faisalhamdi's avatar
faisalhamdi committed
2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={false}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
2098
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
2099 2100 2101
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                            /> :
                                                            <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent',
                                                                        color: 'red'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                />
                                                            </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2159
                }
faisalhamdi's avatar
faisalhamdi committed
2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174
            }, {
                name: `Dec ${this.props.periode}`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
2175 2176 2177 2178 2179 2180
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2181
                                            value={String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd" ? Number(val.value).toFixed(1) : Number(val).toFixed(1)}
2182
                                        />
faisalhamdi's avatar
faisalhamdi committed
2183 2184 2185 2186 2187 2188 2189 2190 2191 2192
                                        :
                                        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)).toFixed(1)}
2193
                                                />
faisalhamdi's avatar
faisalhamdi committed
2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
                                                                disabled={false}
                                                                value={Number(val).toFixed(1)}
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
                                                    />
                                                </div> :
                                                tableMeta.rowData[0] === 5 || tableMeta.rowData[0] === 6 ?
2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228
                                                    <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}
faisalhamdi's avatar
faisalhamdi committed
2229
                                                                    value={Number(handleValueFormula(val, tableMeta)).toFixed(1)}
2230 2231 2232
                                                                />
                                                            }
                                                        />
faisalhamdi's avatar
faisalhamdi committed
2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289
                                                    </div> :
                                                    tableMeta.rowData[0] === 7 ?
                                                        (Number(handleValidation(val, tableMeta)).toFixed(1) >= Number(this.state.minValue) && Number(handleValidation(val, tableMeta)).toFixed(1) <= Number(this.state.maxValue)) ?
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{
                                                                    fontSize: 12,
                                                                    textAlign: 'right',
                                                                    borderColor: 'transparent',
                                                                    margin: 0,
                                                                    width: 96,
                                                                    backgroundColor: 'transparent'
                                                                }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                            /> :
                                                            <LightTooltip title={this.state.minValue === null ? `Value Should be ${tableMeta.rowData[21]}` : `Value Should be (${this.state.minValue}) up to (${this.state.maxValue})`} arrow>
                                                                <NumberFormat
                                                                    thousandSeparator={true}
                                                                    style={{
                                                                        fontSize: 12,
                                                                        textAlign: 'right',
                                                                        borderColor: 'transparent',
                                                                        margin: 0,
                                                                        width: 96,
                                                                        backgroundColor: 'transparent',
                                                                        color: 'red'
                                                                    }}
                                                                    type="text"
                                                                    placeholder=""
                                                                    disabled={true}
                                                                    value={Number(handleValidation(val, tableMeta)).toFixed(1)}
                                                                />
                                                            </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(val).toFixed(1)}
                                                                    />
                                                                }
                                                            />
                                                        </div>
                                }
                            </div>
                        )
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2290
                }
faisalhamdi's avatar
faisalhamdi committed
2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305
            }, {
                name: `${this.props.periode} Total Outlook`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right' }}>
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
                                    null :
                                    this.state.get_for == 'view' ?
2306 2307 2308 2309 2310 2311
                                        <NumberFormat
                                            thousandSeparator={true}
                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            type="text"
                                            placeholder=""
                                            disabled={true}
faisalhamdi's avatar
faisalhamdi committed
2312
                                            value={Number(val).toFixed(1)}
2313
                                        />
faisalhamdi's avatar
faisalhamdi committed
2314
                                        :
faisalhamdi's avatar
faisalhamdi committed
2315 2316 2317 2318 2319 2320 2321
                                        <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}
2322
                                                value={Number(handleTotal(tableMeta)).toFixed(1)}
faisalhamdi's avatar
faisalhamdi committed
2323 2324
                                            />
                                        </span>
faisalhamdi's avatar
faisalhamdi committed
2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346
                                }
                            </div>
                        )
                    }
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
Deni Rinaldi's avatar
Deni Rinaldi committed
2347 2348 2349
                }
            }
        ]
2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361

        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
2362 2363
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
2364
                {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
2365 2366 2367
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Rolling Outlook & Revision CAT</Typography>
                </div>
rifkaki's avatar
rifkaki committed
2368 2369 2370 2371 2372
                <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
2373
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
d.arizona's avatar
d.arizona committed
2374
                    {this.state.visibleBSRO ? <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2375 2376 2377 2378 2379 2380
                        <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                            <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Balance Sheet</Typography>
                        </div>
                        <div style={{ padding: 20 }}>
                            <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                <div>
2381
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
faisalhamdi's avatar
faisalhamdi committed
2382
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2383 2384
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                </div>
rifkaki's avatar
rifkaki committed
2385
                                <div style={{ width: '50%' }}>
faisalhamdi's avatar
faisalhamdi committed
2386
                                    {this.props.isApprover === true || this.state.get_for == 'view' ?
rifkaki's avatar
rifkaki committed
2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397
                                        <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 }, () => {
faisalhamdi's avatar
faisalhamdi committed
2398
                                                            this.downloadAllData()
rifkaki's avatar
rifkaki committed
2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414
                                                        })}
                                                >
                                                    <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
                                                    }}
faisalhamdi's avatar
faisalhamdi committed
2415
                                                    onClick={() => this.setState({ loading: true }, () => {
d.arizona's avatar
d.arizona committed
2416 2417
                                                        this.downloadTemplate()
                                                    })}
rifkaki's avatar
rifkaki committed
2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430
                                                >
                                                    <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
                                                    }}
d.arizona's avatar
d.arizona committed
2431 2432 2433 2434 2435 2436 2437 2438
                                                    onClick={() => this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.setState({
                                                                loading: false,
                                                                visibleUpload: true
                                                            })
                                                        }, 300);
                                                    })}
rifkaki's avatar
rifkaki committed
2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465
                                                >
                                                    <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>
                                    }
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2466
                            </div>
rifkaki's avatar
rifkaki committed
2467

Deni Rinaldi's avatar
Deni Rinaldi committed
2468
                            <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
faisalhamdi's avatar
faisalhamdi committed
2469 2470 2471 2472 2473 2474 2475 2476 2477
                                {!this.state.loading && (
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
                                            data={dataTable2}
                                            columns={columns}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
                                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2478
                            </div>
rifkaki's avatar
rifkaki committed
2479

Riri Novita's avatar
Riri Novita committed
2480 2481 2482 2483 2484 2485 2486 2487 2488
                            <div style={{ display: 'flex' }}>
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                    {
                                        this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
                                            return (
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                            )
                                        }) :
faisalhamdi's avatar
faisalhamdi committed
2489
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
2490 2491 2492
                                    }
                                </div>
                            </div>
rifkaki's avatar
rifkaki committed
2493 2494
                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Notes : {this.state.notes}</Typography>

Deni Rinaldi's avatar
Deni Rinaldi committed
2495
                        </div>
rifkaki's avatar
rifkaki committed
2496 2497
                        <div className="grid grid-2x" style={{ padding: 20 }}>
                            <div className="col-1" style={{ paddingLeft: 0 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508
                                <button
                                    type="button"
                                    onClick={() => this.setState({ loading: true }, () => {
                                        setTimeout(() => {
                                            this.props.onClickClose()
                                        }, 100);
                                    })}
                                    style={{
                                        backgroundColor: 'transparent',
                                        cursor: 'pointer',
                                        borderColor: 'transparent',
rifkaki's avatar
rifkaki committed
2509
                                        outline: 'none',
Deni Rinaldi's avatar
Deni Rinaldi committed
2510 2511 2512
                                    }}
                                >
                                    <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
rifkaki's avatar
rifkaki committed
2513
                                        <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2514 2515 2516
                                    </div>
                                </button>
                            </div>
rifkaki's avatar
rifkaki committed
2517 2518 2519
                            {this.props.isApprover === true ?
                                <div className="col-2">
                                </div> :
rifkaki's avatar
rifkaki committed
2520
                                <div className="" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541
                                    {this.state.get_for == 'view' && this.state.viewOnly &&
                                        <button
                                            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>
rifkaki's avatar
rifkaki committed
2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576
                                    }
                                    {this.state.get_for == 'edit' && <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
                                        onClick={() => {
                                            this.setState({ loading: true, dataTable: dataTable2 }, () => {
                                                setTimeout(() => {
                                                    this.handleValidate()
                                                }, 100);
                                            })
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                            <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                        </div>
                                    </button>}
                                    {this.state.get_for === 'edit' && <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
                                        onClick={() =>
                                            this.state.saveDraft ?
faisalhamdi's avatar
faisalhamdi committed
2577
                                                this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
rifkaki's avatar
rifkaki committed
2578 2579 2580
                                                :
                                                this.state.handleTekTekTek == 1 ? null :
                                                    this.setState({ handleTekTekTek: 1, loading: true }, () => {
rifkaki's avatar
rifkaki committed
2581
                                                        this.backToRollingOutlook('draft')
rifkaki's avatar
rifkaki committed
2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597
                                                    })
                                        }
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                        </div>
                                    </button>}
                                    {this.state.get_for === 'edit' && <button
                                        type="button"
                                        // disabled={this.state.buttonError}
                                        onClick={() =>
                                            this.state.buttonError ?
                                                this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
                                                :
                                                this.state.handleTekTekTek == 1 ? null :
                                                    this.setState({ handleTekTekTek: 1 }, () => {
rifkaki's avatar
rifkaki committed
2598
                                                        this.backToRollingOutlook('submitted')
rifkaki's avatar
rifkaki committed
2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612
                                                    })}
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none',
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                        </div>
                                    </button>}
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
2613
                        </div>
faisalhamdi's avatar
faisalhamdi committed
2614 2615 2616 2617
                    </Paper> :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Balance Sheet</Typography>
d.arizona's avatar
d.arizona committed
2618
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2619 2620 2621 2622 2623 2624 2625 2626 2627 2628
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }} />
                                    {/* </div> */}
                                </div>
d.arizona's avatar
d.arizona committed
2629

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

faisalhamdi's avatar
faisalhamdi committed
2642 2643 2644 2645 2646 2647
                            </div>
                            <div className="grid grid-2x" style={{ padding: 20 }}>
                                <div className="col-1" style={{ paddingLeft: 0 }}>
                                    <button
                                        type="button"
                                        onClick={() => this.setState({ loading: true }, () => {
d.arizona's avatar
d.arizona committed
2648
                                            setTimeout(() => {
faisalhamdi's avatar
faisalhamdi committed
2649 2650 2651
                                                this.setState({ visibleBSRO: true, visibleUpload: false }, () => {
                                                    this.handleGetFor('edit')
                                                })
d.arizona's avatar
d.arizona committed
2652
                                            }, 100);
faisalhamdi's avatar
faisalhamdi committed
2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684
                                        })}
                                        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>
                                {this.props.isApprover === true ?
                                    <div className="col-2">
                                    </div> :
                                    <div className="" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true, dataTable: dataTable2 }, () => {
                                                    setTimeout(() => {
                                                        this.handleValidate()
                                                    }, 100);
d.arizona's avatar
d.arizona committed
2685
                                                })
faisalhamdi's avatar
faisalhamdi committed
2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>}
                                        {this.state.get_for === 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
                                                this.state.saveDraft ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1, loading: true }, () => {
                                                            this.uploadBSRO('draft')
                                                        })
                                            }
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                            </div>
                                        </button>}
                                        {this.state.get_for === 'edit' && <button
                                            type="button"
                                            // disabled={this.state.buttonError}
                                            onClick={() =>
                                                this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1 }, () => {
                                                            this.uploadBSRO('submitted')
                                                        })}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>}
d.arizona's avatar
d.arizona committed
2738
                                    </div>
faisalhamdi's avatar
faisalhamdi committed
2739
                                }
d.arizona's avatar
d.arizona committed
2740
                            </div>
faisalhamdi's avatar
faisalhamdi committed
2741
                        </Paper>}
Deni Rinaldi's avatar
Deni Rinaldi committed
2742
                </div>
d.arizona's avatar
d.arizona committed
2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779
                {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={() => {
                                    String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("ROLLING") && String(this.state.judul).includes("OUTLOOK") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
                        </div>
                    </div>
                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2780 2781 2782 2783
            </div>
        )
    }
}