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

const LightTooltip = withStyles((theme) => ({
    tooltip: {
Riri Novita's avatar
Riri Novita committed
17

Riri Novita's avatar
Riri Novita committed
18 19 20 21 22 23
        backgroundColor: theme.palette.common.white,
        color: 'rgba(0, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);
Riri Novita's avatar
Riri Novita committed
24

Riri Novita's avatar
Riri Novita committed
25 26 27 28 29 30 31 32 33
const LightTooltipError = withStyles((theme) => ({
    tooltip: {
        backgroundColor: theme.palette.common.white,
        color: 'rgba(255, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);

Riri Novita's avatar
Riri Novita committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47
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",
Riri Novita's avatar
Riri Novita committed
48 49
    zIndex: 100,
    top: 0
Riri Novita's avatar
Riri Novita committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63
};
const stylenotes = {
    position: "sticky",
    background: "white",
    zIndex: 101,
    left: 350
};

const styleNotesEmpty = {
    position: "sticky",
    background: "white",
    zIndex: 99,
    left: 0
}
Riri Novita's avatar
Riri Novita committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77
// const StyledButton = withStyles({
//     root: {
//       background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
//       borderRadius: 3,
//       border: 0,
//       color: 'white',
//       height: 48,
//       padding: '0 30px',
//       boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
//     },
//     label: {
//       textTransform: 'capitalize',
//     },
//   })(Input);
Riri Novita's avatar
Riri Novita committed
78

Riri Novita's avatar
Riri Novita committed
79
export default class ProfitLossROO extends Component {
Riri Novita's avatar
Riri Novita committed
80 81 82 83 84
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            loading: true,
Riri Novita's avatar
Riri Novita committed
85 86 87
            visiblePLRO: true,
            minValue: 0,
            maxValue: 0,
Riri Novita's avatar
Riri Novita committed
88
            updateBy: [],
Riri Novita's avatar
Riri Novita committed
89
            notesUpdate: '-',
Riri Novita's avatar
Riri Novita committed
90
            bebas: false,
Riri Novita's avatar
Riri Novita committed
91
            judulColumn: null,
Riri Novita's avatar
Riri Novita committed
92
            handleTekTekTek: 0,
Riri Novita's avatar
Riri Novita committed
93 94 95
            saveDraft: true,
            buttonError: true,
            viewOnly: true,
Riri Novita's avatar
Riri Novita committed
96 97
            get_for: 'view'

Riri Novita's avatar
Riri Novita committed
98
        }
Riri Novita's avatar
Riri Novita committed
99
        this.fileHandler = this.fileHandler.bind(this);
Riri Novita's avatar
Riri Novita committed
100 101 102 103
    }

    componentDidMount() {
        this.getItemHierarki()
d.arizona's avatar
d.arizona committed
104
        this.getLatestUpdate()
Riri Novita's avatar
Riri Novita committed
105
        // this.getSettingControl()
d.arizona's avatar
d.arizona committed
106
        this.handleViewOnly()
Riri Novita's avatar
Riri Novita committed
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
    }

    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
        }
Riri Novita's avatar
Riri Novita committed
126

Riri Novita's avatar
Riri Novita committed
127 128 129 130 131 132 133 134 135 136 137 138
        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
139
        this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
Riri Novita's avatar
Riri Novita committed
140 141 142 143
    }

    handleGetFor(type) {
        this.setState({ get_for: type }, () => {
Riri Novita's avatar
Riri Novita committed
144 145
            // this.getLatestUpdate()
            // this.getSettingControl()
Riri Novita's avatar
Riri Novita committed
146 147 148 149
            this.getItemHierarki()
        })
    }

Riri Novita's avatar
Riri Novita committed
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
    // getSettingControl() {
    //     let body = {
    //         group: 'THRESHOLD_VARIANCE',
    //         company_id: this.props.company.company_id,
    //         type: 'PNL'
    //     }

    //     api.create().getAllSettingByType(body).then(response => {
    //         console.log(response);
    //         if (response.data) {
    //             if (response.data.status === 'success') {
    //                 this.setState({
    //                     // valueThreshold: response.data.data[0] ? response.data.data[0].value : null,
    //                     minValue: response.data.data[0] ? Number(response.data.data[0].min_value) : -10,
    //                     maxValue: response.data.data[0] ? Number(response.data.data[0].max_value) : 10,

    //                 }, () => {
    //                     this.getItemHierarki()
    //                 })
    //             } else {
    //                 this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
171
    //                     if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
172 173 174 175 176 177 178 179 180 181 182 183 184
    //                         setTimeout(() => {
    //                             localStorage.removeItem(Constant.TOKEN)
    //                             window.location.reload();
    //                         }, 1000);
    //                     }
    //                 })
    //             }
    //         } else {
    //             this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
    //         }
    //     })
    // }

d.arizona's avatar
d.arizona committed
185 186 187 188 189 190 191 192 193 194 195 196 197 198
    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
199
                        updateBy: response.data.data.detail === null ? '-' : response.data.data.detail,
d.arizona's avatar
d.arizona committed
200 201 202 203
                        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
204
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
d.arizona's avatar
d.arizona committed
205 206 207 208 209 210 211 212 213 214 215 216
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
        })
    }
Riri Novita's avatar
Riri Novita committed
217

Riri Novita's avatar
Riri Novita committed
218 219 220 221
    getItemHierarki() {
        let payload = {
            "company_id": this.props.company.company_id,
            "get_for": this.state.get_for,
d.arizona's avatar
d.arizona committed
222
            "quartal": this.props.quarter,
Riri Novita's avatar
Riri Novita committed
223 224 225 226 227
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "revision": Number(this.props.revision),
            "rolling_outlook_id": this.props.rollingOutlookID
        }
Riri Novita's avatar
Riri Novita committed
228
        console.log(payload);
Riri Novita's avatar
Riri Novita committed
229 230 231
        api.create().getRollingOutlookPL(payload).then(response => {
            console.log(response);
            let dataTable = []
Riri Novita's avatar
Riri Novita committed
232 233
            let err = false

Riri Novita's avatar
Riri Novita committed
234
            if (response.data) {
Riri Novita's avatar
Riri Novita committed
235
                if (response.data.status === 'success') {
Riri Novita's avatar
Riri Novita committed
236 237 238 239 240 241 242 243 244 245 246
                    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,
Riri Novita's avatar
Riri Novita committed
247
                                item.profit_loss.notes,
Riri Novita's avatar
Riri Novita committed
248
                                item.profit_loss.last_year_total === "" ? "0" : item.profit_loss.last_year_total,
Riri Novita's avatar
Riri Novita committed
249 250 251
                                item.profit_loss.january === "" ? "0" : item.profit_loss.january,
                                item.profit_loss.february === "" ? "0" : item.profit_loss.february,
                                item.profit_loss.march === "" ? "0" : item.profit_loss.march,
Riri Novita's avatar
Riri Novita committed
252 253 254 255 256 257 258 259 260 261
                                item.profit_loss.april === "" ? "0" : item.profit_loss.april,
                                item.profit_loss.may === "" ? "0" : item.profit_loss.may,
                                item.profit_loss.june === "" ? "0" : item.profit_loss.june,
                                item.profit_loss.july === "" ? "0" : item.profit_loss.july,
                                item.profit_loss.august === "" ? "0" : item.profit_loss.august,
                                item.profit_loss.september === "" ? "0" : item.profit_loss.september,
                                item.profit_loss.october === "" ? "0" : item.profit_loss.october,
                                item.profit_loss.november === "" ? "0" : item.profit_loss.november,
                                item.profit_loss.december === "" ? "0" : item.profit_loss.december,
                                item.profit_loss.current_year_total === "" ? "0" : item.profit_loss.current_year_total,
d.arizona's avatar
d.arizona committed
262
                                "",
Riri Novita's avatar
Riri Novita committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276
                                item.order,
                            ])
                        }
                        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,
Riri Novita's avatar
Riri Novita committed
277 278 279 280 281 282 283
                            item.id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.description,
                            item.profit_loss.notes,
                            item.profit_loss.last_year_total === "" ? "0" : item.profit_loss.last_year_total,
Riri Novita's avatar
Riri Novita committed
284 285 286
                            item.profit_loss.january === "" ? "0" : item.profit_loss.january,
                            item.profit_loss.february === "" ? "0" : item.profit_loss.february,
                            item.profit_loss.march === "" ? "0" : item.profit_loss.march,
Riri Novita's avatar
Riri Novita committed
287 288 289 290 291 292 293 294 295 296
                            item.profit_loss.april === "" ? "0" : item.profit_loss.april,
                            item.profit_loss.may === "" ? "0" : item.profit_loss.may,
                            item.profit_loss.june === "" ? "0" : item.profit_loss.june,
                            item.profit_loss.july === "" ? "0" : item.profit_loss.july,
                            item.profit_loss.august === "" ? "0" : item.profit_loss.august,
                            item.profit_loss.september === "" ? "0" : item.profit_loss.september,
                            item.profit_loss.october === "" ? "0" : item.profit_loss.october,
                            item.profit_loss.november === "" ? "0" : item.profit_loss.november,
                            item.profit_loss.december === "" ? "0" : item.profit_loss.december,
                            item.profit_loss.current_year_total === "" ? "0" : item.profit_loss.current_year_total,
d.arizona's avatar
d.arizona committed
297
                            "",
Riri Novita's avatar
Riri Novita committed
298
                            item.order,
Riri Novita's avatar
Riri Novita committed
299 300 301 302 303 304 305 306 307
                        ])
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
                        }
                    })
