ProfitLossRO.js 193 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
        let data = []
Riri Novita's avatar
Riri Novita committed
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
        if (this.props.defaultCurrency.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    "item_report_id": i[1],
                    "notes": String(i[6]),
                    "last_year_total": String(Number(i[7])),
                    "january": String(Number(i[8])),
                    "february": String(Number(i[9])),
                    "march": String(Number(i[10])),
                    "april": String(Number(i[11])),
                    "may": String(Number(i[12])),
                    "june": String(Number(i[13])),
                    "july": String(Number(i[14])),
                    "august": String(Number(i[15])),
                    "september": String(Number(i[16])),
                    "october": String(Number(i[17])),
                    "november": String(Number(i[18])),
                    "december": String(Number(i[19])),
                    "current_year_total": String(Number(i[20])),
                })
Riri Novita's avatar
Riri Novita committed
390
            })
Riri Novita's avatar
Riri Novita committed
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    "item_report_id": i[1],
                    "notes": String(i[6]),
                    "last_year_total": String(fixNumber(Number(i[7]), 1)),
                    "january": String(fixNumber(Number(i[8]), 1)),
                    "february": String(fixNumber(Number(i[9]), 1)),
                    "march": String(fixNumber(Number(i[10]), 1)),
                    "april": String(fixNumber(Number(i[11]), 1)),
                    "may": String(fixNumber(Number(i[12]), 1)),
                    "june": String(fixNumber(Number(i[13]), 1)),
                    "july": String(fixNumber(Number(i[14]), 1)),
                    "august": String(fixNumber(Number(i[15]), 1)),
                    "september": String(fixNumber(Number(i[16]), 1)),
                    "october": String(fixNumber(Number(i[17]), 1)),
                    "november": String(fixNumber(Number(i[18]), 1)),
                    "december": String(fixNumber(Number(i[19]), 1)),
                    "current_year_total": String(fixNumber(Number(i[20]), 1)),
                })
            })
        }

Riri Novita's avatar
Riri Novita committed
414 415 416 417 418
        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,
419
            "currency_id": this.props.defaultCurrency.id,
d.arizona's avatar
d.arizona committed
420
            "quartal": this.props.quarter,
Riri Novita's avatar
Riri Novita committed
421
            "status": type,
Riri Novita's avatar
Riri Novita committed
422
            "profit_loss": data
Riri Novita's avatar
Riri Novita committed
423
        }
qorri_di's avatar
qorri_di committed
424
        console.log("backToRollingOutlook payload", payload);
Riri Novita's avatar
Riri Novita committed
425
        // console.log(JSON.stringify(payload));
d.arizona's avatar
d.arizona committed
426
        api.create('UPLOAD').createRollingOutlookPL(payload).then(response => {
qorri_di's avatar
qorri_di committed
427
            console.log("backToRollingOutlook createRollingOutlookPL", response);
Riri Novita's avatar
Riri Novita committed
428 429
            if (response.data) {
                if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
430 431 432 433 434
                    if (type == 'submitted') {
                        this.props.refresh('PL')
                    } else {
                        this.props.refresh()
                    }
d.arizona's avatar
d.arizona committed
435
                    this.props.onClickClose()
Riri Novita's avatar
Riri Novita committed
436
                } else {
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
                    if (response.data?.message == "Please Set Up Rate Currency First") {
                        this.setState({ visibleAlertSave: true })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 }, () => {
                            document.body.style.overflow = 'unset';
                            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.saveToMonthlyReport()
                            this.props.onClickClose()
                        })
                    }
Riri Novita's avatar
Riri Novita committed
452 453
                }
            } else {
454
                this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false, handleDoubleClick: 0 })
Riri Novita's avatar
Riri Novita committed
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
            }
        })
    }

    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
475 476
                            "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
477
                            "notes": i[3] === undefined ? "" : reg.test(String(i[3])) === false ? "" : String(i[3]).trim(),
