KPIs.js 36.6 KB
Newer Older
Riri Novita's avatar
Riri Novita committed
1
import React, { Component } from 'react'
Deni Rinaldi's avatar
Deni Rinaldi committed
2
import { Checkbox, FormControlLabel, Menu, Paper, Typography, Button } from '@material-ui/core'
Deni Rinaldi's avatar
Deni Rinaldi committed
3
import LineChart from 'react-linechart';
Riri Novita's avatar
Riri Novita committed
4
import Images from '../../assets/Images'
d.arizona's avatar
d.arizona committed
5
import NumberFormat from 'react-number-format';
d.arizona's avatar
d.arizona committed
6
import ReactECharts from 'echarts-for-react';
Riri Novita's avatar
Riri Novita committed
7 8

export default class StrategiMap extends Component {
Deni Rinaldi's avatar
Deni Rinaldi committed
9 10 11
    constructor(props) {
        super(props)
        this.state = {
Deni Rinaldi's avatar
Deni Rinaldi committed
12 13 14 15 16
            openMenu: false,
            dataStrategy: this.props.data.kpi.category,
            checkAll: true,
            checkYTD: true,
            checkAB: true,
d.arizona's avatar
d.arizona committed
17 18 19
            checkYoy: true,
            loading: false,
            dataStrategyNew: []
Deni Rinaldi's avatar
Deni Rinaldi committed
20 21 22 23
        }
    }

    componentDidMount() {
d.arizona's avatar
d.arizona committed
24
        this.setState({ loading: true })
d.arizona's avatar
d.arizona committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 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
        this.olahDataKPI()
    }

    olahDataKPI() {
        console.log(this.state.dataStrategy)
        let arrayNew = this.state.dataStrategyNew
        this.state.dataStrategy.map((item, index) => {
            let arrayNodes = []
            item.nodes.map((itemz, indexz) => {
                let act = []
                let mbv = []
                let yoy = []
                let minACT = 0
                let maxACT = 0
                let minMBV = 0
                let maxMBV = 0
                let minYOY = 0
                let maxYOY = 0
                itemz.trends.map((items, indexs) => {
                    act.push(items.nodes_actual_value)
                    mbv.push(items.nodes_mb_value)
                    yoy.push(items.nodes_yoy_value)

                    if (minACT > items.nodes_actual_value) {
                        minACT = items.nodes_actual_value
                    }
                    if (maxACT < items.nodes_actual_value) {
                        maxACT = items.nodes_actual_value
                    }
                    if (minMBV > items.nodes_mb_value) {
                        minMBV = items.nodes_mb_value
                    }
                    if (maxMBV < items.nodes_mb_value) {
                        maxMBV = items.nodes_mb_value
                    }
                    if (minYOY > items.nodes_yoy_value) {
                        minYOY = items.nodes_yoy_value
                    }
                    if (maxYOY < items.nodes_yoy_value) {
                        maxYOY = items.nodes_yoy_value
                    }
                })
                let sortMin = []
                let sortMax = []
                if (this.state.checkAll) {
                    sortMin = [minACT, minMBV, minYOY].sort((a, b) => a - b)
                    sortMax = [maxACT, maxMBV, maxYOY].sort((a, b) => b - a)
                } else if (this.state.checkAB && this.state.checkYTD && !this.state.checkYoy) {
                    sortMin = [minACT, minMBV].sort((a, b) => a - b)
                    sortMax = [maxACT, maxMBV].sort((a, b) => b - a)
                } else if (this.state.checkAB && !this.state.checkYTD && this.state.checkYoy) {
                    sortMin = [minACT, minYOY].sort((a, b) => a - b)
                    sortMax = [maxACT, maxYOY].sort((a, b) => b - a)
                } else if (this.state.checkAB && !this.state.checkYTD && !this.state.checkYoy) {
                    sortMin = [minMBV]
                    sortMax = [maxMBV]
                } else if (!this.state.checkAB && this.state.checkYTD && this.state.checkYoy) {
                    sortMin = [minMBV, minYOY].sort((a, b) => a - b)
                    sortMax = [maxMBV, maxYOY].sort((a, b) => b - a)
                } else if (!this.state.checkAB && this.state.checkYTD && !this.state.checkYoy) {
                    sortMin = [minMBV]
                    sortMax = [maxMBV]
                } else if (!this.state.checkAB && !this.state.checkYTD && this.state.checkYoy) {
                    sortMin = [minYOY]
                    sortMax = [maxYOY]
                }
d.arizona's avatar
d.arizona committed
91
                arrayNodes.push({ ...itemz, trends: { act, mbv, yoy, minACT, maxACT, minMBV, maxMBV, minYOY, maxYOY, sortMin, sortMax } })
d.arizona's avatar
d.arizona committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
            })
            arrayNew.push({ ...item, nodes: arrayNodes })
        })
        console.log(arrayNew)
        console.log(this.state.checkAll)
        this.setState({ dataStrategyNew: arrayNew }, () => {
            setTimeout(() => {
                this.setState({ loading: false })
            }, 500);
        })
    }