Riri Novita's avatar
Riri Novita committed
308 309 310
                    // if (err === true) {
                    //     this.setState({ bebas: true })
                    // }
Riri Novita's avatar
Riri Novita committed
311
                    this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true, refresh: false })
Riri Novita's avatar
Riri Novita committed
312 313
                } else {
                    this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
314
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
315 316 317 318 319 320 321 322
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
Riri Novita's avatar
Riri Novita committed
323
                this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true, refresh: false })
Riri Novita's avatar
Riri Novita committed
324
            }
Riri Novita's avatar
Riri Novita committed
325
            console.log(dataTable);
Riri Novita's avatar
Riri Novita committed
326 327
        })
    }
Riri Novita's avatar
Riri Novita committed
328

Riri Novita's avatar
Riri Novita committed
329
    downloadTemplate = async () => {
d.arizona's avatar
d.arizona committed
330 331 332 333 334 335 336 337 338 339 340 341 342
        // alert('Coming Soon ...')
        let res = await fetch(
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/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()
        // console.log(res)
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Rolling Outlook Profit Loss.xlsx';
            a.click();
        }
Riri Novita's avatar
Riri Novita committed
343 344 345
        setTimeout(() => {
            this.setState({loading: false})
        }, 500);
Riri Novita's avatar
Riri Novita committed
346 347 348
    }

    async downloadAllData() {
d.arizona's avatar
d.arizona committed
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363
        // alert('Coming Soon ...')
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/profit_loss/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/profit_loss/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()
        this.setState({ loading: false })
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Rolling Outlook Profit Loss.xlsx';
            a.click();
        }