Riri Novita's avatar
Riri Novita committed
478 479 480 481 482 483 484 485 486 487 488 489
                            "january": i[5] === undefined ? "0" : reg.test(String(Number(i[5]))) === false ? "0" : String(Number(i[5])).trim(),
                            "february": i[6] === undefined ? "0" : reg.test(String(Number(i[6]))) === false ? "0" : String(Number(i[6])).trim(),
                            "march": i[7] === undefined ? "0" : reg.test(String(Number(i[7]))) === false ? "0" : String(Number(i[7])).trim(),
                            "april": i[8] === undefined ? "0" : reg.test(String(Number(i[8]))) === false ? "0" : String(Number(i[8])).trim(),
                            "may": i[9] === undefined ? "0" : reg.test(String(Number(i[9]))) === false ? "0" : String(Number(i[9])).trim(),
                            "june": i[10] === undefined ? "0" : reg.test(String(Number(i[10]))) === false ? "0" : String(Number(i[10])).trim(),
                            "july": i[11] === undefined ? "0" : reg.test(String(Number(i[11]))) === false ? "0" : String(Number(i[11])).trim(),
                            "august": i[12] === undefined ? "0" : reg.test(String(Number(i[12]))) === false ? "0" : String(Number(i[12])).trim(),
                            "september": i[13] === undefined ? "0" : reg.test(String(Number(i[13]))) === false ? "0" : String(Number(i[13])).trim(),
                            "october": i[14] === undefined ? "0" : reg.test(String(Number(i[14]))) === false ? "0" : String(Number(i[14])).trim(),
                            "november": i[15] === undefined ? "0" : reg.test(String(Number(i[15]))) === false ? "0" : String(Number(i[15])).trim(),
                            "december": i[16] === undefined ? "0" : reg.test(String(Number(i[16]))) === false ? "0" : String(Number(i[16])).trim(),
Riri Novita's avatar
Riri Novita committed
490 491 492
                        })
                    }
                })
qorri_di's avatar
qorri_di committed
493
                console.log("fileHandler payload", payload)
Riri Novita's avatar
Riri Novita committed
494 495 496 497
                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
498 499
                    quartal: this.props.quarter,
                    rolling_outlook_id: this.props.rollingOutlookID,
Riri Novita's avatar
Riri Novita committed
500 501 502
                    status: 'submitted',
                    profit_loss: payload
                }
qorri_di's avatar
qorri_di committed
503
                console.log("fileHandler body", body)
Riri Novita's avatar
Riri Novita committed
504 505 506 507 508 509
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
            }
        });
    }

    checkUpload() {
510 511 512 513 514
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
        api.create().checkImportRollingOutlookPL(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
515
            console.log(response);
Riri Novita's avatar
Riri Novita committed
516
            // console.log(JSON.stringify(this.state.payload));
qorri_di's avatar
qorri_di committed
517
            console.log("checkUpload Response", response)
Riri Novita's avatar
Riri Novita committed
518 519 520 521 522 523 524 525 526 527 528
            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
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545
                            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
546 547 548 549
                        ]
                    })
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false }, () => {
                        this.state.dataTable.map(item => {
d.arizona's avatar
d.arizona committed
550 551 552 553
                            // if (item[24].length > 0) {
                            //     // console.log('masuk')
                            //     this.setState({ buttonError: true, errorPreview: true })
                            // }
Riri Novita's avatar
Riri Novita committed
554 555 556
                        })
                        // console.log(this.state.buttonError)
                    })
qorri_di's avatar
qorri_di committed
557
                    console.log("checkUpload DataTable", dataTable);
Riri Novita's avatar
Riri Novita committed
558 559
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
560
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
561 562 563 564 565 566
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Riri Novita's avatar
Riri Novita committed
567 568 569 570 571
                }
            }
        })
    }

