OperatingIndicatorMR.js 135 KB
Newer Older
Riri Novita's avatar
Riri Novita committed
1
import { createMuiTheme, FormControlLabel, Input, MuiThemeProvider, Paper, Snackbar, TableCell, Tooltip, Typography, withStyles } from '@material-ui/core';
Deni Rinaldi's avatar
Deni Rinaldi committed
2 3
import MUIDataTable from 'mui-datatables';
import React, { Component } from 'react';
Riri Novita's avatar
Riri Novita committed
4 5
import NumberFormat from 'react-number-format';
import { PropagateLoader } from 'react-spinners';
Deni Rinaldi's avatar
Deni Rinaldi committed
6 7
import ReactTooltip from 'react-tooltip';
import api from '../../api';
Riri Novita's avatar
Riri Novita committed
8
import * as R from 'ramda';
Deni Rinaldi's avatar
Deni Rinaldi committed
9
import Images from '../../assets/Images';
Riri Novita's avatar
Riri Novita committed
10
import Constant from '../../library/Constant';
Riri Novita's avatar
Riri Novita committed
11 12 13
import { ExcelRenderer } from 'react-excel-renderer';
import UploadFile from "../../library/Upload";
import { Alert } from '@material-ui/lab';
Deni Rinaldi's avatar
Deni Rinaldi committed
14 15 16 17 18 19 20 21 22 23

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