Riri Novita's avatar
Riri Novita committed
364 365 366
        setTimeout(() => {
            this.setState({loading: false})
        }, 500);
Riri Novita's avatar
Riri Novita committed
367 368
    }

Riri Novita's avatar
Riri Novita committed
369
    backToRollingOutlook(type) {
Riri Novita's avatar
Riri Novita committed
370 371
        console.log('test');
        // this.setState({ loading: true })
Riri Novita's avatar
Riri Novita committed
372 373 374 375
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                "item_report_id": i[1],
d.arizona's avatar
d.arizona committed
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
                "notes": String(i[6]),
                "last_year_total": String(Number(i[7]).toFixed(1)),
                "january": String(Number(i[8]).toFixed(1)),
                "february": String(Number(i[9]).toFixed(1)),
                "march": String(Number(i[10]).toFixed(1)),
                "april": String(Number(i[11]).toFixed(1)),
                "may": String(Number(i[12]).toFixed(1)),
                "june": String(Number(i[13]).toFixed(1)),
                "july": String(Number(i[14]).toFixed(1)),
                "august": String(Number(i[15]).toFixed(1)),
                "september": String(Number(i[16]).toFixed(1)),
                "october": String(Number(i[17]).toFixed(1)),
                "november": String(Number(i[18]).toFixed(1)),
                "december": String(Number(i[19]).toFixed(1)),
                "current_year_total": String(Number(i[20]).toFixed(1)),
Riri Novita's avatar
Riri Novita committed
391 392 393 394 395 396 397
            })
        })
        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
398
            "quartal": this.props.quarter,
