ProfitLossRO.js 182 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';
qorri_di's avatar
qorri_di committed
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,
88 89 90
            get_for: 'view',
            defaultCurrencyUpload: this.props.defaultCurrency,
            visibleAlertSave: false
Riri Novita's avatar
Riri Novita committed
91

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

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

    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
121

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

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

Riri Novita's avatar
Riri Novita committed
143 144 145
        })
    }

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

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

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

Riri Novita's avatar
Riri Novita committed
326
    downloadTemplate = async () => {
d.arizona's avatar
d.arizona committed
327 328
        // alert('Coming Soon ...')
        let res = await fetch(
329
            `${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}&&currency_id=${this.props.defaultCurrency.id}`
d.arizona's avatar
d.arizona committed
330 331 332 333 334 335 336 337 338 339
        )
        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
340
        setTimeout(() => {
qorri_di's avatar
qorri_di committed
341
            this.setState({ loading: false })
Riri Novita's avatar
Riri Novita committed
342
        }, 500);
Riri Novita's avatar
Riri Novita committed
343 344 345
    }

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

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

    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
447 448
                            "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
449
                            "notes": i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(),
qorri_di's avatar
qorri_di committed
450 451 452 453 454 455 456 457 458 459 460 461
                            "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
462 463 464
                        })
                    }
                })
qorri_di's avatar
qorri_di committed
465
                console.log("fileHandler payload", payload)
Riri Novita's avatar
Riri Novita committed
466 467 468 469
                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
470 471
                    quartal: this.props.quarter,
                    rolling_outlook_id: this.props.rollingOutlookID,
Riri Novita's avatar
Riri Novita committed
472 473 474
                    status: 'submitted',
                    profit_loss: payload
                }
qorri_di's avatar
qorri_di committed
475
                console.log("fileHandler body", body)
Riri Novita's avatar
Riri Novita committed
476 477 478 479 480 481
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
            }
        });
    }

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

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

Riri Novita's avatar
Riri Novita committed
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
    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
661 662
        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false, handleDoubleClick: 0 })
        console.log(this.state.handleDoubleClick);
Riri Novita's avatar
Riri Novita committed
663 664 665 666 667
        //             } 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
668
        //                 if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
669 670 671 672 673 674 675 676 677 678 679 680 681
        //                     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
682 683 684 685
    closeAlert() {
        this.setState({ alert: false })
    }

Riri Novita's avatar
Riri Novita committed
686
    render() {
Riri Novita's avatar
Riri Novita committed
687
        let dataTable2 = this.state.dataTable
Riri Novita's avatar
Riri Novita committed
688 689 690

        const handleNotes = (value, tableMeta) => {
            // console.log(value)
Riri Novita's avatar
Riri Novita committed
691
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
Riri Novita's avatar
Riri Novita committed
692 693 694
            // console.log(dataTable2[tableMeta.rowIndex]);
        }

Riri Novita's avatar
Riri Novita committed
695 696 697 698
        const handleChange = (value, tableMeta, type) => {
            console.log(dataTable2);
            let val = String(value).split(",").join("")
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
qorri_di's avatar
qorri_di committed
699
            console.log("handleChange ", val)
Riri Novita's avatar
Riri Novita committed
700 701 702 703
        }

        const handleValue = (value, data) => {
            let total = 0
Riri Novita's avatar
Riri Novita committed
704 705
            // console.log(data);
            // console.log(dataTable2);
Riri Novita's avatar
Riri Novita committed
706 707 708
            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
709 710 711 712
                    // if (data.rowData[5] == "Revenue") {
                    //     console.log(total);
                    //     // console.log(a);
                    // }
Riri Novita's avatar
Riri Novita committed
713 714
                }
            })
Riri Novita's avatar
Riri Novita committed
715
            // console.log(total);
Riri Novita's avatar
Riri Novita committed
716 717
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
718

Riri Novita's avatar
Riri Novita committed
719 720 721 722 723 724 725 726 727 728 729 730 731 732
            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
733
                    let index = dataTable2.findIndex((val) => val[22] == item)