Riri Novita's avatar
Riri Novita committed
24 25 26 27 28 29 30 31 32
const LightTooltipError = withStyles((theme) => ({
    tooltip: {
        backgroundColor: theme.palette.common.white,
        color: 'rgba(255, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);

Deni Rinaldi's avatar
Deni Rinaldi committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
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,
    top: 0
};

export default class OperatingIndicatorMR extends Component {
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
Deni Rinaldi's avatar
Deni Rinaldi committed
56
            loading: true,
Riri Novita's avatar
Riri Novita committed
57
            visibleOI: true,
Riri Novita's avatar
Riri Novita committed
58
            minValue: 0,
Riri Novita's avatar
Riri Novita committed
59
            maxValue: 0,
Riri Novita's avatar
Riri Novita committed
60
            updateBy: [],
Riri Novita's avatar
Riri Novita committed
61
            notesUpdate: '-',
Riri Novita's avatar
Riri Novita committed
62 63 64
            disabledSave: true,
            editable: true,
            emptyData: false,
d.arizona's avatar
d.arizona committed
65
            templateNull: true,
Riri Novita's avatar
Riri Novita committed
66
            judulColumn: null,
Riri Novita's avatar
Riri Novita committed
67
            saveDraft: true,
Riri Novita's avatar
Riri Novita committed
68 69 70 71 72 73 74
            viewOnly: true,
            get_for: 'view',
            defaultCurrencyUpload: this.props.defaultCurrency,
            visibleAlertSave: false,
            alert: false,
            tipeAlert: '',
            messageAlert: '',
Riri Novita's avatar
Riri Novita committed
75 76
            defaultCurrencyUpload: this.props.defaultCurrency,
            visibleAlertSave: false
Deni Rinaldi's avatar
Deni Rinaldi committed
77
        }
Riri Novita's avatar
Riri Novita committed
78 79 80 81 82 83
        this.fileHandler = this.fileHandler.bind(this);
    }

    componentDidMount() {
        // this.getItemHierarki()
        this.getSettingControl()
Riri Novita's avatar
Riri Novita committed
84
        this.handleViewOnly()
Riri Novita's avatar
Riri Novita committed
85
        // this.getLatestUpdate()
Deni Rinaldi's avatar
Deni Rinaldi committed
86 87
    }

Riri Novita's avatar
Riri Novita committed
88
    handleViewOnly() {
Riri Novita's avatar
Riri Novita committed
89 90
        let checkCreate = this.props.permission.create
        let checkEdit = this.props.permission.edit
Riri Novita's avatar
Riri Novita committed
91
        let checkStatus = true
Riri Novita's avatar
Riri Novita committed
92

Riri Novita's avatar
Riri Novita committed
93 94 95 96
        if (String(this.props.data.status).toLocaleUpperCase() === 'CLOSED') {
            checkStatus = false
        }

Riri Novita's avatar
Riri Novita committed
97
        this.setState({ viewOnly: checkCreate && checkEdit && checkStatus })
Riri Novita's avatar
Riri Novita committed
98 99
    }

d.arizona's avatar
d.arizona committed
100
    handleGetFor(type) {
Riri Novita's avatar
Riri Novita committed
101
        this.setState({ get_for: type }, () => {
d.arizona's avatar
d.arizona committed
102
            this.getSettingControl()
Riri Novita's avatar
Riri Novita committed
103
            // this.getLatestUpdate()
d.arizona's avatar
d.arizona committed
104 105 106
        })
    }

Riri Novita's avatar
Riri Novita committed
107 108
    getLatestUpdate() {
        let payload = {
Riri Novita's avatar
Riri Novita committed
109
            "operating_indicator_id": this.state.operatingIndIDMonthly,
Riri Novita's avatar
Riri Novita committed
110 111 112
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
113
            "months": this.props.months
Riri Novita's avatar
Riri Novita committed
114
        }
Riri Novita's avatar
Riri Novita committed
115
        // console.log(payload);
Riri Novita's avatar
Riri Novita committed
116
        api.create().getLastestUpdateMROI(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
117
            // console.log(response.data)
Riri Novita's avatar
Riri Novita committed
118 119 120
            if (response.data) {
                if (response.data.status === "success") {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
121
                        updateBy: response.data.data.detail === null ? [] : response.data.data.detail,
Riri Novita's avatar
Riri Novita committed
122
                        notesUpdate: response.data.data.notes_update === null ? '-' : response.data.data.notes_update
Riri Novita's avatar
Riri Novita committed
123
                    })
Riri Novita's avatar
Riri Novita committed
124 125
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
126
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
127 128 129 130 131 132
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Riri Novita's avatar
Riri Novita committed
133
                }
Riri Novita's avatar
Riri Novita committed
134 135
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Riri Novita's avatar
Riri Novita committed
136 137 138 139
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
140 141 142 143 144 145 146 147
    getSettingControl() {
        let body = {
            group: 'THRESHOLD_VARIANCE',
            company_id: this.props.company.company_id,
            type: 'BALANCE_SHEET'
        }

        api.create().getAllSettingByType(body).then(response => {
Riri Novita's avatar
Riri Novita committed
148
            console.log(response);
Riri Novita's avatar
Riri Novita committed
149 150 151
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({
Riri Novita's avatar
Riri Novita committed
152 153
                        minValue: response.data.data[0] ? Number(response.data.data[0].min_value) : -5,
                        maxValue: response.data.data[0] ? Number(response.data.data[0].max_value) : 5,
Riri Novita's avatar
Riri Novita committed
154
                    }, () => {
Riri Novita's avatar
Riri Novita committed
155
                        this.getOperatingIDMonthly()
Riri Novita's avatar
Riri Novita committed
156 157 158
                    })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
159
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
160 161 162 163 164 165 166 167 168 169 170
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
171 172
    }

Riri Novita's avatar
Riri Novita committed
173
    getOperatingIDMonthly() {
Riri Novita's avatar
Riri Novita committed
174
        // console.log(this.props.data.operatingIndID);
Riri Novita's avatar
Riri Novita committed
175 176
        let payload = {
            "company_id": this.props.data.company.company_id,
Riri Novita's avatar
Riri Novita committed
177
            "periode": this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
178 179
            "months": this.props.months,
            "currency_id": this.props.defaultCurrency.id,
Riri Novita's avatar
Riri Novita committed
180
        }
Riri Novita's avatar
Riri Novita committed
181
        console.log(payload);
Riri Novita's avatar
Riri Novita committed
182
        api.create().getMonthlyOI(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
183
            console.log(response);
Riri Novita's avatar
Riri Novita committed
184 185
            if (response) {
                if (response.data.data) {
Riri Novita's avatar
Riri Novita committed
186
                    this.setState({ operatingIndIDMonthly: response.data.data.operating_indicator_id }, () => {
Riri Novita's avatar
Riri Novita committed
187
                        this.getItemHierarki()
Riri Novita's avatar
Riri Novita committed
188
                        this.getLatestUpdate()
Riri Novita's avatar
Riri Novita committed
189 190 191 192
                    })
                } else {
                    this.setState({ operatingIndIDMonthly: null }, () => {
                        this.getItemHierarki()
Riri Novita's avatar
Riri Novita committed
193
                        this.getLatestUpdate()
Riri Novita's avatar
Riri Novita committed
194 195
                    })
                }
Riri Novita's avatar
Riri Novita committed
196 197
            } else {
                this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
198
                    if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
199 200 201 202 203 204
                        setTimeout(() => {
                            localStorage.removeItem(Constant.TOKEN)
                            window.location.reload();
                        }, 1000);
                    }
                })
Riri Novita's avatar
Riri Novita committed
205 206 207 208
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
209
    getItemHierarki() {
Riri Novita's avatar
Riri Novita committed
210
        this.setState({ loading: true })
Riri Novita's avatar
Riri Novita committed
211
        let payload = {
Riri Novita's avatar
Riri Novita committed
212
            "operating_indicator_id": this.state.operatingIndIDMonthly,
Riri Novita's avatar
Riri Novita committed
213 214 215
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
216
            "months": this.props.months,
Riri Novita's avatar
Riri Novita committed
217 218
            "get_for": this.state.get_for,
            "currency_id": this.props.defaultCurrency.id,
Deni Rinaldi's avatar
Deni Rinaldi committed
219
        }
Riri Novita's avatar
Riri Novita committed
220
        console.log(payload);
Deni Rinaldi's avatar
Deni Rinaldi committed
221
        api.create().getHierarkiMontlyReportOI(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
222
            console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
223
            let dataTable = []
Riri Novita's avatar
Riri Novita committed
224 225
            let err = false

Deni Rinaldi's avatar
Deni Rinaldi committed
226 227 228 229
            if (response.data) {
                let res = response.data.data
                const handlePushChild = (item) => {
                    let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
Riri Novita's avatar
Riri Novita committed
230 231 232 233
                    if (item.type_report_id === 3) {

                        if (item.monthly_report.mtd_vs_mb === "" && (Number(item.monthly_report.percent_act_vs_mb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_mb) > this.state.maxValue)) {
                            err = true
Riri Novita's avatar
Riri Novita committed
234
                        }
Riri Novita's avatar
Riri Novita committed
235 236 237 238 239
                        if (item.monthly_report.mtd_vs_rb === "" && (Number(item.monthly_report.percent_act_vs_rb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_rb) > this.state.maxValue)) {
                            console.log('msk 2');
                            err = true
                        }
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
240 241 242 243 244 245 246 247
                    if (indexIDzz === -1) {
                        dataTable.push([
                            item.type_report_id,
                            item.id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.description,
Riri Novita's avatar
Riri Novita committed
248
                            item.uom === "" ? null : item.uom,
Riri Novita's avatar
Riri Novita committed
249
                            item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
Riri Novita's avatar
Riri Novita committed
250
                            item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
Riri Novita's avatar
Riri Novita committed
251 252 253 254 255 256
                            item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
                            item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
                            item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
                            item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.percent_act_vs_mb === "" ? "0.0" : item.monthly_report.percent_act_vs_mb,
                            item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.amount_act_vs_rb === "" ? "0.0" : item.monthly_report.amount_act_vs_rb,
                            item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.percent_act_vs_rb === "" ? "0.0" : item.monthly_report.percent_act_vs_rb,
Riri Novita's avatar
Riri Novita committed
257 258
                            item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb,
                            item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb,
Riri Novita's avatar
Riri Novita committed
259
                            item.order,
Deni Rinaldi's avatar
Deni Rinaldi committed
260 261 262 263 264 265 266 267 268 269 270
                        ])
                    }
                    if (item.children !== null) {
                        if (item.children.length > 0) {
                            item.children.map((items, indexs) => {
                                handlePushChild(items)
                            })
                        }
                    }
                }
                res.map((item, index) => {
Riri Novita's avatar
Riri Novita committed
271 272 273 274
                    if (item.type_report_id === 3) {

                        if (item.monthly_report.mtd_vs_mb === "" && (Number(item.monthly_report.percent_act_vs_mb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_mb) > this.state.maxValue)) {
                            err = true
Riri Novita's avatar
Riri Novita committed
275
                        }
Riri Novita's avatar
Riri Novita committed
276 277 278 279 280
                        if (item.monthly_report.mtd_vs_rb === "" && (Number(item.monthly_report.percent_act_vs_rb) < this.state.minValue || Number(item.monthly_report.percent_act_vs_rb) > this.state.maxValue)) {
                            console.log('msk 2');
                            err = true
                        }
                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
281 282 283 284 285 286 287
                    dataTable.push([
                        item.type_report_id,
                        item.id,
                        item.parent,
                        item.formula,
                        item.level,
                        item.description,
Riri Novita's avatar
Riri Novita committed
288
                        item.uom === "" ? null : item.uom,
Riri Novita's avatar
Riri Novita committed
289
                        item.monthly_report.rolling_outlook === null ? "0.0" : item.monthly_report.rolling_outlook === "" ? "0.0" : item.monthly_report.rolling_outlook,
Riri Novita's avatar
Riri Novita committed
290
                        item.monthly_report.master_budget === null ? "0.0" : item.monthly_report.master_budget === "" ? "0.0" : item.monthly_report.master_budget,
Riri Novita's avatar
Riri Novita committed
291 292 293 294 295 296
                        item.monthly_report.rolling_budget === null ? "0.0" : item.monthly_report.rolling_budget === "" ? "0.0" : item.monthly_report.rolling_budget,
                        item.monthly_report.actual === null ? "0.0" : item.monthly_report.actual === "" ? "0.0" : item.monthly_report.actual,
                        item.monthly_report.amount_act_vs_mb === null ? "0.0" : item.monthly_report.amount_act_vs_mb === "" ? "0.0" : item.monthly_report.amount_act_vs_mb,
                        item.monthly_report.percent_act_vs_mb === null ? "0.0" : item.monthly_report.percent_act_vs_mb === "" ? "0.0" : item.monthly_report.percent_act_vs_mb,
                        item.monthly_report.amount_act_vs_rb === null ? "0.0" : item.monthly_report.amount_act_vs_rb === "" ? "0.0" : item.monthly_report.amount_act_vs_rb,
                        item.monthly_report.percent_act_vs_rb === null ? "0.0" : item.monthly_report.percent_act_vs_rb === "" ? "0.0" : item.monthly_report.percent_act_vs_rb,
Riri Novita's avatar
Riri Novita committed
297 298
                        item.monthly_report.mtd_vs_mb === null ? "" : item.monthly_report.mtd_vs_mb,
                        item.monthly_report.mtd_vs_rb === null ? "" : item.monthly_report.mtd_vs_rb,
Riri Novita's avatar
Riri Novita committed
299
                        item.order,
Deni Rinaldi's avatar
Deni Rinaldi committed
300 301 302 303 304 305 306 307 308
                    ])
                    if (item.children !== null) {
                        if (item.children.length > 0) {
                            item.children.map((items, indexs) => {
                                handlePushChild(items)
                            })
                        }
                    }
                })
Riri Novita's avatar
Riri Novita committed
309 310 311 312
                if (err === true) {
                    this.setState({ bebas: true })
                }
                this.setState({ dataTable, loading: false, buttonError: true, saveDraft: true }, () => {
Riri Novita's avatar
Riri Novita committed
313 314 315 316
                    if (this.state.dataTable.length == 0) {
                        this.setState({ emptyData: true })
                    }
                })
Deni Rinaldi's avatar
Deni Rinaldi committed
317
            }
Riri Novita's avatar
Riri Novita committed
318
            console.log(dataTable);
Deni Rinaldi's avatar
Deni Rinaldi committed
319 320
        })
    }
Deni Rinaldi's avatar
Deni Rinaldi committed
321

Riri Novita's avatar
Riri Novita committed
322 323
    downloadTemplate = async () => {
        let res = await fetch(
324
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/download_template?report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&months=${this.props.months}&&currency_id=${this.props.defaultCurrency.id}`
Riri Novita's avatar
Riri Novita committed
325 326
        )
        res = await res.blob()
Riri Novita's avatar
Riri Novita committed
327
        // // console.log(res)
Riri Novita's avatar
Riri Novita committed
328 329 330 331 332 333 334 335 336 337
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Template Monthly Report Operating Indicator.xlsx';
            a.click();
        }
    }

    async downloadAllData() {
Riri Novita's avatar
Riri Novita committed
338
        // console.log(this.props.months);
Riri Novita's avatar
Riri Novita committed
339
        let url = `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${this.props.data.operatingIndID == null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&months=${this.props.months}`
Riri Novita's avatar
Riri Novita committed
340 341
        console.log(url);
        let res = await fetch(
Riri Novita's avatar
Riri Novita committed
342
            `${process.env.REACT_APP_URL_MAIN_BE}/public/transaction/operating_indicator/monthly_report/export_monthly_report?operating_indicator_id=${this.props.data.operatingIndID === null ? "" : this.props.data.operatingIndID}&&report_id=${this.props.data.report_id}&&company_id=${this.props.data.company.company_id}&&year=${this.props.data.periode}&&months=${this.props.months}`
Riri Novita's avatar
Riri Novita committed
343 344 345 346 347 348 349 350 351 352 353 354
        )
        res = await res.blob()
        this.setState({ loading: false })
        if (res.size > 0) {
            let url = window.URL.createObjectURL(res);
            let a = document.createElement('a');
            a.href = url;
            a.download = 'Monthly Report Operating Indicator.xlsx';
            a.click();
        }
    }

Riri Novita's avatar
Riri Novita committed
355
    createData(type) {
Riri Novita's avatar
Riri Novita committed
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
        let data = []
        this.state.dataTable.map(i => {
            data.push({
                "item_report_id": i[1],
                "uom": i[6],
                "rolling_outlook": i[7],
                "master_budget": i[8],
                "rolling_budget": i[9],
                "actual": i[10],
                "amount_act_vs_mb": i[11],
                "percent_act_vs_mb": i[12],
                "amount_act_vs_rb": i[13],
                "percent_act_vs_rb": i[14],
                "mtd_vs_mb": i[15],
                "mtd_vs_rb": i[16]
            })
        })
        let payload = {
Riri Novita's avatar
Riri Novita committed
374
            "operating_indicator_id": this.state.operatingIndIDMonthly,
Riri Novita's avatar
Riri Novita committed
375 376
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
Riri Novita's avatar
Riri Novita committed
377
            "currency_id": this.props.defaultCurrency.id,
Riri Novita's avatar
Riri Novita committed
378
            "periode": this.props.data.periode,
Riri Novita's avatar
Riri Novita committed
379
            "status": type,
Riri Novita's avatar
Riri Novita committed
380
            "months": this.props.months,
Riri Novita's avatar
Riri Novita committed
381
            "monthly_report": data
Riri Novita's avatar
Riri Novita committed
382
        }
Riri Novita's avatar
Riri Novita committed
383 384
        console.log(payload);
        // // console.log('=========================')
Riri Novita's avatar
Riri Novita committed
385
        console.log(JSON.stringify(payload))
Riri Novita's avatar
Riri Novita committed
386
        this.props.saveMonthlyOI(payload)
Riri Novita's avatar
Riri Novita committed
387
        // this.props.onClickClose()
Riri Novita's avatar
Riri Novita committed
388 389
    }

Riri Novita's avatar
Riri Novita committed
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
    fileHandler = (event) => {
        let fileObj = event
        ExcelRenderer(fileObj, (err, resp) => {
            console.log(resp)
            if (err) {
                // // console.log(err);
            }
            else {
                let isi = resp.rows.slice(3)
                // // console.log(isi);
                let payload = []
                let reg = /^[-+]?(?:[0-9]+,)*[0-9]+(?:\.[0-9]+)?$/;
                isi.map((i, index) => {
                    if (i.length > 0) {
                        payload.push({
                            order: i[0] === undefined ? "" : String(i[0]).trim(),
                            item_report_id: i[1] === undefined ? "" : String(i[1]).trim(),
                            item_report: i[2] === undefined ? "" : String(i[2]).trim(),
                            uom: i[3] === undefined ? "" : String(i[3]).trim(),
                            actual: i[4] === undefined ? "0" : reg.test(String(i[4])) === false ? "0" : String(i[4]).trim(),
Riri Novita's avatar
Riri Novita committed
410 411
                            mtd_vs_mb: i[5] === undefined ? "" : String(i[5]).trim(),
                            mtd_vs_rb: i[6] === undefined ? "" : String(i[6]).trim(),
Riri Novita's avatar
Riri Novita committed
412 413 414 415 416 417 418
                        })
                    }
                })
                let body = {
                    company_id: this.props.data.company.company_id,
                    periode: this.props.data.periode,
                    report_id: this.props.data.report_id,
Riri Novita's avatar
Riri Novita committed
419
                    months: this.props.months,
Riri Novita's avatar
Riri Novita committed
420
                    status: 'submitted',
Riri Novita's avatar
Riri Novita committed
421 422 423
                    monthly_report: payload
                }
                console.log(body)
Riri Novita's avatar
Riri Novita committed
424
                console.log(JSON.stringify(body));
Riri Novita's avatar
Riri Novita committed
425
                this.setState({ payload: body, judul: resp.rows[1][0], judulColumn: resp.rows[0][0] })
Riri Novita's avatar
Riri Novita committed
426 427 428 429 430
            }
        });
    }

    checkUpload() {
Riri Novita's avatar
Riri Novita committed
431 432 433 434 435
        let payload = {
            ...this.state.payload,
            currency_id: this.state.defaultCurrencyUpload?.id
        }
        api.create().checkUploadMonthlyReportOI(payload).then(response => {
Riri Novita's avatar
Riri Novita committed
436 437 438 439 440 441
            // console.log(JSON.stringify(this.state.payload));
            console.log(response)
            if (response.data) {
                if (response.data.status === 'success') {
                    this.setState({ visibleUpload: false, visibleOI: false, loading: true })
                    let total = 0
Riri Novita's avatar
Riri Novita committed
442
                    let err = false
Riri Novita's avatar
Riri Novita committed
443 444
                    let dataTable = response.data.data.map((item, index) => {
                        console.log(item);
Riri Novita's avatar
Riri Novita committed
445 446 447
                        if (item.type_report_id != null) {
                            total += 1
                        }
Riri Novita's avatar
Riri Novita committed
448 449 450 451
                        // if (item.type_report_id === 3) {

                        //     if (item.mtd_vs_mb === "" && (Number(item.percent_act_vs_mb) < this.state.minValue || Number(item.percent_act_vs_mb) > this.state.maxValue)) {
                        //         err = true
qorri_di's avatar
qorri_di committed
452
                        //     } 
Riri Novita's avatar
Riri Novita committed
453 454 455 456 457
                        //     if (item.mtd_vs_rb === "" && (Number(item.percent_act_vs_rb) < this.state.minValue || Number(item.percent_act_vs_rb) > this.state.maxValue)) {
                        //         console.log('msk 2');
                        //         err = true
                        //     }
                        // }
Riri Novita's avatar
Riri Novita committed
458 459 460 461 462 463 464 465 466 467 468 469
                        return [
                            item.type_report_id,
                            item.item_report_id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.item_report,
                            item.uom,
                            item.rolling_outlook,
                            item.master_budget,
                            item.rolling_budget,
                            item.actual,
Riri Novita's avatar
Riri Novita committed
470 471 472 473 474 475 476 477
                            // 0,
                            // 0,
                            // 0,
                            // 0,
                            item.amount_act_vs_mb,
                            item.percent_act_vs_mb,
                            item.amount_act_vs_rb,
                            item.percent_act_vs_rb,
Riri Novita's avatar
Riri Novita committed
478 479 480 481 482
                            item.mtd_vs_mb,
                            item.mtd_vs_rb,
                            item.order,
                            item.error
                        ]
Riri Novita's avatar
Riri Novita committed
483
                    })
Riri Novita's avatar
Riri Novita committed
484
                    console.log(dataTable);
Riri Novita's avatar
Riri Novita committed
485
                    this.setState({ dataTable, dataLoaded: true, loading: false, buttonError: false, templateNull: total > 0 ? true : false })
Riri Novita's avatar
Riri Novita committed
486 487
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
488
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
489 490 491 492 493 494
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
Riri Novita's avatar
Riri Novita committed
495 496 497 498 499 500 501
                }
            }
        })
    }

    uploadOI(type) {
        let data = []
Riri Novita's avatar
Riri Novita committed
502
        // console.log(this.state.dataTable)
Riri Novita's avatar
Riri Novita committed
503 504 505 506 507 508 509 510 511 512 513 514
        this.state.dataTable.map(i => {
            data.push({
                item_report_id: i[1],
                uom: String(i[6]),
                rolling_outlook: String(Number(i[7]).toFixed(1)),
                master_budget: String(Number(i[8]).toFixed(1)),
                rolling_budget: String(Number(i[9]).toFixed(1)),
                actual: String(Number(i[10]).toFixed(1)),
                amount_act_vs_mb: String(Number(i[11]).toFixed(1)),
                percent_act_vs_mb: String(Number(i[12]).toFixed(1)),
                amount_act_vs_rb: String(Number(i[13]).toFixed(1)),
                percent_act_vs_rb: String(Number(i[14]).toFixed(1)),
Riri Novita's avatar
Riri Novita committed
515 516
                mtd_vs_mb: String(i[15]),
                mtd_vs_rb: String(i[16]),
Riri Novita's avatar
Riri Novita committed
517 518 519 520
            })
        })
        let body = {
            company_id: this.props.data.company.company_id,
Riri Novita's avatar
Riri Novita committed
521
            operating_indicator_id: this.state.operatingIndIDMonthly,
Riri Novita's avatar
Riri Novita committed
522 523 524
            periode: this.props.data.periode,
            report_id: this.props.data.report_id,
            status: type,
Riri Novita's avatar
Riri Novita committed
525
            months: this.props.months,
Riri Novita's avatar
Riri Novita committed
526
            currency_id: this.props.defaultCurrency.id,
Riri Novita's avatar
Riri Novita committed
527 528
            monthly_report: data
        }
Riri Novita's avatar
Riri Novita committed
529 530
        // console.log(body);
        // console.log(JSON.stringify(body))
Riri Novita's avatar
Riri Novita committed
531 532 533 534 535 536 537 538
        api.create('UPLOAD').uploadMonthlyReportOI(body).then(response => {
            // // console.log(response);
            this.setState({ loading: false })
            if (response.data) {
                if (response.data.status === "success") {
                    this.props.onClickClose()
                    this.props.getReport()
                } else {
Riri Novita's avatar
Riri Novita committed
539 540 541 542 543 544 545 546 547 548 549 550
                    if (response.data.message == "Please Set Up Rate Currency First") {
                        this.setState({ visibleAlertSave: true, loading: false })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
Riri Novita's avatar
Riri Novita committed
551
                }
Riri Novita's avatar
Riri Novita committed
552 553
            } else {
                alert(response.problem)
Riri Novita's avatar
Riri Novita committed
554 555 556 557
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
558 559 560 561
    handleValidate() {
        let data = []
        let err = false
        this.state.dataTable.map((i, index) => {
Riri Novita's avatar
Riri Novita committed
562 563 564 565 566 567 568 569 570
            if (i[0] === 3) {
                if (i[15] === "" && (Number(i[12]) < this.state.minValue || Number(i[12]) > this.state.maxValue)) {
                    console.log('msk 1');
                    err = true
                } else if (i[16] === "" && (Number(i[14]) < this.state.minValue || Number(i[14]) > this.state.maxValue)) {
                    console.log('msk 2');
                    err = true
                }
            }
Riri Novita's avatar
Riri Novita committed
571
            data.push({
Riri Novita's avatar
Riri Novita committed
572 573 574 575 576 577 578 579 580 581 582 583
                "item_report_id": i[1],
                "uom": i[6],
                "rolling_outlook": i[7],
                "master_budget": i[8],
                "rolling_budget": i[9],
                "actual": i[10],
                "amount_act_vs_mb": i[11],
                "percent_act_vs_mb": i[12],
                "amount_act_vs_rb": i[13],
                "percent_act_vs_rb": i[14],
                "mtd_vs_mb": i[15],
                "mtd_vs_rb": i[16]
Riri Novita's avatar
Riri Novita committed
584 585 586 587 588
            })
        })

        // console.log(JSON.stringify(data))
        let payload = {
Riri Novita's avatar
Riri Novita committed
589
            "operating_indicator_id": this.state.operatingIndIDMonthly,
Riri Novita's avatar
Riri Novita committed
590 591 592 593
            "report_id": this.props.data.report_id,
            "company_id": this.props.data.company.company_id,
            "periode": this.props.data.periode,
            "status": "submitted",
Riri Novita's avatar
Riri Novita committed
594
            "months": this.props.months,
Riri Novita's avatar
Riri Novita committed
595
            "currency_id": this.props.defaultCurrency.id,
Riri Novita's avatar
Riri Novita committed
596 597 598 599 600 601 602 603 604 605 606 607 608 609
            "monthly_report": data
        }
        // console.log(JSON.stringify(payload));
        api.create().validateSubmitReportOI(payload).then((response) => {
            console.log(response)
            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 })
                    } else {
                        this.setState({ loading: false, buttonError: true, editable: true, saveDraft: false })
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
d.arizona's avatar
d.arizona committed
610
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
611 612 613 614 615 616 617 618 619 620 621 622 623
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
624 625 626 627
    closeAlert() {
        this.setState({ alert: false })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
628
    render() {
Riri Novita's avatar
Riri Novita committed
629
        let dataTable2 = this.state.dataTable
Riri Novita's avatar
Riri Novita committed
630 631 632 633 634

        const handleText = (value, tableMeta, type) => {
            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = value
        }

Riri Novita's avatar
Riri Novita committed
635 636 637 638 639 640 641 642 643
        const handleValue = (data, type) => {
            let total = 0
            dataTable2.map((item, index) => {
                if (data.rowData[1] === item[2]) {
                    let itemVal = item[data.columnIndex + type].value !== undefined ? Number(item[data.columnIndex + type].value) : Number(item[data.columnIndex + type])
                    total = item[data.columnIndex + type] === undefined ? Number(total) + 0 : Number(total) + itemVal
                }
            })
            let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[data.rowIndex][2])
Deni Rinaldi's avatar
Deni Rinaldi committed
644
            dataTable2[data.rowIndex][data.columnIndex + type] = Number(total).toFixed(1)
Riri Novita's avatar
Riri Novita committed
645 646 647 648 649 650 651 652
            // console.log(indexParent);
            return total
        }

        const handleChange = (value, tableMeta, type) => {
            console.log(dataTable2);
            let val = String(value).split(",").join("")
            if (type === "actual") {
Deni Rinaldi's avatar
Deni Rinaldi committed
653
                dataTable2[tableMeta.rowIndex][10] = Number(val).toFixed(1)
Riri Novita's avatar
Riri Novita committed
654 655 656
            } else {
                let indexParent = dataTable2.findIndex((val) => val[1] === dataTable2[tableMeta.rowIndex][2])
                if (indexParent > 0) {
Deni Rinaldi's avatar
Deni Rinaldi committed
657 658 659
                    dataTable2[tableMeta.rowIndex][10] = Number(val).toFixed(1)
                    let jagain = Number(dataTable2[indexParent][10]).toFixed(1)
                    dataTable2[indexParent][10] = jagain === undefined ? (0 + Number(val)).toFixed(1) : Number(Number(jagain) + Number(val)).toFixed(1)
Riri Novita's avatar
Riri Novita committed
660

Riri Novita's avatar
Riri Novita committed
661
                } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
662
                    dataTable2[tableMeta.rowIndex][10] = Number(val).toFixed(1)
Riri Novita's avatar
Riri Novita committed
663 664 665 666 667 668 669
                }
            }
        }

        const handleVariance = (tableMeta, dex, type) => {
            let total = 0
            if (dex === 1) {
Riri Novita's avatar
Riri Novita committed
670
                total = Number(tableMeta.rowData[10]) - Number(tableMeta.rowData[8]).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
671
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Riri Novita's avatar
Riri Novita committed
672
            } else if (dex === 2) {
Riri Novita's avatar
Riri Novita committed
673
                total = Number(tableMeta.rowData[10]) - Number(tableMeta.rowData[9]).toFixed(1)
Deni Rinaldi's avatar
Deni Rinaldi committed
674
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Riri Novita's avatar
Riri Novita committed
675
            }
Riri Novita's avatar
Riri Novita committed
676 677 678 679 680 681
            return total
        }

        const handleVariancePercent = (tableMeta, dex, type) => {
            let total = 0
            if (dex === 1) {
Riri Novita's avatar
Riri Novita committed
682
                total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][11]) / Number(dataTable2[tableMeta.rowIndex][8])) * 100)
Deni Rinaldi's avatar
Deni Rinaldi committed
683
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Riri Novita's avatar
Riri Novita committed
684
            } else if (dex === 2) {
Riri Novita's avatar
Riri Novita committed
685
                total = R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100), NaN) ? '0' : R.equals(Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100), Infinity) ? '0' : Number((Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100 == "-Infinity" ? '0' : (Number(dataTable2[tableMeta.rowIndex][13]) / Number(dataTable2[tableMeta.rowIndex][9])) * 100)
Deni Rinaldi's avatar
Deni Rinaldi committed
686
                dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total).toFixed(1)
Riri Novita's avatar
Riri Novita committed
687
            }
Riri Novita's avatar
Riri Novita committed
688 689 690
            return total
        }

Riri Novita's avatar
Riri Novita committed
691 692 693 694 695 696 697 698
        const handleFormula = (data, tableMeta, type) => {
            let arrayFormula = tableMeta.rowData[3].match(/[a-zA-Z]+|[0-9]+|[-!$%^&*()_+|~=`{}\[\]:";'<>?,.\/]+(?:\.[0-9]+@|)/g)
            let arrayJumlah = []
            let tambahan = false
            let opet = ""

            arrayFormula.map((item, indexs) => {
                if (item == 'X') {
Riri Novita's avatar
Riri Novita committed
699
                    tambahan = true
Riri Novita's avatar
Riri Novita committed
700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754
                } else if (item == '-' || item == '+' || item == '/' || item == '*') {
                    arrayJumlah.push(item)
                } else {
                    let index = dataTable2.findIndex((val) => val[17] == item)
                    if (tambahan) {
                        if (item == '-' || item == '+' || item == '/' || item == '*') {
                            opet = item
                        } else {
                            arrayJumlah.push(opet == '' ? Number(item) : Number(String(opet + String(item))))
                            tambahan = false
                            opet = ""
                        }
                    } else {
                        if (index != -1) {
                            arrayJumlah.push(dataTable2[index][tableMeta.columnIndex + type])
                        }
                    }
                }
            })

            let array = arrayJumlah
            let total = 0
            let opt = ""

            array.map((item, index) => {
                if (item == "+") {
                    opt = "tambah"
                } else if (item == "-") {
                    opt = "kurang"
                } else if (item == "*") {
                    opt = "kali"
                } else if (item == "/") {
                    opt = "bagi"
                } else {
                    if (opt == "tambah") {
                        total = Number(total) + Number(item)
                    } else if (opt == "kurang") {
                        total = Number(total) - Number(item)
                    } else if (opt == "kali") {
                        total = Number(total) * Number(item)
                        // if (tableMeta.rowData[22] === 3) {
                        //     console.log(dataTable2[tableMeta.rowIndex]);
                        //     console.log(total);
                        //     console.log(item);
                        //     console.log(arrayJumlah);
                        // }
                    } else if (opt == "bagi") {
                        total = R.equals((Number(total) / Number(item)), NaN) ? '0' : Number(total) / Number(item)
                    } else {
                        total += Number(item)
                    }
                }
            })

            let a = dataTable2[tableMeta.rowIndex][tableMeta.columnIndex + type] = Number(total)
d.arizona's avatar
d.arizona committed
755
            console.log(tableMeta.columnIndex + type)
Riri Novita's avatar
Riri Novita committed
756 757 758 759
            return a

        }

Deni Rinaldi's avatar
Deni Rinaldi committed
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
        let 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[0] === null ?
                                    tableMeta.rowData[4] == 0 ?
                                        <LightTooltip title={"Report Items Not Registered"} arrow>
                                            <span style={{ fontSize: 12, fontWeight: 'bold', color: 'red' }}>{String(val).toUpperCase()}</span>
                                        </LightTooltip> :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                            <LightTooltip title={"Report Items Not Registered"} arrow>
                                                <span style={{ fontSize: 12, color: 'red' }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                            </LightTooltip>
                                        </div>
                                    :
                                    tableMeta.rowData[4] == 0 ?
                                        <span style={{ fontSize: 12, fontWeight: 'bold' }}>{String(tableMeta.rowData[0] === 4 ? "" : val).toUpperCase()}</span>
                                        :
                                        <div style={{ paddingLeft: 20 * Number(tableMeta.rowData[4]) }}>
                                            <span style={{ fontSize: 12 }}>{tableMeta.rowData[0] === 4 ? "" : val}</span>
                                        </div>
                                }
                            </div>
                        )
                    }
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
825 826 827 828 829 830 831 832 833 834 835 836
            }, {
                name: "UOM",
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#07a7d0', width: 96, borderLeft: '1px #fff solid', borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
837
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
838
                                    null :
Riri Novita's avatar
Riri Novita committed
839
                                    this.state.get_for == 'view' ? val :
Riri Novita's avatar
Riri Novita committed
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
                                        <div style={{ flex: 1 }}>
                                            <FormControlLabel
                                                style={{ margin: 0 }}
                                                // value={val}
                                                control={
                                                    <Input
                                                        disableUnderline={true}
                                                        style={{ color: "#000", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        type="text"
                                                        placeholder=""
                                                        disabled={true}
                                                        defaultValue={val}
                                                    // onBlur={(event) => {
                                                    //     // updateValue(event.target.value)
                                                    //     handleNotes(event.target.value, tableMeta)
                                                    //     // console.log(dataTable2)
                                                    // }}
                                                    />
                                                }
Riri Novita's avatar
Riri Novita committed
859
                                            />
Riri Novita's avatar
Riri Novita committed
860
                                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
861 862 863 864 865 866
                                }
                            </div>
                        )
                    }
                }
            }, {
rifkaki's avatar
rifkaki committed
867
                name: `Rolling Outlook (FY${this.props.data.periode})`,
Deni Rinaldi's avatar
Deni Rinaldi committed
868 869 870 871 872 873 874 875 876 877
                options: {
                    customHeadRender: (columnMeta) => (
                        <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#07a7d0', width: 96, borderLeft: '1px #fff solid', borderRight: '1px #fff solid' }}>
                            <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                        </TableCell>
                    ),
                    setCellProps: () => ({ style2 }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
878
                                {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
879
                                    null :
Riri Novita's avatar
Riri Novita committed
880
                                    this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
881 882 883 884 885 886
                                        <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
887
                                            decimalScale={1}
Riri Novita's avatar
Riri Novita committed
888 889
                                            value={Number(val).toFixed(1)}
                                        />
Riri Novita's avatar
Riri Novita committed
890 891 892
                                        :
                                        tableMeta.rowData[0] === 2 ?
                                            <span style={{ fontSize: 12, textAlign: 'right' }}>
qorri_di's avatar
qorri_di committed
893 894 895 896 897 898 899
                                                <NumberFormat
                                                    thousandSeparator={true}
                                                    style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                    type="text"
                                                    placeholder=""
                                                    disabled={true}
                                                    decimalScale={1}
Riri Novita's avatar
Riri Novita committed
900
                                                    value={Number(handleValue(tableMeta, 0)).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
901
                                                />
Riri Novita's avatar
Riri Novita committed
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938
                                            </span> :
                                            // tableMeta.rowData[0] === 6 ?
                                            // <div style={{ flex: 1 }}>
                                            //     <FormControlLabel
                                            //         style={{ margin: 0 }}
                                            //         value={tableMeta.rowData[7]}
                                            //         decimalScale={1}
                                            //         control={
                                            //             <NumberFormat
                                            //                 thousandSeparator={true}
                                            //                 style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                            //                 type="text"
                                            //                 placeholder=""
                                            //                 disabled={true}
                                            //                 value={Number(handleFormula(val, tableMeta, 0)).toFixed(1)}
                                            //             />
                                            //         }
                                            //     />
                                            // </div> 
                                            // :
                                            <div style={{ flex: 1 }}>
                                                <FormControlLabel
                                                    style={{ margin: 0 }}
                                                    value={val}
                                                    control={
                                                        <NumberFormat
                                                            thousandSeparator={true}
                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            disabled={true}
                                                            value={Number(val).toFixed(1)}
                                                            decimalScale={1}
                                                        />
                                                    }
                                                />
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
939 940 941 942 943 944 945 946 947 948 949 950 951 952
                                }
                            </div>
                        )
                    }
                }
            },
            {
                name: `Month To Date (MTD)`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <th style={{ ...style2, color: '#fff', backgroundColor: '#1c71b8', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
                            {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
                                  <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                              </TableCell> */}
Riri Novita's avatar
Riri Novita committed
953
                            <div style={{ borderBottom: "1px #fff solid", backgroundColor: '#1c71b8', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 40, fontSize: 12, fontWeight: 'bold', padding: 5 }}>{columnMeta.name}</div>
Deni Rinaldi's avatar
Deni Rinaldi committed
954
                            <div className="grid grid-3x" style={{ ...style2, color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
Riri Novita's avatar
Riri Novita committed
955
                                <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
956 957
                                    <span>{"Master Budget (MB)"}</span>
                                </div>
Riri Novita's avatar
Riri Novita committed
958
                                <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", backgroundColor: '#07a7d0', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
959 960
                                    <span>{"Rolling Budget (RB)"}</span>
                                </div>
Riri Novita's avatar
Riri Novita committed
961
                                <div className="column-3" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, backgroundColor: '#37b5e6', justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
962 963 964 965 966 967 968 969 970 971 972 973
                                    <span>{"Actual"}</span>
                                </div>
                            </div>
                        </th>
                    ),
                    setCellProps: () => ({
                        style: {
                            paddingLeft: 0,
                            paddingRight: 0
                        }
                    }),
                    customBodyRender: (val, tableMeta, updateValue) => {
Riri Novita's avatar
Riri Novita committed
974
                        // console.log(tableMeta);
Deni Rinaldi's avatar
Deni Rinaldi committed
975 976 977 978 979
                        return (
                            <div>
                                <div className="grid grid-3x content-center">
                                    <div className="col-1">
                                        <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
980
                                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
981
                                                null :
Riri Novita's avatar
Riri Novita committed
982
                                                this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
983 984 985 986 987 988
                                                    <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
989
                                                        value={Number(tableMeta.rowData[8]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
990
                                                        decimalScale={1}
Riri Novita's avatar
Riri Novita committed
991
                                                    />
qorri_di's avatar
qorri_di committed
992
                                                    :
Riri Novita's avatar
Riri Novita committed
993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
                                                    tableMeta.rowData[0] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValue(tableMeta, 0)).toFixed(1)}
                                                                decimalScale={1}
                                                            />
                                                        </span>
                                                        // :
                                                        // tableMeta.rowData[0] === 6 ?
                                                        // <div style={{ flex: 1 }}>
                                                        //     <FormControlLabel
                                                        //         style={{ margin: 0 }}
                                                        //         value={ Number(tableMeta.rowData[8]).toFixed(1)}
                                                        //         control={
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleFormula(val, tableMeta, 1)).toFixed(1)}
                                                        //                 decimalScale={1}
                                                        //             />
                                                        //         }
                                                        //     />
                                                        // </div> 
                                                        :
                                                        <div style={{ flex: 1 }}>
                                                            <FormControlLabel
                                                                style={{ margin: 0 }}
                                                                value={tableMeta.rowData[8]}
                                                                control={
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(tableMeta.rowData[8]).toFixed(1)}
                                                                        decimalScale={1}
                                                                    />
                                                                }
                                                            />
                                                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1042 1043 1044 1045 1046
                                            }
                                        </div>
                                    </div>
                                    <div className="col-2">
                                        <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
1047
                                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Deni Rinaldi's avatar
Deni Rinaldi committed
1048
                                                null :
Riri Novita's avatar
Riri Novita committed
1049
                                                this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1050 1051 1052 1053 1054 1055
                                                    <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
1056
                                                        value={Number(tableMeta.rowData[9]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1057
                                                        decimalScale={1}
Riri Novita's avatar
Riri Novita committed
1058
                                                    />
qorri_di's avatar
qorri_di committed
1059
                                                    :
Riri Novita's avatar
Riri Novita committed
1060 1061
                                                    tableMeta.rowData[0] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
qorri_di's avatar
qorri_di committed
1062 1063 1064 1065 1066 1067
                                                            <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
1068
                                                                value={Number(handleValue(tableMeta, 1)).toFixed(1)}
qorri_di's avatar
qorri_di committed
1069
                                                                decimalScale={1}
Riri Novita's avatar
Riri Novita committed
1070
                                                            />
Riri Novita's avatar
Riri Novita committed
1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108
                                                        </span>
                                                        // :
                                                        // tableMeta.rowData[0] === 6 ?
                                                        // <div style={{ flex: 1 }}>
                                                        //     <FormControlLabel
                                                        //         style={{ margin: 0 }}
                                                        //         value={tableMeta.rowData[9]}
                                                        //         control={
                                                        //             <NumberFormat
                                                        //                 thousandSeparator={true}
                                                        //                 style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                        //                 type="text"
                                                        //                 placeholder=""
                                                        //                 disabled={true}
                                                        //                 value={Number(handleFormula(val, tableMeta, 1)).toFixed(1)}
                                                        //                 decimalScale={1}
                                                        //             />
                                                        //         }
                                                        //     />
                                                        // </div> 
                                                        :
                                                        <div style={{ flex: 1 }}>
                                                            <FormControlLabel
                                                                style={{ margin: 0 }}
                                                                value={Number(tableMeta.rowData[9]).toFixed(1)}
                                                                control={
                                                                    <NumberFormat
                                                                        thousandSeparator={true}
                                                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                        type="text"
                                                                        placeholder=""
                                                                        disabled={true}
                                                                        value={Number(tableMeta.rowData[9]).toFixed(1)}
                                                                        decimalScale={1}
                                                                    />
                                                                }
                                                            />
                                                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1109 1110 1111 1112 1113
                                            }
                                        </div>
                                    </div>
                                    <div className="col-3">
                                        <div style={{ textAlign: 'right', width: 90 }}>
Riri Novita's avatar
Riri Novita committed
1114
                                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Riri Novita's avatar
Riri Novita committed
1115
                                                null
Riri Novita's avatar
Riri Novita committed
1116
                                                :
Riri Novita's avatar
Riri Novita committed
1117
                                                this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1118 1119 1120 1121 1122 1123
                                                    <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
1124
                                                        value={Number(tableMeta.rowData[10]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1125
                                                        decimalScale={1}
Riri Novita's avatar
Riri Novita committed
1126
                                                    />
qorri_di's avatar
qorri_di committed
1127
                                                    :
Riri Novita's avatar
Riri Novita committed
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144
                                                    tableMeta.rowData[0] === 2 ?
                                                        <span style={{ fontSize: 12, textAlign: 'right' }}>
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(handleValue(tableMeta, 2)).toFixed(1)}
                                                                decimalScale={1}
                                                            />
                                                        </span>
                                                        :
                                                        tableMeta.rowData[0] === 3 ?
                                                            <div style={{ flex: 1 }}>
                                                                <FormControlLabel
                                                                    style={{ margin: 0 }}
Deni Rinaldi's avatar
Deni Rinaldi committed
1145
                                                                    value={Number(tableMeta.rowData[10]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160
                                                                    control={
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{ color: this.state.get_for == 'view' ? "black" : "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            decimalScale={1}
                                                                            fixedDecimalScale={1}
                                                                            disabled={!this.props.permission.create || !this.props.permission.edit || this.state.get_for == 'view'}
                                                                            value={Number(tableMeta.rowData[10]).toFixed(1)}
                                                                            onBlur={(event) => {
                                                                                handleChange(event.target.value, tableMeta)
                                                                            }}
                                                                        />
                                                                    }
qorri_di's avatar
qorri_di committed
1161
                                                                />
Riri Novita's avatar
Riri Novita committed
1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179
                                                            </div>
                                                            :
                                                            tableMeta.rowData[0] === 6 ?
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={Number(tableMeta.rowData[8]).toFixed(1)}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                disabled={true}
                                                                                decimalScale={1}
                                                                                value={Number(handleFormula(val, tableMeta, 2)).toFixed(1)}
                                                                            />
                                                                        }
qorri_di's avatar
qorri_di committed
1180
                                                                    />
Riri Novita's avatar
Riri Novita committed
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198
                                                                </div>
                                                                :
                                                                <div style={{ flex: 1 }}>
                                                                    <FormControlLabel
                                                                        style={{ margin: 0 }}
                                                                        value={tableMeta.rowData[10]}
                                                                        control={
                                                                            <NumberFormat
                                                                                thousandSeparator={true}
                                                                                style={{ color: "#5198ea", fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                                type="text"
                                                                                placeholder=""
                                                                                value={Number(tableMeta.rowData[10]).toFixed(1)}
                                                                                decimalScale={1}
                                                                            />
                                                                        }
                                                                    />
                                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1199 1200 1201 1202 1203 1204 1205 1206 1207
                                            }
                                        </div>
                                    </div>
                                </div>
                            </div>
                        )
                    }
                }
            },
Riri Novita's avatar
Riri Novita committed
1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
Deni Rinaldi's avatar
Deni Rinaldi committed
1220 1221 1222 1223 1224 1225
            {
                name: `Variance`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)" }} >
                            <div style={{ borderBottom: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 40 }}>{columnMeta.name}</div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1226 1227
                            <div className="grid grid-2x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
                                <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239
                                    <div style={{ borderBottom: '1px #fff solid' }}>
                                        <span>{"Act vs MB"}</span>
                                    </div>
                                    <div className="grid grid-2x">
                                        <div className="column-1" style={{ borderRight: '1px #fff solid' }}>
                                            <span>{"Amount"}</span>
                                        </div>
                                        <div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
                                            <span>{"%"}</span>
                                        </div>
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1240
                                <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, border: '1px #fff solid', backgroundColor: '#07a7d0' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
                                    <div style={{ borderBottom: '1px #fff solid' }}>
                                        <span>{"Act vs RB"}</span>
                                    </div>
                                    <div className="grid grid-2x">
                                        <div className="column-1" style={{ borderRight: '1px #fff solid' }}>
                                            <span>{"Amount"}</span>
                                        </div>
                                        <div className="column-2" style={{ borderLeft: '1px #fff solid' }}>
                                            <span>{"%"}</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </th>
                    ),
                    setCellProps: () => ({
                        style: {
                            paddingLeft: 0,
                            paddingRight: 0
                        }
                    }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1265
                                <div className="grid grid-2x content-center">
Deni Rinaldi's avatar
Deni Rinaldi committed
1266 1267 1268
                                    <div className="column-1">
                                        <div className="grid grid-2x content-center">
                                            <div className="column-1">
Riri Novita's avatar
Riri Novita committed
1269 1270
                                                <div style={{ textAlign: 'right', width: 120 }}>
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Riri Novita's avatar
Riri Novita committed
1271
                                                        null
Riri Novita's avatar
Riri Novita committed
1272
                                                        :
Riri Novita's avatar
Riri Novita committed
1273
                                                        this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1274 1275 1276 1277 1278 1279 1280
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[11]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1281
                                                                decimalScale={1}
Riri Novita's avatar
Riri Novita committed
1282
                                                            />
Riri Novita's avatar
Riri Novita committed
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300
                                                            :
                                                            <div style={{ flex: 1 }}>
                                                                <FormControlLabel
                                                                    style={{ margin: 0 }}
                                                                    value={Number(tableMeta.rowData[11]).toFixed(1)}
                                                                    control={
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleVariance(tableMeta, 1, 0)).toFixed(1)}
                                                                            decimalScale={1}
                                                                        />
                                                                    }
                                                                />
                                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1301 1302 1303 1304
                                                    }
                                                </div>
                                            </div>
                                            <div className="column-2">
Riri Novita's avatar
Riri Novita committed
1305 1306
                                                <div style={{ textAlign: 'right', width: 120 }}>
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Riri Novita's avatar
Riri Novita committed
1307
                                                        null
Riri Novita's avatar
Riri Novita committed
1308
                                                        :
Riri Novita's avatar
Riri Novita committed
1309
                                                        this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1310 1311 1312 1313 1314
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
Riri Novita's avatar
Riri Novita committed
1315
                                                                suffix={'%'}
Riri Novita's avatar
Riri Novita committed
1316 1317
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[12]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1318
                                                                decimalScale={1}
Riri Novita's avatar
Riri Novita committed
1319
                                                            />
Riri Novita's avatar
Riri Novita committed
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
                                                            :
                                                            <div style={{ flex: 1 }}>
                                                                <FormControlLabel
                                                                    style={{ margin: 0 }}
                                                                    value={val}
                                                                    control={
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            suffix={'%'}
                                                                            disabled={true}
                                                                            value={Number(handleVariancePercent(tableMeta, 1, 1)).toFixed(1)}
                                                                            decimalScale={1}
                                                                        />
                                                                    }
                                                                />
                                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1339 1340 1341 1342 1343
                                                    }
                                                </div>
                                            </div>
                                        </div>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1344
                                    <div className="column-2">
Deni Rinaldi's avatar
Deni Rinaldi committed
1345 1346
                                        <div className="grid grid-2x content-center">
                                            <div className="column-1">
Riri Novita's avatar
Riri Novita committed
1347
                                                <div style={{ textAlign: 'right', width: 120 }}>
Riri Novita's avatar
Riri Novita committed
1348
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Riri Novita's avatar
Riri Novita committed
1349
                                                        null
Riri Novita's avatar
Riri Novita committed
1350
                                                        :
Riri Novita's avatar
Riri Novita committed
1351
                                                        this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1352 1353 1354 1355 1356 1357 1358
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[13]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1359
                                                                decimalScale={1}
Riri Novita's avatar
Riri Novita committed
1360
                                                            />
Riri Novita's avatar
Riri Novita committed
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378
                                                            :
                                                            <div style={{ flex: 1 }}>
                                                                <FormControlLabel
                                                                    style={{ margin: 0 }}
                                                                    value={Number(tableMeta.rowData[13]).toFixed(1)}
                                                                    control={
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            value={Number(handleVariance(tableMeta, 2, 2)).toFixed(1)}
                                                                            decimalScale={1}
                                                                        />
                                                                    }
                                                                />
                                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1379 1380 1381 1382
                                                    }
                                                </div>
                                            </div>
                                            <div className="column-2">
Riri Novita's avatar
Riri Novita committed
1383
                                                <div style={{ textAlign: 'right', width: 120 }}>
Riri Novita's avatar
Riri Novita committed
1384
                                                    {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 ?
Riri Novita's avatar
Riri Novita committed
1385
                                                        null
Riri Novita's avatar
Riri Novita committed
1386
                                                        :
Riri Novita's avatar
Riri Novita committed
1387
                                                        this.state.get_for == 'view' ?
Riri Novita's avatar
Riri Novita committed
1388 1389 1390 1391 1392
                                                            <NumberFormat
                                                                thousandSeparator={true}
                                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                type="text"
                                                                placeholder=""
Riri Novita's avatar
Riri Novita committed
1393
                                                                suffix={'%'}
Riri Novita's avatar
Riri Novita committed
1394 1395
                                                                disabled={true}
                                                                value={Number(tableMeta.rowData[14]).toFixed(1)}
Riri Novita's avatar
Riri Novita committed
1396
                                                                decimalScale={1}
Riri Novita's avatar
Riri Novita committed
1397
                                                            />
Riri Novita's avatar
Riri Novita committed
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416
                                                            :
                                                            <div style={{ flex: 1, width: 120 }}>
                                                                <FormControlLabel
                                                                    style={{ margin: 0 }}
                                                                    value={val}
                                                                    control={
                                                                        <NumberFormat
                                                                            thousandSeparator={true}
                                                                            style={{ color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            disabled={true}
                                                                            suffix={'%'}
                                                                            value={Number(handleVariancePercent(tableMeta, 2, 3)).toFixed(1)}
                                                                            decimalScale={1}
                                                                        />
                                                                    }
                                                                />
                                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427
                                                    }
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        )
                    }
                }
            },
