BalanceSheetOLPA.js 158 KB
Newer Older
Deni Rinaldi's avatar
Deni Rinaldi committed
1 2 3 4 5 6 7 8 9 10 11
import { createMuiTheme, MuiThemeProvider, Paper, TableCell, Tooltip, Typography, FormControlLabel, withStyles, Snackbar } from '@material-ui/core'
import { Alert } from '@material-ui/lab';
import MUIDataTable from 'mui-datatables'
import React, { Component } from 'react'
import NumberFormat from 'react-number-format';
import { PropagateLoader } from 'react-spinners';
import ReactTooltip from 'react-tooltip';
import api from '../../api';
import Images from '../../assets/Images';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
faisalhamdi's avatar
faisalhamdi committed
12 13
import * as R from 'ramda';
import Constant from '../../library/Constant';
Riri Novita's avatar
Riri Novita committed
14
import { fixNumber, titleCase } from '../../library/Utils';
Deni Rinaldi's avatar
Deni Rinaldi committed
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 44 45 46 47 48 49 50 51

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

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

export default class BalanceSheetOLPA extends Component {
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            visibleBalanceSheet: true,
            disabledSave: true,
            editable: false,
            buttonError: false,
            judulColumn: null,
Riri Novita's avatar
Riri Novita committed
52
            updateBy: [],
53
            handleDoubleClick: 0,
faisalhamdi's avatar
faisalhamdi committed
54
            viewOnly: true,
faisalhamdi's avatar
faisalhamdi committed
55 56 57
            get_for: 'view',
            minValue: "0",
            maxValue: "0",
58 59 60
            kansas: 0,
            defaultCurrencyUpload: this.props.defaultCurrency,
            visibleAlertSave: false
Deni Rinaldi's avatar
Deni Rinaldi committed
61
        }
faisalhamdi's avatar
faisalhamdi committed
62 63
        this.handleValue = this.handleValue.bind(this)
        this.fileHandler = this.fileHandler.bind(this);
Deni Rinaldi's avatar
Deni Rinaldi committed
64 65 66
    }

    componentDidMount() {
faisalhamdi's avatar
faisalhamdi committed
67 68
        this.getLatestUpdate()
        this.handleViewOnly()
faisalhamdi's avatar
faisalhamdi committed
69
        this.getSettingControl()
Deni Rinaldi's avatar
Deni Rinaldi committed
70 71
    }

faisalhamdi's avatar
faisalhamdi committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
    handleViewOnly() {
        let checkApprover = false
        let checkLastStatus = false
        let checkStatus = false
        let checkPrevRev = false

        if (this.props.isApprover) {
            checkApprover = true
        } else {
            checkApprover = false
        }

        if (this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') {
            checkLastStatus = true
        } else {
            checkLastStatus = false
        }

        if (this.props.prevRevision) {
            checkPrevRev = true
        } else {
            checkPrevRev = false
        }

        if (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') {
            checkStatus = true
        } else {
            checkStatus = false
        }

        this.setState({ viewOnly: !checkApprover && checkLastStatus && checkStatus && checkPrevRev })
    }

    handleGetFor(type) {
        this.setState({ get_for: type }, () => {
            this.getLatestUpdate()
faisalhamdi's avatar
faisalhamdi committed
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
            this.getSettingControl()
        })
    }

    getSettingControl() {
        let body = {
            group: 'THRESHOLD_CONTROL',
            company_id: this.props.company.company_id,
            type: 'BALANCE_SHEET'
        }

        api.create().getAllSettingByType(body).then(response => {
            console.log(response);
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({
                        minValue: response.data.data[0] ? response.data.data[0].min_value : null,
                        maxValue: response.data.data[0] ? response.data.data[0].max_value : null,
                    }, () => {
                        this.getItemHierarki()
                    })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
131
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
132 133 134 135 136 137 138 139 140 141
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
faisalhamdi's avatar
faisalhamdi committed
142 143 144 145
        })
    }

    getLatestUpdate() {
Deni Rinaldi's avatar
Deni Rinaldi committed
146 147 148 149
        let payload = {
            "outlook_pa_id": this.props.outlook_pa_id,
            "report_id": this.props.report_id,
            "revision": this.props.revision,
d.arizona's avatar
d.arizona committed
150
            "get_for": this.state.get_for,
Deni Rinaldi's avatar
Deni Rinaldi committed
151
            "periode": this.props.periode,
Riri Novita's avatar
Riri Novita committed
152 153
            "company_id": this.props.company.company_id,
            "currency_id": this.props.defaultCurrency.id
Deni Rinaldi's avatar
Deni Rinaldi committed
154 155
        }
        api.create().getLastestUpdateOLPA(payload).then(response => {
faisalhamdi's avatar
faisalhamdi committed
156
            // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
157 158 159
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
160
                        updateBy: response.data.data.detail === null ? '-' : response.data.data.detail
Deni Rinaldi's avatar
Deni Rinaldi committed
161
                    })
faisalhamdi's avatar
faisalhamdi committed
162 163
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
164
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
165 166 167 168 169 170
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
171
                }
