ProfitLossRO.js 177 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';
14
import {fixNumber, roundMath} from "../../library/Utils";
Riri Novita's avatar
Riri Novita committed
15 16 17

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

Riri Novita's avatar
Riri Novita committed
19 20 21 22 23 24
        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
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

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
40 41
    zIndex: 100,
    top: 0
Riri Novita's avatar
Riri Novita committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55
};
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
56 57 58 59 60 61 62 63 64 65 66 67 68 69
// 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
70

Riri Novita's avatar
Riri Novita committed
71
export default class ProfitLossROO extends Component {
Riri Novita's avatar
Riri Novita committed
72 73 74 75 76
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            loading: true,
Riri Novita's avatar
Riri Novita committed
77 78 79
            visiblePLRO: true,
            minValue: 0,
            maxValue: 0,
Riri Novita's avatar
Riri Novita committed
80
            updateBy: [],
Riri Novita's avatar
Riri Novita committed
81
            notesUpdate: '-',
Riri Novita's avatar
Riri Novita committed
82
            bebas: false,
Riri Novita's avatar
Riri Novita committed
83
            judulColumn: null,
84
            handleDoubleClick: 0,
Riri Novita's avatar
Riri Novita committed
85 86 87
            saveDraft: true,
            buttonError: true,
            viewOnly: true,
Riri Novita's avatar
Riri Novita committed
88 89
            get_for: 'view'

Riri Novita's avatar
Riri Novita committed
90
        }
Riri Novita's avatar
Riri Novita committed
91
        this.fileHandler = this.fileHandler.bind(this);
Riri Novita's avatar
Riri Novita committed
92 93 94 95
    }

    componentDidMount() {
        this.getItemHierarki()
d.arizona's avatar
d.arizona committed
96
        this.getLatestUpdate()
Riri Novita's avatar
Riri Novita committed
97
        // this.getSettingControl()
98
        // this.handleViewOnly()
Riri Novita's avatar
Riri Novita committed
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
    }

    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
118

Riri Novita's avatar
Riri Novita committed
119 120 121 122 123 124 125 126 127 128 129 130
        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
131
        this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
Riri Novita's avatar
Riri Novita committed
132 133 134 135
    }

    handleGetFor(type) {
        this.setState({ get_for: type }, () => {
Riri Novita's avatar
Riri Novita committed
136 137
            // this.getLatestUpdate()
            // this.getSettingControl()
Riri Novita's avatar
Riri Novita committed
138
            this.getItemHierarki()
139

Riri Novita's avatar
Riri Novita committed
140 141 142
        })
    }

Riri Novita's avatar
Riri Novita committed
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
    // 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
164
    //                     if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
165 166 167 168 169 170 171 172 173 174 175 176 177
    //                         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
178 179 180 181 182 183 184 185 186 187 188 189 190 191
    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
192
                        updateBy: response.data.data.detail === null ? '-' : response.data.data.detail,
d.arizona's avatar
d.arizona committed
193 194 195 196
                        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
197
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
d.arizona's avatar
d.arizona committed
198 199 200 201 202 203 204 205 206 207 208 209
                            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
210

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

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

Riri Novita's avatar
Riri Novita committed
322
    downloadTemplate = async () => {
d.arizona's avatar
d.arizona committed
323 324 325 326 327 328 329 330 331 332 333 334 335
        // 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
336 337 338
        setTimeout(() => {
            this.setState({loading: false})
        }, 500);
Riri Novita's avatar
Riri Novita committed
339 340 341
    }

    async downloadAllData() {
d.arizona's avatar
d.arizona committed
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
        // 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
357 358 359
        setTimeout(() => {
            this.setState({loading: false})
        }, 500);
Riri Novita's avatar
Riri Novita committed
360 361
    }

Riri Novita's avatar
Riri Novita committed
362
    backToRollingOutlook(type) {
Riri Novita's avatar
Riri Novita committed
363 364
        console.log('test');
        // this.setState({ loading: true })
Riri Novita's avatar
Riri Novita committed
365 366 367 368
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                "item_report_id": i[1],
d.arizona's avatar
d.arizona committed
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
                "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
384 385 386 387 388 389 390
            })
        })
        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
391
            "quartal": this.props.quarter,
Riri Novita's avatar
Riri Novita committed
392
            "status": type,
Riri Novita's avatar
Riri Novita committed
393
            "profit_loss": data