    handleAch(item) {
        let value = String(item)
        value = String(value).substr(0, String(value).length - 1)
        return Number(value)
Deni Rinaldi's avatar
Deni Rinaldi committed
108 109
    }

Riri Novita's avatar
Riri Novita committed
110
    render() {
Deni Rinaldi's avatar
Deni Rinaldi committed
111 112 113
        const data = [
            {
                color: "steelblue",
Deni Rinaldi's avatar
Deni Rinaldi committed
114 115 116 117 118
                points: [{ x: 1, y: 1 }, { x: 2, y: 2 }, { x: 3, y: -2 }]
            },
            {
                color: "green",
                points: [{ x: 1, y: 2 }, { x: 2, y: 3 }, { x: 3, y: 5 }]
Deni Rinaldi's avatar
Deni Rinaldi committed
119 120
            }
        ];
d.arizona's avatar
d.arizona committed
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

        const optionvv = {
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    crossStyle: {
                        color: '#999'
                    }
                }
            },
            grid: {
                left: 0,
                bottom: 0
            },
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: [150, 230, 224, 218, 135, 147, 260],
                type: 'line'
            }]
        };
d.arizona's avatar
d.arizona committed
148 149 150 151 152 153
        const newTitleCase = (val) => {
            let value = val
            return value.split(' ')
                .map(w => w[0].toUpperCase() + w.substr(1).toLowerCase())
                .join(' ')
        }
d.arizona's avatar
d.arizona committed
154 155 156 157 158 159 160 161 162 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
        const handleIsHigher = (item) => {
            let actMo = 0
            let prevMo = 0
            let isHigh = 'false'
            let trends = [...item.trends.act]
            let trendsLength = trends.length

            if (trendsLength < 2) {
                actMo = trends[0]
            } else {
                actMo = trends[trendsLength-1]
                prevMo = trends[trendsLength-2]
            }

            if (actMo > prevMo) {
                isHigh = 'true'
            } else if (actMo == prevMo) {
                isHigh = 'same'
            } else {
                isHigh = 'false'
            }

            return isHigh
        }
        const handleColorAch = (item) => {
            let actMR = 0
            let actMB = 0
            let isHigh = false
            let trendsAct = [...item.trends.act]
            let trendsMB = [...item.trends.mbv]
            let trendsActLength = trendsAct.length
            let trendsMBLength = trendsMB.length
            actMR = trendsAct[trendsActLength-1]
            actMB = trendsMB[trendsMBLength-1]

            if (actMR < actMB) {
                isHigh = false
            }  else {
                isHigh = true
            }
            
            return isHigh
        }
Riri Novita's avatar
Riri Novita committed
197
        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