faisalhamdi's avatar
faisalhamdi committed
172 173
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
174 175 176 177
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
178 179 180
    async getItemHierarki() {
        this.setState({ loading: true, judulColumn: null })
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
181
            "outlook_pa_id": this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
182
            "report_id": this.props.report_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
183
            "revision": this.props.revision,
Deni Rinaldi's avatar
Deni Rinaldi committed
184
            "periode": this.props.periode,
faisalhamdi's avatar
faisalhamdi committed
185
            "company_id": this.props.company.company_id,
186 187
            "get_for": this.state.get_for,
            "currency_id": this.props.defaultCurrency.id
Deni Rinaldi's avatar
Deni Rinaldi committed
188
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
189
        let response = await api.create().getDetailReportOLPA(payload)
faisalhamdi's avatar
faisalhamdi committed
190
        console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
191
        console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205
        let dataTable = []
        if (response.data) {
            let res = response.data.data
            const handlePushChild = (item) => {
                let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                if (indexIDzz === -1) {
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
                        item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
Riri Novita's avatar
Riri Novita committed
206 207 208 209 210 211 212 213 214 215 216 217 218
                        Number(item.balance_sheet.january),
                        Number(item.balance_sheet.february),
                        Number(item.balance_sheet.march),
                        Number(item.balance_sheet.april),
                        Number(item.balance_sheet.may),
                        Number(item.balance_sheet.june),
                        Number(item.balance_sheet.july),
                        Number(item.balance_sheet.august),
                        Number(item.balance_sheet.september),
                        Number(item.balance_sheet.october),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.november) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november),
                        this.props.status === 'CLOSED' ? Number(item.balance_sheet.december) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december),
                        Number(item.balance_sheet.total_current_year),
Deni Rinaldi's avatar
Deni Rinaldi committed
219
                        item.order,
Deni Rinaldi's avatar
Deni Rinaldi committed
220
                        item.condition_it_should_be,
Deni Rinaldi's avatar
Deni Rinaldi committed
221 222
                        item.condition_if_wrong,
                        item.balance_sheet.forecast_formula == null ? [] : item.balance_sheet.forecast_formula
Deni Rinaldi's avatar
Deni Rinaldi committed
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
                    ])
                }
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
                    }
                }
            }
            res.map((item, index) => {
                dataTable.push([
                    item.type_report_id,
                    item.id,
                    item.parent,
                    item.formula,
                    item.level,
                    item.description,
                    item.balance_sheet.total_actual_before === null ? "0" : item.balance_sheet.total_actual_before === "" ? "0" : item.balance_sheet.total_actual_before,
Riri Novita's avatar
Riri Novita committed
242 243 244 245 246 247 248 249 250 251 252 253 254
                    Number(item.balance_sheet.january),
                    Number(item.balance_sheet.february),
                    Number(item.balance_sheet.march),
                    Number(item.balance_sheet.april),
                    Number(item.balance_sheet.may),
                    Number(item.balance_sheet.june),
                    Number(item.balance_sheet.july),
                    Number(item.balance_sheet.august),
                    Number(item.balance_sheet.september),
                    Number(item.balance_sheet.october),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.november) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.november), formula: item.balance_sheet.november_formula } : Number(item.balance_sheet.november),
                    this.props.status === 'CLOSED' ? Number(item.balance_sheet.december) : item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.balance_sheet.december), formula: item.balance_sheet.december_formula } : Number(item.balance_sheet.december),
                    Number(item.balance_sheet.total_current_year),
Deni Rinaldi's avatar
Deni Rinaldi committed
255 256
                    item.order,
                    item.condition_it_should_be,
Deni Rinaldi's avatar
Deni Rinaldi committed
257 258
                    item.condition_if_wrong,
                    item.balance_sheet.forecast_formula == null ? [] : item.balance_sheet.forecast_formula
Deni Rinaldi's avatar
Deni Rinaldi committed
259 260 261 262 263 264 265 266 267
                ])
                if (item.children !== null) {
                    if (item.children.length > 0) {
                        item.children.map((items, indexs) => {
                            handlePushChild(items)
                        })
                    }
                }
            })
faisalhamdi's avatar
faisalhamdi committed
268
            console.log(dataTable);
faisalhamdi's avatar
faisalhamdi committed
269
            this.setState({ dataTable, loading: false, buttonError: true, editable: true, saveDraft: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
270
        } else {
faisalhamdi's avatar
faisalhamdi committed
271
            this.setState({ dataTable, loading: false, buttonError: true, editable: true, saveDraft: true })
Deni Rinaldi's avatar
Deni Rinaldi committed
272 273 274
        }
    }

faisalhamdi's avatar
faisalhamdi committed
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
    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) {
            // console.log(indexParent)
            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)
        }
    }

    backToOLPA(type) {
Deni Rinaldi's avatar
Deni Rinaldi committed
303
        let data = []
Riri Novita's avatar
Riri Novita committed
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
        if (this.props.defaultCurrency.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(Number(i[6])),
                    january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
                    february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
                    march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
                    april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
                    may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
                    june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
                    july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
                    august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
                    september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
                    october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
                    november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value)) : String(Number(i[17]))),
                    december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[18].value)) : String(Number(i[18]))),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
                })
Deni Rinaldi's avatar
Deni Rinaldi committed
323
            })
Riri Novita's avatar
Riri Novita committed
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(fixNumber(Number(i[6]), 1)),
                    january: i[0] === 3 && i[7] === "" ? "0.0" : String(fixNumber(Number(i[7]), 1)),
                    february: i[0] === 3 && i[8] === "" ? "0.0" : String(fixNumber(Number(i[8]), 1)),
                    march: i[0] === 3 && i[9] === "" ? "0.0" : String(fixNumber(Number(i[9]), 1)),
                    april: i[0] === 3 && i[10] === "" ? "0.0" : String(fixNumber(Number(i[10]), 1)),
                    may: i[0] === 3 && i[11] === "" ? "0.0" : String(fixNumber(Number(i[11]), 1)),
                    june: i[0] === 3 && i[12] === "" ? "0.0" : String(fixNumber(Number(i[12]), 1)),
                    july: i[0] === 3 && i[13] === "" ? "0.0" : String(fixNumber(Number(i[13]), 1)),
                    august: i[0] === 3 && i[14] === "" ? "0.0" : String(fixNumber(Number(i[14]), 1)),
                    september: i[0] === 3 && i[15] === "" ? "0.0" : String(fixNumber(Number(i[15]), 1)),
                    october: i[0] === 3 && i[16] === "" ? "0.0" : String(fixNumber(Number(i[16]), 1)),
                    november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[17].value), 1)) : String(fixNumber(Number(i[17]), 1))),
                    december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[18].value), 1)) : String(fixNumber(Number(i[18]), 1))),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(fixNumber(Number(i[19]), 1)),
                })
            })
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
345
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
346
            "outlook_pa_id": this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
347 348 349
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
350
            "currency_id": this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
351 352 353
            "status": type,
            "balance_sheet": data
        }
