HomePage.js 25.5 KB
Newer Older
Deni Rinaldi's avatar
Deni Rinaldi committed
1
import React, { Component } from 'react';
Deni Rinaldi's avatar
Deni Rinaldi committed
2
import { Typography, MuiThemeProvider, createMuiTheme, Paper } from '@material-ui/core';
Deni Rinaldi's avatar
Deni Rinaldi committed
3
import MUIDataTable from "mui-datatables";
Deni Rinaldi's avatar
Deni Rinaldi committed
4
import Images from '../assets/Images';
Deni Rinaldi's avatar
Deni Rinaldi committed
5
import DonutChart from 'react-d3-donut';
d.arizona's avatar
d.arizona committed
6 7
import Constant from '../library/Constant';
import api from '../api';
d.arizona's avatar
d.arizona committed
8
import { Link } from 'react-router-dom';
d.arizona's avatar
d.arizona committed
9
import { PropagateLoader } from 'react-spinners';
d.arizona's avatar
d.arizona committed
10
import { titleCase } from '../library/Utils';
Deni Rinaldi's avatar
Deni Rinaldi committed
11

Deni Rinaldi's avatar
Deni Rinaldi committed
12 13 14
var ct = require("../library/CustomTable");
const getMuiTheme = () => createMuiTheme(ct.customTable());

Deni Rinaldi's avatar
Deni Rinaldi committed
15
class HomePage extends Component {
d.arizona's avatar
d.arizona committed
16 17 18
    constructor(props) {
        super(props)
        this.state = {
d.arizona's avatar
d.arizona committed
19
            userData: null,
Deni Rinaldi's avatar
Deni Rinaldi committed
20 21 22 23 24 25
            listDashboard: [],
            listMasterBudget: [
                { nama: 'Triputra Agro Persada', status: 'complete' },
                { nama: 'Puninar Infinite Raya', status: 'complete' },
                { nama: 'Dharma Group', status: 'overdue' },
                { nama: 'Daya Group', status: 'open' },
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
26
            ],
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
27
            isApprover: true,
Deni Rinaldi's avatar
Deni Rinaldi committed
28 29
            listSubcoMB: [],
            valueSubmit: 0,
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
30
            listdmb: [],
Deni Rinaldi's avatar
Deni Rinaldi committed
31 32
            dataTableMB: [],
            loading: false
d.arizona's avatar
d.arizona committed
33 34 35 36
        }
    }

