OperatingIndicatorRO.js 163 KB
Newer Older
Riri Novita's avatar
Riri Novita committed
1
import React, { Component } from 'react';
syadziy's avatar
syadziy committed
2
import { Typography, Paper, createMuiTheme, MuiThemeProvider, TableCell, FormControlLabel, Input, Snackbar, withStyles, Tooltip } from '@material-ui/core';
Riri Novita's avatar
Riri Novita committed
3 4 5 6 7 8 9 10 11
import MUIDataTable from 'mui-datatables';
import NumberFormat from 'react-number-format';
import api from '../../api';
import PropagateLoader from "react-spinners/PropagateLoader"
import Images from '../../assets/Images';
import ReactTooltip from 'react-tooltip';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import { Alert } from '@material-ui/lab';
Riri Novita's avatar
Riri Novita committed
12
import Constant from '../../library/Constant';
Riri Novita's avatar
Riri Novita committed
13
import { fixNumber, titleCase } from '../../library/Utils';
Riri Novita's avatar
Riri Novita committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

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

const options = ct.customOptionsFixedColumn();
const style = {
    position: "sticky",
    left: 0,
    zIndex: 101,
    background: "white",
};
const style2 = {
    position: "sticky",
    background: "white",
    zIndex: 100
};

const LightTooltip = withStyles((theme) => ({
    tooltip: {
        backgroundColor: theme.palette.common.white,
        color: 'rgba(0, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);

export default class OperatingIndicatorRO extends Component {
    constructor(props) {
        super(props)
        this.state = {
Riri Novita's avatar
Riri Novita committed
44 45
            dataTable: [],
            loading: true,
Riri Novita's avatar
Riri Novita committed
46
            visibleOI: true,
d.arizona's avatar
d.arizona committed
47
            updateBy: [],
Riri Novita's avatar
Riri Novita committed
48
            notesUpdate: '-',
Riri Novita's avatar
Riri Novita committed
49 50 51
            disabledSave: true,
            editable: true,
            emptyData: false,
Riri Novita's avatar
Riri Novita committed
52 53 54 55
            templateNull: true,
            judulColumn: null,
            saveDraft: true,
            viewOnly: true,
Riri Novita's avatar
Riri Novita committed
56 57 58 59 60 61
            get_for: 'view',
            defaultCurrencyUpload: this.props.defaultCurrency,
            visibleAlertSave: false,
            alert: false,
            tipeAlert: '',
            messageAlert: '',
Riri Novita's avatar
Riri Novita committed
62 63 64 65 66
        }
        this.handleValue = this.handleValue.bind(this)
        this.fileHandler = this.fileHandler.bind(this);
    }

Riri Novita's avatar
Riri Novita committed
67
    componentDidMount() {
Riri Novita's avatar
Riri Novita committed
68
        this.getOperatingIDRolling()
Riri Novita's avatar
Riri Novita committed
69 70 71 72 73 74 75
        this.handleViewOnly()
        // // console.log(this.props);
    }

    handleViewOnly() {
        let checkCreate = this.props.permission.create
        let checkEdit = this.props.permission.edit
Riri Novita's avatar
Riri Novita committed
76
        let checkStatus = true
Riri Novita's avatar
Riri Novita committed
77

Riri Novita's avatar
Riri Novita committed
78 79 80 81 82 83
        console.log(this.props.data.status);
        if (String(this.props.data.status).toLocaleUpperCase() === 'CLOSED') {
            checkStatus = false
        }
        console.log(checkStatus);

d.arizona's avatar
d.arizona committed
84
        this.setState({ viewOnly: checkCreate && checkEdit && checkStatus })
Riri Novita's avatar
Riri Novita committed
85 86 87 88
    }

    handleGetFor(type) {
        this.setState({ get_for: type }, () => {
d.arizona's avatar
d.arizona committed
89
            this.getLatestUpdate()
Riri Novita's avatar
Riri Novita committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
            this.getOperatingIDRolling()
        })
    }

    getOperatingIDRolling() {
        // console.log(this.props.data.operatingIndID);
        let payload = {
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
            "quartal": this.props.quartal
        }
        console.log(payload);
        api.create().getRollingOI(payload).then(response => {
            console.log(response);
            if (response) {
                if (response.data.data) {
                    this.setState({ operatingIndIDRolling: response.data.data.operating_indicator_id }, () => {
                        this.getDataDetail()
                        this.getLatestUpdate()
                    })
                } else {
                    this.setState({ operatingIndIDRolling: null }, () => {
                        this.getDataDetail()
                        this.getLatestUpdate()
                    })
                }
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
120 121
    getLatestUpdate() {
        let payload = {
Riri Novita's avatar
Riri Novita committed
122
            "operating_indicator_id": this.state.operatingIndIDRolling,
Riri Novita's avatar
Riri Novita committed
123 124 125
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
126
            "quartal": this.props.quartal
Riri Novita's avatar
Riri Novita committed
127
        }
Riri Novita's avatar
Riri Novita committed
128 129
        // console.log(payload);
        api.create().getLastestUpdateROOI(payload).then(response => {
d.arizona's avatar
d.arizona committed
130
            console.log(response.data)
Riri Novita's avatar
Riri Novita committed
131 132 133
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
d.arizona's avatar
d.arizona committed
134
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail,
Riri Novita's avatar
Riri Novita committed
135 136 137 138
                        notesUpdate: 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
139
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
140 141 142 143 144
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
Riri Novita's avatar
Riri Novita committed
145 146
                    })
                }
Riri Novita's avatar
Riri Novita committed
147 148
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Riri Novita's avatar
Riri Novita committed
149 150 151 152 153 154 155
            }
        })
    }

    getDataDetail() {
        this.setState({ loading: true })
        let payload = {
Riri Novita's avatar
Riri Novita committed
156
            "operating_indicator_id": this.state.operatingIndIDRolling,
Riri Novita's avatar
Riri Novita committed
157 158
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
Riri Novita's avatar
Riri Novita committed
159 160
            "periode": this.props.data.periode,
            "quartal": this.props.quartal,
Riri Novita's avatar
Riri Novita committed
161 162
            "get_for": this.state.get_for,
            "currency_id": this.props.defaultCurrency.id,
Riri Novita's avatar
Riri Novita committed
163 164
        }
        console.log(payload)
Riri Novita's avatar
Riri Novita committed
165
        api.create().getHierarkiRollingOI(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
166 167
            console.log(response)
            let dataTable = []
Riri Novita's avatar
Riri Novita committed
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
            if (response.data.status === 'success') {
                let res = response.data.data
                // // // console.log(res) 
                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,
                            item.uom,
                            item.rolling_outlook.january === "" ? "0" : item.rolling_outlook.january,
                            item.rolling_outlook.february === "" ? "0" : item.rolling_outlook.february,
                            item.rolling_outlook.march === "" ? "0" : item.rolling_outlook.march,
                            item.rolling_outlook.april === "" ? "0" : item.rolling_outlook.april,
                            item.rolling_outlook.may === "" ? "0" : item.rolling_outlook.may,
                            item.rolling_outlook.june === "" ? "0" : item.rolling_outlook.june,
                            item.rolling_outlook.july === "" ? "0" : item.rolling_outlook.july,
                            item.rolling_outlook.august === "" ? "0" : item.rolling_outlook.august,
                            item.rolling_outlook.september === "" ? "0" : item.rolling_outlook.september,
                            item.rolling_outlook.october === "" ? "0" : item.rolling_outlook.october,
                            item.rolling_outlook.november === "" ? "0" : item.rolling_outlook.november,
                            item.rolling_outlook.december === "" ? "0" : item.rolling_outlook.december,
                            item.rolling_outlook.total_current_year === "" ? "0" : item.rolling_outlook.total_current_year,
                            item.order
                        ])
                    }
                    if (item.children !== null) {
                        if (item.children.length > 0) {
                            item.children.map((items, indexs) => {
                                handlePushChild(items)
                            })
                        }
                    }
                }
                res.map((item, index) => {
Riri Novita's avatar
Riri Novita committed
207 208 209 210 211 212 213 214
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
                        item.uom,
Riri Novita's avatar
Riri Novita committed
215 216 217
                        item.rolling_outlook.january === "" ? "0" : item.rolling_outlook.january,
                        item.rolling_outlook.february === "" ? "0" : item.rolling_outlook.february,
                        item.rolling_outlook.march === "" ? "0" : item.rolling_outlook.march,
Riri Novita's avatar
Riri Novita committed
218 219 220 221 222 223 224 225 226 227
                        item.rolling_outlook.april === "" ? "0" : item.rolling_outlook.april,
                        item.rolling_outlook.may === "" ? "0" : item.rolling_outlook.may,
                        item.rolling_outlook.june === "" ? "0" : item.rolling_outlook.june,
                        item.rolling_outlook.july === "" ? "0" : item.rolling_outlook.july,
                        item.rolling_outlook.august === "" ? "0" : item.rolling_outlook.august,
                        item.rolling_outlook.september === "" ? "0" : item.rolling_outlook.september,
                        item.rolling_outlook.october === "" ? "0" : item.rolling_outlook.october,
                        item.rolling_outlook.november === "" ? "0" : item.rolling_outlook.november,
                        item.rolling_outlook.december === "" ? "0" : item.rolling_outlook.december,
                        item.rolling_outlook.total_current_year === "" ? "0" : item.rolling_outlook.total_current_year,
Riri Novita's avatar
Riri Novita committed
228 229
                        item.order
                    ])
Riri Novita's avatar
Riri Novita committed
230 231 232 233 234 235
                    if (item.children !== null) {
                        if (item.children.length > 0) {
                            item.children.map((items, indexs) => {
                                handlePushChild(items)
                            })
                        }
Riri Novita's avatar
Riri Novita committed
236
                    }
Riri Novita's avatar
Riri Novita committed
237 238 239 240
                })
                this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true }, () => {
                    if (this.state.dataTable.length == 0) {
                        this.setState({ emptyData: true })
Riri Novita's avatar
Riri Novita committed
241
                    }
Riri Novita's avatar
Riri Novita committed
242 243 244
                })
            } else {
                this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
245
                    if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
246 247 248 249 250 251 252
                        setTimeout(() => {
                            localStorage.removeItem(Constant.TOKEN)
                            window.location.reload();
                        }, 1000);
                    }
                })
            }