faisalhamdi's avatar
faisalhamdi committed
354
        console.log(data);
Deni Rinaldi's avatar
Deni Rinaldi committed
355
        this.setState({ loading: false })
Faisal Hamdi's avatar
Faisal Hamdi committed
356
        if (type == 'submitted') {
d.arizona's avatar
d.arizona committed
357 358 359 360 361 362 363 364 365 366 367
            this.props.saveToOLPA(payload, 'BS')
            // let bodyRatioOLPA = {
            //     "report": 'ratio',
            //     "outlookPaId": this.props.outlook_pa_id,
            //     "companyId": this.props.company.company_id,
            //     "periode": this.props.periode
            // }
            // api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
            //     console.log(res)
            //     this.setState({ loading: false })
            // })
Faisal Hamdi's avatar
Faisal Hamdi committed
368 369 370 371
            this.props.onClickClose()
        } else {
            this.props.saveToOLPA(payload)
            this.props.onClickClose()
Faisal Hamdi's avatar
Faisal Hamdi committed
372
        }
Faisal Hamdi's avatar
Faisal Hamdi committed
373

Deni Rinaldi's avatar
Deni Rinaldi committed
374 375 376 377
    }

    downloadTemplate = async () => {
        let res = await fetch(
378
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/download_template?report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&currency_id=${this.props.defaultCurrency.id}`
Deni Rinaldi's avatar
Deni Rinaldi committed
379 380
        )
        res = await res.blob()
Deni Rinaldi's avatar
Deni Rinaldi committed
381
        // console.log(res)
Deni Rinaldi's avatar
Deni Rinaldi committed
382 383 384 385
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
Deni Rinaldi's avatar
Deni Rinaldi committed
386
            a.download = 'Template Outlook PA Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
387 388 389 390 391 392 393 394 395 396 397 398 399
            a.click();
        }
    }

    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            // console.log(resp)
            if (err) {
                console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
Deni Rinaldi's avatar
Deni Rinaldi committed
400
                // console.log(resp.rows[2]);
Deni Rinaldi's avatar
Deni Rinaldi committed
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
                let payload = []
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
                            item_report_id: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report: i[1] === undefined ? "" : String(i[1]).trim(),
                            total_actual_before: i[2] === undefined ? "0" : reg.test(String(i[2])) === false ? "0" : String(i[2]).trim(),
                            january: i[3] === undefined ? "0" : reg.test(String(i[3])) === false ? "0" : String(i[3]).trim(),
                            february: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
                            march: i[5] === undefined ? "0" : reg.test(String(i[5])) === false ? "0" : String(i[5]).trim(),
                            april: i[6] === undefined ? "0" : reg.test(String(i[6])) === false ? "0" : String(i[6]).trim(),
                            may: i[7] === undefined ? "0" : reg.test(String(i[7])) === false ? "0" : String(i[7]).trim(),
                            june: i[8] === undefined ? "0" : reg.test(String(i[8])) === false ? "0" : String(i[8]).trim(),
                            july: i[9] === undefined ? "0" : reg.test(String(i[9])) === false ? "0" : String(i[9]).trim(),
                            august: i[10] === undefined ? "0" : reg.test(String(i[10])) === false ? "0" : String(i[10]).trim(),
                            september: i[11] === undefined ? "0" : reg.test(String(i[11])) === false ? "0" : String(i[11]).trim(),
                            october: i[12] === undefined ? "0" : reg.test(String(i[12])) === false ? "0" : String(i[12]).trim(),
                            november: i[13] === undefined ? "0" : reg.test(String(i[13])) === false ? "0" : String(i[13]).trim(),
                            december: i[14] === undefined ? "0" : reg.test(String(i[14])) === false ? "0" : String(i[14]).trim(),
                            total_current_year: i[15] === undefined ? "0" : reg.test(String(i[15])) === false ? "0" : String(i[15]).trim(),
                        })
                    }
                })
                let body = {
                    company_id: this.props.company.company_id,
                    periode: this.props.periode,
                    report_id: this.props.report_id,
                    balance_sheet: payload
                }
faisalhamdi's avatar
faisalhamdi committed
431
                console.log(body)
Deni Rinaldi's avatar
Deni Rinaldi committed
432 433 434 435 436 437
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[2] })
            }
        });
    }

    checkUpload() {
438 439 440 441 442
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
        api.create().checkUploadOLPA(payload).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
443
            // console.log(JSON.stringify(this.state.payload));
Deni Rinaldi's avatar
Deni Rinaldi committed
444
            console.log(response)
Deni Rinaldi's avatar
Deni Rinaldi committed
445 446 447 448 449 450 451 452 453 454 455 456
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleBalanceSheet: false, loading: true })
                    let dataTable = response.data.data.map((item, index) => {
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.total_actual_before,
Riri Novita's avatar
Riri Novita committed
457 458 459 460 461 462 463 464 465 466 467 468 469
                            Number(item.january),
                            Number(item.february),
                            Number(item.march),
                            Number(item.april),
                            Number(item.may),
                            Number(item.june),
                            Number(item.july),
                            Number(item.august),
                            Number(item.september),
                            Number(item.october),
                            item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.november), formula: item.november_formula } : Number(item.november),
                            item.type_report_id == 5 || item.type_report_id == 6 || item.type_report_id == 7 ? { value: Number(item.december), formula: item.december_formula } : Number(item.december),
                            Number(item.total_current_year),
Deni Rinaldi's avatar
Deni Rinaldi committed
470 471 472
                            item.orders,
                            item.condition_it_should_be,
                            item.condition_if_wrong,
Deni Rinaldi's avatar
Deni Rinaldi committed
473
                            item.forecast_formula == null ? [] : item.forecast_formula,
Deni Rinaldi's avatar
Deni Rinaldi committed
474 475 476
                            item.error
                        ]
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
477
                    console.log(this.state.dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
478 479
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, editable: true }, () => {
                        this.state.dataTable.map(item => {
Deni Rinaldi's avatar
Deni Rinaldi committed
480
                            if (item[24].length > 0) {
faisalhamdi's avatar
faisalhamdi committed
481
                                console.log('masuk')
Deni Rinaldi's avatar
Deni Rinaldi committed
482 483 484
                                this.setState({ buttonError: true, errorPreview: true, editable: true })
                            }
                        })
faisalhamdi's avatar
faisalhamdi committed
485
                        console.log(this.state.dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
486
                    })
Riri Novita's avatar
Riri Novita committed
487 488
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
489
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
490 491 492 493 494 495
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
496 497 498 499 500 501 502
                }
            }
        })
    }

    uploadBalanceSheet(type) {
        let data = []
Riri Novita's avatar
Riri Novita committed
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521
        if (this.props.defaultCurrency.id == 2) {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(Number(i[6])),
                    january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
                    february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
                    march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
                    april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
                    may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
                    june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
                    july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
                    august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
                    september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
                    october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
                    november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[17].value)) : String(Number(i[17]))),
                    december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(Number(i[18].value)) : String(Number(i[18]))),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
                })
Deni Rinaldi's avatar
Deni Rinaldi committed
522
            })
Riri Novita's avatar
Riri Novita committed
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544
        } else {
            this.state.dataTable.map(i => {
                data.push({
                    item_report_id: i[1],
                    total_actual_before: String(fixNumber(Number(i[6]), 1)),
                    january: i[0] === 3 && i[7] === "" ? "0.0" : String(fixNumber(Number(i[7]), 1)),
                    february: i[0] === 3 && i[8] === "" ? "0.0" : String(fixNumber(Number(i[8]), 1)),
                    march: i[0] === 3 && i[9] === "" ? "0.0" : String(fixNumber(Number(i[9]), 1)),
                    april: i[0] === 3 && i[10] === "" ? "0.0" : String(fixNumber(Number(i[10]), 1)),
                    may: i[0] === 3 && i[11] === "" ? "0.0" : String(fixNumber(Number(i[11]), 1)),
                    june: i[0] === 3 && i[12] === "" ? "0.0" : String(fixNumber(Number(i[12]), 1)),
                    july: i[0] === 3 && i[13] === "" ? "0.0" : String(fixNumber(Number(i[13]), 1)),
                    august: i[0] === 3 && i[14] === "" ? "0.0" : String(fixNumber(Number(i[14]), 1)),
                    september: i[0] === 3 && i[15] === "" ? "0.0" : String(fixNumber(Number(i[15]), 1)),
                    october: i[0] === 3 && i[16] === "" ? "0.0" : String(fixNumber(Number(i[16]), 1)),
                    november: i[0] === 3 && i[17] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[17].value), 1)) : String(fixNumber(Number(i[17]), 1))),
                    december: i[0] === 3 && i[18] === "" ? "0.0" : (i[0] === 5 || i[0] === 6 || i[0] === 7 ? String(fixNumber(Number(i[18].value), 1)) : String(fixNumber(Number(i[18]), 1))),
                    total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(fixNumber(Number(i[19]), 1)),
                })
            })
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
545
        let body = {
Deni Rinaldi's avatar
Deni Rinaldi committed
546
            outlook_pa_id: this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
547 548 549
            company_id: this.props.company.company_id,
            periode: this.props.periode,
            report_id: this.props.report_id,
Riri Novita's avatar
Riri Novita committed
550
            currency_id: this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
551 552 553
            balance_sheet: data,
            status: type
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
554
        // console.log(JSON.stringify(body));
Deni Rinaldi's avatar
Deni Rinaldi committed
555
        api.create('UPLOAD').uploadOLPA(body).then(response => {
faisalhamdi's avatar
faisalhamdi committed
556
            console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
557 558
            if (response.data) {
                if (response.data.status === "success") {
Faisal Hamdi's avatar
Faisal Hamdi committed
559 560 561 562 563 564 565
                    if (type == 'submitted') {
                        this.props.onClickClose()
                        this.props.getReport()
                        let bodyRatioOLPA = {
                            "report": 'ratio',
                            "outlookPaId": this.props.outlook_pa_id,
                            "companyId": this.props.company.company_id,
Riri Novita's avatar
Riri Novita committed
566 567 568
                            "periode": this.props.periode,
                            "currency_id": this.props.defaultCurrency.id,

Faisal Hamdi's avatar
Faisal Hamdi committed
569 570 571 572 573 574 575 576
                        }
                        api.create().triggerRatioOLPA(bodyRatioOLPA).then((res) => {
                            console.log(res)
                            this.setState({ loading: false })
                        })
                    } else {
                        this.props.onClickClose()
                        this.props.getReport()
Faisal Hamdi's avatar
Faisal Hamdi committed
577
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
578
                } else {
579 580 581 582 583 584 585 586 587 588 589 590
                    if (response.data?.message == "Please Set Up Rate Currency First") {
                        this.setState({ visibleAlertSave: true })
                    } else {
                        this.setState({ visibleAlertSave: true, 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);
                            }
                        })
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
591 592 593 594 595 596 597 598 599
                }
            } else {
                this.setState({ loading: false })
                alert(response.problem)
            }
        })
    }

    async downloadAllData() {
faisalhamdi's avatar
faisalhamdi committed
600
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
Deni Rinaldi's avatar
Deni Rinaldi committed
601
        // console.log(url);
Deni Rinaldi's avatar
Deni Rinaldi committed
602
        let res = await fetch(
faisalhamdi's avatar
faisalhamdi committed
603
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/outlook_pa/export_outlook_pa?outlook_pa_id=${this.props.outlook_pa_id === null ? "" : this.props.outlook_pa_id}&&report_id=${this.props.report_id}&&company_id=${this.props.company.company_id}&&year=${this.props.periode}&&revision=${this.props.revision}`
Deni Rinaldi's avatar
Deni Rinaldi committed
604 605 606 607 608 609 610
        )
        res = await res.blob()
        this.setState({ loading: false })
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
Deni Rinaldi's avatar
Deni Rinaldi committed
611
            a.download = 'Outlook PA Balance Sheet.xlsx';
Deni Rinaldi's avatar
Deni Rinaldi committed
612 613 614 615 616 617
            a.click();
        }
    }

    handleValidate() {
        let data = []
faisalhamdi's avatar
faisalhamdi committed
618 619 620
        let err = false
        let dataTable = this.state.dataTable
        let kansas = this.state.kansas
Deni Rinaldi's avatar
Deni Rinaldi committed
621
        // console.log(this.state.dataTable)
faisalhamdi's avatar
faisalhamdi committed
622 623
        dataTable.map((i, index) => {
            if (String(i[5]) == "Control (should be nil)") {
Riri Novita's avatar
Riri Novita committed
624 625 626 627 628
                // console.log(this.state.minValue)
                // console.log(this.state.maxValue)
                // console.log(Number(i[17].value).toFixed(1))
                // console.log(Number(i[18].value).toFixed(1))
                // console.log(Number(i[19]).toFixed(1))
syadziy's avatar
syadziy committed
629

Riri Novita's avatar
Riri Novita committed
630
                if ((this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[17].value), 1) : Number(i[17].value) < Number(this.state.minValue)) || (this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[17].value), 1) : Number(i[17].value) > Number(this.state.maxValue))) {
631
                    console.log("masuk selisih control 1")
faisalhamdi's avatar
faisalhamdi committed
632
                    err = true
Riri Novita's avatar
Riri Novita committed
633
                } else if ((this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[18].value), 1) : Number(i[18].value) < Number(this.state.minValue)) || (this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[18].value), 1) : Number(i[18].value) > Number(this.state.maxValue))) {
634
                    console.log("masuk selisih control 2")
faisalhamdi's avatar
faisalhamdi committed
635
                    err = true
Riri Novita's avatar
Riri Novita committed
636
                } else if ((this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[19]), 1) : Number(i[19]) < Number(this.state.minValue)) || (this.props.defaultCurrency.id == 1 ? fixNumber(Number(i[19]), 1) : Number(i[19]) > Number(this.state.maxValue))) {
637
                    console.log("masuk selisih control 3")
faisalhamdi's avatar
faisalhamdi committed
638 639 640 641
                    err = true
                }
            }