Riri Novita's avatar
Riri Novita committed
394
        }
395
        console.log("backToRollingOutlook payload",payload);
Riri Novita's avatar
Riri Novita committed
396
        // console.log(JSON.stringify(payload));
d.arizona's avatar
d.arizona committed
397
        api.create('UPLOAD').createRollingOutlookPL(payload).then(response => {
398
            console.log("backToRollingOutlook createRollingOutlookPL",response);
Riri Novita's avatar
Riri Novita committed
399 400
            if (response.data) {
                if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
401 402 403 404 405
                    if (type == 'submitted') {
                        this.props.refresh('PL')
                    } else {
                        this.props.refresh()
                    }
d.arizona's avatar
d.arizona committed
406
                    this.props.onClickClose()
Riri Novita's avatar
Riri Novita committed
407
                } else {
408
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
Riri Novita's avatar
Riri Novita committed
409
                        document.body.style.overflow = 'unset';
d.arizona's avatar
d.arizona committed
410
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
411 412 413 414 415
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
Riri Novita's avatar
Riri Novita committed
416 417 418 419 420
                        // this.props.saveToMonthlyReport()
                        this.props.onClickClose()
                    })
                }
            } else {
421
                this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 })
Riri Novita's avatar
Riri Novita committed
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
            }
        })
    }

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

    checkUpload() {
d.arizona's avatar
d.arizona committed
477
        api.create().checkImportRollingOutlookPL(this.state.payload).then(response => {
Riri Novita's avatar
Riri Novita committed
478
            // console.log(JSON.stringify(this.state.payload));
479
            console.log("checkUpload Response",response)
Riri Novita's avatar
Riri Novita committed
480 481 482 483 484 485 486 487 488 489 490
            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
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
                            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
508 509 510 511
                        ]
                    })
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
                        this.state.dataTable.map(item => {
d.arizona's avatar
d.arizona committed
512 513 514 515
                            // if (item[24].length > 0) {
                            //     // console.log('masuk')
                            //     this.setState({ buttonError: true, errorPreview: true })
                            // }
Riri Novita's avatar
Riri Novita committed
516 517 518
                        })
                        // console.log(this.state.buttonError)
                    })
519
                    console.log("checkUpload DataTable",dataTable);
Riri Novita's avatar
Riri Novita committed
520 521
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
522
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
523 524 525 526 527 528
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Riri Novita's avatar
Riri Novita committed
529 530 531 532 533
                }
            }
        })
    }

d.arizona's avatar
d.arizona committed
534
    uploadProfitLossRO(type) {
Riri Novita's avatar
Riri Novita committed
535 536 537
        let data = []
        this.state.dataTable.map(i => {
            data.push({
d.arizona's avatar
d.arizona committed
538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
                "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
555 556
            })
        })
557
        console.log("uploadProfitLossRO Data",data)
Riri Novita's avatar
Riri Novita committed
558 559 560 561 562
        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
563 564
            "quartal": this.props.quarter,
            "rolling_outlook_id": this.props.rollingOutlookID,
Riri Novita's avatar
Riri Novita committed
565 566 567
            "status": type,
            "profit_loss": data
        }
568
        console.log("uploadProfitLossRO Body",body);
d.arizona's avatar
d.arizona committed
569
        api.create('UPLOAD').importRollingOutlookPL(body).then(response => {
570
            console.log("uploadProfitLossRO importRollingOutlookPL",response);
Riri Novita's avatar
Riri Novita committed
571 572 573
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
574
                        this.props.onClickClose()
d.arizona's avatar
d.arizona committed
575 576 577 578 579
                        if (type == 'submitted') {
                            this.props.refresh('PL')
                        } else {
                            this.props.refresh()
                        }
Riri Novita's avatar
Riri Novita committed
580 581 582
                        // this.props.onClickClose()
                        // this.props.getReport()
                    } else {
583
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
d.arizona's avatar
d.arizona committed
584
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
585 586 587 588 589
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
d.arizona's avatar
d.arizona committed
590 591
                            this.props.onClickClose()
                            this.props.refresh()
Riri Novita's avatar
Riri Novita committed
592 593 594 595
                        })
                        // alert(response.data.status)
                    }
                } else {
596
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
Riri Novita's avatar
Riri Novita committed
597 598
                }
            } else {
599
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
Riri Novita's avatar
Riri Novita committed
600 601 602 603
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
604 605 606 607 608 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
    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
647
        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
Riri Novita's avatar
Riri Novita committed
648 649 650 651 652
        //             } 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
653
        //                 if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
654 655 656 657 658 659 660 661 662 663 664 665 666
        //                     setTimeout(() => {
        //                         localStorage.removeItem(Constant.TOKEN)
        //                         window.location.reload();
        //                     }, 1000);
        //                 }
        //             })
        //         }
        //     } else {
        //         this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
        //     }
        // })
    }