    componentDidMount() {
Deni Rinaldi's avatar
Deni Rinaldi committed
37
        this.setState({ loading: true })
d.arizona's avatar
d.arizona committed
38 39 40
        let userId = localStorage.getItem(Constant.USER)
        api.create().getDetailUser(userId).then((response) => {
            if (response.data) {
Deni Rinaldi's avatar
Deni Rinaldi committed
41
                if (response.data.status === 'success') {
Deni Rinaldi's avatar
Deni Rinaldi committed
42
                    this.setState({ userData: response.data.data }, () => {
Deni Rinaldi's avatar
Deni Rinaldi committed
43
                        // console.log(this.state.userData)
d.arizona's avatar
d.arizona committed
44 45 46 47
                    })
                }
            }
        })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
48 49 50 51 52 53 54 55 56 57
        // api.create().checkApprover().then(response => {
        //     console.log(response);
        //     if (response.data.data.is_approver === true) {
        //         this.setState({ isApprover: true }, () =>
        //             this.getDashboard())
        //     } else {
        //         this.setState({ isApprover: false })
        //     }
        // })
        this.getApprMat()
Deni Rinaldi's avatar
Deni Rinaldi committed
58
        this.getListUserSubco()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
59
        this.getDashboardMB()
d.arizona's avatar
d.arizona committed
60
        this.getDashboard()
d.arizona's avatar
d.arizona committed
61 62
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
63
    componentDidUpdate() {
d.arizona's avatar
d.arizona committed
64
        window.onpopstate = e => {
Deni Rinaldi's avatar
Deni Rinaldi committed
65 66
            //your code...
            this.props.selectIndex('Home')
d.arizona's avatar
d.arizona committed
67 68 69
        }
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
70 71
    getListUserSubco() {
        api.create().getDashboardUser().then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
72
            // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
73 74 75 76 77 78 79 80 81 82
            let valueSubmit = 0
            if (response.data) {
                if (response.data.status === "success") {
                    response.data.data.map((item, index) => {
                        if (item.is_submit === true) {
                            valueSubmit += 1
                        }
                    })
                    this.setState({
                        listSubcoMB: response.data.data,
Deni Rinaldi's avatar
Deni Rinaldi committed
83 84
                        valueSubmit,
                        loading: false
Deni Rinaldi's avatar
Deni Rinaldi committed
85 86 87 88 89 90
                    })
                }
            }
        })
    }

d.arizona's avatar
d.arizona committed
91 92
    getDashboard() {
        let listDashboard = []
d.arizona's avatar
d.arizona committed
93
        let rawData = []
d.arizona's avatar
d.arizona committed
94
        api.create().getDashboard().then((response) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
95
            // console.log(response);
d.arizona's avatar
d.arizona committed
96 97
            if (String(response.data.status).toLocaleLowerCase() == 'success') {
                let data = response.data.data
Deni Rinaldi's avatar
Deni Rinaldi committed
98
                data.map((item, index) => {
d.arizona's avatar
d.arizona committed
99 100
                    let statusConvert = item.status == 'approval_review'? 'Waiting For Review' : item.status == 'approval_proccess'? 'Waiting For Approval' : titleCase(item.status) 
                    listDashboard.push([index + 1, item.approval_id, item.company_name, `${item.type_report} - ${item.periode}`, item.revision, item.status, statusConvert])
d.arizona's avatar
d.arizona committed
101
                    rawData.push(item)
d.arizona's avatar
d.arizona committed
102
                })
d.arizona's avatar
d.arizona committed
103
                this.setState({ listDashboard, rawData })
d.arizona's avatar
d.arizona committed
104 105
            }
        })
d.arizona's avatar
d.arizona committed
106 107
    }

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
108
    getApprMat() {
d.arizona's avatar
d.arizona committed
109
        this.setState({loading: true})
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
110
        api.create().getAM().then((response) => {
r.kurnia's avatar
r.kurnia committed
111 112
            console.log(response);
            let actAMActive = []
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
113
            let actAM = response.data.data.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
114
                if (String(item.status).toLocaleLowerCase() == 'active') {
r.kurnia's avatar
r.kurnia committed
115
                    actAMActive.push(item)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
116 117 118 119
                    return item
                }
            })
            let userId = localStorage.getItem(Constant.USER)
r.kurnia's avatar
r.kurnia committed
120
            let indexId = actAMActive.findIndex((val) => val.user_id == userId)
Deni Rinaldi's avatar
Deni Rinaldi committed
121
            if (indexId === -1) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
122
                this.setState({ isApprover: false })
Deni Rinaldi's avatar
Deni Rinaldi committed
123
                this.getListUserSubco()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
124
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
125
            this.getDashboardMB()
Deni Rinaldi's avatar
Deni Rinaldi committed
126
            // console.log(actAM)
d.arizona's avatar
d.arizona committed
127
            this.setState({loading: false})
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
128 129 130
        })
    }

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
131
    getDashboardMB() {
Deni Rinaldi's avatar
Deni Rinaldi committed
132
        api.create().getDashboardMB().then((response) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
133
            // console.log(response)
Deni Rinaldi's avatar
Deni Rinaldi committed
134
            if (String(response.data.status).toLocaleLowerCase() == 'success') {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
135 136 137 138 139 140 141 142
                let data = response.data.data
                let listdmb = data.sort((a, b) => a.company_id - b.company_id).map((item, index) => {
                    return [
                        item.company_name,
                        item.master_budget,
                        item.operating_indicator
                    ]
                })
Deni Rinaldi's avatar
Deni Rinaldi committed
143
                this.setState({ dataTableMB: listdmb, loading: false })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
144 145 146 147
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
148
    render() {
d.arizona's avatar
d.arizona committed
149 150 151 152 153 154 155
        const columns = ["#", "ID", "Company", "Report Type", "Revision", 
        {
            name: "",
            options: {
                display: false
            }
        }, 'Status', {
Deni Rinaldi's avatar
Deni Rinaldi committed
156 157 158
            name: "Action",
            options: {
                customBodyRender: (val, tableMeta) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
159
                    // console.log(tableMeta);
Deni Rinaldi's avatar
Deni Rinaldi committed
160 161
                    return (
                        <div style={{ display: 'flex' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
162 163
                            <Link to={{
                                pathname: `/home/master-budget/`,
Deni Rinaldi's avatar
Deni Rinaldi committed
164
                                state: {
Deni Rinaldi's avatar
Deni Rinaldi committed
165 166 167 168
                                    userType: 'approver',
                                    rawData: this.state.rawData[tableMeta.rowIndex]
                                }
                            }}>
d.arizona's avatar
d.arizona committed
169 170 171 172 173 174 175 176 177 178 179 180
                                <button
                                    style={{
                                        backgroundColor: 'transparent',
                                        cursor: 'pointer',
                                        borderColor: 'transparent',
                                        marginRight: 10
                                    }}
                                    onClick={() => null}
                                >
                                    <img src={Images.editCopy2} />
                                </button>
                            </Link>
Deni Rinaldi's avatar
Deni Rinaldi committed
181 182 183 184 185 186 187 188 189 190 191 192 193
                        </div >
                    );
                }
            }
        }]
        const data = [
            ["1", "TRIPUTRA AGRO PERSADA", "Laporan Bulanan - September 2020", "1 (20 Oktober 2020)", "Belum Disetujui"],
            ["2", "DAYA GROUP", "Laporan Bulanan - September 2020", "1 (20 Oktober 2020)", "Belum Disetujui"],
            ["3", "PUNINAR INFINITE RAYA", "Budget Tahunan 2021", "0 (20 Oktober 2020)", "Belum Disetujui"],
            ["4", "DHARMA GROUP", "Laporan Bulanan - September 2020", "0 (20 Oktober 2020)", "Belum Disetujui"],
            ["5", "PUNINAR INFINITE RAYA", "Budget Tahunan 2021", "0 (20 Oktober 2020)", "Belum Disetujui"],
        ]
        const options = {
d.arizona's avatar
d.arizona committed
194
            filter: true,
Deni Rinaldi's avatar
Deni Rinaldi committed
195 196 197 198 199
            sort: false,
            responsive: "scroll",
            print: false,
            download: false,
            selectableRows: false,
d.arizona's avatar
d.arizona committed
200
            viewColumns: true,
Deni Rinaldi's avatar
Deni Rinaldi committed
201
            rowsPerPage: 5,
d.arizona's avatar
d.arizona committed
202
            search: true
Deni Rinaldi's avatar
Deni Rinaldi committed
203
        }
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
204 205 206

        const columnsMB = ["Company", "Master Budget & CAT", "Operating Indicator"]

Deni Rinaldi's avatar
Deni Rinaldi committed
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
        const dataChart = [{
            count: 90,
            color: '#5198ea',
            name: 'My name',
        }, {
            count: 10,
            color: '#ffd600',
            name: 'name',
        }]
        const dataChart2 = [{
            count: 90,
            color: '#f65a4c',
            name: 'My name',
        }, {
            count: 10,
            color: '#5198ea',
            name: 'name',
        }]
        const dataChart3 = [{
            count: 90,
            color: '#4caf51',
            name: 'My name',
        }, {
            count: 10,
            color: '#f65a4c',
            name: 'name',
        }]
d.arizona's avatar
d.arizona committed
234 235 236 237 238 239 240 241 242 243
        const loadingComponent = (
            <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );
Deni Rinaldi's avatar
Deni Rinaldi committed
244
        return (
d.arizona's avatar
d.arizona committed
245
            <div style={{ flex: 1, backgroundColor: '#f8f8f8', minHeight: this.props.height }}>
d.arizona's avatar
d.arizona committed
246
                {this.state.loading && loadingComponent}
Deni Rinaldi's avatar
Deni Rinaldi committed
247
                {this.state.isApprover === true ?
Deni Rinaldi's avatar
Deni Rinaldi committed
248
                    <div>
Deni Rinaldi's avatar
Deni Rinaldi committed
249 250 251 252 253
                        <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                            <Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData === null ? '' : `Welcome, ${this.state.userData.fullname} !`}</Typography>
                        </div>
                        <div style={{ flex: 1, padding: 20, width: '100%' }}>
                            <div style={{ display: 'flex' }}>
d.arizona's avatar
d.arizona committed
254
                                <Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Waiting Your Approval</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
255 256
                            </div>

Deni Rinaldi's avatar
Deni Rinaldi committed
257 258 259 260 261 262 263 264
                        </div>
                        <div style={{ flex: 1, padding: 20, width: '100%' }}>
                            <div>
                                <MuiThemeProvider theme={getMuiTheme()}>
                                    <MUIDataTable
                                        data={this.state.listDashboard}
                                        columns={columns}
                                        options={options}
Deni Rinaldi's avatar
Deni Rinaldi committed
265
                                    />
Deni Rinaldi's avatar
Deni Rinaldi committed
266 267
                                </MuiThemeProvider>
                            </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
268 269 270 271 272 273 274 275 276 277 278 279
                            <div style={{ marginTop: 20 }}>
                                <Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Master Budget & CAT</Typography>
                                <div style={{ marginTop: 10, width: '100%' }}>
                                    <MuiThemeProvider theme={getMuiTheme()}>
                                        <MUIDataTable
                                            data={this.state.dataTableMB}
                                            columns={columnsMB}
                                            options={options}
                                        />
                                    </MuiThemeProvider>
                                </div>
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
280
                            {/* <div style={{ marginTop: 20 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
281 282 283 284 285 286 287 288 289 290 291 292 293
                                <Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Status Laporan</Typography>
                                <div style={{ marginTop: 10, display: 'flex' }}>
                                    <div style={{ width: 280, height: 400, padding: 20, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4', marginRight: 25 }}>
                                        <Typography style={{ color: '#4b4b4b', fontSize: '24px', fontWeight: 'bold' }}>Budget Tahunan - 2021</Typography>
                                        <div style={{ textAlign: 'center' }}>
                                            <DonutChart
                                                innerRadius={70}
                                                outerRadius={100}
                                                transition={true}
                                                pieClass="pie1"
                                                displayTooltip={true}
                                                strokeWidth={3}
                                                data={dataChart} />
Deni Rinaldi's avatar
Deni Rinaldi committed
294
                                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
                                        <div style={{ display: 'flex', width: '100%', marginTop: 10 }}>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>Submit</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>92.8 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.red} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>-0.6%</Typography>
                                                </div>
                                            </div>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>On Time</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>6.1 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.green} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>0.7%</Typography>
                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
311

Deni Rinaldi's avatar
Deni Rinaldi committed
312 313 314 315 316 317 318 319 320
                                            </div>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>Overdue</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>1.1 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.green} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>0.1%</Typography>
                                                </div>
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
321 322
                                        </div>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
323 324 325 326 327 328 329 330 331 332 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 362

                                    <div style={{ width: 280, height: 400, padding: 20, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4', marginRight: 25 }}>
                                        <Typography style={{ color: '#4b4b4b', fontSize: '24px', fontWeight: 'bold' }}>Laporan Bulanan - Oct 2020</Typography>
                                        <div style={{ textAlign: 'center' }}>
                                            <DonutChart
                                                innerRadius={70}
                                                outerRadius={100}
                                                transition={true}
                                                pieClass="pie5"
                                                displayTooltip={true}
                                                strokeWidth={3}
                                                data={dataChart2}
                                            />
                                        </div>
                                        <div style={{ display: 'flex', width: '100%', marginTop: 10 }}>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>Submit</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>92.8 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.red} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>-0.6%</Typography>
                                                </div>
                                            </div>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>On Time</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>6.1 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.green} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>0.7%</Typography>
                                                </div>

                                            </div>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>Overdue</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>1.1 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.green} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>0.1%</Typography>
                                                </div>
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
363 364
                                        </div>
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
365 366 367 368 369 370 371 372 373 374 375 376
                                    <div style={{ width: 280, height: 400, padding: 20, backgroundColor: 'white', borderRadius: 6, border: 'solid 1px #c4c4c4', }}>
                                        <Typography style={{ color: '#4b4b4b', fontSize: '24px', fontWeight: 'bold', height: 71 }}>Lainnya</Typography>
                                        <div style={{ textAlign: 'center' }}>
                                            <DonutChart
                                                innerRadius={70}
                                                outerRadius={100}
                                                transition={true}
                                                pieClass="pie2"
                                                displayTooltip={true}
                                                strokeWidth={3}
                                                data={dataChart3}
                                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
377
                                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
                                        <div style={{ display: 'flex', width: '100%', marginTop: 10 }}>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>Submit</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>92.8 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.red} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>-0.6%</Typography>
                                                </div>
                                            </div>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>On Time</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>6.1 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.green} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>0.7%</Typography>
                                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
394

Deni Rinaldi's avatar
Deni Rinaldi committed
395 396 397 398 399 400 401 402 403
                                            </div>
                                            <div style={{ width: '33%' }}>
                                                <Typography style={{ color: '#656565', fontSize: '15px', textAlign: 'left' }}>Overdue</Typography>
                                                <Typography style={{ color: '#656565', fontSize: '20px', textAlign: 'left' }}>1.1 %</Typography>
                                                <div style={{ display: 'flex' }} >
                                                    <img src={Images.green} />
                                                    <Typography style={{ color: '#656565', fontSize: '14px', textAlign: 'left' }}>0.1%</Typography>
                                                </div>
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
404 405 406
                                        </div>
                                    </div>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
407
                            </div> */}
Deni Rinaldi's avatar
Deni Rinaldi committed
408
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
409
                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
410 411 412 413 414 415 416
                    :
                    <div>
                        <div className={"main-color"} style={{ height: 78, flex: 1, display: 'flex', alignItems: 'center', paddingLeft: 20 }}>
                            <Typography style={{ fontSize: '24px', color: 'white' }}>{this.state.userData === null ? '' : `Welcome, ${this.state.userData.fullname} !`}</Typography>
                        </div>
                        <div style={{ flex: 1, padding: 20, width: '100%' }}>
                            <div style={{ display: 'flex' }}>
d.arizona's avatar
d.arizona committed
417
                                <Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Tasks to be Complete</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
418 419 420
                            </div>
                        </div>
                        <div style={{ flex: 1, padding: 20, width: '100%' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
421 422 423
                            <Paper style={{ width: 450, padding: 20, borderRadius: 10 }}>
                                <Typography style={{ fontWeight: 'bold', textDecorationLine: 'underline' }}>{`Master Budget ${this.state.valueSubmit}/${this.state.listSubcoMB.length}`}</Typography>
                                {this.state.listSubcoMB.map((item, index) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
424 425 426
                                    return (
                                        <div style={{ display: 'flex', justifyContent: 'space-between', marginTop: 10, paddingLeft: 10 }}>
                                            <div style={{ display: 'flex' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
                                                <img src={item.is_submit === true ? Images.dotDone : item.is_overdue === true ? Images.dotOverdue : Images.dotOpen} />
                                                <Link to={{
                                                    pathname: `/home/master-budget/`,
                                                    state: {
                                                        userType: 'user',
                                                        rawData: item
                                                    }
                                                }}>
                                                    <button
                                                        style={{
                                                            backgroundColor: 'transparent',
                                                            cursor: 'pointer',
                                                            borderColor: 'transparent',
                                                            margin: 5,
                                                            outline: 'none'
                                                        }}>
                                                        <Typography style={{ marginLeft: 10, color: '#5198ea', fontSize: 13 }}>{item.company_name}</Typography>
                                                    </button>
                                                </Link>
Deni Rinaldi's avatar
Deni Rinaldi committed
446
                                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
447
                                            {item.is_overdue && (
Deni Rinaldi's avatar
Deni Rinaldi committed
448 449 450 451 452 453 454 455 456 457 458
                                                <div style={{ backgroundColor: '#f65a4c', paddingRight: 5, paddingLeft: 5, borderRadius: 5, alignSelf: 'center' }}>
                                                    <Typography style={{ fontSize: 11, color: '#fff' }}>Overdue</Typography>
                                                </div>
                                            )}
                                        </div>
                                    )
                                })}
                            </Paper>
                        </div>
                    </div>
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
459 460
            </div>
        );
461

Deni Rinaldi's avatar
Deni Rinaldi committed
462 463 464
    }
}

Deni Rinaldi's avatar
Deni Rinaldi committed
465
export default HomePage;