Riri Novita's avatar
Riri Novita committed
399
            "status": type,
Riri Novita's avatar
Riri Novita committed
400
            "profit_loss": data
Riri Novita's avatar
Riri Novita committed
401
        }
Riri Novita's avatar
Riri Novita committed
402 403
        console.log(payload);
        // console.log(JSON.stringify(payload));
d.arizona's avatar
d.arizona committed
404
        api.create('UPLOAD').createRollingOutlookPL(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
405 406 407
            console.log(response);
            if (response.data) {
                if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
408 409 410 411 412
                    if (type == 'submitted') {
                        this.props.refresh('PL')
                    } else {
                        this.props.refresh()
                    }
d.arizona's avatar
d.arizona committed
413
                    this.props.onClickClose()
Riri Novita's avatar
Riri Novita committed
414
                } else {
Riri Novita's avatar
Riri Novita committed
415 416
                    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
417
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
418 419 420 421 422
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
Riri Novita's avatar
Riri Novita committed
423 424 425 426 427
                        // this.props.saveToMonthlyReport()
                        this.props.onClickClose()
                    })
                }
            } else {
Riri Novita's avatar
Riri Novita committed
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
                this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 })
            }
        })
    }

    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(),
d.arizona's avatar
d.arizona committed
449 450
                            "item_report_id": i[1] === undefined ? 0 : i[1],
                            "item_report": i[2] === undefined ? "" : String(i[2]).trim(),
Riri Novita's avatar
Riri Novita committed
451
                            "notes": i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(),
d.arizona's avatar
d.arizona committed
452 453 454 455 456 457 458 459 460 461 462 463
                            "january": i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            "february": i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            "march": i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            "april": i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            "may": i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            "june": i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            "july": i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            "august": i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            "september": i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            "october": i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            "november": i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            "december": i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
Riri Novita's avatar
Riri Novita committed
464 465 466 467 468 469 470
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
d.arizona's avatar
d.arizona committed
471 472
                    quartal: this.props.quarter,
                    rolling_outlook_id: this.props.rollingOutlookID,
Riri Novita's avatar
Riri Novita committed
473 474 475 476 477 478 479 480 481 482
                    status: 'submitted',
                    profit_loss: payload
                }
                console.log(body)
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
            }
        });
    }

    checkUpload() {
d.arizona's avatar
d.arizona committed
483
        api.create().checkImportRollingOutlookPL(this.state.payload).then(response => {
Riri Novita's avatar
Riri Novita committed
484 485 486 487 488 489 490 491 492 493 494 495 496
            // console.log(JSON.stringify(this.state.payload));
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visiblePLRO: false, loading: true })
                    let dataTable = response.data.data.map((item, index) => {
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
d.arizona's avatar
d.arizona committed
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513
                            item.notes,
                            item.last_year_total === "" ? "0" : item.last_year_total,
                            item.january === "" ? "0" : item.january,
                            item.february === "" ? "0" : item.february,
                            item.march === "" ? "0" : item.march,
                            item.april === "" ? "0" : item.april,
                            item.may === "" ? "0" : item.may,
                            item.june === "" ? "0" : item.june,
                            item.july === "" ? "0" : item.july,
                            item.august === "" ? "0" : item.august,
                            item.september === "" ? "0" : item.september,
                            item.october === "" ? "0" : item.october,
                            item.november === "" ? "0" : item.november,
                            item.december === "" ? "0" : item.december,
                            item.current_year_total === "" ? "0" : item.current_year_total,
                            "",
                            item.order,
Riri Novita's avatar
Riri Novita committed
514 515 516 517
                        ]
                    })
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
                        this.state.dataTable.map(item => {
d.arizona's avatar
d.arizona committed
518 519 520 521
                            // if (item[24].length > 0) {
                            //     // console.log('masuk')
                            //     this.setState({ buttonError: true, errorPreview: true })
                            // }
Riri Novita's avatar
Riri Novita committed
522 523 524 525
                        })
                        // console.log(this.state.buttonError)
                    })
                    console.log(dataTable);
Riri Novita's avatar
Riri Novita committed
526 527
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
528
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
529 530 531 532 533 534
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Riri Novita's avatar
Riri Novita committed
535 536 537 538 539
                }
            }
        })
    }