Deni Rinaldi's avatar
Deni Rinaldi committed
642 643 644
            data.push({
                item_report_id: i[1],
                total_actual_before: String(i[6]),
Riri Novita's avatar
Riri Novita committed
645 646 647 648 649 650 651 652 653 654 655 656 657
                january: i[0] === 3 && i[7] === "" ? "0.0" : String(Number(i[7])),
                february: i[0] === 3 && i[8] === "" ? "0.0" : String(Number(i[8])),
                march: i[0] === 3 && i[9] === "" ? "0.0" : String(Number(i[9])),
                april: i[0] === 3 && i[10] === "" ? "0.0" : String(Number(i[10])),
                may: i[0] === 3 && i[11] === "" ? "0.0" : String(Number(i[11])),
                june: i[0] === 3 && i[12] === "" ? "0.0" : String(Number(i[12])),
                july: i[0] === 3 && i[13] === "" ? "0.0" : String(Number(i[13])),
                august: i[0] === 3 && i[14] === "" ? "0.0" : String(Number(i[14])),
                september: i[0] === 3 && i[15] === "" ? "0.0" : String(Number(i[15])),
                october: i[0] === 3 && i[16] === "" ? "0.0" : String(Number(i[16])),
                november: i[0] === 3 && i[17] === "" ? "0.0" : String(Number(i[17])),
                december: i[0] === 3 && i[18] === "" ? "0.0" : String(Number(i[18])),
                total_current_year: i[0] === 3 && i[19] === "" ? "0.0" : String(Number(i[19])),
Deni Rinaldi's avatar
Deni Rinaldi committed
658 659
            })
        })