Riri Novita's avatar
Riri Novita committed
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780
                    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") {
qorri_di's avatar
qorri_di committed
781
                        total = fixNumber(Number(total), 1) * fixNumber(Number(item), 1)// angka yg diupload menjadi bilangan bulat
Riri Novita's avatar
Riri Novita committed
782 783 784 785 786 787 788 789 790 791 792 793 794
                    } 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) {
795
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
qorri_di's avatar
qorri_di committed
796
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = fixNumber(Number(total), 1)//hasil dari penjumlahan/kali/pembagian menjadi bilangan bulat
797

Riri Novita's avatar
Riri Novita committed
798
            // }
799

Riri Novita's avatar
Riri Novita committed
800 801
            return Number(total)

802

Riri Novita's avatar
Riri Novita committed
803 804
        }

d.arizona's avatar
d.arizona committed
805 806
        const handleTotal = (val, tableMeta) => {
            let total = 0
qorri_di's avatar
qorri_di committed
807
            tableMeta.rowData.map((item, index) => {
d.arizona's avatar
d.arizona committed
808 809 810 811
                if (index >= 8 && index <= 19) {
                    total += Number(item)
                }
            })
Riri Novita's avatar
Riri Novita committed
812 813 814

            if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "sales price") {
                let value = Number(dataTable2[tableMeta.rowIndex - 2][20]) / Number(dataTable2[tableMeta.rowIndex - 1][20])
qorri_di's avatar
qorri_di committed
815
                dataTable2[tableMeta.rowIndex][20] = R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
Riri Novita's avatar
Riri Novita committed
816
                return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
817
            }
qorri_di's avatar
qorri_di committed
818 819 820 821 822
            // 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
823 824 825 826 827 828
            // }
            else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
                return total
            }
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
Riri Novita's avatar
Riri Novita committed
829
            // if (String(tableMeta.rowData[5]).toLocaleLowerCase === "sales volume") {
830
            // console.log(total);
Riri Novita's avatar
Riri Novita committed
831
            // }
Riri Novita's avatar
Riri Novita committed
832
            // return total
d.arizona's avatar
d.arizona committed
833 834
        }

Riri Novita's avatar
Riri Novita committed
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866
        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
867 868 869 870 871 872 873 874 875 876 877 878 879
                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
880
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
Riri Novita's avatar
Riri Novita committed
881 882 883 884 885 886 887
                                            <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
888
                                    :
Riri Novita's avatar
Riri Novita committed
889 890 891 892 893 894 895 896 897
                                    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
898
                    }