Riri Novita's avatar
Riri Novita committed
667 668 669 670
    closeAlert() {
        this.setState({ alert: false })
    }

Riri Novita's avatar
Riri Novita committed
671
    render() {
Riri Novita's avatar
Riri Novita committed
672
        let dataTable2 = this.state.dataTable
Riri Novita's avatar
Riri Novita committed
673 674 675

        const handleNotes = (value, tableMeta) => {
            // console.log(value)
Riri Novita's avatar
Riri Novita committed
676
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
Riri Novita's avatar
Riri Novita committed
677 678 679
            // console.log(dataTable2[tableMeta.rowIndex]);
        }

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

        const handleValue = (value, data) => {
            let total = 0
Riri Novita's avatar
Riri Novita committed
689 690
            // console.log(data);
            // console.log(dataTable2);
Riri Novita's avatar
Riri Novita committed
691 692 693
            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
694 695 696 697
                    // if (data.rowData[5] == "Revenue") {
                    //     console.log(total);
                    //     // console.log(a);
                    // }
Riri Novita's avatar
Riri Novita committed
698 699
                }
            })
Riri Novita's avatar
Riri Novita committed
700
            // console.log(total);
Riri Novita's avatar
Riri Novita committed
701 702
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
703

Riri Novita's avatar
Riri Novita committed
704 705 706 707 708 709 710 711 712 713 714 715 716 717
            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
718
                    let index = dataTable2.findIndex((val) => val[22] == item)
Riri Novita's avatar
Riri Novita committed
719 720 721 722 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
                    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") {
766
                        total = fixNumber(Number(total),1) * fixNumber(Number(item),1)// angka yg diupload menjadi bilangan bulat
Riri Novita's avatar
Riri Novita committed
767 768 769 770 771 772 773 774 775 776 777 778 779
                    } 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) {
780 781 782
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = fixNumber(Number(total),1)//hasil dari penjumlahan/kali/pembagian menjadi bilangan bulat

Riri Novita's avatar
Riri Novita committed
783
            // }
784

Riri Novita's avatar
Riri Novita committed
785 786
            return Number(total)

787

Riri Novita's avatar
Riri Novita committed
788 789
        }

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

            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))
802 803 804 805 806 807
            }
                // 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)
Riri Novita's avatar
Riri Novita committed
808 809 810 811 812 813
            // }
            else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
                return total
            }
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
Riri Novita's avatar
Riri Novita committed
814
            // if (String(tableMeta.rowData[5]).toLocaleLowerCase === "sales volume") {
815
            // console.log(total);
Riri Novita's avatar
Riri Novita committed
816
            // }
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>
                                        //             :
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>
                                        //             :
1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139
                                        <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(val).toFixed(1)}
                                                    />
                                                }
                                            />
                                        </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>
                                        //             :
1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237
                                        <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(val).toFixed(1)}
                                                    />
                                                }
                                            />
                                        </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>
                                        //             :
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335
                                        <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(val).toFixed(1)}
                                                    />
                                                }
                                            />
                                        </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
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1342
                name: this.props.quarter == 'q2' || this.props.quarter == 'q3' ? `Apr ${this.props.periode} Actual` : `Apr ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354
                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 :
syadziy's avatar
syadziy committed
1355
                                    this.state.get_for == 'view' || this.props.quarter == 'q2' || this.props.quarter == 'q3' ?
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
                                                                />
                                                            }
                                                        />
                                                    </div>
                                }
                            </div>
                        )
                    }
                }
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1440
                name: this.props.quarter == 'q2' || this.props.quarter == 'q3' ? `May ${this.props.periode} Actual` : `May ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1441 1442 1443 1444
                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 :