d.arizona's avatar
d.arizona committed
572
    uploadProfitLossRO(type) {
Riri Novita's avatar
Riri Novita committed
573
        let data = []
Riri Novita's avatar
Riri Novita committed
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
        if (this.state.defaultCurrencyUpload?.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    "item_report_id": i[1],
                    "item_report": i[5],
                    "notes": String(i[6]),
                    "last_year_total": String(Number(i[7])),
                    "january": String(Number(i[8])),
                    "february": String(Number(i[9])),
                    "march": String(Number(i[10])),
                    "april": String(Number(i[11])),
                    "may": String(Number(i[12])),
                    "june": String(Number(i[13])),
                    "july": String(Number(i[14])),
                    "august": String(Number(i[15])),
                    "september": String(Number(i[16])),
                    "october": String(Number(i[17])),
                    "november": String(Number(i[18])),
                    "december": String(Number(i[19])),
                    "current_year_total": String(Number(i[20])),
                })
Riri Novita's avatar
Riri Novita committed
595
            })
Riri Novita's avatar
Riri Novita committed
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    "item_report_id": i[1],
                    "item_report": i[5],
                    "notes": String(i[6]),
                    "last_year_total": String(fixNumber(Number(i[7]), 1)),
                    "january": String(fixNumber(Number(i[8]), 1)),
                    "february": String(fixNumber(Number(i[9]), 1)),
                    "march": String(fixNumber(Number(i[10]), 1)),
                    "april": String(fixNumber(Number(i[11]), 1)),
                    "may": String(fixNumber(Number(i[12]), 1)),
                    "june": String(fixNumber(Number(i[13]), 1)),
                    "july": String(fixNumber(Number(i[14]), 1)),
                    "august": String(fixNumber(Number(i[15]), 1)),
                    "september": String(fixNumber(Number(i[16]), 1)),
                    "october": String(fixNumber(Number(i[17]), 1)),
                    "november": String(fixNumber(Number(i[18]), 1)),
                    "december": String(fixNumber(Number(i[19]), 1)),
                    "current_year_total": String(fixNumber(Number(i[20]), 1)),
                })
            })
        }

qorri_di's avatar
qorri_di committed
620
        console.log("uploadProfitLossRO Data", data)
Riri Novita's avatar
Riri Novita committed
621 622 623 624 625
        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
626
            "currency_id": this.state.defaultCurrencyUpload?.id,
d.arizona's avatar
d.arizona committed
627 628
            "quartal": this.props.quarter,
            "rolling_outlook_id": this.props.rollingOutlookID,
Riri Novita's avatar
Riri Novita committed
629 630 631
            "status": type,
            "profit_loss": data
        }
qorri_di's avatar
qorri_di committed
632
        console.log("uploadProfitLossRO Body", body);
d.arizona's avatar
d.arizona committed
633
        api.create('UPLOAD').importRollingOutlookPL(body).then(response => {
qorri_di's avatar
qorri_di committed
634
            console.log("uploadProfitLossRO importRollingOutlookPL", response);
Riri Novita's avatar
Riri Novita committed
635 636 637
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === "success") {
d.arizona's avatar
d.arizona committed
638
                        this.props.onClickClose()
d.arizona's avatar
d.arizona committed
639 640 641 642 643
                        if (type == 'submitted') {
                            this.props.refresh('PL')
                        } else {
                            this.props.refresh()
                        }
Riri Novita's avatar
Riri Novita committed
644 645 646
                        // this.props.onClickClose()
                        // this.props.getReport()
                    } else {
Riri Novita's avatar
Riri Novita committed
647
                        if (response.data?.message == "Please Set Up Rate Currency First") {
Riri Novita's avatar
Riri Novita committed
648
                            this.setState({ visibleAlertSave: true, loading: false })
Riri Novita's avatar
Riri Novita committed
649 650 651 652 653 654 655 656 657 658 659 660
                        } 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
661 662 663
                        // alert(response.data.status)
                    }
                } else {
664
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
Riri Novita's avatar
Riri Novita committed
665 666
                }
            } else {
667
                this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
Riri Novita's avatar
Riri Novita committed
668 669 670 671
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
    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
715 716
        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false, handleDoubleClick: 0 })
        console.log(this.state.handleDoubleClick);