Riri Novita's avatar
Riri Novita committed
899 900 901 902 903 904
                }
            }, {
                name: "Notes",
                options: {
                    customHeadRender: (columnMeta) => (
                        dataTable2.length > 0 ?
Riri Novita's avatar
Riri Novita committed
905
                            <TableCell style={{ ...stylenotes, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Riri Novita's avatar
Riri Novita committed
906 907
                                <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                            </TableCell> :
Riri Novita's avatar
Riri Novita committed
908
                            <TableCell style={{ ...styleNotesEmpty, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
Riri Novita's avatar
Riri Novita committed
909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924
                                <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
925 926 927 928 929 930 931 932 933 934
                                        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
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958
                                            <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
959
                                </div>
Riri Novita's avatar
Riri Novita committed
960
                            </div>
Riri Novita's avatar
Riri Novita committed
961 962
                        )
                    }
Riri Novita's avatar
Riri Novita committed
963
                }
Riri Novita's avatar
Riri Novita committed
964
            }, {
Riri Novita's avatar
Riri Novita committed
965
                name: `${Number(this.props.periode) - 1} Total Actual`,
Riri Novita's avatar
Riri Novita committed
966 967 968 969 970 971 972 973 974 975 976 977
                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
978
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
979 980 981 982 983 984 985 986
                                        <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
987
                                        :
Riri Novita's avatar
Riri Novita committed
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 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040
                                        // 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>
                                        //             :
1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056
                                        <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
1057 1058 1059 1060
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1061
                }
Riri Novita's avatar
Riri Novita committed
1062
            }, {
Riri Novita's avatar
Riri Novita committed
1063
                name: `Jan ${this.props.periode} Actual`,
Riri Novita's avatar
Riri Novita committed
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075
                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
1076
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1077 1078 1079 1080 1081 1082 1083 1084
                                        <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
1085
                                        :
Riri Novita's avatar
Riri Novita committed
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 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138
                                        // tableMeta.rowData[0] === 2 ?
                                        //     <span style={{ fontSize: 12, textAlign: 'right' }}>
                                        //         <NumberFormat
                                        //             thousandSeparator={true}
                                        //             style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        //             type="text"
                                        //             placeholder=""
                                        //             disabled={true}
                                        //             // value={Number(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>
                                        //             :
1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154
                                        <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
1155 1156 1157 1158
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1159
                }
Riri Novita's avatar
Riri Novita committed
1160
            }, {
Riri Novita's avatar
Riri Novita committed
1161
                name: `Feb ${this.props.periode} Actual`,
Riri Novita's avatar
Riri Novita committed
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173
                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
1174
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1175 1176 1177 1178 1179 1180 1181 1182
                                        <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
1183
                                        :
Riri Novita's avatar
Riri Novita committed
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
                                        // 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>
                                        //             :
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252
                                        <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
1253 1254 1255 1256
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1257
                }
Riri Novita's avatar
Riri Novita committed
1258
            }, {
Riri Novita's avatar
Riri Novita committed
1259
                name: `Mar ${this.props.periode} Actual`,
Riri Novita's avatar
Riri Novita committed
1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271
                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
1272
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1273 1274 1275 1276 1277 1278 1279 1280
                                        <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
1281
                                        :
Riri Novita's avatar
Riri Novita committed
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 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334
                                        // 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>
                                        //             :
1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350
                                        <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
1351 1352 1353 1354
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1355
                }
Riri Novita's avatar
Riri Novita committed
1356
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1357
                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
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369
                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
1370
                                    this.state.get_for == 'view' || this.props.quarter == 'q2' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1371 1372 1373 1374 1375 1376 1377 1378
                                        <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
1379
                                        :
Riri Novita's avatar
Riri Novita committed
1380 1381 1382 1383 1384 1385 1386 1387 1388
                                        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
1389
                                                    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
1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
qorri_di's avatar
qorri_di committed
1401
                                                                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
1402 1403 1404
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
qorri_di's avatar
qorri_di committed
1405
                                                                disabled={this.props.quarter == 'q1' ? false : true}
Riri Novita's avatar
Riri Novita committed
1406
                                                                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
1407 1408 1409 1410 1411
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
1412
                                                    />
Riri Novita's avatar
Riri Novita committed
1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426
                                                </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
1427
                                                                    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
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443
                                                                />
                                                            }
                                                        />
                                                    </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
1444
                                                                    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
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454
                                                                />
                                                            }
                                                        />
                                                    </div>
                                }
                            </div>
                        )
                    }
                }
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1455
                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
1456 1457 1458 1459
                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
1460 1461 1462 1463 1464 1465 1466 1467
                        </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
1468
                                    this.state.get_for == 'view' || this.props.quarter == 'q2' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1469 1470 1471 1472 1473 1474 1475 1476
                                        <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
1477
                                        :
Riri Novita's avatar
Riri Novita committed
1478 1479 1480 1481 1482 1483 1484 1485 1486
                                        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
1487
                                                    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
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
qorri_di's avatar
qorri_di committed
1499
                                                                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
1500 1501 1502
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
qorri_di's avatar
qorri_di committed
1503
                                                                disabled={this.props.quarter == 'q1' ? false : true}
Riri Novita's avatar
Riri Novita committed
1504
                                                                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
1505 1506 1507 1508 1509
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
1510
                                                    />
Riri Novita's avatar
Riri Novita committed
1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524
                                                </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
1525
                                                                    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
1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541
                                                                />
                                                            }
                                                        />
                                                    </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
1542
                                                                    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
1543 1544 1545 1546
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
1547 1548 1549 1550
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1551
                }
Riri Novita's avatar
Riri Novita committed
1552
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1553
                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