Riri Novita's avatar
Riri Novita committed
1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
Deni Rinaldi's avatar
Deni Rinaldi committed
1446 1447 1448 1449 1450 1451 1452 1453 1454
            {
                name: `MTD Explanation`,
                options: {
                    customHeadRender: (columnMeta) => (
                        <th style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 13, fontWeight: 1, width: 150, borderRight: "1px solid rgb(255, 255, 255)", padding: 0 }} >
                            {/* <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96 }}>
                                <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
                            </TableCell> */}
                            <div style={{ borderBottom: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', fontSize: 12, fontWeight: 'bold', padding: 5, height: 40 }}>{columnMeta.name}</div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1455
                            <div className="grid grid-2x" style={{ ...style2, backgroundColor: '#1c71b8', color: '#fff', fontSize: 12, fontWeight: 'bold', position: "sticky" }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1456 1457 1458
                                <div className="column-1" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, borderRight: "1px #fff solid", justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
                                    <span>{"vs MB"}</span>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1459
                                <div className="column-2" style={{ placeSelf: 'center', textAlign: 'center', padding: 5, justifyContent: 'center', display: 'flex', alignItems: 'center', height: 45 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473
                                    <span>{"vs RB"}</span>
                                </div>
                            </div>
                        </th>
                    ),
                    setCellProps: () => ({
                        style: {
                            paddingLeft: 0,
                            paddingRight: 0
                        }
                    }),
                    customBodyRender: (val, tableMeta, updateValue) => {
                        return (
                            <div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1474
                                <div className="grid grid-2x content-center">
Deni Rinaldi's avatar
Deni Rinaldi committed
1475
                                    <div className="col-1">
Riri Novita's avatar
Riri Novita committed
1476 1477 1478
                                        <div style={{ textAlign: 'left', width: 90 }}>
                                            <div style={{ flex: 1 }}>
                                                {tableMeta.rowData[0] === 3 ?
Riri Novita's avatar
Riri Novita committed
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528
                                                    this.state.get_for == 'view' ?
                                                        <Input
                                                            disableUnderline={true}
                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            multiline={true}
                                                            disabled={true}
                                                            defaultValue={tableMeta.rowData[15]}
                                                            inputProps={{
                                                                style: {
                                                                    color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#000000b0" : '#000000b0',
                                                                    textAlign: 'left'
                                                                }
                                                            }}
                                                            onBlur={(event) => {
                                                                handleText(event.target.value, tableMeta, 0)
                                                            }}
                                                        />
                                                        :
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            // value={tableMeta.rowData[15]}
                                                            control={
                                                                tableMeta.rowData[15] === "" && (Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue) ?
                                                                    <LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow>
                                                                        <Input
                                                                            disableUnderline={true}
                                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30, padding: 0 }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            multiline={true}
                                                                            disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
                                                                            // value={tableMeta.rowData[15]}
                                                                            defaultValue={tableMeta.rowData[15]}
                                                                            inputProps={{
                                                                                style: {
                                                                                    color: "#5198ea",
                                                                                    textAlign: 'left',
                                                                                    backgroundColor: '#ffac99',
                                                                                    minHeight: 30,
                                                                                    padding: 0
                                                                                }
                                                                            }}
                                                                            onBlur={(event) => {
                                                                                handleText(event.target.value, tableMeta, 0)
                                                                            }}
                                                                        />
                                                                    </LightTooltipError>
                                                                    :
Riri Novita's avatar
Riri Novita committed
1529 1530
                                                                    <Input
                                                                        disableUnderline={true}
Riri Novita's avatar
Riri Novita committed
1531
                                                                        style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
Riri Novita's avatar
Riri Novita committed
1532 1533 1534
                                                                        type="text"
                                                                        placeholder=""
                                                                        multiline={true}
Riri Novita's avatar
Riri Novita committed
1535
                                                                        disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
Riri Novita's avatar
Riri Novita committed
1536 1537 1538
                                                                        defaultValue={tableMeta.rowData[15]}
                                                                        inputProps={{
                                                                            style: {
Riri Novita's avatar
Riri Novita committed
1539 1540
                                                                                color: Number(tableMeta.rowData[12]) < this.state.minValue || Number(tableMeta.rowData[12]) > this.state.maxValue ? "#5198ea" : '#5198ea',
                                                                                textAlign: 'left'
Riri Novita's avatar
Riri Novita committed
1541 1542 1543 1544 1545 1546
                                                                            }
                                                                        }}
                                                                        onBlur={(event) => {
                                                                            handleText(event.target.value, tableMeta, 0)
                                                                        }}
                                                                    />
Riri Novita's avatar
Riri Novita committed
1547 1548
                                                            }
                                                        />
Riri Novita's avatar
Riri Novita committed
1549 1550 1551 1552
                                                    :
                                                    null
                                                }
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1553 1554
                                        </div>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1555
                                    <div className="col-2">
Riri Novita's avatar
Riri Novita committed
1556 1557 1558
                                        <div style={{ textAlign: 'left', width: 90 }}>
                                            <div style={{ flex: 1 }}>
                                                {tableMeta.rowData[0] === 3 ?
Riri Novita's avatar
Riri Novita committed
1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608
                                                    this.state.get_for == 'view' ?
                                                        <Input
                                                            disableUnderline={true}
                                                            style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                            type="text"
                                                            placeholder=""
                                                            multiline={true}
                                                            disabled={true}
                                                            defaultValue={tableMeta.rowData[16]}
                                                            inputProps={{
                                                                style: {
                                                                    color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#000000b0" : '#000000b0',
                                                                    textAlign: 'left'
                                                                }
                                                            }}
                                                            onBlur={(event) => {
                                                                handleText(event.target.value, tableMeta, 1)
                                                            }}
                                                        />
                                                        :
                                                        <FormControlLabel
                                                            style={{ margin: 0 }}
                                                            // value={tableMeta.rowData[16]}
                                                            control={
                                                                tableMeta.rowData[16] === "" && (Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue) ?
                                                                    <LightTooltipError title={"MTD Explanation vs RB is Reqiured"} arrow>
                                                                        <Input
                                                                            disableUnderline={true}
                                                                            style={{ color: "#5198ea", fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent', minHeight: 30, padding: 0 }}
                                                                            type="text"
                                                                            placeholder=""
                                                                            multiline={true}
                                                                            disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
                                                                            // value={tableMeta.rowData[16]}
                                                                            defaultValue={tableMeta.rowData[16]}
                                                                            inputProps={{
                                                                                style: {
                                                                                    color: "#5198ea",
                                                                                    textAlign: 'left',
                                                                                    backgroundColor: '#ffac99',
                                                                                    minHeight: 30,
                                                                                    padding: 0
                                                                                }
                                                                            }}
                                                                            onBlur={(event) => {
                                                                                handleText(event.target.value, tableMeta, 1)
                                                                            }}
                                                                        />
                                                                    </LightTooltipError>
                                                                    :
Riri Novita's avatar
Riri Novita committed
1609 1610
                                                                    <Input
                                                                        disableUnderline={true}
Riri Novita's avatar
Riri Novita committed
1611
                                                                        style={{ fontSize: 12, textAlign: 'left', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
Riri Novita's avatar
Riri Novita committed
1612 1613 1614
                                                                        type="text"
                                                                        placeholder=""
                                                                        multiline={true}
Riri Novita's avatar
Riri Novita committed
1615
                                                                        disabled={this.props.isApprover ? true : (this.state.get_for == 'view' ? true : false)}
Riri Novita's avatar
Riri Novita committed
1616 1617 1618
                                                                        defaultValue={tableMeta.rowData[16]}
                                                                        inputProps={{
                                                                            style: {
Riri Novita's avatar
Riri Novita committed
1619 1620
                                                                                color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? "#5198ea" : '#5198ea',
                                                                                textAlign: 'left'
Riri Novita's avatar
Riri Novita committed
1621 1622 1623
                                                                            }
                                                                        }}
                                                                        onBlur={(event) => {
Riri Novita's avatar
Riri Novita committed
1624
                                                                            handleText(event.target.value, tableMeta, 1)
Riri Novita's avatar
Riri Novita committed
1625 1626
                                                                        }}
                                                                    />
Riri Novita's avatar
Riri Novita committed
1627 1628
                                                            }
                                                        />
Riri Novita's avatar
Riri Novita committed
1629 1630 1631 1632
                                                    :
                                                    null
                                                }
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1633 1634 1635 1636 1637 1638 1639 1640
                                        </div>
                                    </div>
                                </div>
                            </div>
                        )
                    }
                }
            },
Riri Novita's avatar
Riri Novita committed
1641 1642 1643 1644 1645 1646
            {
                name: "",
                options: {
                    display: false
                }
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
1647 1648
        ]

Riri Novita's avatar
Riri Novita committed
1649 1650 1651 1652 1653 1654 1655 1656 1657 1658
        const loadingComponent = (
            <div style={{ position: 'fixed', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );
Deni Rinaldi's avatar
Deni Rinaldi committed
1659

Deni Rinaldi's avatar
Deni Rinaldi committed
1660 1661 1662
        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 }}>
Riri Novita's avatar
Riri Novita committed
1663
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Monthly Report Submission</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
1664
                </div>
Riri Novita's avatar
Riri Novita committed
1665 1666 1667 1668 1669
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
Deni Rinaldi's avatar
Deni Rinaldi committed
1670
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
Riri Novita's avatar
Riri Novita committed
1671 1672 1673 1674
                    {this.state.visibleOI === true ?
                        <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                            <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                                <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Monthly Report - Operating Indicator</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
1675
                            </div>
Riri Novita's avatar
Riri Novita committed
1676 1677 1678 1679 1680 1681
                            <div style={{ padding: 20 }}>
                                {!this.state.emptyData && <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 : {
Riri Novita's avatar
Riri Novita committed
1682 1683
                                                this.props.months === 1 ? 'JAN' :
                                                    this.props.months === 2 ? 'FEB' :
qorri_di's avatar
qorri_di committed
1684
                                                        this.props.months === 3 ? 'MAR' :
Riri Novita's avatar
Riri Novita committed
1685 1686 1687 1688 1689 1690 1691 1692 1693
                                                            this.props.months === 4 ? 'APR' :
                                                                this.props.months === 5 ? 'MAY' :
                                                                    this.props.months === 6 ? 'JUN' :
                                                                        this.props.months === 7 ? 'JUL' :
                                                                            this.props.months === 8 ? 'AUG' :
                                                                                this.props.months === 9 ? 'SEP' :
                                                                                    this.props.months === 10 ? 'OCT' :
                                                                                        this.props.months === 11 ? 'NOV' :
                                                                                            this.props.months === 12 ? 'DEC' : ""} {this.props.data.periode}
Riri Novita's avatar
Riri Novita committed
1694
                                        </Typography>
Riri Novita's avatar
Riri Novita committed
1695 1696 1697 1698 1699
                                        {this.props.defaultCurrency.id === 1 ?
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                            :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                        }
Riri Novita's avatar
Riri Novita committed
1700 1701 1702
                                    </div>
                                    <div style={{ width: '50%' }}>
                                        <div style={{ justifyContent: 'flex-end', display: 'flex', flexFlow: 'wrap' }}>
Riri Novita's avatar
Riri Novita committed
1703
                                            {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Download Template'} data-for="template">
Riri Novita's avatar
Riri Novita committed
1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716
                                                <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" />
Riri Novita's avatar
Riri Novita committed
1717
                                            {this.state.get_for == 'edit' && (this.props.permission.create || this.props.permission.edit) && <a data-tip={'Upload'} data-for="upload">
Riri Novita's avatar
Riri Novita committed
1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.setState({ visibleUpload: true, editable: true })}
                                                >
                                                    <img src={Images.upload} />
                                                </button>
                                            </a>}
                                            <ReactTooltip border={true} id="upload" place="bottom" type="light" effect="solid" />
qorri_di's avatar
qorri_di committed
1731
                                            {/* <a data-tip={'Download'} data-for="download">
Riri Novita's avatar
Riri Novita committed
1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743
                                                <button
                                                    style={{
                                                        backgroundColor: 'transparent',
                                                        cursor: 'pointer',
                                                        borderColor: 'transparent',
                                                        margin: 5
                                                    }}
                                                    onClick={() => this.downloadAllData()}
                                                >
                                                    <img src={Images.download} />
                                                </button>
                                            </a>
qorri_di's avatar
qorri_di committed
1744
                                            <ReactTooltip border={true} id="download" place="bottom" type="light" effect="solid" /> */}
Riri Novita's avatar
Riri Novita committed
1745 1746 1747
                                        </div>
                                    </div>
                                </div>}
Deni Rinaldi's avatar
Deni Rinaldi committed
1748

Riri Novita's avatar
Riri Novita committed
1749 1750
                                <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
                                    {this.state.loading && loadingComponent}
Riri Novita's avatar
Riri Novita committed
1751 1752
                                    {!this.state.loading &&
                                        <MuiThemeProvider theme={getMuiTheme()}>
Riri Novita's avatar
Riri Novita committed
1753 1754 1755 1756 1757 1758 1759

                                            <MUIDataTable
                                                data={dataTable2}
                                                columns={columns}
                                                options={options}
                                            />
                                        </MuiThemeProvider>
Riri Novita's avatar
Riri Novita committed
1760
                                    }
Riri Novita's avatar
Riri Novita committed
1761
                                </div>
Riri Novita's avatar
Riri Novita committed
1762 1763 1764 1765 1766
                                <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
1767 1768 1769 1770
                                                return (
                                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>{item.latest_update}</Typography>
                                                )
                                            }) :
Riri Novita's avatar
Riri Novita committed
1771
                                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10, marginRight: 5 }}>-</Typography>
Riri Novita's avatar
Riri Novita committed
1772 1773 1774
                                        }
                                    </div>
                                </div>
Riri Novita's avatar
Riri Novita committed
1775
                                <Typography style={{ fontSize: '11px', color: '#4b4b4b', marginTop: 10 }}>Notes : {this.state.notesUpdate}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
1776
                            </div>
Riri Novita's avatar
Riri Novita committed
1777
                            <div className="grid grid-2x">
Riri Novita's avatar
Riri Novita committed
1778
                                <div className="col-1" style={{ paddingLeft: 20 }}>
Riri Novita's avatar
Riri Novita committed
1779
                                    <button
Riri Novita's avatar
Riri Novita committed
1780
                                        className="button"
Riri Novita's avatar
Riri Novita committed
1781 1782 1783 1784 1785 1786
                                        type="button"
                                        style={{
                                            backgroundColor: 'transparent',
                                            cursor: 'pointer',
                                            borderColor: 'transparent',
                                        }}
Riri Novita's avatar
Riri Novita committed
1787
                                        onClick={() => this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
1788 1789 1790 1791 1792
                                            setTimeout(() => {
                                                this.props.onClickClose()
                                                this.props.getReport()
                                            }, 100);
                                        })}