d.arizona's avatar
d.arizona committed
540
    uploadProfitLossRO(type) {
Riri Novita's avatar
Riri Novita committed
541 542 543
        let data = []
        this.state.dataTable.map(i => {
            data.push({
d.arizona's avatar
d.arizona committed
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560
                "item_report_id": i[1],
                "item_report": i[5],
                "notes": String(i[6]),
                "last_year_total": String(Number(i[7]).toFixed(1)),
                "january": String(Number(i[8]).toFixed(1)),
                "february": String(Number(i[9]).toFixed(1)),
                "march": String(Number(i[10]).toFixed(1)),
                "april": String(Number(i[11]).toFixed(1)),
                "may": String(Number(i[12]).toFixed(1)),
                "june": String(Number(i[13]).toFixed(1)),
                "july": String(Number(i[14]).toFixed(1)),
                "august": String(Number(i[15]).toFixed(1)),
                "september": String(Number(i[16]).toFixed(1)),
                "october": String(Number(i[17]).toFixed(1)),
                "november": String(Number(i[18]).toFixed(1)),
                "december": String(Number(i[19]).toFixed(1)),
                "current_year_total": String(Number(i[20]).toFixed(1)),
Riri Novita's avatar
Riri Novita committed
561 562 563 564 565 566 567
            })
        })
        let body = {
            "monthly_report_id": this.props.monthlyReportId,
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
d.arizona's avatar
d.arizona committed
568 569
            "quartal": this.props.quarter,
            "rolling_outlook_id": this.props.rollingOutlookID,
Riri Novita's avatar
Riri Novita committed
570 571 572 573
            "status": type,
            "profit_loss": data
        }
        console.log(data);
d.arizona's avatar
d.arizona committed
574
        api.create('UPLOAD').importRollingOutlookPL(body).then(response => {
Riri Novita's avatar
Riri Novita committed
575 576 577 578
            console.log(response);
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
579
                        this.props.onClickClose()
d.arizona's avatar
d.arizona committed
580 581 582 583 584
                        if (type == 'submitted') {
                            this.props.refresh('PL')
                        } else {
                            this.props.refresh()
                        }
Riri Novita's avatar
Riri Novita committed
585 586 587 588
                        // this.props.onClickClose()
                        // this.props.getReport()
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleTekTekTek: 0 }, () => {
d.arizona's avatar
d.arizona committed
589
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
590 591 592 593 594
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
d.arizona's avatar
d.arizona committed
595 596
                            this.props.onClickClose()
                            this.props.refresh()
Riri Novita's avatar
Riri Novita committed
597 598 599 600 601 602 603 604
                        })
                        // alert(response.data.status)
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
                }
            } else {
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false, handleTekTekTek: 0 })
Riri Novita's avatar
Riri Novita committed
605 606 607 608
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
    handleValidate() {
        // let data = []
        // let err = false
        // this.state.dataTable.map((i, index) => {
        //     data.push({
        //         "item_report_id": i[1],
        //         "notes": i[6],
        //         "rolling_outlook": i[7],
        //         "master_budget": i[8],
        //         "rolling_budget": i[9],
        //         "actual": i[10],
        //         "ytd_actual": i[11],
        //         "actual_previous_month": i[12],
        //         "amount_act_vs_previous_month": i[13],
        //         "percent_act_vs_previous_month": i[14],
        //         "amount_act_vs_mb": i[15],
        //         "percent_act_vs_mb": i[16],
        //         "amount_act_vs_rb": i[17],
        //         "percent_act_vs_rb": i[18],
        //         "mtd_vs_mb": i[19],
        //         "mtd_vs_rb": i[20],
        //         "mtd_vs_previous_month": i[21],
        //     })
        // })

        // console.log(this.state.dataTable);
        // console.log(JSON.stringify(data))
        // let payload = {
        //     "monthly_report_id": this.props.monthlyReportId,
        //     "company_id": this.props.company.company_id,
        //     "periode": this.props.periode,
        //     "report_id": this.props.report_id,
        //     "status": "submitted",
        //     "months": this.props.month.month_id,
        //     "profit_loss": data
        // }
        // console.log(JSON.stringify(payload));
        // api.create().validateSubmitReportPL(payload).then((response) => {
        //     console.log(response.data.data.result)
        //     console.log(err);
        //     if (response.data) {
        //         if (response.data.status === "success") {
        //             if (response.data.data.result && err === false) {
Riri Novita's avatar
Riri Novita committed
652
        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
Riri Novita's avatar
Riri Novita committed
653 654 655 656 657
        //             } else {
        //                 this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
        //             }
        //         } else {
        //             this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
658
        //                 if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
659 660 661 662 663 664 665 666 667 668 669 670 671
        //                     setTimeout(() => {
        //                         localStorage.removeItem(Constant.TOKEN)
        //                         window.location.reload();
        //                     }, 1000);
        //                 }
        //             })
        //         }
        //     } else {
        //         this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
        //     }
        // })
    }