1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565
                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
1566
                                    this.state.get_for == 'view' || this.props.quarter == 'q2' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1567 1568 1569 1570 1571 1572 1573 1574
                                        <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
1575
                                        :
Riri Novita's avatar
Riri Novita committed
1576 1577 1578 1579 1580 1581 1582 1583 1584
                                        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
1585
                                                    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
1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
qorri_di's avatar
qorri_di committed
1597
                                                                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
1598 1599 1600
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
qorri_di's avatar
qorri_di committed
1601
                                                                disabled={this.props.quarter == 'q1' ? false : true}
Riri Novita's avatar
Riri Novita committed
1602
                                                                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
1603 1604 1605 1606 1607
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
1608
                                                    />
Riri Novita's avatar
Riri Novita committed
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622
                                                </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
1623
                                                                    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
1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639
                                                                />
                                                            }
                                                        />
                                                    </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
1640
                                                                    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
1641 1642 1643 1644
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
1645 1646 1647 1648
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1649
                }
Riri Novita's avatar
Riri Novita committed
1650
            }, {
Faisal Hamdi's avatar
Faisal Hamdi committed
1651
                name: this.props.quarter == 'q3' ? `Jul ${this.props.periode} Actual` : `Jul ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663
                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
1664
                                    this.state.get_for == 'view' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1665 1666 1667 1668 1669 1670 1671 1672
                                        <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
1673
                                        :
Riri Novita's avatar
Riri Novita committed
1674 1675 1676 1677 1678 1679 1680 1681 1682
                                        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)}
qorri_di's avatar
qorri_di committed
1683
                                                    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
1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
qorri_di's avatar
qorri_di committed
1695
                                                                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
1696 1697 1698
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
qorri_di's avatar
qorri_di committed
1699 1700
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2' ? false : true}
                                                                value={this.props.quarter == 'q3' ? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1701 1702 1703 1704 1705
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
1706
                                                    />
Riri Novita's avatar
Riri Novita committed
1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720
                                                </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}
qorri_di's avatar
qorri_di committed
1721
                                                                    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
1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737
                                                                />
                                                            }
                                                        />
                                                    </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}
qorri_di's avatar
qorri_di committed
1738
                                                                    value={this.props.quarter == 'q3' ? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1739 1740 1741 1742
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
1743 1744 1745 1746
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1747
                }
1748 1749
            },
            {
Faisal Hamdi's avatar
Faisal Hamdi committed
1750
                name: this.props.quarter == 'q3' ? `Aug ${this.props.periode} Actual` : `Aug ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762
                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
1763
                                    this.state.get_for == 'view' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1764 1765 1766 1767 1768 1769 1770 1771
                                        <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
1772
                                        :
Riri Novita's avatar
Riri Novita committed
1773 1774 1775 1776 1777 1778 1779 1780 1781
                                        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)}
qorri_di's avatar
qorri_di committed
1782
                                                    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
1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
qorri_di's avatar
qorri_di committed
1794
                                                                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
1795 1796 1797
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
qorri_di's avatar
qorri_di committed
1798 1799
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2' ? false : true}
                                                                value={this.props.quarter == 'q3' ? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819
                                                                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}
qorri_di's avatar
qorri_di committed
1820
                                                                    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
1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836
                                                                />
                                                            }
                                                        />
                                                    </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}
qorri_di's avatar
qorri_di committed
1837
                                                                    value={this.props.quarter == 'q3' ? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1838 1839 1840 1841
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
1842 1843 1844 1845
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1846
                }
1847
            },