Riri Novita's avatar
Riri Novita committed
253 254 255 256 257 258
            console.log(dataTable);
        })

    }

    createData(type) {
Riri Novita's avatar
Riri Novita committed
259
        let payloadRO = []
Riri Novita's avatar
Riri Novita committed
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
        if (this.props.defaultCurrency.id == 2) {
            this.state.dataTable.map((item, index) => {
                payloadRO.push({
                    "item_report_id": item[1],
                    "january": String(Number(item[7])),
                    "february": String(Number(item[8])),
                    "march": String(Number(item[9])),
                    "april": String(Number(item[10])),
                    "may": String(Number(item[11])),
                    "june": String(Number(item[12])),
                    "july": String(Number(item[13])),
                    "august": String(Number(item[14])),
                    "september": String(Number(item[15])),
                    "october": String(Number(item[16])),
                    "november": String(Number(item[17])),
                    "december": String(Number(item[18])),
                    "total_current_year": String(Number(item[19])),
                })
Riri Novita's avatar
Riri Novita committed
278
            })
Riri Novita's avatar
Riri Novita committed
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
        } else {
            this.state.dataTable.map((item, index) => {
                payloadRO.push({
                    "item_report_id": item[1],
                    "january": String(fixNumber(Number(item[7]), 1)),
                    "february": String(fixNumber(Number(item[8]), 1)),
                    "march": String(fixNumber(Number(item[9]), 1)),
                    "april": String(fixNumber(Number(item[10]), 1)),
                    "may": String(fixNumber(Number(item[11]), 1)),
                    "june": String(fixNumber(Number(item[12]), 1)),
                    "july": String(fixNumber(Number(item[13]), 1)),
                    "august": String(fixNumber(Number(item[14]), 1)),
                    "september": String(fixNumber(Number(item[15]), 1)),
                    "october": String(fixNumber(Number(item[16]), 1)),
                    "november": String(fixNumber(Number(item[17]), 1)),
                    "december": String(fixNumber(Number(item[18]), 1)),
                    "total_current_year": String(fixNumber(Number(item[19]), 1)),
                })
            })
        }

Riri Novita's avatar
Riri Novita committed
300
        let payload = {
Riri Novita's avatar
Riri Novita committed
301
            "operating_indicator_id": this.state.operatingIndIDRolling,
Riri Novita's avatar
Riri Novita committed
302 303 304
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
305
            "quartal": this.props.quartal,
Riri Novita's avatar
Riri Novita committed
306
            "currency_id": this.props.defaultCurrency.id,
Riri Novita's avatar
Riri Novita committed
307
            "status": type,
Riri Novita's avatar
Riri Novita committed
308
            "rolling_outlook": payloadRO
Riri Novita's avatar
Riri Novita committed
309 310 311 312
        }
        console.log(payload);
        // // console.log('=========================')
        // console.log(JSON.stringify(payload))
Riri Novita's avatar
Riri Novita committed
313
        this.props.saveRollingOI(payload)
Riri Novita's avatar
Riri Novita committed
314 315
        this.setState({ loading: false })
        // this.props.onClickClose()
Riri Novita's avatar
Riri Novita committed
316

Riri Novita's avatar
Riri Novita committed
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
    }

    handleValue(data) {
        let total = 0
        this.state.dataTable.map((item, index) => {
            if (data.rowData[1] == item[2]) {
                total = item[data.columnIndex] == undefined ? (Number(total) + 0) : (Number(total) + Number(item[data.columnIndex]))
            }
        })
        let indexParent = this.state.dataTable.findIndex((val) => val[1] == this.state.dataTable[data.rowIndex][2])
        let a = this.state.dataTable[data.rowIndex][data.columnIndex] = total
        // // // console.log(indexParent);
        return a
    }

    handleChange(value, tableMeta) {
        let val = String(value).split(",").join("")
        let data = this.state.dataTable
        let indexParent = data.findIndex((val) => val[1] == data[tableMeta.rowIndex][2])
        if (indexParent > 0) {
            let a = data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
            let jagain = data[indexParent][tableMeta.columnIndex]
            a = data[indexParent][tableMeta.columnIndex] = jagain == undefined ? (0 + Number(val)) : (jagain + Number(val))
        } else {
            data[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
        }
    }

    downloadTemplate = async () => {
        let res = await fetch(
347
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&quartal=${this.props.quartal}&&currency_id=${this.props.defaultCurrency.id}`
Riri Novita's avatar
Riri Novita committed
348 349 350 351 352 353 354
        )
        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;
Riri Novita's avatar
Riri Novita committed
355
            a.download = 'Template Rolling Outlook Operating Indicator.xlsx';
Riri Novita's avatar
Riri Novita committed
356 357
            a.click();
        }
Riri Novita's avatar
Riri Novita committed
358
        setTimeout(() => {
d.arizona's avatar
d.arizona committed
359
            this.setState({ loading: false })
Riri Novita's avatar
Riri Novita committed
360
        }, 500);
Riri Novita's avatar
Riri Novita committed
361 362 363
    }

    async downloadAllData() {
Riri Novita's avatar
Riri Novita committed
364 365
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${this.state.operatingIndIDRolling == null ? "" : this.state.operatingIndIDRolling}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&quartal=${this.props.quartal}`
        console.log(url);
Riri Novita's avatar
Riri Novita committed
366
        let res = await fetch(
Riri Novita's avatar
Riri Novita committed
367
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/rolling_outlook/export_rolling_outlook?operating_indicator_id=${this.state.operatingIndIDRolling === null ? "" : this.state.operatingIndIDRolling}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&quartal=${this.props.quartal}`
Riri Novita's avatar
Riri Novita committed
368 369 370 371 372 373 374 375 376 377 378
        )
        res = await res.blob()
        // // console.log(res)
        this.setState({ loading: false })
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Master Budget Operating Indicator.xlsx';
            a.click();
        }
Riri Novita's avatar
Riri Novita committed
379
        setTimeout(() => {
d.arizona's avatar
d.arizona committed
380
            this.setState({ loading: false })
Riri Novita's avatar
Riri Novita committed
381
        }, 500);
Riri Novita's avatar
Riri Novita committed
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
    }

    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(isi);
                let payload = []
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
                            order: i[0] === undefined ? "0" : String(i[0]).trim(),
                            item_report_id: i[1] === undefined ? "0" : String(i[1]).trim(),
                            item_report: i[2] === undefined ? "0" : String(i[2]).trim(),
                            uom: i[3] === undefined ? "" : String(i[3]).trim(),
                            january: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            february: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            march: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            april: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            may: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            june: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            july: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            august: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            september: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            october: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            november: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            december: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                            total_current_year: i[16] === undefined ? "0" : reg.test(String(i[16])) === false ? "0" : String(i[16]).trim(),
                        })
                    }
                })
                let body = {
                    company_id: this.props.data.company.company_id,
Riri Novita's avatar
Riri Novita committed
421
                    operating_indicator_id: this.state.operatingIndIDRolling,
Riri Novita's avatar
Riri Novita committed
422
                    periode: this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
423
                    quartal: this.props.quartal,
Riri Novita's avatar
Riri Novita committed
424
                    report_id: this.props.data.report_id,
Riri Novita's avatar
Riri Novita committed
425
                    rolling_outlook: payload,
Riri Novita's avatar
Riri Novita committed
426 427 428
                    status: 'submitted'
                }
                console.log(body)
Riri Novita's avatar
Riri Novita committed
429
                console.log(resp.rows[1][0]);
Riri Novita's avatar
Riri Novita committed
430
                this.setState({ payload: body, buttonError: false, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
Riri Novita's avatar
Riri Novita committed
431 432 433 434 435
            }
        });
    }

    checkUpload() {
Riri Novita's avatar
Riri Novita committed
436 437 438 439
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
Riri Novita's avatar
Riri Novita committed
440
        // // console.log(JSON.stringify(this.state.payload))
Riri Novita's avatar
Riri Novita committed
441
        api.create().checkUploadRollingOutlookOI(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477
            // // // console.log(JSON.stringify(this.state.payload));
            // // console.log('===============')
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleOI: false, loading: true })
                    let total = 0
                    let dataTable = response.data.data.map((item, index) => {
                        if (item.type_report_id != null) {
                            total += 1
                        }
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.uom,
                            item.january,
                            item.february,
                            item.march,
                            item.april,
                            item.may,
                            item.june,
                            item.july,
                            item.august,
                            item.september,
                            item.october,
                            item.november,
                            item.december,
                            item.total_current_year,
                            item.order,
                            item.error
                        ]
                    })
Riri Novita's avatar
Riri Novita committed
478
                    this.setState({ dataTable, dataLoaded: true, loading: false, templateNull: total > 0 ? true : false })
Riri Novita's avatar
Riri Novita committed
479 480 481 482 483 484 485 486
                }
            }
        })
    }

    uploadOI(type) {
        let data = []
        // // console.log(this.state.dataTable)
Riri Novita's avatar
Riri Novita committed
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505
        if (this.props.defaultCurrency.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    item_report: String(i[5]),
                    january: String(Number(i[7])),
                    february: String(Number(i[8])),
                    march: String(Number(i[9])),
                    april: String(Number(i[10])),
                    may: String(Number(i[11])),
                    june: String(Number(i[12])),
                    july: String(Number(i[13])),
                    august: String(Number(i[14])),
                    september: String(Number(i[15])),
                    october: String(Number(i[16])),
                    november: String(Number(i[17])),
                    december: String(Number(i[18])),
                    total_current_year: String(Number(i[19])),
                })
Riri Novita's avatar
Riri Novita committed
506
            })
Riri Novita's avatar
Riri Novita committed
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    item_report: String(i[5]),
                    january: String(fixNumber(Number(i[7]), 1)),
                    february: String(fixNumber(Number(i[8]), 1)),
                    march: String(fixNumber(Number(i[9]), 1)),
                    april: String(fixNumber(Number(i[10]), 1)),
                    may: String(fixNumber(Number(i[11]), 1)),
                    june: String(fixNumber(Number(i[12]), 1)),
                    july: String(fixNumber(Number(i[13]), 1)),
                    august: String(fixNumber(Number(i[14]), 1)),
                    september: String(fixNumber(Number(i[15]), 1)),
                    october: String(fixNumber(Number(i[16]), 1)),
                    november: String(fixNumber(Number(i[17]), 1)),
                    december: String(fixNumber(Number(i[18]), 1)),
                    total_current_year: String(fixNumber(Number(i[19]), 1)),
                })
            })
        }

Riri Novita's avatar
Riri Novita committed
529 530
        let body = {
            company_id: this.props.data.company.company_id,
Riri Novita's avatar
Riri Novita committed
531
            operating_indicator_id: this.state.operatingIndIDRolling,
Riri Novita's avatar
Riri Novita committed
532
            periode: this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
533
            quartal: this.props.quartal,
Riri Novita's avatar
Riri Novita committed
534
            report_id: this.props.data.report_id,
Riri Novita's avatar
Riri Novita committed
535
            currency_id: this.props.defaultCurrency.id,
Riri Novita's avatar
Riri Novita committed
536
            status: type,
Riri Novita's avatar
Riri Novita committed
537
            rolling_outlook: data
Riri Novita's avatar
Riri Novita committed
538 539 540
        }
        // // console.log(data);
        // // console.log(JSON.stringify(body))
Riri Novita's avatar
Riri Novita committed
541 542
        api.create('UPLOAD').uploadRollingOutlookOI(body).then(response => {
            console.log(response);
Riri Novita's avatar
Riri Novita committed
543 544 545 546 547 548
            this.setState({ loading: false })
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
Riri Novita's avatar
Riri Novita committed
549 550 551 552 553 554 555 556 557 558 559 560 561
                    if (response.data.message == "Please Set Up Rate Currency First") {
                        this.setState({ visibleAlertSave: true, loading: false })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
                    // alert(response.data.status)
Riri Novita's avatar
Riri Novita committed
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585
                }
            } else {
                alert(response.problem)
            }
        })
    }

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

    render() {
        let dataTable2 = this.state.dataTable
        const handleChange = (value, tableMeta) => {
            let val = String(value).split(",").join("")
            let total = 0
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
        }

        const handleValue = (value, tableMeta) => {
            let val = String(value).split(",").join("")
            let total = 0
            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
            dataTable2[tableMeta.rowIndex].map((item, index) => {
Riri Novita's avatar
Riri Novita committed
586
                if (index >= 7 && index <= 19) {
Riri Novita's avatar
Riri Novita committed
587 588 589 590
                    let valItem = item == undefined || item == "" ? 0 : item
                    total += Number(valItem)
                }
            })
Riri Novita's avatar
Riri Novita committed
591
            dataTable2[tableMeta.rowIndex][19] = total
Riri Novita's avatar
Riri Novita committed
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622
            return total
        }

        const handleParent = (tableMeta) => {
            // // console.log(tableMeta)
            let total = 0

            dataTable2.map((item, index) => {
                if (item[2] == tableMeta.rowData[1]) {
                    // // console.log(total)
                    // // console.log(item[tableMeta.columnIndex])
                    total += Number(item[tableMeta.columnIndex])
                }
            })

            dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            return total
        }

        const handleFormula = (tableMeta) => {
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayFormulaConvert = []
            // // // console.log(arrayFormula)
            let opet = ""
            let tambahan = false
            arrayFormula.map((item, indexs) => {
                if (item == 'X') {
                    tambahan = true
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
                    arrayFormulaConvert.push(item)
                } else {
Riri Novita's avatar
Riri Novita committed
623
                    let indexID = dataTable2.findIndex((val) => val[20] == item)
Riri Novita's avatar
Riri Novita committed
624 625 626 627
                    if (tambahan) {
                        if (item == '-' || item == '+' || item == '/' || item == '*') {
                            opet = item
                        } else {
Riri Novita's avatar
Riri Novita committed
628
                            arrayFormulaConvert.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
Riri Novita's avatar
Riri Novita committed
629 630 631
                            tambahan = false
                            opet = ""
                        }
Riri Novita's avatar
Riri Novita committed
632
                    } else {
Riri Novita's avatar
Riri Novita committed
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701
                        if (indexID !== -1) {
                            let valuezz = dataTable2[indexID][tableMeta.columnIndex]
                            // // // console.log(dataTable2[indexID])
                            arrayFormulaConvert.push(valuezz == "" ? 0 : valuezz)
                        }
                    }
                }
            })
            // // console.log(arrayFormula)
            // // console.log(arrayFormulaConvert)
            let array = arrayFormulaConvert
            let total = 0
            let opt = ""
            array.map((item, index) => {
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
                    if (opt == "tambah") {
                        total = Number(total) + Number(item)
                    } else if (opt == "kurang") {
                        total = Number(total) - Number(item)
                    } else if (opt == "kali") {
                        total = Number(total) * Number(item)
                    } else if (opt == "bagi") {
                        total = Number(total) / Number(item)
                    } else {
                        total += Number(item)
                    }
                }
            })
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(total)
            return a

        }
        const columns = [{
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "",
            options: {
                display: false
            }
        }, {
            name: "Account",
            options: {
                customHeadRender: (columnMeta) => (
Riri Novita's avatar
Riri Novita committed
702
                    <TableCell key={columnMeta.index} style={{ ...style, top: 0, zIndex: 102, backgroundColor: '#1c71b8', width: 300, borderRight: '1px #fff solid' }}>
Riri Novita's avatar
Riri Novita committed
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781
                        <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[1] !== null ?
                                    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> :
                                    tableMeta.rowData[4] == 0 ?
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
                                            <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>
                                :
                                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>

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

        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
                <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>
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
                    {this.state.visibleOI === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Operating Indicator</Typography>
                            </div>
                            <div style={{ padding: 20 }}>
                                {!this.state.emptyData && <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
Riri Novita's avatar
Riri Novita committed
2092
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode} {String(this.props.quartal).toLocaleUpperCase()}</Typography>
Riri Novita's avatar
Riri Novita committed
2093 2094 2095 2096 2097
                                        {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
2098 2099 2100
                                    </div>
                                    <div style={{ width: '50%' }}>
                                        <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
Riri Novita's avatar
Riri Novita committed
2101
                                            {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Download Template'} data-for="template">
Riri Novita's avatar
Riri Novita committed
2102 2103 2104 2105 2106 2107 2108
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
d.arizona's avatar
d.arizona committed
2109
                                                    onClick={() => this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2110 2111
                                                        this.downloadTemplate()
                                                    })}
Riri Novita's avatar
Riri Novita committed
2112 2113 2114 2115 2116
                                                >
                                                    <img src={Images.template} />
                                                </button>
                                            </a>}
                                            <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
Riri Novita's avatar
Riri Novita committed
2117
                                            {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Upload'} data-for="upload">
Riri Novita's avatar
Riri Novita committed
2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.setState({ visibleUpload: true, editable: true })}
                                                >
                                                    <img src={Images.upload} />
                                                </button>
                                            </a>}
                                            <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
qorri_di's avatar
qorri_di committed
2131
                                            {/* <a data-tip={'Download'} data-for="download">
Riri Novita's avatar
Riri Novita committed
2132 2133 2134 2135 2136 2137 2138
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
Riri Novita's avatar
Riri Novita committed
2139 2140
                                                    onClick={() =>
                                                        this.setState({ loading: true }, () => {
d.arizona's avatar
d.arizona committed
2141
                                                            this.downloadAllData()
Riri Novita's avatar
Riri Novita committed
2142
                                                        })}
Riri Novita's avatar
Riri Novita committed
2143 2144 2145 2146
                                                >
                                                    <img src={Images.download} />
                                                </button>
                                            </a>
qorri_di's avatar
qorri_di committed
2147
                                            <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
Riri Novita's avatar
Riri Novita committed
2148 2149 2150 2151 2152 2153
                                        </div>
                                    </div>
                                </div>}

                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                    {this.state.loading && loadingComponent}
d.arizona's avatar
d.arizona committed
2154 2155 2156 2157 2158 2159 2160 2161 2162
                                    {!this.state.loading &&
                                        <MuiThemeProvider theme={getMuiTheme()}>
                                            <MUIDataTable
                                                data={dataTable2}
                                                columns={columns}
                                                options={options}
                                            />
                                        </MuiThemeProvider>
                                    }
Riri Novita's avatar
Riri Novita committed
2163
                                </div>
d.arizona's avatar
d.arizona committed
2164
                                <div style={{ display: 'flex' }}>
d.arizona's avatar
d.arizona committed
2165
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
d.arizona's avatar
d.arizona committed
2166 2167 2168
                                    <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
2169 2170 2171 2172
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
Riri Novita's avatar
Riri Novita committed
2173
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
d.arizona's avatar
d.arizona committed
2174
                                        }
d.arizona's avatar
d.arizona committed
2175 2176
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
2177
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notesUpdate}</Typography>
Riri Novita's avatar
Riri Novita committed
2178 2179
                            </div>
                            <div className="grid grid-2x">
Riri Novita's avatar
Riri Novita committed
2180
                                <div className="col-1" style={{ paddingLeft: 20 }}>
Riri Novita's avatar
Riri Novita committed
2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                        }}
                                        onClick={() => {
                                            this.props.onClickClose()
                                            this.props.getReport()
                                        }
                                        }
                                    >
                                        <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
2200
                                {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 2 }}>
Riri Novita's avatar
Riri Novita committed
2201
                                    {this.state.get_for == 'view' && this.state.viewOnly &&
Riri Novita's avatar
Riri Novita committed
2202 2203 2204
                                        <button
                                            type="button"
                                            onClick={() => {
d.arizona's avatar
d.arizona committed
2205
                                                this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2206 2207 2208 2209 2210 2211 2212 2213 2214
                                                    this.handleGetFor('edit')
                                                })
                                            }}
                                            style={{ marginRight: 21 }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography>
                                            </div>
                                        </button>}
d.arizona's avatar
d.arizona committed
2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226
                                    {this.state.get_for == 'edit' &&
                                        <button
                                            type="button"
                                            onClick={() =>
                                                this.setState({ loading: true, editable: false }, () => {
                                                    setTimeout(() => {
                                                        this.setState({ loading: false, buttonError: false, saveDraft: false })
                                                    }, 100);
                                                })
                                            }
                                            style={{ marginRight: 20 }}
                                        >
Riri Novita's avatar
Riri Novita committed
2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242
                                            <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"
                                            // disabled={this.state.editable}
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
d.arizona's avatar
d.arizona committed
2243
                                            onClick={() =>
Riri Novita's avatar
Riri Novita committed
2244 2245 2246 2247 2248 2249 2250
                                                this.state.editable === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.createData("draft")
                                                        }, 100);
d.arizona's avatar
d.arizona committed
2251
                                                    })}
Riri Novita's avatar
Riri Novita committed
2252 2253 2254 2255 2256 2257 2258 2259 2260
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
                                            </div>
                                        </button>}
                                    {this.state.get_for == 'edit' &&
                                        <button
                                            type="button"
                                            // disabled={this.state.editable}
d.arizona's avatar
d.arizona committed
2261
                                            onClick={() =>
Riri Novita's avatar
Riri Novita committed
2262 2263 2264 2265 2266 2267 2268
                                                this.state.editable === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
                                                    this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.createData("submitted")
                                                        }, 100);
d.arizona's avatar
d.arizona committed
2269
                                                    })}
Riri Novita's avatar
Riri Novita committed
2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable === true ? 'default' : 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>}
Riri Novita's avatar
Riri Novita committed
2282 2283 2284 2285 2286 2287 2288 2289 2290
                                </div>}
                            </div>
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.data.company.company_name}</Typography>
Riri Novita's avatar
Riri Novita committed
2291
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.data.periode} {String(this.props.quartal).toLocaleUpperCase()}
Riri Novita's avatar
Riri Novita committed
2292
                                        </Typography>
Riri Novita's avatar
Riri Novita committed
2293 2294 2295 2296 2297
                                        {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
2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311
                                    </div>
                                    {this.state.dataLoaded && (
                                        <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                            {this.state.loading && loadingComponent}
                                            <MuiThemeProvider theme={getMuiTheme()}>
                                                <MUIDataTable
                                                    data={dataTable2}
                                                    columns={columns}
                                                    options={options}
                                                />
                                            </MuiThemeProvider>
                                        </div>
                                    )}
                                </div>
Riri Novita's avatar
Riri Novita committed
2312
                                <div className="grid grid-2x" style={{ marginLeft: 10 }}>
Riri Novita's avatar
Riri Novita committed
2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339
                                    <div className="col-1">
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                            }}
                                            onClick={() =>
                                                this.setState({ loading: true, visibleOI: true }, () => {
                                                    setTimeout(() => {
                                                        this.getDataDetail()
                                                    }, 100)
                                                })}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
                                            </div>
                                        </button>
                                    </div>
                                    {!this.state.emptyData && this.state.templateNull && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                        <button
                                            type="button"
                                            onClick={() =>
                                                this.setState({ loading: true, editable: false }, () => {
                                                    setTimeout(() => {
Riri Novita's avatar
Riri Novita committed
2340
                                                        this.setState({ loading: false, buttonError: false, saveDraft: false })
Riri Novita's avatar
Riri Novita committed
2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354
                                                    }, 100);
                                                })
                                            }
                                            style={{ marginRight: 20 }}
                                        >
                                            <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>
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
2355
                                                cursor: 'pointer',
Riri Novita's avatar
Riri Novita committed
2356 2357 2358 2359
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Riri Novita's avatar
Riri Novita committed
2360
                                            // disabled={this.state.editable}
Riri Novita's avatar
Riri Novita committed
2361
                                            onClick={() =>
Riri Novita's avatar
Riri Novita committed
2362
                                                this.state.saveDraft === true ?
d.arizona's avatar
d.arizona committed
2363 2364
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
Riri Novita's avatar
Riri Novita committed
2365
                                                    this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378
                                                        setTimeout(() => {
                                                            this.uploadOI("draft")
                                                        }, 100);
                                                    })}
                                        >
                                            <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"
                                            onClick={() =>
                                                this.state.editable === true ?
d.arizona's avatar
d.arizona committed
2379
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
Riri Novita's avatar
Riri Novita committed
2380
                                                    :
Riri Novita's avatar
Riri Novita committed
2381 2382 2383 2384 2385
                                                    this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.uploadOI("submitted")
                                                        }, 100);
                                                    })}
Riri Novita's avatar
Riri Novita committed
2386
                                            // disabled={this.state.editable}
Riri Novita's avatar
Riri Novita committed
2387 2388
                                            style={{
                                                backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
2389
                                                cursor: 'pointer',
Riri Novita's avatar
Riri Novita committed
2390 2391 2392 2393 2394 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
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                            </div>
                                        </button>
                                    </div>}
                                </div>
                            </div>
                        </Paper>}
                </div>

                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
                                    </div>
                                </div>
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
                            </div>
Riri Novita's avatar
Riri Novita committed
2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440
                            <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(String(this.props.quartal).toLocaleUpperCase()) && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
                                            this.checkUpload() :
                                            this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                    }}
                                />
                            </div>
2441
                            <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>
Riri Novita's avatar
Riri Novita committed
2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469
                        </div>
                    </div>
                )}

                {this.state.visibleAlertSave && (
                    <div className="test app-popup-show">
                        <div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
                            <div style={{ margin: 30 }}>
                                <div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
                                    <div style={{ alignSelf: 'center', marginRight: 25 }}>
                                        <img src={Images.warning} />
                                    </div>
                                    <div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
                                        <b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
                                    </div>
                                </div>
                                <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            background: '#F6F7F9',
                                            cursor: 'pointer',
                                            border: '1px solid #3549609e',
                                            outline: 'none',
                                            marginRight: 20,
                                            borderRadius: 9
                                        }}
Riri Novita's avatar
Riri Novita committed
2470
                                        onClick={() => this.setState({ visibleAlertSave: false, loading: false })}
Riri Novita's avatar
Riri Novita committed
2471 2472 2473 2474 2475 2476 2477
                                    >
                                        <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>
Riri Novita's avatar
Riri Novita committed
2478 2479 2480 2481 2482 2483 2484
                        </div>
                    </div>
                )}
            </div>
        );
    }
}