syadziy's avatar
syadziy committed
660
        console.log(JSON.stringify(data))
Deni Rinaldi's avatar
Deni Rinaldi committed
661
        let payload = {
Deni Rinaldi's avatar
Deni Rinaldi committed
662
            "outlook_pa_id": this.props.outlook_pa_id,
Deni Rinaldi's avatar
Deni Rinaldi committed
663 664 665
            "company_id": this.props.company.company_id,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
666
            "currency_id": this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
667 668 669
            "balance_sheet": data,
            "status": "submitted"
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
670
        api.create().validateSubmitReportOLPA(payload).then((response) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
671
            // console.log(response)
faisalhamdi's avatar
faisalhamdi committed
672 673 674 675 676 677 678
            // console.log(response.data.data.result)
            // console.log(err);
            if (response.data) {
                if (response.data.status === "success") {
                    if (response.data.data.result && err === false) {
                        this.setState({ loading: false, buttonError: false, editable: false, saveDraft: false })
                        if (kansas == 0) {
faisalhamdi's avatar
faisalhamdi committed
679
                            this.setState({ kansas: 1, loading: true }, () => {
faisalhamdi's avatar
faisalhamdi committed
680 681 682
                                this.handleValidate()
                            })
                        } else {
faisalhamdi's avatar
faisalhamdi committed
683
                            this.setState({ kansas: 0 })
faisalhamdi's avatar
faisalhamdi committed
684 685 686 687
                        }
                    } else {
                        this.setState({ loading: false, buttonError: true, editable: true, saveDraft: true })
                        if (kansas == 0) {
faisalhamdi's avatar
faisalhamdi committed
688
                            this.setState({ kansas: 1, loading: true }, () => {
faisalhamdi's avatar
faisalhamdi committed
689 690 691
                                this.handleValidate()
                            })
                        } else {
faisalhamdi's avatar
faisalhamdi committed
692
                            this.setState({ kansas: 0 })
faisalhamdi's avatar
faisalhamdi committed
693 694 695 696
                        }
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
697
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
698 699 700 701 702 703 704
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
705
            } else {
faisalhamdi's avatar
faisalhamdi committed
706
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
707 708 709 710 711 712 713 714 715 716 717
            }
        })
    }

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

    render() {
        let dataTable2 = this.state.dataTable
        const handleChange = (value, tableMeta, type) => {
faisalhamdi's avatar
faisalhamdi committed
718
            console.log(dataTable2);
Deni Rinaldi's avatar
Deni Rinaldi committed
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733
            let val = String(value).split(",").join("")
            if (type === "actual") {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
            } else {
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
                    // console.log(indexParent)
                    let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                    let jagain = dataTable2[indexParent][tableMeta.columnIndex]
                    a = dataTable2[indexParent][tableMeta.columnIndex] = jagain === undefined ? (0 + Number(val)) : (jagain + Number(val))
                } else {
                    dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = Number(val)
                }
            }
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
734

Deni Rinaldi's avatar
Deni Rinaldi committed
735 736 737 738
        const handleValue = (data) => {
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] === item[2]) {
Deni Rinaldi's avatar
Deni Rinaldi committed
739 740
                    let itemVal = item[data.columnIndex].value !== undefined ? Number(item[data.columnIndex].value) : Number(item[data.columnIndex])
                    total = item[data.columnIndex] === undefined ? Number(total) + 0 : Number(total) + itemVal
Deni Rinaldi's avatar
Deni Rinaldi committed
741 742 743 744 745 746 747
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
            let a = dataTable2[data.rowIndex][data.columnIndex] = Number(total)
            // console.log(indexParent);
            return a
        }
idlanirined's avatar
idlanirined committed
748

syadziy's avatar
syadziy committed
749 750 751 752
        const handleTotal = (tableMeta) => {
            let total = 0
            tableMeta.rowData.map((item, index) => {
                if (String(tableMeta.rowData[5]).toLocaleLowerCase() == "profit (loss) mtd") {
syadziy's avatar
syadziy committed
753
                    // console.log(index)
syadziy's avatar
syadziy committed
754
                    if (index >= 7 && index <= 18) {
syadziy's avatar
syadziy committed
755
                        // console.log(item.value + "aaa")
syadziy's avatar
syadziy committed
756 757 758 759 760 761 762 763 764 765 766 767 768 769
                        if (item.value == undefined) {
                            total += Number(item)
                        } else {
                            total += Number(item.value)
                        }
                    }
                }
            })
            if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
                // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            } else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
            }
syadziy's avatar
syadziy committed
770
            // console.log(total)
syadziy's avatar
syadziy committed
771 772
            return total
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
773 774

        const handleValueFormula = (value, tableMeta, column, periode, forecast) => {
syadziy's avatar
syadziy committed
775 776
            // console.log(value)
            // console.log(tableMeta.rowData[5])
Deni Rinaldi's avatar
Deni Rinaldi committed
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791
            let splitFormula = String(tableMeta.rowData[3]).split('@')
            let baru = []
            let anjay = []
            splitFormula.map((item, index) => {
                let items = String(item).substr(Number(String(item).length) - 1, 1)
                let re = /^[a-zA-Z0-9]+$/;
                let asd = ''
                if (item !== "") {
                    if (!re.test(items)) {
                        if (String(item).substr(Number(String(item).length) - 1, 1) === ']') {
                            baru.push(String(item))
                        } else {
                            baru.push(String(item).substr(0, Number(String(item).length) - 1))
                            baru.push(String(item).substr(Number(String(item).length) - 1, 1))
                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
792
                    } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
793
                        baru.push(String(item))
Deni Rinaldi's avatar
Deni Rinaldi committed
794 795 796 797
                    }
                }
            })

Deni Rinaldi's avatar
Deni Rinaldi committed
798 799 800
            baru.map((item, index) => {
                if (item == '-' || item == '+' || item == '/' || item == '*') {
                    anjay.push(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
801
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823
                    if (String(item).includes('#')) {
                        if (forecast !== undefined) {
                            let forecastt = 0
                            forecast.map((items, index) => {
                                if (items.periode == periode) {
                                    forecastt += Number(items.value)
                                }
                            })
                            anjay.push(forecastt)
                        } else if (String(item).includes('[M-1]')) {
                            let tst = String(item).replace('[M-1]', '')
                            let data = tableMeta.columnIndex == 7 ? 18 : tableMeta.columnIndex - 1
                            let period = data == 18 ? Number(this.props.periode) - 1 : this.props.periode
                            // console.log(tableMeta.columnIndex)
                            let indexID = tableMeta.rowData[data].formula.findIndex((val) => val.item_formula == String(`@${tst}`) && val.periode == period)
                            // console.log(indexID)
                            if (indexID !== -1) {
                                let valuezz = tableMeta.rowData[data].formula[indexID].value
                                // baru.push(valuezz)
                                anjay.push(valuezz == "" ? 0 : valuezz)
                                // console.log(valuezz)
                            }
d.arizona's avatar
d.arizona committed
824 825 826 827 828 829 830 831 832 833
                        } else {
                            // console.log(baru);
                            // console.log(value);
                            let indexID = value.formula.findIndex((val) => val.item_formula == String(`@${item}`) && val.periode == Number(this.props.periode))
                            // console.log(indexID)
                            if (indexID !== -1) {
                                // console.log(value.formula[indexID].value)
                                let valuezz = value.formula[indexID].value
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849
                        }
                    } else if (String(item).includes('[M-1]')) {
                        let tst = String(item).replace('[M-1]', '')
                        if (tableMeta.columnIndex === 7 || tableMeta.columnIndex === 19) {
                            let indexID = dataTable2.findIndex((val) => val[20] == tst)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[indexID][6]
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
                        } else {
                            let data = tableMeta.columnIndex - 1
                            let indexID = dataTable2.findIndex((val) => val[20] == tst)
                            if (indexID !== -1) {
                                let valuezz = dataTable2[indexID][data].value !== undefined ? dataTable2[indexID][data].value : dataTable2[indexID][data]
                                anjay.push(valuezz == "" ? 0 : valuezz)
                            }
syadziy's avatar
syadziy committed
850 851
                            // if (tableMeta.rowData[5] == 'R/E (Cummulative)') {
                            // console.log(tst, data, tableMeta.rowData[data]);}
Deni Rinaldi's avatar
Deni Rinaldi committed
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866
                        }
                    } else {
                        let indexID = dataTable2.findIndex((val) => val[20] == item)
                        // console.log(dataTable2[indexID])
                        if (indexID !== -1) {
                            let valuezz = dataTable2[indexID][tableMeta.columnIndex].value == undefined ? dataTable2[indexID][tableMeta.columnIndex] : dataTable2[indexID][tableMeta.columnIndex].value
                            anjay.push(valuezz == "" ? 0 : valuezz)
                        } else {
                            if (item === '(-1)') {
                                anjay.push(-1)
                            }
                            // console.log(item);

                        }
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
867 868
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
869 870
            // console.log(baru)
            // console.log(anjay)
syadziy's avatar
syadziy committed
871 872 873 874 875
            // if (tableMeta.rowData[5] == 'R/E (Cummulative)') {
            //     console.log(splitFormula)
            //     console.log(baru)
            //     console.log(anjay)
            // }
Deni Rinaldi's avatar
Deni Rinaldi committed
876 877
            let total = 0
            let opt = ""
Deni Rinaldi's avatar
Deni Rinaldi committed
878
            anjay.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
879 880 881 882 883 884 885 886 887
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
888
                    item = item == "" ? 0 : item
Deni Rinaldi's avatar
Deni Rinaldi committed
889 890 891 892 893 894 895
                    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") {
Deni Rinaldi's avatar
Deni Rinaldi committed
896
                        total = Number(total) / Number(item) == NaN ? 0 : Number(total) / Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
897
                    } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
898
                        total += Number(item)
Deni Rinaldi's avatar
Deni Rinaldi committed
899 900 901
                    }
                }
            })
Deni Rinaldi's avatar
Deni Rinaldi committed
902 903 904 905 906 907 908 909 910 911 912 913 914 915
            total = R.equals(total, NaN) ? "0.0" : total

            if (dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value == undefined) {
                // console.log([tableMeta.rowIndex][tableMeta.columnIndex])
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = total
            } else {
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex].value = total
            }

            return total
        }

        const handleValidation = (data, tableMeta) => {
            let a = handleValueFormula(data, tableMeta)
Deni Rinaldi's avatar
Deni Rinaldi committed
916 917 918
            return a
        }

Deni Rinaldi's avatar
Deni Rinaldi committed
919 920
        const handleForecast = (tableMeta, periode, column) => {
            let total = 0
d.arizona's avatar
d.arizona committed
921 922 923 924 925 926
            if (column == 19 && String(tableMeta.rowData[5]).toLocaleLowerCase() == "r/e (cummulative)") {
                total = tableMeta.rowData[7]
                dataTable2[tableMeta.rowIndex][column] = tableMeta.rowData[7]
            } else {
                total = handleValueFormula(dataTable2[tableMeta.rowIndex][column], tableMeta, column, periode, dataTable2[tableMeta.rowIndex][23])
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
927 928 929 930
            // console.log(total)
            return total
        }

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

        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 }}>
