BalanceSheetRO.js 50.7 KB
Newer Older
1
import { createMuiTheme, FormControlLabel, Input, Snackbar, MuiThemeProvider, Paper, 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'
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import ReactTooltip from 'react-tooltip';
import Images from '../../assets/Images';
import api from '../../api';
import NumberFormat from 'react-number-format';
import { type } from 'ramda';
import { PropagateLoader } from 'react-spinners';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import Constant from '../../library/Constant';
import * as R from 'ramda';
import { Alert } from '@material-ui/lab';

const LightTooltip = withStyles((theme) => ({
    tooltip: {
        backgroundColor: theme.palette.common.white,
        color: 'rgba(0, 0, 0, 0.87)',
        boxShadow: theme.shadows[1],
        fontSize: 11,
    },
}))(Tooltip);
Deni Rinaldi's avatar
Deni Rinaldi committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

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

const options = ct.customOptionsFixedColumn();

const style = {
    position: "sticky",
    left: 0,
    zIndex: 101,
    background: "white",
};
const style2 = {
    position: "sticky",
    background: "white",
    zIndex: 100
};

export default class BalanceSheetRO extends Component {
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
    constructor(props) {
        super(props)
        this.state = {
            dataTable: [],
            loading: true,
            get_for: "view",
        }
    }

    componentDidMount() {
        this.getItemHierarki()
    }

    getItemHierarki() {
        this.setState({ loading: true, judulColumn: null })
        let payload = {
            "company_id": this.props.company.company_id,
            "get_for": this.state.get_for,
            "months": 0,
            "periode": this.props.periode,
            "report_id": this.props.report_id,
            "revision": Number(this.props.revision),
            "rolling_outlook_id": this.props.rollingOutlookID
        }
        api.create().getRollingOutlookBS(payload).then(response => {
            console.log(response);
            let dataTable = []
            if (response.data) {
                if (response.data.status == 'success') {
                    let res = response.data.data
                    const handlePushChild = (item) => {
                        let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
                        if (indexIDzz === -1) {
                            dataTable.push([
                                item.type_report_id,
                                item.id,
                                item.parent,
                                item.formula,
                                item.level,
                                item.description,
                                item.balance_sheet.total_december_last_year === "" ? "0" : item.balance_sheet.total_december_last_year,
                                item.balance_sheet.january === "" ? "0" : item.balance_sheet.january,
                                item.balance_sheet.february === "" ? "0" : item.balance_sheet.february,
                                item.balance_sheet.march === "" ? "0" : item.balance_sheet.march,
                                item.balance_sheet.april === "" ? "0" : item.balance_sheet.april,
                                item.balance_sheet.may === "" ? "0" : item.balance_sheet.may,
                                item.balance_sheet.june === "" ? "0" : item.balance_sheet.june,
                                item.balance_sheet.july === "" ? "0" : item.balance_sheet.july,
                                item.balance_sheet.august === "" ? "0" : item.balance_sheet.august,
                                item.balance_sheet.september === "" ? "0" : item.balance_sheet.september,
                                item.balance_sheet.october === "" ? "0" : item.balance_sheet.october,
                                item.balance_sheet.november === "" ? "0" : item.balance_sheet.november,
                                item.balance_sheet.december === "" ? "0" : item.balance_sheet.december,
                                item.balance_sheet.total_december_year === "" ? "0" : item.balance_sheet.total_december_year,
                                item.order,
                                item.condition_it_should_be,
                                item.condition_if_wrong
                            ])
                        }
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
                        }
                    }
                    res.map((item, index) => {
                        dataTable.push([
                            item.type_report_id,
                            item.id,
                            item.parent,
                            item.formula,
                            item.level,
                            item.description,
                            item.balance_sheet.total_december_last_year === "" ? "0" : item.balance_sheet.total_december_last_year,
                            item.balance_sheet.january === "" ? "0" : item.balance_sheet.january,
                            item.balance_sheet.february === "" ? "0" : item.balance_sheet.february,
                            item.balance_sheet.march === "" ? "0" : item.balance_sheet.march,
                            item.balance_sheet.april === "" ? "0" : item.balance_sheet.april,
                            item.balance_sheet.may === "" ? "0" : item.balance_sheet.may,
                            item.balance_sheet.june === "" ? "0" : item.balance_sheet.june,
                            item.balance_sheet.july === "" ? "0" : item.balance_sheet.july,
                            item.balance_sheet.august === "" ? "0" : item.balance_sheet.august,
                            item.balance_sheet.september === "" ? "0" : item.balance_sheet.september,
                            item.balance_sheet.october === "" ? "0" : item.balance_sheet.october,
                            item.balance_sheet.november === "" ? "0" : item.balance_sheet.november,
                            item.balance_sheet.december === "" ? "0" : item.balance_sheet.december,
                            item.balance_sheet.total_december_year === "" ? "0" : item.balance_sheet.total_december_year,
                            item.order,
                            item.condition_it_should_be,
                            item.condition_if_wrong
                        ])
                        if (item.children !== null) {
                            if (item.children.length > 0) {
                                item.children.map((items, indexs) => {
                                    handlePushChild(items)
                                })
                            }
                        }
                    })
                    // console.log(dataTable)
                    this.setState({ dataTable, loading: false, buttonError: true, editable: true })
                } else {
                    this.setState({ loading: false, alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                        if (response.data.message.includes("Someone Logged In")) {
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
                this.setState({ dataTable, loading: false, buttonError: true, editable: true })
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
162
    render() {
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
        // let dataTable = [
        //     ["Total Assets", "1"],
        // ]
        let columns = [
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
                name: "",
                options: {
                    display: false
                }
            },
            {
Deni Rinaldi's avatar
Deni Rinaldi committed
198 199 200 201 202 203 204 205 206 207 208
            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 }}>
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
                            {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>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
227 228 229 230 231
                        </div>
                    )
                }
            }
        }, {
232
            name: `31 Dec ${Number(this.props.periode) - 1 } Actual`,
Deni Rinaldi's avatar
Deni Rinaldi committed
233 234
            options: {
                customHeadRender: (columnMeta) => (
235 236
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
237 238 239
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
240
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
241 242
                    return (
                        <div style={{ textAlign: 'right' }}>
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
272 273 274 275 276
                        </div>
                    )
                }
            }
        }, {
277
            name: `Jan ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
278 279
            options: {
                customHeadRender: (columnMeta) => (
280 281
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
282 283 284
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
285
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
286 287
                    return (
                        <div style={{ textAlign: 'right' }}>
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
317 318 319 320 321
                        </div>
                    )
                }
            }
        }, {
322
            name: `Feb ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
323 324
            options: {
                customHeadRender: (columnMeta) => (
325 326
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
327 328 329
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
330
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
331 332
                    return (
                        <div style={{ textAlign: 'right' }}>
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
362 363 364 365 366
                        </div>
                    )
                }
            }
        }, {
367
            name: `Mar ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
368 369
            options: {
                customHeadRender: (columnMeta) => (
370 371
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
372 373 374
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
375
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
376 377
                    return (
                        <div style={{ textAlign: 'right' }}>
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
407 408 409 410 411
                        </div>
                    )
                }
            }
        }, {
412
            name: `Apr ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
413 414
            options: {
                customHeadRender: (columnMeta) => (
415 416
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
417 418 419
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
420
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
421 422
                    return (
                        <div style={{ textAlign: 'right' }}>
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
452 453 454 455 456
                        </div>
                    )
                }
            }
        }, {
457
            name: `May ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
458 459
            options: {
                customHeadRender: (columnMeta) => (
460 461
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
462 463 464
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
465
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
466 467
                    return (
                        <div style={{ textAlign: 'right' }}>
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
497 498 499 500 501
                        </div>
                    )
                }
            }
        }, {
502
            name: `Jun ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
503 504
            options: {
                customHeadRender: (columnMeta) => (
505 506
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
507 508 509
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
510
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
511 512
                    return (
                        <div style={{ textAlign: 'right' }}>
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
542 543 544 545 546
                        </div>
                    )
                }
            }
        }, {
547
            name: `Jul ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
548 549
            options: {
                customHeadRender: (columnMeta) => (
550 551
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
552 553 554
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
555
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
556 557
                    return (
                        <div style={{ textAlign: 'right' }}>
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
587 588 589 590 591
                        </div>
                    )
                }
            }
        }, {
592
            name: `Aug ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
593 594
            options: {
                customHeadRender: (columnMeta) => (
595 596
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
597 598 599
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
600
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
601 602
                    return (
                        <div style={{ textAlign: 'right' }}>
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
632 633 634 635 636
                        </div>
                    )
                }
            }
        }, {
637
            name: `Sep ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
638 639
            options: {
                customHeadRender: (columnMeta) => (
640 641
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
642 643 644
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
645
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
646 647
                    return (
                        <div style={{ textAlign: 'right' }}>
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
677 678 679 680 681
                        </div>
                    )
                }
            }
        }, {
682
            name: `Oct ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
683 684
            options: {
                customHeadRender: (columnMeta) => (
685 686
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
687 688 689
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
690
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
691 692
                    return (
                        <div style={{ textAlign: 'right' }}>
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
722 723 724 725 726
                        </div>
                    )
                }
            }
        }, {
727
            name: `Nov ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
728 729
            options: {
                customHeadRender: (columnMeta) => (
730 731
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
732 733 734
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
735
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
736 737
                    return (
                        <div style={{ textAlign: 'right' }}>
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
767 768 769 770 771
                        </div>
                    )
                }
            }
        }, {
772
            name: `Dec ${this.props.periode}`,
Deni Rinaldi's avatar
Deni Rinaldi committed
773 774
            options: {
                customHeadRender: (columnMeta) => (
775 776
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
777 778 779
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
780
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
781 782
                    return (
                        <div style={{ textAlign: 'right' }}>
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
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
812 813 814 815 816
                        </div>
                    )
                }
            }
        }, {
817
            name: `${this.props.periode} Outlook`,
Deni Rinaldi's avatar
Deni Rinaldi committed
818 819
            options: {
                customHeadRender: (columnMeta) => (
820 821
                    <TableCell style={{ ...style2, top: 0, zIndex: 99, backgroundColor: '#1c71b8', width: 96, borderRight: '1px #fff solid' }}>
                        <Typography style={{ color: 'white', fontSize: 12, fontWeight: 'bold', textAlign: 'center' }}>{columnMeta.name}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
822 823 824
                    </TableCell>
                ),
                setCellProps: () => ({ style2 }),
825
                customBodyRender: (val, tableMeta, updateValue) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
826 827
                    return (
                        <div style={{ textAlign: 'right' }}>
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856
                            {tableMeta.rowData[0] === 4 || tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 7 ?
                                null :
                                this.state.get_for == 'view' ? 
                                    <NumberFormat
                                        thousandSeparator={true}
                                        style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                        type="text"
                                        placeholder=""
                                        disabled={true}
                                        value={Number(val).toFixed(1)}
                                    />
                                :
                                <div style={{ flex: 1 }}>
                                    <FormControlLabel
                                        style={{ margin: 0 }}
                                        value={val}
                                        control={
                                            <NumberFormat
                                                thousandSeparator={true}
                                                style={{ fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
                                                type="text"
                                                placeholder=""
                                                disabled={true}
                                                value={Number(val).toFixed(1)}
                                            />
                                        }
                                    />
                                </div>
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
857 858 859 860 861 862
                        </div>
                    )
                }
            }
        },
        ]
863 864 865 866 867 868 869 870 871 872 873 874

        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
875 876
        return (
            <div style={{ height: this.props.height, backgroundColor: '#f8f8f8', marginBottom: 100, minHeight: 1000 }}>
877
                {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
878 879 880 881 882 883 884 885 886 887 888
                <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                    <Typography style={{ fontSize: '16px', color: 'white' }}>Rolling Outlook & Revision CAT</Typography>
                </div>
                <div style={{ flex: 1, padding: 20, width: '100%' }}>
                    <Paper style={{ paddingTop: 10, paddingBottom: 20 }}>
                        <div style={{ borderBottom: 'solid 1px #c4c4c4' }} >
                            <Typography style={{ fontSize: '12px', color: '#4b4b4b', margin: 10 }}>Rolling Outlook - Balance Sheet</Typography>
                        </div>
                        <div style={{ padding: 20 }}>
                            <div style={{ display: 'flex', justifyContent: 'space-between' }}>
                                <div>
889 890
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{this.props.company.company_name}</Typography>
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Period : {this.props.periode} (rev.{this.props.revision})</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
891 892 893 894
                                    <Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>in IDR mn</Typography>
                                </div>
                            </div>
                            <div style={{ marginTop: 20, width: this.props.width - (this.props.open === true ? 400 : 150) }}>
895
                            {!this.state.loading && (
Deni Rinaldi's avatar
Deni Rinaldi committed
896 897
                                <MuiThemeProvider theme={getMuiTheme()}>
                                    <MUIDataTable
898
                                        data={this.state.dataTable}
Deni Rinaldi's avatar
Deni Rinaldi committed
899 900 901 902
                                        columns={columns}
                                        options={options}
                                    />
                                </MuiThemeProvider>
903
                            )}
Deni Rinaldi's avatar
Deni Rinaldi committed
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
                            </div>
                        </div>
                        <div className="grid grid-2x" style={{ marginTop: 20 }}>
                            <div className="col-1">
                                <button
                                    type="button"
                                    onClick={() => this.setState({ loading: true }, () => {
                                        setTimeout(() => {
                                            this.props.onClickClose()
                                        }, 100);
                                    })}
                                    style={{
                                        backgroundColor: 'transparent',
                                        cursor: 'pointer',
                                        borderColor: 'transparent',
                                        outline: 'none'
                                    }}
                                >
                                    <div style={{ backgroundColor: '#019ce5', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
                                        <Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Cancel</Typography>
                                    </div>
                                </button>
                            </div>
                        </div>
                    </Paper>
                </div>
            </div>
        )
    }
}