Riri Novita's avatar
Riri Novita committed
717 718 719 720 721
        //             } 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
722
        //                 if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
723 724 725 726 727 728 729 730 731 732 733 734 735
        //                     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
736 737 738 739
    closeAlert() {
        this.setState({ alert: false })
    }

Riri Novita's avatar
Riri Novita committed
740
    render() {
Riri Novita's avatar
Riri Novita committed
741
        let dataTable2 = this.state.dataTable
Riri Novita's avatar
Riri Novita committed
742 743 744

        const handleNotes = (value, tableMeta) => {
            // console.log(value)
Riri Novita's avatar
Riri Novita committed
745
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = value
Riri Novita's avatar
Riri Novita committed
746 747 748
            // console.log(dataTable2[tableMeta.rowIndex]);
        }

Riri Novita's avatar
Riri Novita committed
749 750 751 752
        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
753
            console.log("handleChange ", val)
Riri Novita's avatar
Riri Novita committed
754 755 756 757
        }

        const handleValue = (value, data) => {
            let total = 0
Riri Novita's avatar
Riri Novita committed
758 759
            // console.log(data);
            // console.log(dataTable2);
Riri Novita's avatar
Riri Novita committed
760 761 762
            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
763 764 765 766
                    // if (data.rowData[5] == "Revenue") {
                    //     console.log(total);
                    //     // console.log(a);
                    // }
Riri Novita's avatar
Riri Novita committed
767 768
                }
            })
Riri Novita's avatar
Riri Novita committed
769
            // console.log(total);
Riri Novita's avatar
Riri Novita committed
770 771
            let indexParent = dataTable2.findIndex((val) => val[1] == dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
772

Riri Novita's avatar
Riri Novita committed
773 774 775 776 777 778 779 780
            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 = ""
Riri Novita's avatar
Riri Novita committed
781 782 783
            // if (String(tableMeta.rowData[1]) == 19865 && tableMeta.columnIndex == 11) {
            //     console.log(arrayFormula)
            // }
Riri Novita's avatar
Riri Novita committed
784 785 786 787 788 789
            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
790
                    let index = dataTable2.findIndex((val) => val[22] == item)
Riri Novita's avatar
Riri Novita committed
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822
                    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 = ""
Riri Novita's avatar
Riri Novita committed
823 824 825
            // if (String(tableMeta.rowData[1]) == 19865 && tableMeta.columnIndex == 11) {
            //     console.log(array)
            // }
Riri Novita's avatar
Riri Novita committed
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840
            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") {
Riri Novita's avatar
Riri Novita committed
841
                        total = this.props.defaultCurrency.id == 1 ? (fixNumber(Number(total), 1) * fixNumber(Number(item), 1)) : (Number(total) * Number(item)) // angka yg diupload menjadi bilangan bulat
Riri Novita's avatar
Riri Novita committed
842 843 844 845 846 847 848
                    } 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)
                    }
                }
            })
Riri Novita's avatar
Riri Novita committed
849 850 851
            // if (String(tableMeta.rowData[1]) == 19865 && tableMeta.columnIndex == 11) {
            //     console.log(total)
            // }
Riri Novita's avatar
Riri Novita committed
852 853 854 855 856 857
            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) {
858
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total).toFixed(1)
Riri Novita's avatar
Riri Novita committed
859
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = this.props.defaultCurrency.id == 1 ? fixNumber(Number(total), 1) : Number(total) //hasil dari penjumlahan/kali/pembagian menjadi bilangan bulat
860

Riri Novita's avatar
Riri Novita committed
861
            // }