syadziy's avatar
syadziy committed
1453
                                    this.state.get_for == 'view' || this.props.quarter == 'q2' || this.props.quarter == 'q3' ?
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
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1538
                name: this.props.quarter == 'q2' || this.props.quarter == 'q3' ? `Jun ${this.props.periode} Actual` : `Jun ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550
                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 :
syadziy's avatar
syadziy committed
1551
                                    this.state.get_for == 'view' || this.props.quarter == 'q2' || this.props.quarter == 'q3' ?
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
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1636
                name: this.props.quarter == 'q3' ? `Jul ${this.props.periode} Actual` : `Jul ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648
                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 :
syadziy's avatar
syadziy committed
1649
                                    this.state.get_for == 'view' || this.props.quarter == 'q3' ?
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
                }
1733 1734
            },
            {
Faisal Hamdi's avatar
Faisal Hamdi committed
1735
                name: this.props.quarter == 'q3' ? `Aug ${this.props.periode} Actual` : `Aug ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747
                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 :
syadziy's avatar
syadziy committed
1748
                                    this.state.get_for == 'view' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1749 1750 1751 1752 1753 1754 1755 1756
                                        <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
1757
                                        :
Riri Novita's avatar
Riri Novita committed
1758 1759 1760 1761 1762 1763 1764 1765 1766
                                        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
1767
                                                    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
1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778
                                                />
                                            </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
1779
                                                                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
1780 1781 1782
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
Riri Novita's avatar
Riri Novita committed
1783
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
Riri Novita's avatar
Riri Novita committed
1784
                                                                value={this.props.quarter == 'q3'? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804
                                                                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
1805
                                                                    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
1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821
                                                                />
                                                            }
                                                        />
                                                    </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
1822
                                                                    value={this.props.quarter == 'q3'? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1823 1824 1825 1826
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
1827 1828 1829 1830
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1831
                }
1832 1833
            },
            {   name: this.props.quarter == 'q3' ? `Sep ${this.props.periode} Actual` : `Sep ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845
                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 :
syadziy's avatar
syadziy committed
1846
                                    this.state.get_for == 'view' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1847 1848 1849 1850 1851 1852 1853 1854
                                        <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
1855
                                        :
Riri Novita's avatar
Riri Novita committed
1856 1857 1858 1859 1860 1861 1862 1863 1864
                                        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
1865
                                                    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
1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876
                                                />
                                            </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
1877
                                                                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
1878 1879 1880
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
Riri Novita's avatar
Riri Novita committed
1881
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2'? false : true}
Riri Novita's avatar
Riri Novita committed
1882
                                                                value={this.props.quarter == 'q3'? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1883 1884 1885 1886 1887
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
1888
                                                    />
Riri Novita's avatar
Riri Novita committed
1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902
                                                </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
1903
                                                                    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
1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919
                                                                />
                                                            }
                                                        />
                                                    </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
1920
                                                                    value={this.props.quarter == 'q3'? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1921 1922 1923 1924
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
1925 1926 1927 1928
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1929
                }
1930 1931 1932
            },

            {   name: `Oct ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944
                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
1945
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1946 1947 1948 1949 1950 1951 1952 1953
                                        <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
1954
                                        :
Riri Novita's avatar
Riri Novita committed
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 1985 1986
                                        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
1987
                                                    />
Riri Novita's avatar
Riri Novita committed
1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023
                                                </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
2024 2025 2026 2027
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2028
                }
2029 2030 2031
            },

            {name: `Nov ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043
                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
2044
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2045 2046 2047 2048 2049 2050 2051 2052
                                        <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
2053
                                        :
Riri Novita's avatar
Riri Novita committed
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 2083 2084 2085
                                        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
2086
                                                    />
Riri Novita's avatar
Riri Novita committed
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 2120 2121 2122
                                                </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
2123 2124 2125 2126
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2127
                }
Riri Novita's avatar
Riri Novita committed
2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141
            }, {
                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
2142
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2143 2144 2145 2146 2147 2148 2149 2150
                                        <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
2151
                                        :
Riri Novita's avatar
Riri Novita committed
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 2181 2182 2183
                                        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
2184
                                                    />
Riri Novita's avatar
Riri Novita committed
2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220
                                                </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
2221 2222 2223 2224
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2225
                }
Riri Novita's avatar
Riri Novita committed
2226
            }, {
Riri Novita's avatar
Riri Novita committed
2227
                name: `${this.props.periode} Total Outlook`,
Riri Novita's avatar
Riri Novita committed
2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239
                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
2240
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2241 2242 2243 2244 2245 2246 2247 2248
                                        <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)}
                                        />
2249
                                        :
Riri Novita's avatar
Riri Novita committed
2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265
                                        <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