198 199
            <div style={{ padding: 20, width: this.props.width }}>
                <Paper style={{ borderRadius: 10, boxShadow: '0 0 4px 0 rgba(0, 0, 0, 0.5)', padding: 20 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
                    <div>
                        <Button aria-controls="simple-menu" aria-haspopup="true" onClick={(e) => this.setState({ openMenu: e.currentTarget })}>
                            Filter
                        </Button>
                        <Menu
                            id="simple-menu"
                            anchorEl={this.state.openMenu}
                            keepMounted
                            open={Boolean(this.state.openMenu)}
                            onClose={() => this.setState({ openMenu: false })}
                        >
                            <div style={{ padding: 20 }}>
                                <div style={{ display: 'flex', borderBottom: 'solid 3px #979696' }}>
                                    <FormControlLabel
                                        control={
                                            <Checkbox
                                                checked={this.state.checkAll}
                                                onChange={() => {
                                                    this.setState({
                                                        checkAll: true,
                                                        checkYTD: true,
                                                        checkAB: true,
d.arizona's avatar
d.arizona committed
222 223 224 225
                                                        checkYoy: true,
                                                        loading: true,
                                                    }, () => {
                                                        setTimeout(() => {
d.arizona's avatar
d.arizona committed
226
                                                            this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
227
                                                        }, 500);
Deni Rinaldi's avatar
Deni Rinaldi committed
228 229 230 231 232 233 234 235 236 237 238 239
                                                    })
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        style={{ marginRight: 20 }}
                                        label={"Pilih Semua"}
                                    />
                                    <FormControlLabel
                                        control={
                                            <Checkbox
d.arizona's avatar
d.arizona committed
240
                                                checked={!this.state.checkAll && !this.state.checkYoy && !this.state.checkAB && !this.state.checkYTD}
Deni Rinaldi's avatar
Deni Rinaldi committed
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
                                                onChange={() => {
                                                    this.setState({
                                                        checkAll: false,
                                                        checkYTD: false,
                                                        checkAB: false,
                                                        checkYoy: false
                                                    })
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        label={"Hapus Semua"}
                                    />
                                </div>
                                <div style={{ display: 'grid' }}>
                                    <FormControlLabel
                                        control={
                                            <Checkbox
                                                checked={this.state.checkYTD}
                                                onChange={() => {
d.arizona's avatar
d.arizona committed
262
                                                    this.setState({
d.arizona's avatar
d.arizona committed
263 264
                                                        checkYTD: !this.state.checkYTD,
                                                        loading: true
d.arizona's avatar
d.arizona committed
265
                                                    }, () => {
d.arizona's avatar
d.arizona committed
266 267
                                                        this.setState({ checkAll: this.state.checkYoy && this.state.checkAB && this.state.checkYTD }, () => {
                                                            setTimeout(() => {
d.arizona's avatar
d.arizona committed
268
                                                                this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
269 270
                                                            }, 500);
                                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
271 272 273 274 275 276 277 278 279 280 281 282 283
                                                    })
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        label={"Tren YTD"}
                                    />
                                    <FormControlLabel
                                        control={
                                            <Checkbox
                                                checked={this.state.checkAB}
                                                onChange={() => {
d.arizona's avatar
d.arizona committed
284 285 286
                                                    this.setState({ checkAB: !this.state.checkAB, loading: true }, () => {
                                                        this.setState({ checkAll: this.state.checkYoy && this.state.checkAB && this.state.checkYTD }, () => {
                                                            setTimeout(() => {
d.arizona's avatar
d.arizona committed
287
                                                                this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
288 289
                                                            }, 500);
                                                        })
d.arizona's avatar
d.arizona committed
290
                                                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
291 292 293 294 295 296 297 298 299 300 301 302
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        label={"Actual vs Budget"}
                                    />
                                    <FormControlLabel
                                        control={
                                            <Checkbox
                                                checked={this.state.checkYoy}
                                                onChange={() => {
d.arizona's avatar
d.arizona committed
303 304 305
                                                    this.setState({ checkYoy: !this.state.checkYoy, loading: true }, () => {
                                                        this.setState({ checkAll: this.state.checkYoy && this.state.checkAB && this.state.checkYTD }, () => {
                                                            setTimeout(() => {
d.arizona's avatar
d.arizona committed
306
                                                                this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
307 308
                                                            }, 500);
                                                        })
d.arizona's avatar
d.arizona committed
309
                                                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
310 311 312 313 314 315 316 317 318 319 320
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        label={"Yoy"}
                                    />
                                </div>
                            </div>
                        </Menu>
                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
321 322
                    <div style={{ height: 56, backgroundColor: '#ffffff', display: 'flex', justifyContent: 'space-between', borderBottom: 'solid 3px #979696 ' }}>
                        <div style={{ display: 'grid', alignContent: 'center', width: '20%' }}>
Riri Novita's avatar
Riri Novita committed
323 324
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Category</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
325
                        <div style={{ display: 'grid', alignContent: 'center', width: '20%' }}>
Riri Novita's avatar
Riri Novita committed
326 327
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>KPI</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
328
                        <div style={{ display: 'grid', alignContent: 'center', width: '25%' }}>
Riri Novita's avatar
Riri Novita committed
329 330
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Trends</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
331
                        <div style={{ display: 'grid', alignContent: 'center', width: '10%' }}>
d.arizona's avatar
d.arizona committed
332
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Current ({this.props.dataPayload.month.month_value})</Typography>
Riri Novita's avatar
Riri Novita committed
333
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
334
                        <div style={{ display: 'grid', alignContent: 'center', width: '10%' }}>
Riri Novita's avatar
Riri Novita committed
335 336
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Achievement</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
337 338 339
                        <div style={{ display: 'grid', alignContent: 'center', width: '5%' }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>vs Prev. Month</Typography>
                        </div>
Riri Novita's avatar
Riri Novita committed
340
                    </div>
d.arizona's avatar
d.arizona committed
341
                    {this.state.dataStrategyNew.map((i) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
342
                        i.nodes.map((item, index) => {
d.arizona's avatar
d.arizona committed
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
                            // let dataYTD = []
                            // let dataAB = []
                            // let dataYoy = []
                            // let option = []
                            // if (this.state.checkYTD === true) {
                            //     option.push({
                            //         color: "steelblue",
                            //         points: dataYTD
                            //     })
                            // }
                            // if (this.state.checkAB === true) {
                            //     option.push({
                            //         color: "#e3e16d",
                            //         points: dataAB
                            //     })
                            // }
                            // if (this.state.checkYoy === true) {
                            //     option.push({
                            //         color: "#f27f77",
                            //         points: dataYoy
                            //     })
                            // }
                            // item.trends.map((val, idx) => {
                            //     dataYTD.push({
                            //         x: idx + 1,
                            //         y: val.nodes_actual_value
                            //     })
                            //     dataAB.push({
                            //         x: idx + 1,
                            //         y: val.nodes_mb_value
                            //     })
                            //     dataYoy.push({
                            //         x: idx + 1,
                            //         y: val.nodes_yoy_value
                            //     })
                            // })
Deni Rinaldi's avatar
Deni Rinaldi committed
379 380 381
                            return (
                                <div style={{ backgroundColor: '#ffffff', display: 'flex', justifyContent: 'space-between', borderBottom: 'solid 3px #979696', padding: '10px 0px' }}>
                                    <div style={{ width: '20%', display: 'grid', alignContent: 'center' }}>
d.arizona's avatar
d.arizona committed
382
                                        <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{index > 0 ? '' : newTitleCase(String(i.category_name).toLocaleLowerCase())}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
383 384 385 386 387 388 389
                                    </div>
                                    <div style={{ width: '20%', display: 'grid', alignContent: 'center' }}>
                                        <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.item_name}</Typography>
                                        <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.unit}</Typography>
                                    </div>
                                    <div style={{ width: '25%', display: 'grid', alignContent: 'center' }}>
                                        <div style={{ marginLeft: -50 }}>
d.arizona's avatar
d.arizona committed
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
                                            {!this.state.loading && (this.state.checkAB || this.state.checkYTD || this.state.checkYoy) && <ReactECharts
                                                // showLoading={this.state.loading2}
                                                // lazyUpdate
                                                style={{ height: 350, width: '100%', marginTop: 20 }}
                                                option={{
                                                    tooltip: {
                                                        trigger: 'axis',
                                                        axisPointer: {
                                                            type: 'cross',
                                                            crossStyle: {
                                                                color: '#999'
                                                            }
                                                        }
                                                    },
                                                    legend: {
                                                        data:
                                                            this.state.checkAll ?
                                                                ['Actual', 'MB', 'Yoy']
                                                                :
                                                                (this.state.checkAB && this.state.checkYTD && !this.state.checkYoy ?
                                                                    ['Actual', 'MB']
                                                                    :
                                                                    (this.state.checkAB && !this.state.checkYTD && this.state.checkYoy ?
                                                                        ['Actual', 'Yoy']
                                                                        :
                                                                        (this.state.checkAB && !this.state.checkYTD && !this.state.checkYoy ?
                                                                            ['Actual']
                                                                            :
                                                                            (!this.state.checkAB && this.state.checkYTD && this.state.checkYoy ?
                                                                                ['MB', 'Yoy']
                                                                                :
                                                                                (!this.state.checkAB && this.state.checkYTD && !this.state.checkYoy ?
                                                                                    ['MB']
                                                                                    :
                                                                                    ['Yoy'])))))
                                                    },
                                                    grid: {
d.arizona's avatar
d.arizona committed
427 428
                                                        left: 50,
                                                        bottom: 50
d.arizona's avatar
d.arizona committed
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
                                                    },
                                                    xAxis: {
                                                        type: 'category',
                                                        data: this.props.selectedMonth
                                                    },
                                                    yAxis: {
                                                        type: 'value',
                                                        min: item.trends.sortMin[0] - 0.5,
                                                        max: item.trends.sortMax[0] + 0.5,
                                                    },
                                                    series:
                                                        this.state.checkAll ?
                                                            [
                                                                {
                                                                    name: 'Actual',
                                                                    data: item.trends.act,
                                                                    type: 'line'
                                                                },
                                                                {
                                                                    name: 'MB',
                                                                    data: item.trends.mbv,
                                                                    type: 'line'
                                                                },
                                                                {
                                                                    name: 'Yoy',
                                                                    data: item.trends.yoy,
                                                                    type: 'line'
                                                                }
                                                            ]
                                                            :
                                                            this.state.checkAB && this.state.checkYTD && !this.state.checkYoy ?
                                                                [
                                                                    {
                                                                        name: 'Actual',
                                                                        data: item.trends.act,
                                                                        type: 'line'
                                                                    },
                                                                    {
                                                                        name: 'MB',
                                                                        data: item.trends.mbv,
                                                                        type: 'line'
                                                                    },
                                                                ]
                                                                :
                                                                this.state.checkAB && !this.state.checkYTD && this.state.checkYoy ?
                                                                    [
                                                                        {
                                                                            name: 'Actual',
                                                                            data: item.trends.act,
                                                                            type: 'line'
                                                                        },
                                                                        {
                                                                            name: 'Yoy',
                                                                            data: item.trends.yoy,
                                                                            type: 'line'
                                                                        }
                                                                    ]
                                                                    :
                                                                    this.state.checkAB && !this.state.checkYTD && !this.state.checkYoy ?
                                                                        [
                                                                            {
                                                                                name: 'Actual',
                                                                                data: item.trends.act,
                                                                                type: 'line'
                                                                            },
                                                                        ]
                                                                        :
                                                                        !this.state.checkAB && this.state.checkYTD && this.state.checkYoy ?
                                                                            [
                                                                                {
                                                                                    name: 'MB',
                                                                                    data: item.trends.mbv,
                                                                                    type: 'line'
                                                                                },
                                                                                {
                                                                                    name: 'Yoy',
                                                                                    data: item.trends.yoy,
                                                                                    type: 'line'
                                                                                }
                                                                            ]
                                                                            :
                                                                            !this.state.checkAB && this.state.checkYTD && !this.state.checkYoy ?
                                                                                [
                                                                                    {
                                                                                        name: 'MB',
                                                                                        data: item.trends.mbv,
                                                                                        type: 'line'
                                                                                    },
                                                                                ]
                                                                                :
                                                                                [
                                                                                    {
                                                                                        name: 'Yoy',
                                                                                        data: item.trends.yoy,
                                                                                        type: 'line'
                                                                                    }
                                                                                ]

                                                }}
                                            />}
Deni Rinaldi's avatar
Deni Rinaldi committed
529 530 531 532
                                        </div>

                                    </div>
                                    <div style={{ width: '10%', display: 'grid', alignContent: 'center' }}>
d.arizona's avatar
d.arizona committed
533 534
                                        <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}><NumberFormat value={item.current_value} displayType={'text'} thousandSeparator={true} /></Typography>
                                        {/* <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.current_value}</Typography> */}
Deni Rinaldi's avatar
Deni Rinaldi committed
535
                                    </div>
d.arizona's avatar
d.arizona committed
536
                                    <div style={{ width: '10%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
537
                                        <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', backgroundColor: item.achievement == '-' || item.achievement == "" ? 'transparent' : handleColorAch(item) ? 'green' : '#ff0000', height: 70, width: 105, marginRight: 20 }}>
d.arizona's avatar
d.arizona committed
538
                                            {item.achievement == '-' || item.achievement == "" ?
d.arizona's avatar
d.arizona committed
539
                                                <Typography style={{ color: '#fff', fontWeight: 'bold', fontSize: 12 }}>-</Typography>
d.arizona's avatar
d.arizona committed
540 541
                                                :
                                                <Typography style={{ color: '#fff', fontWeight: 'bold', fontSize: 12 }}><NumberFormat value={this.handleAch(item.achievement)} displayType={'text'} thousandSeparator={true} suffix={'%'} /></Typography>}
Deni Rinaldi's avatar
Deni Rinaldi committed
542 543 544
                                        </div>
                                    </div>
                                    <div style={{ width: '5%', display: 'grid', alignContent: 'center' }}>
d.arizona's avatar
d.arizona committed
545
                                        {item.trends.act.length == 0 ?
d.arizona's avatar
d.arizona committed
546 547
                                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>-</Typography>
                                            :
d.arizona's avatar
d.arizona committed
548 549 550 551 552
                                            (handleIsHigher(item) == 'same' ?
                                                <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>-</Typography>
                                                :
                                                <img src={handleIsHigher(item) == 'true' ? Images.up : Images.down} />
                                            )
d.arizona's avatar
d.arizona committed
553
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
554
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
555
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
556 557
                            )
                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
558 559
                    ))}
                    {/* <div style={{ height: 56, backgroundColor: '#ffffff', display: 'flex' }}>
Riri Novita's avatar
Riri Novita committed
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575
                        <div style={{ width: '100%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', marginLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Category</Typography>
                        </div>
                        <div style={{ width: '75%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>KPI</Typography>
                        </div>
                        <div style={{ width: '100%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Trends</Typography>
                        </div>
                        <div style={{ width: '75%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Current</Typography>
                        </div>
                        <div style={{ width: '75%', borderBottom: 'solid 1px #979696 ', marginRight: 20, display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Achievement</Typography>
                        </div>
                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
576
                    <div style={{ height: 56, backgroundColor: '#ffffff', display: 'flex' }}>
Riri Novita's avatar
Riri Novita committed
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591
                        <div style={{ width: '100%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', marginLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}></Typography>
                        </div>
                        <div style={{ width: '75%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>KPI</Typography>
                        </div>
                        <div style={{ width: '100%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Trends</Typography>
                        </div>
                        <div style={{ width: '75%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Current</Typography>
                        </div>
                        <div style={{ width: '75%', borderBottom: 'solid 1px #979696 ', marginRight: 20, display: 'grid', alignContent: 'center', paddingLeft: 20 }}>
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Achievement</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
592
                    </div> */}
Riri Novita's avatar
Riri Novita committed
593 594 595 596 597
                </Paper>
            </div>
        )
    }
}