862

Riri Novita's avatar
Riri Novita committed
863 864
            return Number(total)

865

Riri Novita's avatar
Riri Novita committed
866 867
        }

d.arizona's avatar
d.arizona committed
868 869
        const handleTotal = (val, tableMeta) => {
            let total = 0
qorri_di's avatar
qorri_di committed
870
            tableMeta.rowData.map((item, index) => {
d.arizona's avatar
d.arizona committed
871 872 873 874
                if (index >= 8 && index <= 19) {
                    total += Number(item)
                }
            })
Riri Novita's avatar
Riri Novita committed
875 876 877

            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
878
                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
879
                return R.equals(value, NaN) ? "0.0" : (R.equals(value, Infinity) ? "0.0" : (value == "-Infinity" ? "0.0" : value))
880
            }
qorri_di's avatar
qorri_di committed
881 882 883 884 885
            // 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
886 887 888 889 890 891
            // }
            else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
                return total
            }
            // dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
Riri Novita's avatar
Riri Novita committed
892
            // if (String(tableMeta.rowData[5]).toLocaleLowerCase === "sales volume") {
893
            // console.log(total);
Riri Novita's avatar
Riri Novita committed
894
            // }
Riri Novita's avatar
Riri Novita committed
895
            // return total
d.arizona's avatar
d.arizona committed
896 897
        }

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