Riri Novita's avatar
Riri Novita committed
1793 1794 1795 1796 1797 1798
                                    >
                                        <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
                                        </div>
                                    </button>
                                </div>
Riri Novita's avatar
Riri Novita committed
1799 1800
                                {!this.state.emptyData && (this.props.permission.create || this.props.permission.edit) && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingRight: 2 }}>
                                    {this.state.get_for == 'view' && this.state.viewOnly && <button
d.arizona's avatar
d.arizona committed
1801 1802
                                        type="button"
                                        onClick={() => {
Riri Novita's avatar
Riri Novita committed
1803
                                            this.setState({ loading: true }, () => {
d.arizona's avatar
d.arizona committed
1804 1805 1806
                                                this.handleGetFor('edit')
                                            })
                                        }}
Riri Novita's avatar
Riri Novita committed
1807
                                        style={{ marginRight: 21 }}
d.arizona's avatar
d.arizona committed
1808 1809 1810 1811 1812 1813
                                    >
                                        <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
Riri Novita's avatar
Riri Novita committed
1814
                                        type="button"
Riri Novita's avatar
Riri Novita committed
1815 1816
                                        onClick={() =>
                                            this.setState({ loading: true, editable: false }, () => {
Riri Novita's avatar
Riri Novita committed
1817
                                                setTimeout(() => {
Riri Novita's avatar
Riri Novita committed
1818
                                                    this.handleValidate()
Riri Novita's avatar
Riri Novita committed
1819
                                                    // this.setState({ loading: false, buttonError: false })
Riri Novita's avatar
Riri Novita committed
1820 1821
                                                }, 100);
                                            })
Riri Novita's avatar
Riri Novita committed
1822 1823
                                        }
                                        style={{ marginRight: 20 }}
Riri Novita's avatar
Riri Novita committed
1824 1825 1826 1827
                                    >
                                        <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>
d.arizona's avatar
d.arizona committed
1828 1829
                                    </button>}
                                    {this.state.get_for == 'edit' && <button
Riri Novita's avatar
Riri Novita committed
1830 1831
                                        className="button"
                                        type="button"
Riri Novita's avatar
Riri Novita committed
1832
                                        // disabled={this.state.editable}
Riri Novita's avatar
Riri Novita committed
1833 1834
                                        style={{
                                            backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
1835
                                            cursor: 'pointer',
Riri Novita's avatar
Riri Novita committed
1836 1837 1838 1839
                                            borderColor: 'transparent',
                                            outline: 'none',
                                            marginRight: 20
                                        }}
Riri Novita's avatar
Riri Novita committed
1840
                                        onClick={() =>
Riri Novita's avatar
Riri Novita committed
1841
                                            this.state.saveDraft === true ?
Riri Novita's avatar
Riri Novita committed
1842 1843 1844 1845 1846 1847 1848
                                                this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                :
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
                                                        this.createData("draft")
                                                    }, 100);
                                                })}