faisalhamdi's avatar
faisalhamdi committed
2014
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Outlook Performance Appraisal Submission</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032
                </div>
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
                {/* {this.state.loading && loadingComponent} */}
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
                    {this.state.visibleBalanceSheet === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Outlook Performance Appraisal - Balance Sheet</Typography>
                            </div>
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
Riri Novita's avatar
Riri Novita committed
2033 2034 2035 2036 2037
                                        {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>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
2038 2039
                                    </div>
                                    <div style={{ width: '50%' }}>
Riri Novita's avatar
Riri Novita committed
2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094
                                        {/* {this.props.isApprover == true || this.state.dataTable.length == 0 ? null : */}
                                        {this.props.isApprover == true || this.state.get_for == 'view' ?
                                            null
                                            // <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                            //     <a data-tip={'Download'} data-for="download">
                                            //         <button
                                            //             style={{
                                            //                 backgroundColor: 'transparent',
                                            //                 cursor: 'pointer',
                                            //                 borderColor: 'transparent',
                                            //                 margin: 5
                                            //             }}
                                            //             onClick={() =>
                                            //                 this.setState({ loading: true }, () => {
                                            //                     setTimeout(() => {
                                            //                         this.downloadAllData()
                                            //                     }, 100);
                                            //                 })}
                                            //         >
                                            //             <img src={Images.download} />
                                            //         </button>
                                            //     </a>
                                            //     <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                            // </div> 
                                            :
                                            <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
                                                <a data-tip={'Download Template'} data-for="template">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.downloadTemplate()}
                                                    >
                                                        <img src={Images.template} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="template" place="bottom" type="light" effect="solid" />
                                                <a data-tip={'Upload'} data-for="upload">
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() => this.setState({ visibleUpload: true })}
                                                    >
                                                        <img src={Images.upload} />
                                                    </button>
                                                </a>
                                                <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
                                                {/* <a data-tip={'Download'} data-for="download">
Deni Rinaldi's avatar
Deni Rinaldi committed
2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5
                                                        }}
                                                        onClick={() =>
                                                            this.setState({ loading: true }, () => {
                                                                setTimeout(() => {
                                                                    this.downloadAllData()
                                                                }, 100);
                                                            })}
                                                    >
                                                        <img src={Images.download} />
                                                    </button>
                                                </a>
qorri_di's avatar
qorri_di committed
2112
                                                <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
Riri Novita's avatar
Riri Novita committed
2113 2114
                                            </div>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127
                                    </div>
                                </div>

                                <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>
Riri Novita's avatar
Riri Novita committed
2128 2129 2130 2131 2132
                                <div style={{ display: 'flex' }}>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 20 }}>Last Updated by : </Typography>
                                    <div style={{ marginLeft: 10, overflowY: 'scroll', height: this.state.updateBy.length < 2 ? 25 : 75, marginTop: 10 }}>
                                        {
                                            this.state.updateBy.length > 0 ? this.state.updateBy.reverse().map((item, index) => {
qorri_di's avatar
qorri_di committed
2133 2134 2135 2136
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
faisalhamdi's avatar
faisalhamdi committed
2137
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
2138 2139 2140
                                        }
                                    </div>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2141
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 5 }}>Notes : {this.state.notes}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159
                            </div>
                            <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                <div className="col-1">
                                    <button
                                        type="button"
                                        onClick={() => this.setState({ loading: true }, () => {
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                            }, 100);
                                        })}
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                            outline: 'none'
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
faisalhamdi's avatar
faisalhamdi committed
2160
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2161 2162 2163
                                        </div>
                                    </button>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
2164 2165
                                {this.props.isApprover === true ?
                                    <div className="col-2">
faisalhamdi's avatar
faisalhamdi committed
2166
                                    </div> :
faisalhamdi's avatar
faisalhamdi committed
2167
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 5 }}>
Riri Novita's avatar
Riri Novita committed
2168
                                        {this.state.get_for == 'view' && this.state.viewOnly && <button
faisalhamdi's avatar
faisalhamdi committed
2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
                                                this.setState({ loading: true, refresh: true }, () => {
                                                    this.handleGetFor('edit')
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Edit</Typography>
                                            </div>
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
faisalhamdi's avatar
faisalhamdi committed
2199
                                                this.setState({ loading: true, dataTable: dataTable2 }, () => {
faisalhamdi's avatar
faisalhamdi committed
2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220
                                                    setTimeout(() => {
                                                        this.handleValidate()
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
faisalhamdi's avatar
faisalhamdi committed
2221 2222 2223
                                                this.state.saveDraft ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
2224 2225
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
faisalhamdi's avatar
faisalhamdi committed
2226 2227
                                                            this.backToOLPA('draft')
                                                        })
faisalhamdi's avatar
faisalhamdi committed
2228 2229 2230 2231 2232 2233
                                            }
                                        >
                                            <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>}
qorri_di's avatar
qorri_di committed
2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255
                                        {this.state.get_for == 'edit' &&
                                            <button
                                                type="button"
                                                disabled={this.state.buttonError}
                                                onClick={() => this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                    :
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1 }, () => {
                                                            this.backToOLPA('submitted')
                                                        })}
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                }}
                                            >
                                                <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                                </div>
                                            </button>}
faisalhamdi's avatar
faisalhamdi committed
2256
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
2257 2258 2259 2260 2261 2262 2263 2264 2265 2266
                                }
                            </div>
                        </Paper>
                        :
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div>
                                <div style={{ padding: 25 }}>
                                    <div>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                        <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode}</Typography>
Riri Novita's avatar
Riri Novita committed
2267 2268 2269 2270 2271
                                        {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>
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298
                                    </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>

                                <div className="grid grid-2x" style={{ marginTop: 20 }}>
                                    <div className="col-1">
                                        <button
                                            type="button"
                                            onClick={() => this.setState({ loading: true, visibleBalanceSheet: true }, () => {
                                                setTimeout(() => {
                                                    this.getItemHierarki()
                                                }, 100);
                                            })}
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
faisalhamdi's avatar
faisalhamdi committed
2299
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
2300 2301 2302 2303
                                            </div>
                                        </button>
                                    </div>
                                    <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
2304
                                        {this.state.get_for == 'edit' && <button
Deni Rinaldi's avatar
Deni Rinaldi committed
2305 2306 2307 2308
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
2309
                                                cursor: 'pointer',
Deni Rinaldi's avatar
Deni Rinaldi committed
2310 2311 2312 2313 2314
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() => {
2315
                                                this.setState({ loading: true, dataTable: dataTable2 }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2316
                                                    setTimeout(() => {
2317
                                                        this.handleValidate()
Deni Rinaldi's avatar
Deni Rinaldi committed
2318 2319 2320 2321 2322 2323 2324
                                                    }, 100);
                                                })
                                            }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
2325 2326 2327
                                        </button>}
                                        {this.state.get_for == 'edit' && <button
                                            className="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
2328 2329 2330 2331 2332 2333 2334 2335 2336
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: this.state.editable !== true ? 'pointer' : 'default',
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
                                            onClick={() =>
2337 2338 2339
                                                this.state.saveDraft ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                    :
2340 2341
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1, loading: true }, () => {
2342 2343
                                                            this.uploadBalanceSheet('draft')
                                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
2344 2345 2346 2347 2348
                                            }
                                        >
                                            <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>
2349
                                        </button>}
qorri_di's avatar
qorri_di committed
2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371
                                        {this.state.get_for == 'edit' &&
                                            <button
                                                type="button"
                                                // disabled={this.state.buttonError}
                                                onClick={() => this.state.buttonError ?
                                                    this.setState({ alert: true, messageAlert: 'Data is not complete !', tipeAlert: 'warning' })
                                                    :
                                                    this.state.handleDoubleClick == 1 ? null :
                                                        this.setState({ handleDoubleClick: 1 }, () => {
                                                            this.uploadBalanceSheet('submitted')
                                                        })}
                                                style={{
                                                    backgroundColor: 'transparent',
                                                    cursor: this.state.buttonError === true ? 'default' : 'pointer',
                                                    borderColor: 'transparent',
                                                    outline: 'none',
                                                }}
                                            >
                                                <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                    <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
                                                </div>
                                            </button>}
Deni Rinaldi's avatar
Deni Rinaldi committed
2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396
                                    </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>
2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413
                            <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.judul).includes("OUTLOOK") && String(this.state.judul).includes("PA") && String(this.state.judul).includes("BALANCE") && String(this.state.judul).includes("SHEET") ?
                                            this.checkUpload() :
                                            this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                    }}
                                />
                            </div>
2414
                            <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>
2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442
                        </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
                                        }}
2443
                                        onClick={() => this.setState({ visibleAlertSave: false, loading: false })}
2444 2445 2446 2447 2448 2449 2450
                                    >
                                        <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>
Deni Rinaldi's avatar
Deni Rinaldi committed
2451 2452 2453 2454 2455 2456 2457
                        </div>
                    </div>
                )}
            </div>
        )
    }
}