qorri_di's avatar
qorri_di committed
1848 1849
            {
                name: this.props.quarter == 'q3' ? `Sep ${this.props.periode} Actual` : `Sep ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861
                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
1862
                                    this.state.get_for == 'view' || this.props.quarter == 'q3' ?
Riri Novita's avatar
Riri Novita committed
1863 1864 1865 1866 1867 1868 1869 1870
                                        <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
1871
                                        :
Riri Novita's avatar
Riri Novita committed
1872 1873 1874 1875 1876 1877 1878 1879 1880
                                        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)}
qorri_di's avatar
qorri_di committed
1881
                                                    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
1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892
                                                />
                                            </span>
                                            :
                                            tableMeta.rowData[0] === 3 ?
                                                <div style={{ flex: 1 }}>
                                                    <FormControlLabel
                                                        style={{ margin: 0 }}
                                                        value={val}
                                                        control={
                                                            <NumberFormat
                                                                thousandSeparator={true}
qorri_di's avatar
qorri_di committed
1893
                                                                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
1894 1895 1896
                                                                type="text"
                                                                placeholder=""
                                                                // disabled={this.props.isApprover? true : (this.state.get_for == 'view'? true : false)}
qorri_di's avatar
qorri_di committed
1897 1898
                                                                disabled={this.props.quarter == 'q1' || this.props.quarter == 'q2' ? false : true}
                                                                value={this.props.quarter == 'q3' ? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1899 1900 1901 1902 1903
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
1904
                                                    />
Riri Novita's avatar
Riri Novita committed
1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918
                                                </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}
qorri_di's avatar
qorri_di committed
1919
                                                                    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
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935
                                                                />
                                                            }
                                                        />
                                                    </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}
qorri_di's avatar
qorri_di committed
1936
                                                                    value={this.props.quarter == 'q3' ? (val === "0" ? "" : Number(val).toFixed(1)) : Number(val).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1937 1938 1939 1940
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
1941 1942 1943 1944
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
1945
                }
1946 1947
            },

qorri_di's avatar
qorri_di committed
1948 1949
            {
                name: `Oct ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961
                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
1962
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1963 1964 1965 1966 1967 1968 1969 1970
                                        <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
1971
                                        :
Riri Novita's avatar
Riri Novita committed
1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003
                                        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
2004
                                                    />
Riri Novita's avatar
Riri Novita committed
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040
                                                </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
2041 2042 2043 2044
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2045
                }
2046 2047
            },