Riri Novita's avatar
Riri Novita committed
1849 1850
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
Riri Novita's avatar
Riri Novita committed
1851
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
Riri Novita's avatar
Riri Novita committed
1852
                                        </div>
d.arizona's avatar
d.arizona committed
1853 1854
                                    </button>}
                                    {this.state.get_for == 'edit' && <button
Riri Novita's avatar
Riri Novita committed
1855
                                        type="button"
Riri Novita's avatar
Riri Novita committed
1856
                                        // disabled={this.state.editable}
Riri Novita's avatar
Riri Novita committed
1857
                                        onClick={() =>
Riri Novita's avatar
Riri Novita committed
1858 1859 1860 1861 1862 1863 1864
                                            this.state.editable === true ?
                                                this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
                                                :
                                                this.setState({ loading: true }, () => {
                                                    setTimeout(() => {
                                                        this.createData("submitted")
                                                    }, 100);
Riri Novita's avatar
Riri Novita committed
1865
                                                })}
Riri Novita's avatar
Riri Novita committed
1866 1867
                                        style={{
                                            backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
1868
                                            cursor: 'pointer',
Riri Novita's avatar
Riri Novita committed
1869 1870
                                            borderColor: 'transparent',
                                            outline: 'none',
Riri Novita's avatar
Riri Novita committed
1871
                                            marginRight: 20
Riri Novita's avatar
Riri Novita committed
1872 1873 1874
                                        }}
                                    >
                                        <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
Riri Novita's avatar
Riri Novita committed
1875
                                            <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
Riri Novita's avatar
Riri Novita committed
1876
                                        </div>
d.arizona's avatar
d.arizona committed
1877
                                    </button>}