qorri_di's avatar
qorri_di committed
2011 2012
            {
                name: `Oct ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024
                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
2025
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2026 2027 2028 2029 2030 2031
                                        <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
2032
                                            value={fixNumber(Number(val), 1) == 0 ? "0.0" : fixNumber(Number(val), 1)}
Riri Novita's avatar
Riri Novita committed
2033
                                        />
Riri Novita's avatar
Riri Novita committed
2034
                                        :
Riri Novita's avatar
Riri Novita committed
2035 2036 2037 2038 2039 2040 2041 2042
                                        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}
Riri Novita's avatar
Riri Novita committed
2043 2044
                                                    // value={fixNumber(Number(val), 1) == 0 ? "0.0" : fixNumber(Number(val), 1)}
                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(val, tableMeta)), 1) : Number(handleValue(val, tableMeta)) == 0 ? "0.0" : Number(handleValue(val, tableMeta))}
Riri Novita's avatar
Riri Novita committed
2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060
                                                />
                                            </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}
Riri Novita's avatar
Riri Novita committed
2061
                                                                value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val) == 0 ? "0.0" : Number(val)}
Riri Novita's avatar
Riri Novita committed
2062 2063 2064 2065 2066
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
2067
                                                    />
Riri Novita's avatar
Riri Novita committed
2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081
                                                </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
2082
                                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormula(val, tableMeta, 1)), 1) : Number(handleFormula(val, tableMeta, 1)) == 0 ? "0.0" :  Number(handleFormula(val, tableMeta, 1))}
Riri Novita's avatar
Riri Novita committed
2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098
                                                                />
                                                            }
                                                        />
                                                    </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
2099
                                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val) == 0 ? "0.0" : Number(val)}
Riri Novita's avatar
Riri Novita committed
2100 2101 2102 2103
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
2104 2105 2106 2107
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2108
                }
2109 2110
            },

qorri_di's avatar
qorri_di committed
2111 2112
            {
                name: `Nov ${this.props.periode}`,
Riri Novita's avatar
Riri Novita committed
2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124
                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
2125
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2126 2127 2128 2129 2130 2131
                                        <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
2132
                                            value={fixNumber(Number(val), 1) == 0 ? "0.0" : fixNumber(Number(val), 1)}
Riri Novita's avatar
Riri Novita committed
2133
                                        />
Riri Novita's avatar
Riri Novita committed
2134
                                        :
Riri Novita's avatar
Riri Novita committed
2135 2136 2137 2138 2139 2140 2141 2142
                                        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}
Riri Novita's avatar
Riri Novita committed
2143 2144
                                                    // value={fixNumber(Number(val), 1) == 0 ? "0.0" : fixNumber(Number(val), 1)}
                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(val, tableMeta)), 1) : Number(handleValue(val, tableMeta)) == 0 ? "0.0" : Number(handleValue(val, tableMeta))}
Riri Novita's avatar
Riri Novita committed
2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160
                                                />
                                            </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}
Riri Novita's avatar
Riri Novita committed
2161
                                                                value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val) == 0 ? "0.0" : Number(val)}
Riri Novita's avatar
Riri Novita committed
2162 2163 2164 2165 2166
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
2167
                                                    />
Riri Novita's avatar
Riri Novita committed
2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181
                                                </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
2182
                                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormula(val, tableMeta, 1)), 1) : Number(handleFormula(val, tableMeta, 1)) == 0 ? "0.0" : Number(handleFormula(val, tableMeta, 1))}
Riri Novita's avatar
Riri Novita committed
2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198
                                                                />
                                                            }
                                                        />
                                                    </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
2199
                                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val) == 0 ? "0.0" : Number(val)}
Riri Novita's avatar
Riri Novita committed
2200 2201 2202 2203
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
2204 2205 2206 2207
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2208
                }
Riri Novita's avatar
Riri Novita committed
2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222
            }, {
                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
2223
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2224 2225 2226 2227 2228 2229
                                        <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
2230
                                            value={fixNumber(Number(val), 1) == 0 ? "0.0" : fixNumber(Number(val), 1)}
Riri Novita's avatar
Riri Novita committed
2231
                                        />
Riri Novita's avatar
Riri Novita committed
2232
                                        :
Riri Novita's avatar
Riri Novita committed
2233 2234 2235 2236 2237 2238 2239 2240
                                        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}
Riri Novita's avatar
Riri Novita committed
2241 2242
                                                    // value={fixNumber(Number(val), 1) == 0 ? "0.0" : fixNumber(Number(val), 1)}
                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleValue(val, tableMeta)), 1) : Number(handleValue(val, tableMeta)) == 0 ? "0.0" : Number(handleValue(val, tableMeta))}
Riri Novita's avatar
Riri Novita committed
2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258
                                                />
                                            </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}
Riri Novita's avatar
Riri Novita committed
2259
                                                                value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val) == 0 ? "0.0" : Number(val)}
Riri Novita's avatar
Riri Novita committed
2260 2261 2262 2263 2264
                                                                onBlur={(event) => {
                                                                    handleChange(event.target.value, tableMeta)
                                                                }}
                                                            />
                                                        }
Riri Novita's avatar
Riri Novita committed
2265
                                                    />
Riri Novita's avatar
Riri Novita committed
2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279
                                                </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
2280
                                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleFormula(val, tableMeta, 1)), 1) : Number(handleFormula(val, tableMeta, 1)) == 0 ? "0.0" : Number(handleFormula(val, tableMeta, 1))}
Riri Novita's avatar
Riri Novita committed
2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296
                                                                />
                                                            }
                                                        />
                                                    </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
2297
                                                                    value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(val), 1) : Number(val) == 0 ? "0.0" : Number(val)}
Riri Novita's avatar
Riri Novita committed
2298 2299 2300 2301
                                                                />
                                                            }
                                                        />
                                                    </div>
Riri Novita's avatar
Riri Novita committed
2302 2303 2304 2305
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2306
                }
Riri Novita's avatar
Riri Novita committed
2307
            }, {
Riri Novita's avatar
Riri Novita committed
2308
                name: `${this.props.periode} Total Outlook`,
Riri Novita's avatar
Riri Novita committed
2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320
                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
2321
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
2322 2323 2324 2325 2326 2327
                                        <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
2328
                                            value={fixNumber(Number(val), 1) == 0 ? "0.0" : fixNumber(Number(val), 1)}
Riri Novita's avatar
Riri Novita committed
2329
                                        />
2330
                                        :
Riri Novita's avatar
Riri Novita committed
2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341
                                        <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
2342
                                                        value={this.props.defaultCurrency.id == 1 ? fixNumber(Number(handleTotal(val, tableMeta)), 1) : Number(handleTotal(val, tableMeta)) == 0 ? "0.0" : Number(handleTotal(val, tableMeta))}
Riri Novita's avatar
Riri Novita committed
2343 2344 2345 2346
                                                    />
                                                }
                                            />
                                        </div>
Riri Novita's avatar
Riri Novita committed
2347 2348 2349 2350
                                }
                            </div>
                        )
                    }
Riri Novita's avatar
Riri Novita committed
2351
                }
Riri Novita's avatar
Riri Novita committed
2352
            },
Riri Novita's avatar
Riri Novita committed
2353
        ]
Riri Novita's avatar
Riri Novita committed
2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365

        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
2366 2367
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
Riri Novita's avatar
Riri Novita committed
2368
                {this.state.loading && loadingComponent}
Riri Novita's avatar
Riri Novita committed
2369 2370 2371
                <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
2372 2373 2374 2375 2376
                <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
2377
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Riri Novita's avatar
Riri Novita committed
2378 2379 2380 2381 2382 2383 2384 2385 2386
                    {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
2387
                                        <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
2388 2389 2390 2391 2392
                                        {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
2393 2394
                                    </div>
                                    <div style={{ width: '50%' }}>
Riri Novita's avatar
Riri Novita committed
2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449
                                        {this.props.isApprover === true || this.state.get_for == 'view' ?
                                            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" />
                                            // </div> 
                                            :
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                <a data-tip={'Download Template'} data-for="template">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.setState({ loading: true }, () => {
                                                            this.downloadTemplate()
                                                        })}
                                                    >
                                                        <img src={Images.template} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                <a data-tip={'Upload'} data-for="upload">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.setState({ visibleUpload: true })}
                                                    >
                                                        <img src={Images.upload} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
Riri Novita's avatar
Riri Novita committed
2450
                                                {/* <a data-tip={'Download'} data-for="download">
Riri Novita's avatar
Riri Novita committed
2451 2452 2453 2454 2455 2456 2457 2458 2459 2460
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                this.downloadAllData()
Riri Novita's avatar
Riri Novita committed
2461
                                                            })}
Riri Novita's avatar
Riri Novita committed
2462 2463 2464 2465
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
Riri Novita's avatar
Riri Novita committed
2466
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
Riri Novita's avatar
Riri Novita committed
2467 2468
                                            </div>
                                        }
Riri Novita's avatar
Riri Novita committed
2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483
                                    </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
2484 2485 2486 2487 2488
                                <div style={{ display: 'flex' }}>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                    <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                        {
                                            this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
qorri_di's avatar
qorri_di committed
2489 2490 2491 2492
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
2493
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
2494 2495 2496
                                        }
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
2497 2498
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notesUpdate}</Typography>
                            </div>
Riri Novita's avatar
Riri Novita committed
2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521
                            {/* {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
2522
                                {this.props.isApprover === true ?
Riri Novita's avatar
Riri Novita committed
2523 2524 2525 2526
                                    <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
2527
                                            <button
Riri Novita's avatar
Riri Novita committed
2528
                                                className="button"
Riri Novita's avatar
Riri Novita committed
2529 2530 2531 2532 2533
                                                type="button"
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: 'pointer',
                                                    borderColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
2534 2535 2536 2537 2538 2539 2540
                                                    outline: 'none',
                                                    marginRight: 20
                                                }}
                                                onClick={() => {
                                                    this.setState({ loading: true, refresh: true }, () => {
                                                        this.handleGetFor('edit')
                                                    })
Riri Novita's avatar
Riri Novita committed
2541 2542
                                                }}
                                            >
Riri Novita's avatar
Riri Novita committed
2543 2544
                                                <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
2545
                                                </div>
Riri Novita's avatar
Riri Novita committed
2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585
                                            </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
2586
                                                        })
Riri Novita's avatar
Riri Novita committed
2587 2588 2589 2590
                                            }
                                        >
                                            <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
2591
                                            </div>
Riri Novita's avatar
Riri Novita committed
2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615
                                        </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
2616
                                    </div>
Riri Novita's avatar
Riri Novita committed
2617 2618 2619 2620
                                }
                            </div>
                            {/* : null
                            } */}
Riri Novita's avatar
Riri Novita committed
2621 2622 2623 2624 2625 2626 2627
                        </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
2628
                                <div>
Riri Novita's avatar
Riri Novita committed
2629
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
Riri Novita's avatar
Riri Novita committed
2630
                                    <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
2631 2632 2633 2634 2635
                                    {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
2636
                                </div>
Riri Novita's avatar
Riri Novita committed
2637 2638 2639 2640 2641 2642 2643 2644 2645 2646
                                <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
2647
                                </div>
Riri Novita's avatar
Riri Novita committed
2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667
                                <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
2668
                                    </div>
Riri Novita's avatar
Riri Novita committed
2669
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Riri Novita's avatar
Riri Novita committed
2670 2671 2672 2673 2674 2675 2676 2677
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
Riri Novita's avatar
Riri Novita committed
2678
                                                marginRight: 20
Riri Novita's avatar
Riri Novita committed
2679 2680 2681
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2682 2683 2684 2685
                                                    setTimeout(() => {
                                                        // this.setState({ loading: false })
                                                        this.handleValidate()
                                                    }, 100);
Riri Novita's avatar
Riri Novita committed
2686 2687 2688 2689
                                                })
                                            }}
                                        >
                                            <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
2690
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
Riri Novita's avatar
Riri Novita committed
2691 2692
                                            </div>
                                        </button>
Riri Novita's avatar
Riri Novita committed
2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706
                                        <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' })
                                                    :
2707 2708
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2709
                                                            this.uploadProfitLossRO('draft')
Riri Novita's avatar
Riri Novita committed
2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723
                                                        })
                                            }
                                        >
                                            <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' })
                                                    :
2724 2725
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
d.arizona's avatar
d.arizona committed
2726
                                                            this.uploadProfitLossRO('submitted')
Riri Novita's avatar
Riri Novita committed
2727 2728 2729 2730 2731 2732 2733 2734 2735 2736
                                                        })}
                                            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>
2737
                                                {/*save & complete ini muncul setelah pencet tombol edit, kemudian setelah upload suatu file*/}
Riri Novita's avatar
Riri Novita committed
2738 2739 2740
                                            </div>
                                        </button>
                                    </div>
Riri Novita's avatar
Riri Novita committed
2741
                                </div>
Riri Novita's avatar
Riri Novita committed
2742 2743
                            </div>
                        </Paper>}
Riri Novita's avatar
Riri Novita committed
2744
                </div>
Riri Novita's avatar
Riri Novita committed
2745 2746

                {this.state.visibleUpload && (
d.arizona's avatar
d.arizona committed
2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765
                    // 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>
2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782
                            <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>
2783
                            <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data in <b>{this.props.defaultCurrency.id == 1 ? "IDR mn" : "thousand USD"}</b></div>
2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811
                        </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
                                        }}
2812
                                        onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0, loading: false })}
2813 2814 2815 2816 2817 2818 2819
                                    >
                                        <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
2820 2821
                        </div>
                    </div>
Riri Novita's avatar
Riri Novita committed
2822
                )}
Riri Novita's avatar
Riri Novita committed
2823 2824 2825
            </div>
        )
    }
Riri Novita's avatar
Riri Novita committed
2826
}