qorri_di's avatar
qorri_di committed
2048 2049
            {
                name: `Nov ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061
                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
2062
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2063 2064 2065 2066 2067 2068 2069 2070
                                        <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
2071
                                        :
Riri Novita's avatar
Riri Novita committed
2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103
                                        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
2104
                                                    />
Riri Novita's avatar
Riri Novita committed
2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140
                                                </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
2141 2142 2143 2144
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2145
                }
Riri Novita's avatar
Riri Novita committed
2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159
            }, {
                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
2160
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2161 2162 2163 2164 2165 2166 2167 2168
                                        <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
2169
                                        :
Riri Novita's avatar
Riri Novita committed
2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201
                                        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
2202
                                                    />
Riri Novita's avatar
Riri Novita committed
2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238
                                                </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
2239 2240 2241 2242
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2243
                }
Riri Novita's avatar
Riri Novita committed
2244
            }, {
Riri Novita's avatar
Riri Novita committed
2245
                name: `${this.props.periode} Total Outlook`,
Riri Novita's avatar
Riri Novita committed
2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257
                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
2258
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2259 2260 2261 2262 2263 2264 2265 2266
                                        <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)}
                                        />
2267
                                        :
Riri Novita's avatar
Riri Novita committed
2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283
                                        <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
2284 2285 2286 2287
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2288
                }
Riri Novita's avatar
Riri Novita committed
2289
            },
Riri Novita's avatar
Riri Novita committed
2290
        ]
Riri Novita's avatar
Riri Novita committed
2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302

        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
2303 2304
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Riri Novita's avatar
Riri Novita committed
2305
                {this.state.loading && loadingComponent}
Riri Novita's avatar
Riri Novita committed
2306 2307 2308
                <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
2309 2310 2311 2312 2313
                <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
2314
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Riri Novita's avatar
Riri Novita committed
2315 2316 2317 2318 2319 2320 2321 2322 2323
                    {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
2324
                                        <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
2325 2326 2327 2328 2329
                                        {this.props.defaultCurrency.id === 1 ?
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                            :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                        }
Riri Novita's avatar
Riri Novita committed
2330 2331 2332
                                    </div>
                                    <div style={{ width: '50%' }}>
                                        {this.props.isApprover === true || this.state.get_for == 'view' ?
qorri_di's avatar
qorri_di committed
2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353
                                            null
                                            // <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                            //     <a data-tip={'Download'} data-for="download">
                                            //         <button
                                            //             style={{
                                            //                 backgroundColor: 'transparent',
                                            //                 cursor: 'pointer',
                                            //                 borderColor: 'transparent',
                                            //                 margin: 5
                                            //             }}
                                            //             onClick={() =>
                                            //                 this.setState({ loading: true }, () => {
                                            //                     setTimeout(() => {
                                            //                         this.downloadAllData()
                                            //                     }, 100);
                                            //                 })}
                                            //         >
                                            //             <img src={Images.download} />
                                            //         </button>
                                            //     </a>
                                            //     <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
qorri_di's avatar
qorri_di committed
2354
                                            // </div> 
qorri_di's avatar
qorri_di committed
2355
                                            :
Riri Novita's avatar
Riri Novita committed
2356 2357 2358 2359 2360 2361 2362 2363 2364
                                            <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
                                                        }}
qorri_di's avatar
qorri_di committed
2365
                                                        onClick={() => this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2366 2367
                                                            this.downloadTemplate()
                                                        })}
Riri Novita's avatar
Riri Novita committed
2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386
                                                    >
                                                        <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" />
Riri Novita's avatar
Riri Novita committed
2387
                                                <a data-tip={'Download'} data-for="download">
Riri Novita's avatar
Riri Novita committed
2388 2389 2390 2391 2392 2393 2394 2395 2396
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
2397
                                                                this.downloadAllData()
Riri Novita's avatar
Riri Novita committed
2398 2399 2400 2401 2402
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
Riri Novita's avatar
Riri Novita committed
2403
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" />
Riri Novita's avatar
Riri Novita committed
2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420
                                            </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
2421 2422 2423 2424 2425
                                <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) => {
qorri_di's avatar
qorri_di committed
2426 2427 2428 2429
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
2430
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
2431 2432 2433
                                        }
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
2434 2435
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
                            </div>
Riri Novita's avatar
Riri Novita committed
2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458
                            {/* {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>
Riri Novita's avatar
Riri Novita committed
2459
                                {this.props.isApprover === true ?
Riri Novita's avatar
Riri Novita committed
2460 2461 2462 2463
                                    <div className="col-2">
                                    </div> :
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
                                        {this.state.get_for == 'view' && this.state.viewOnly &&
Riri Novita's avatar
Riri Novita committed
2464
                                            <button
Riri Novita's avatar
Riri Novita committed
2465
                                                className="button"
Riri Novita's avatar
Riri Novita committed
2466 2467 2468 2469 2470
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: 'pointer',
                                                    borderColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
2471 2472 2473 2474 2475 2476 2477
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() => {
                                                    this.setState({ loading: true, refresh: true }, () => {
                                                        this.handleGetFor('edit')
                                                    })
Riri Novita's avatar
Riri Novita committed
2478 2479
                                                }}
                                            >
Riri Novita's avatar
Riri Novita committed
2480 2481
                                                <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>
Riri Novita's avatar
Riri Novita committed
2482
                                                </div>
Riri Novita's avatar
Riri Novita committed
2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522
                                            </button>}
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
                                                        this.handleValidate()
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
                                                this.state.saveDraft === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
                                                            this.backToRollingOutlook('draft')
Riri Novita's avatar
Riri Novita committed
2523
                                                        })
Riri Novita's avatar
Riri Novita committed
2524 2525 2526 2527
                                            }
                                        >
                                            <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>
Riri Novita's avatar
Riri Novita committed
2528
                                            </div>
Riri Novita's avatar
Riri Novita committed
2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
                                            type="button"
                                            // disabled={this.state.buttonError}
                                            onClick={() =>
                                                this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
                                                            this.backToRollingOutlook('submitted')
                                                        })}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete3</Typography>
                                                {/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
                                            </div>
                                        </button>}
Riri Novita's avatar
Riri Novita committed
2553
                                    </div>
Riri Novita's avatar
Riri Novita committed
2554 2555 2556 2557
                                }
                            </div>
                            {/* : null
                            } */}
Riri Novita's avatar
Riri Novita committed
2558 2559 2560 2561 2562 2563 2564
                        </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
2565
                                <div>
Riri Novita's avatar
Riri Novita committed
2566
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Riri Novita's avatar
Riri Novita committed
2567
                                    <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
2568 2569 2570 2571 2572
                                    {this.props.defaultCurrency.id === 1 ?
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                        :
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                    }
Riri Novita's avatar
Riri Novita committed
2573
                                </div>
Riri Novita's avatar
Riri Novita committed
2574 2575 2576 2577 2578 2579 2580 2581 2582 2583
                                <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
2584
                                </div>
Riri Novita's avatar
Riri Novita committed
2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604
                                <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
2605
                                    </div>
Riri Novita's avatar
Riri Novita committed
2606
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Riri Novita's avatar
Riri Novita committed
2607 2608 2609 2610 2611 2612 2613 2614
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
Riri Novita's avatar
Riri Novita committed
2615
                                                marginRight: 20
Riri Novita's avatar
Riri Novita committed
2616 2617 2618
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2619 2620 2621 2622
                                                    setTimeout(() => {
                                                        // this.setState({ loading: false })
                                                        this.handleValidate()
                                                    }, 100);
Riri Novita's avatar
Riri Novita committed
2623 2624 2625 2626
                                                })
                                            }}
                                        >
                                            <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
2627
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
Riri Novita's avatar
Riri Novita committed
2628 2629
                                            </div>
                                        </button>
Riri Novita's avatar
Riri Novita committed
2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643
                                        <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' })
                                                    :
2644 2645
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2646
                                                            this.uploadProfitLossRO('draft')
Riri Novita's avatar
Riri Novita committed
2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660
                                                        })
                                            }
                                        >
                                            <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' })
                                                    :
2661 2662
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2663
                                                            this.uploadProfitLossRO('submitted')
Riri Novita's avatar
Riri Novita committed
2664 2665 2666 2667 2668 2669 2670 2671 2672 2673
                                                        })}
                                            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>
2674
                                                {/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
Riri Novita's avatar
Riri Novita committed
2675 2676 2677
                                            </div>
                                        </button>
                                    </div>
Riri Novita's avatar
Riri Novita committed
2678
                                </div>
Riri Novita's avatar
Riri Novita committed
2679 2680
                            </div>
                        </Paper>}
Riri Novita's avatar
Riri Novita committed
2681
                </div>
Riri Novita's avatar
Riri Novita committed
2682 2683

                {this.state.visibleUpload && (
d.arizona's avatar
d.arizona committed
2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702
                    // 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>
2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748
                            <div style={{ padding: '25px 30px' }}>
                                <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 style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data is <b>{this.props.defaultCurrency.id == 1 ? "IDR" : "USD"}</b></div>
                        </div>
                    </div>
                )}

                {this.state.visibleAlertSave && (
                    <div className="test app-popup-show">
                        <div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
                            <div style={{ margin: 30 }}>
                                <div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
                                    <div style={{ alignSelf: 'center', marginRight: 25 }}>
                                        <img src={Images.warning} />
                                    </div>
                                    <div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
                                        <b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
                                    </div>
                                </div>
                                <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            background: '#F6F7F9',
                                            cursor: 'pointer',
                                            border: '1px solid #3549609e',
                                            outline: 'none',
                                            marginRight: 20,
                                            borderRadius: 9
                                        }}
Riri Novita's avatar
Riri Novita committed
2749
                                        onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
2750 2751 2752 2753 2754 2755 2756
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
                                            <Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
                                        </div>
                                    </button>
                                </div>
                            </div>
d.arizona's avatar
d.arizona committed
2757 2758
                        </div>
                    </div>
Riri Novita's avatar
Riri Novita committed
2759
                )}
Riri Novita's avatar
Riri Novita committed
2760 2761 2762
            </div>
        )
    }
Riri Novita's avatar
Riri Novita committed
2763
}