Riri Novita's avatar
Riri Novita committed
1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888
                                </div>}
                            </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 : {
Riri Novita's avatar
Riri Novita committed
1889 1890
                                                this.props.months === 1 ? 'JAN' :
                                                    this.props.months === 2 ? 'FEB' :
qorri_di's avatar
qorri_di committed
1891
                                                        this.props.months === 3 ? 'MAR' :
Riri Novita's avatar
Riri Novita committed
1892 1893 1894 1895 1896 1897 1898 1899 1900
                                                            this.props.months === 4 ? 'APR' :
                                                                this.props.months === 5 ? 'MAY' :
                                                                    this.props.months === 6 ? 'JUN' :
                                                                        this.props.months === 7 ? 'JUL' :
                                                                            this.props.months === 8 ? 'AUG' :
                                                                                this.props.months === 9 ? 'SEP' :
                                                                                    this.props.months === 10 ? 'OCT' :
                                                                                        this.props.months === 11 ? 'NOV' :
                                                                                            this.props.months === 12 ? 'DEC' : ""} {this.props.data.periode}
Riri Novita's avatar
Riri Novita committed
1901
                                        </Typography>
Riri Novita's avatar
Riri Novita committed
1902 1903 1904 1905 1906
                                        {this.props.defaultCurrency.id === 1 ?
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                            :
                                            <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in USD thousand</Typography>
                                        }