Riri Novita's avatar
Riri Novita committed
672 673 674 675
    closeAlert() {
        this.setState({ alert: false })
    }

Riri Novita's avatar
Riri Novita committed
676
    render() {
Riri Novita's avatar
Riri Novita committed
677
        let dataTable2 = this.state.dataTable
Riri Novita's avatar
Riri Novita committed
678 679 680

        const handleNotes = (value, tableMeta) => {
            // console.log(value)
Riri Novita's avatar
Riri Novita committed
681
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
Riri Novita's avatar
Riri Novita committed
682 683 684
            // console.log(dataTable2[tableMeta.rowIndex]);
        }

Riri Novita's avatar
Riri Novita committed
685 686 687 688 689 690 691 692
        const handleChange = (value, tableMeta, type) => {
            console.log(dataTable2);
            let val = String(value).split(",").join("")
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
        }

        const handleValue = (value, data) => {
            let total = 0
Riri Novita's avatar
Riri Novita committed
693 694
            // console.log(data);
            // console.log(dataTable2);
Riri Novita's avatar
Riri Novita committed
695 696 697
            dataTable2.map((item, index) => {
                if (data.rowData[1] == item[2]) {
                    total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(String(item[data.columnIndex]).includes('-') ? Number(String(item[data.columnIndex]).substr(1, String(item[data.columnIndex]).length)) * -1 : Number(item[data.columnIndex])))
Riri Novita's avatar
Riri Novita committed
698 699 700 701
                    // if (data.rowData[5] == "Revenue") {
                    //     console.log(total);
                    //     // console.log(a);
                    // }
Riri Novita's avatar
Riri Novita committed
702 703
                }
            })
Riri Novita's avatar
Riri Novita committed
704
            // console.log(total);
Riri Novita's avatar
Riri Novita committed
705 706
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
Riri Novita's avatar
Riri Novita committed
707
            
Riri Novita's avatar
Riri Novita committed
708 709 710 711 712 713 714 715 716 717 718 719 720 721
            return a
        }

        const handleFormula = (data, tableMeta, month) => {
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
            let tambahan = false
            let opet = ""
            arrayFormula.map((item, indexs) => {
                if (item == 'X') {
                    tambahan = true
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
                    arrayJumlah.push(item)
                } else {
Riri Novita's avatar
Riri Novita committed
722
                    let index = dataTable2.findIndex((val) => val[22] == item)
Riri Novita's avatar
Riri Novita committed
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783
                    if (tambahan) {
                        if (item == '-' || item == '+' || item == '/' || item == '*') {
                            opet = item
                        } else {
                            arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
                            tambahan = false
                            opet = ""
                        }
                    } else {
                        if (index != -1) {
                            if (item === String(tableMeta.rowData[23])) {
                                arrayJumlah.push(0)
                            } else {
                                arrayJumlah.push(dataTable2[index][tableMeta.columnIndex])
                            }
                        }
                    }
                }

                // if (indexs % 2 !== 0) {
                //     operator.push(item)
                // }
            })
            // if (String(tableMeta.rowData[5]) == "Net Trading Profit (TPAT)") {
            // console.log(tableMeta.rowData[3])
            // console.log(arrayFormula)
            // console.log(arrayJumlah)
            // }

            let array = arrayJumlah
            let total = 0
            let opt = ""
            array.map((item, index) => {
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
                    if (opt == "tambah") {
                        total = Number(total) + Number(item)
                    } else if (opt == "kurang") {
                        total = Number(total) - Number(item)
                    } else if (opt == "kali") {
                        total = Number(total) * Number(item)
                    } else if (opt == "bagi") {
                        total = R.equals((Number(total) / Number(item)), NaN) ? '0' : (R.equals((Number(total) / Number(item)), Infinity) ? '0' : (Number(total) / Number(item) == "-Infinity") ? "0.0" : Number(total) / Number(item))
                    } else {
                        total += Number(item)
                    }
                }
            })
            total = R.equals(total, NaN) ? "0.0" : (R.equals(total, Infinity) ? "0.0" : (total == "-Infinity" ? "0.0" : total))
            // if (tableMeta.rowData[1] === 20092) {
            //     console.log(total);
            //     console.log(arrayJumlah);
            // }
            // if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === "" || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === undefined || dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] === null) {