2266 2267 2268 2269
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2270
                }
Riri Novita's avatar
Riri Novita committed
2271
            },
Riri Novita's avatar
Riri Novita committed
2272
        ]
Riri Novita's avatar
Riri Novita committed
2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284

        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
2285 2286
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Riri Novita's avatar
Riri Novita committed
2287
                {this.state.loading && loadingComponent}
Riri Novita's avatar
Riri Novita committed
2288 2289 2290
                <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
2291 2292 2293 2294 2295
                <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
2296
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Riri Novita's avatar
Riri Novita committed
2297 2298 2299 2300 2301 2302 2303 2304 2305
                    {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
2306
                                        <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
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 2338 2339 2340
                                        <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
2341 2342 2343
                                                        onClick={() => this.setState({loading: true}, () => {
                                                            this.downloadTemplate()
                                                        })}
Riri Novita's avatar
Riri Novita committed
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
                                                    >
                                                        <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 }, () => {
2373
                                                                this.downloadAllData()
Riri Novita's avatar
Riri Novita committed
2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396
                                                            })}
                                                    >
                                                        <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
2397 2398 2399 2400 2401
                                <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) => {
2402 2403 2404 2405 2406
                                                    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>
Riri Novita's avatar
Riri Novita committed
2407 2408 2409
                                        }
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438
                                <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 }}>
2439
                                        {this.state.get_for == 'view' && this.state.viewOnly &&
Riri Novita's avatar
Riri Novita committed
2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459
                                            <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
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
                                        {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' })
                                                    :
2496 2497
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512
                                                            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' })
                                                    :
2513 2514
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2515 2516 2517 2518 2519 2520 2521 2522 2523 2524
                                                            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' }}>
2525 2526
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete3</Typography>
                                                {/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
Riri Novita's avatar
Riri Novita committed
2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540
                                            </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
2541
                                <div>
Riri Novita's avatar
Riri Novita committed
2542
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Riri Novita's avatar
Riri Novita committed
2543
                                    <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
2544 2545
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                </div>
Riri Novita's avatar
Riri Novita committed
2546 2547 2548 2549 2550 2551 2552 2553 2554 2555
                                <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
2556
                                </div>
Riri Novita's avatar
Riri Novita committed
2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576
                                <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
2577
                                    </div>
Riri Novita's avatar
Riri Novita committed
2578
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Riri Novita's avatar
Riri Novita committed
2579 2580 2581 2582 2583 2584 2585 2586
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
Riri Novita's avatar
Riri Novita committed
2587
                                                marginRight: 20
Riri Novita's avatar
Riri Novita committed
2588 2589 2590
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2591 2592 2593 2594
                                                    setTimeout(() => {
                                                        // this.setState({ loading: false })
                                                        this.handleValidate()
                                                    }, 100);
Riri Novita's avatar
Riri Novita committed
2595 2596 2597 2598
                                                })
                                            }}
                                        >
                                            <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
2599
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
Riri Novita's avatar
Riri Novita committed
2600 2601
                                            </div>
                                        </button>
Riri Novita's avatar
Riri Novita committed
2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615
                                        <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' })
                                                    :
2616 2617
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2618
                                                            this.uploadProfitLossRO('draft')
Riri Novita's avatar
Riri Novita committed
2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632
                                                        })
                                            }
                                        >
                                            <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' })
                                                    :
2633 2634
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2635
                                                            this.uploadProfitLossRO('submitted')
Riri Novita's avatar
Riri Novita committed
2636 2637 2638 2639 2640 2641 2642 2643 2644 2645
                                                        })}
                                            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>
2646
                                                {/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
Riri Novita's avatar
Riri Novita committed
2647 2648 2649
                                            </div>
                                        </button>
                                    </div>
Riri Novita's avatar
Riri Novita committed
2650
                                </div>
Riri Novita's avatar
Riri Novita committed
2651 2652
                            </div>
                        </Paper>}
Riri Novita's avatar
Riri Novita committed
2653
                </div>
Riri Novita's avatar
Riri Novita committed
2654 2655

                {this.state.visibleUpload && (
d.arizona's avatar
d.arizona committed
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 2687 2688 2689 2690 2691
                    // 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
2692
                )}
Riri Novita's avatar
Riri Novita committed
2693 2694 2695
            </div>
        )
    }
Riri Novita's avatar
Riri Novita committed
2696
}