Riri Novita's avatar
Riri Novita committed
1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920
                                    </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>
rifkaki's avatar
rifkaki committed
1921
                                <div className="grid grid-2x" style={{ marginLeft: 10 }}>
Riri Novita's avatar
Riri Novita committed
1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933
                                    <div className="col-1">
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
                                                cursor: 'pointer',
                                                borderColor: 'transparent',
                                            }}
                                            onClick={() =>
                                                this.setState({ loading: true, visibleOI: true }, () => {
                                                    setTimeout(() => {
Riri Novita's avatar
Riri Novita committed
1934
                                                        this.getItemHierarki()
Riri Novita's avatar
Riri Novita committed
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948
                                                    }, 100)
                                                })}
                                        >
                                            <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Back</Typography>
                                            </div>
                                        </button>
                                    </div>
                                    {!this.state.emptyData && this.state.templateNull && <div className="col-2" style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%' }}>
                                        <button
                                            type="button"
                                            onClick={() =>
                                                this.setState({ loading: true, editable: false }, () => {
                                                    setTimeout(() => {
Riri Novita's avatar
Riri Novita committed
1949 1950
                                                        this.handleValidate()
                                                        // this.setState({ loading: false, buttonError: false })
Riri Novita's avatar
Riri Novita committed
1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964
                                                    }, 100);
                                                })
                                            }
                                            style={{ marginRight: 20 }}
                                        >
                                            <div style={{ backgroundColor: '#fff', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #354960' }}>
                                                <Typography style={{ fontSize: '11px', color: '#354960', textAlign: 'center' }}>Calculate</Typography>
                                            </div>
                                        </button>
                                        <button
                                            className="button"
                                            type="button"
                                            style={{
                                                backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
1965
                                                cursor: 'pointer',
Riri Novita's avatar
Riri Novita committed
1966 1967 1968 1969
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Riri Novita's avatar
Riri Novita committed
1970
                                            // disabled={this.state.editable}
Riri Novita's avatar
Riri Novita committed
1971
                                            onClick={() =>
Riri Novita's avatar
Riri Novita committed
1972 1973
                                                this.state.saveDraft === true ?
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
Riri Novita's avatar
Riri Novita committed
1974
                                                    :
Riri Novita's avatar
Riri Novita committed
1975
                                                    this.setState({ loading: true }, () => {
Riri Novita's avatar
Riri Novita committed
1976 1977 1978 1979 1980 1981
                                                        setTimeout(() => {
                                                            this.uploadOI("draft")
                                                        }, 100);
                                                    })}
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
Riri Novita's avatar
Riri Novita committed
1982
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save as Draft</Typography>
Riri Novita's avatar
Riri Novita committed
1983 1984 1985
                                            </div>
                                        </button>
                                        <button
Riri Novita's avatar
Riri Novita committed
1986
                                            className="button"
Riri Novita's avatar
Riri Novita committed
1987
                                            type="button"
Riri Novita's avatar
Riri Novita committed
1988
                                            // disabled={this.state.editable}
Riri Novita's avatar
Riri Novita committed
1989 1990
                                            style={{
                                                backgroundColor: 'transparent',
Riri Novita's avatar
Riri Novita committed
1991
                                                cursor: 'pointer',
Riri Novita's avatar
Riri Novita committed
1992 1993 1994 1995
                                                borderColor: 'transparent',
                                                outline: 'none',
                                                marginRight: 20
                                            }}
Riri Novita's avatar
Riri Novita committed
1996 1997
                                            onClick={() =>
                                                this.state.editable === true ?
Riri Novita's avatar
Riri Novita committed
1998
                                                    this.setState({ alert: true, messageAlert: 'Data Incomplete !', tipeAlert: 'error' })
Riri Novita's avatar
Riri Novita committed
1999 2000 2001 2002 2003 2004
                                                    :
                                                    this.setState({ loading: true }, () => {
                                                        setTimeout(() => {
                                                            this.uploadOI("submitted")
                                                        }, 100);
                                                    })}
Riri Novita's avatar
Riri Novita committed
2005

Riri Novita's avatar
Riri Novita committed
2006 2007
                                        >
                                            <div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
Riri Novita's avatar
Riri Novita committed
2008
                                                <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Save & Complete</Typography>
Riri Novita's avatar
Riri Novita committed
2009 2010 2011
                                            </div>
                                        </button>
                                    </div>}
Riri Novita's avatar
Riri Novita committed
2012 2013
                                </div>
                            </div>
Riri Novita's avatar
Riri Novita committed
2014
                        </Paper>}
Deni Rinaldi's avatar
Deni Rinaldi committed
2015
                </div>
Riri Novita's avatar
Riri Novita committed
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035

                {this.state.visibleUpload && (
                    <div className="test app-popup-show">
                        <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                            <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                                <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                    <div className="popup-title">
                                        <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Upload File</span>
                                    </div>
                                </div>
                                <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                    <button
                                        type="button"
                                        className="btn btn-circle btn-white"
                                        onClick={() => this.setState({ visibleUpload: false })}
                                    >
                                        <img src={Images.close} />
                                    </button>
                                </div>
                            </div>
Riri Novita's avatar
Riri Novita committed
2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052
                            <div style={{ padding: '25px 30px' }}>
                                <UploadFile
                                    type={this.state.uploadStatus}
                                    percentage={this.state.percentage}
                                    result={this.state.result}
                                    acceptedFiles={["xlsx"]}
                                    onHandle={(dt) => {
                                        this.fileHandler(dt)
                                        this.setState({ uploadStatus: 'idle', percentage: '0' })
                                    }}
                                    onUpload={() => {
                                        String(this.state.judulColumn).includes("TEMPLATE") && String(this.state.judulColumn).includes("UPLOAD") && String(this.state.judul).includes("MONTHLY") && String(this.state.judul).includes("REPORT") && String(this.state.judul).includes("OPERATING") && String(this.state.judul).includes("INDICATOR") ?
                                            this.checkUpload() :
                                            this.setState({ alert: true, messageAlert: "Invalid Template", tipeAlert: 'warning' })
                                    }}
                                />
                            </div>
2053
                            <div style={{ padding: '0px 30px 29px', fontSize: 17, color: 'red' }}><b>Warning:</b> Valid currency for uploading data in <b>{this.props.defaultCurrency.id == 1 ? "IDR mn" : "thousand USD"}</b></div>
Riri Novita's avatar
Riri Novita committed
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
                        </div>
                    </div>
                )}

                {this.state.visibleAlertSave && (
                    <div className="test app-popup-show">
                        <div className="popup-content border-radius" style={{ background: '#FFF27D', borderRadius: 10, width: 715, height: 238 }}>
                            <div style={{ margin: 30 }}>
                                <div style={{ display: 'flex', marginTop: 76, marginBottom: 43 }}>
                                    <div style={{ alignSelf: 'center', marginRight: 25 }}>
                                        <img src={Images.warning} />
                                    </div>
                                    <div style={{ justifyContent: 'center', fontSize: 20, color: '#1D2995', marginTop: 10 }}>
                                        <b>Rate Currency USD</b> pada periode yang dipilih <b>belum</b> diatur.<br /> Silahkan menghubungi Superadmin
                                    </div>
                                </div>
                                <div style={{ display: 'flex', justifyContent: 'flex-end' }}>
                                    <button
                                        className="button"
                                        type="button"
                                        style={{
                                            background: '#F6F7F9',
                                            cursor: 'pointer',
                                            border: '1px solid #3549609e',
                                            outline: 'none',
                                            marginRight: 20,
                                            borderRadius: 9
                                        }}
Riri Novita's avatar
Riri Novita committed
2082
                                        onClick={() => this.setState({ visibleAlertSave: false, handleDoubleClick: 0 })}
Riri Novita's avatar
Riri Novita committed
2083 2084 2085 2086 2087 2088 2089
                                    >
                                        <div style={{ backgroundColor: '#fff', width: 105, height: 30, borderRadius: 9, justifyContent: 'center', display: 'flex', alignItems: 'center', border: 'solid 1px #3549609e' }}>
                                            <Typography style={{ fontSize: '15px', color: '#354960', textAlign: 'center' }}>Close</Typography>
                                        </div>
                                    </button>
                                </div>
                            </div>
Riri Novita's avatar
Riri Novita committed
2090 2091 2092
                        </div>
                    </div>
                )}
Deni Rinaldi's avatar
Deni Rinaldi committed
2093
            </div>
Riri Novita's avatar
Riri Novita committed
2094
        );
Deni Rinaldi's avatar
Deni Rinaldi committed
2095 2096
    }
}