Riri Novita's avatar
Riri Novita committed
784
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
Riri Novita's avatar
Riri Novita committed
785 786 787 788 789
            // }
            return Number(total)

        }

d.arizona's avatar
d.arizona committed
790 791 792 793 794 795 796
        const handleTotal = (val, tableMeta) => {
            let total = 0
            tableMeta.rowData.map((item,index) => {
                if (index >= 8 && index <= 19) {
                    total += Number(item)
                }
            })
Riri Novita's avatar
Riri Novita committed
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813

            if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
                let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
                dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" :  (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
                return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
            } 
            // else if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "total man power") {
            //     let totalTMP = dataTable2[tableMeta.rowIndex][20] = dataTable2[tableMeta.rowIndex][19]
            //     return totalTMP
            // } else if (indexParent !== -1 && String(dataTable2[indexParent][5]).toLocaleUpperCase() == "GROSS PROFIT MARGIN (% OF REVENUE)") {
            //     return handleFormula(0, tableMeta, 0)
            // }
            else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
                return total
            }
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
Riri Novita's avatar
Riri Novita committed
814 815 816
            // if (String(tableMeta.rowData[5]).toLocaleLowerCase === "sales volume") {
                // console.log(total);
            // }
Riri Novita's avatar
Riri Novita committed
817
            // return total
d.arizona's avatar
d.arizona committed
818 819
        }

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

        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>
        );

Riri Novita's avatar
Riri Novita committed
2282 2283
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Riri Novita's avatar
Riri Novita committed
2284
                {this.state.loading && loadingComponent}
Riri Novita's avatar
Riri Novita committed
2285 2286 2287
                <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>
Riri Novita's avatar
Riri Novita committed
2288 2289 2290 2291 2292
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
Riri Novita's avatar
Riri Novita committed
2293
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Riri Novita's avatar
Riri Novita committed
2294 2295 2296 2297 2298 2299 2300 2301 2302
                    {this.state.visiblePLRO ?
                        <Paper style={{ paddingTop: 10 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography>
                            </div>
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Riri Novita's avatar
Riri Novita committed
2303
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision})</Typography>
Riri Novita's avatar
Riri Novita committed
2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                    </div>
                                    <div style={{ width: '50%' }}>
                                        {this.props.isApprover === true || this.state.get_for == 'view' ?
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                <a data-tip={'Download'} data-for="download">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                            </div> :
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                <a data-tip={'Download Template'} data-for="template">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
Riri Novita's avatar
Riri Novita committed
2338 2339 2340
                                                        onClick={() => this.setState({loading: true}, () => {
                                                            this.downloadTemplate()
                                                        })}
Riri Novita's avatar
Riri Novita committed
2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393
                                                    >
                                                        <img src={Images.template} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                <a data-tip={'Upload'} data-for="upload">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.setState({ visibleUpload: true })}
                                                    >
                                                        <img src={Images.upload} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                <a data-tip={'Download'} data-for="download">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                    this.downloadAllData()
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
                                            </div>
                                        }
                                    </div>
                                </div>

                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                    {!this.state.refresh && (
                                        <MuiThemeProvider theme={getMuiTheme()}>
                                            <MUIDataTable
                                                data={dataTable2}
                                                columns={columns}
                                                options={options}
                                            />
                                        </MuiThemeProvider>
                                    )}
                                </div>

Riri Novita's avatar
Riri Novita committed
2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406
                                <div style={{ display: 'flex' }}>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                    <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                        {
                                            this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
                                        }
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
                            </div>
                            {/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
                            (this.props.lastStatus === 'SUBMIT' || this.props.lastStatus === 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? */}
                            <div className="grid grid-2x" style={{ padding: 20 }}>
                                <div className="col-1" style={{ paddingLeft: 0 }}>
                                    <button
                                        type="button"
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
                                        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="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
d.arizona's avatar
d.arizona committed
2436
                                        {this.state.get_for == 'view' && this.state.viewOnly && 
Riri Novita's avatar
Riri Novita committed
2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456
                                            <button
                                                className="button"
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() => {
                                                    this.setState({ loading: true, refresh: 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>}
Riri Novita's avatar
Riri Novita committed
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536
                                        {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 }, () => {
                                                    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 === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1, loading: true }, () => {
                                                            this.backToRollingOutlook('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, loading: true }, () => {
                                                            this.backToRollingOutlook('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>}
                                    </div>
                                }
                            </div>
                            {/* : null
                            } */}
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Profit Loss</Typography>
                            </div>
                            <div style={{ padding: 20 }}>
Riri Novita's avatar
Riri Novita committed
2537
                                <div>
Riri Novita's avatar
Riri Novita committed
2538
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Riri Novita's avatar
Riri Novita committed
2539
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} {String(this.props.quarter).toLocaleUpperCase()} (rev.{this.props.revision}) </Typography>
Riri Novita's avatar
Riri Novita committed
2540 2541
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                </div>
Riri Novita's avatar
Riri Novita committed
2542 2543 2544 2545 2546 2547 2548 2549 2550 2551
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                    {this.state.dataLoaded && (
                                        <MuiThemeProvider theme={getMuiTheme()}>
                                            <MUIDataTable
                                                data={dataTable2}
                                                columns={columns}
                                                options={options}
                                            />
                                        </MuiThemeProvider>
                                    )}
Riri Novita's avatar
Riri Novita committed
2552
                                </div>
Riri Novita's avatar
Riri Novita committed
2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572
                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1" style={{ paddingLeft: 0 }}>
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visiblePLRO: true }, () => {
                                                setTimeout(() => {
                                                    this.getItemHierarki()
                                                }, 100);
                                            })}
                                            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>
Riri Novita's avatar
Riri Novita committed
2573
                                    </div>
Riri Novita's avatar
Riri Novita committed
2574
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Riri Novita's avatar
Riri Novita committed
2575 2576 2577 2578 2579 2580 2581 2582
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
Riri Novita's avatar
Riri Novita committed
2583
                                                marginRight: 20
Riri Novita's avatar
Riri Novita committed
2584 2585 2586
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2587 2588 2589 2590
                                                    setTimeout(() => {
                                                        // this.setState({ loading: false })
                                                        this.handleValidate()
                                                    }, 100);
Riri Novita's avatar
Riri Novita committed
2591 2592 2593 2594
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
Riri Novita's avatar
Riri Novita committed
2595
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
Riri Novita's avatar
Riri Novita committed
2596 2597
                                            </div>
                                        </button>
Riri Novita's avatar
Riri Novita committed
2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
                                                this.state.saveDraft === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2614
                                                            this.uploadProfitLossRO('draft')
Riri Novita's avatar
Riri Novita committed
2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630
                                                        })
                                            }
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                            </div>
                                        </button>
                                        <button
                                            type="button"
                                            // disabled={this.state.buttonError}
                                            onClick={() =>
                                                this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleTekTekTek == 1 ? null :
                                                        this.setState({ handleTekTekTek: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2631
                                                            this.uploadProfitLossRO('submitted')
Riri Novita's avatar
Riri Novita committed
2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644
                                                        })}
                                            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>
Riri Novita's avatar
Riri Novita committed
2645
                                </div>
Riri Novita's avatar
Riri Novita committed
2646 2647
                            </div>
                        </Paper>}
Riri Novita's avatar
Riri Novita committed
2648
                </div>
Riri Novita's avatar
Riri Novita committed
2649 2650

                {this.state.visibleUpload && (
d.arizona's avatar
d.arizona committed
2651 2652 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 2685 2686
                    // alert("Coming Soon...")
                    <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("PROFIT") && String(this.state.judul).includes("LOSS") ?
                                        this.checkUpload() :
                                        this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                }}
                            />
                        </div>
                    </div>
Riri Novita's avatar
Riri Novita committed
2687
                )}
Riri Novita's avatar
Riri Novita committed
2688 2689 2690
            </div>
        )
    }
Riri Novita's avatar
Riri Novita committed
2691
}