KPIs.js 37 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'
Riri Novita's avatar
Riri Novita committed
3
import Images from '../../assets/Images'
d.arizona's avatar
d.arizona committed
4
import NumberFormat from 'react-number-format';
d.arizona's avatar
d.arizona committed
5
import ReactECharts from 'echarts-for-react';
Riri Novita's avatar
Riri Novita committed
6 7

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

    componentDidMount() {
d.arizona's avatar
d.arizona committed
23
        this.setState({ loading: true })
d.arizona's avatar
d.arizona committed
24 25 26
        this.olahDataKPI()
    }

d.arizona's avatar
d.arizona committed
27 28 29 30 31 32
    handleKPI(name) {
        let arrayCAT = this.props.tableCAT
        let indexID = this.props.tableCAT.findIndex((val) => String(val[5]).toLocaleLowerCase() == String(name).toLocaleLowerCase())
        return arrayCAT[indexID][8]
    }

d.arizona's avatar
d.arizona committed
33 34 35 36 37 38
    olahDataKPI() {
        console.log(this.state.dataStrategy)
        let arrayNew = this.state.dataStrategyNew
        this.state.dataStrategy.map((item, index) => {
            let arrayNodes = []
            item.nodes.map((itemz, indexz) => {
d.arizona's avatar
d.arizona committed
39
                let kpi = this.handleKPI(itemz.item_name)
d.arizona's avatar
d.arizona committed
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 91 92 93 94 95 96
                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
97
                arrayNodes.push({ ...itemz, kpi, trends: { act, mbv, yoy, minACT, maxACT, minMBV, maxMBV, minYOY, maxYOY, sortMin, sortMax } })
d.arizona's avatar
d.arizona committed
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
            })
            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
114 115
    }

Riri Novita's avatar
Riri Novita committed
116
    render() {
Deni Rinaldi's avatar
Deni Rinaldi committed
117 118 119
        const data = [
            {
                color: "steelblue",
Deni Rinaldi's avatar
Deni Rinaldi committed
120 121 122 123 124
                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
125 126
            }
        ];
d.arizona's avatar
d.arizona committed
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

        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
154 155 156 157 158 159
        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
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
        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) {
d.arizona's avatar
d.arizona committed
175
                isHigh = item.kpi == 'HIG' ? 'true' : 'false'
d.arizona's avatar
d.arizona committed
176 177 178
            } else if (actMo == prevMo) {
                isHigh = 'same'
            } else {
d.arizona's avatar
d.arizona committed
179
                isHigh = item.kpi == 'HIB' ? 'true' : 'false'
d.arizona's avatar
d.arizona committed
180 181 182 183 184 185 186 187 188 189 190 191 192 193
            }

            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]
d.arizona's avatar
d.arizona committed
194
            let percentage = String(item.achievement).includes('%')? Number(String(item.achievement).substr(0,String(item.achievement).length -1)) : Number(item.achievement)
d.arizona's avatar
d.arizona committed
195

d.arizona's avatar
d.arizona committed
196
            if (percentage < 100) {
d.arizona's avatar
d.arizona committed
197 198 199 200 201 202 203
                isHigh = false
            }  else {
                isHigh = true
            }
            
            return isHigh
        }
Riri Novita's avatar
Riri Novita committed
204
        return (
Deni Rinaldi's avatar
Deni Rinaldi committed
205 206
            <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
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
                    <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
229 230 231 232
                                                        checkYoy: true,
                                                        loading: true,
                                                    }, () => {
                                                        setTimeout(() => {
d.arizona's avatar
d.arizona committed
233
                                                            this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
234
                                                        }, 500);
Deni Rinaldi's avatar
Deni Rinaldi committed
235 236 237 238 239 240 241 242 243 244 245 246
                                                    })
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        style={{ marginRight: 20 }}
                                        label={"Pilih Semua"}
                                    />
                                    <FormControlLabel
                                        control={
                                            <Checkbox
d.arizona's avatar
d.arizona committed
247
                                                checked={!this.state.checkAll && !this.state.checkYoy && !this.state.checkAB && !this.state.checkYTD}
Deni Rinaldi's avatar
Deni Rinaldi committed
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
                                                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
269
                                                    this.setState({
d.arizona's avatar
d.arizona committed
270 271
                                                        checkYTD: !this.state.checkYTD,
                                                        loading: true
d.arizona's avatar
d.arizona committed
272
                                                    }, () => {
d.arizona's avatar
d.arizona committed
273 274
                                                        this.setState({ checkAll: this.state.checkYoy && this.state.checkAB && this.state.checkYTD }, () => {
                                                            setTimeout(() => {
d.arizona's avatar
d.arizona committed
275
                                                                this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
276 277
                                                            }, 500);
                                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
278 279 280 281 282 283 284 285 286 287 288 289 290
                                                    })
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        label={"Tren YTD"}
                                    />
                                    <FormControlLabel
                                        control={
                                            <Checkbox
                                                checked={this.state.checkAB}
                                                onChange={() => {
d.arizona's avatar
d.arizona committed
291 292 293
                                                    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
294
                                                                this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
295 296
                                                            }, 500);
                                                        })
d.arizona's avatar
d.arizona committed
297
                                                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
298 299 300 301 302 303 304 305 306 307 308 309
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        label={"Actual vs Budget"}
                                    />
                                    <FormControlLabel
                                        control={
                                            <Checkbox
                                                checked={this.state.checkYoy}
                                                onChange={() => {
d.arizona's avatar
d.arizona committed
310 311 312
                                                    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
313
                                                                this.setState({ loading: false })
d.arizona's avatar
d.arizona committed
314 315
                                                            }, 500);
                                                        })
d.arizona's avatar
d.arizona committed
316
                                                    })
Deni Rinaldi's avatar
Deni Rinaldi committed
317 318 319 320 321 322 323 324 325 326 327
                                                }}
                                                name="checkedB"
                                                color="primary"
                                            />
                                        }
                                        label={"Yoy"}
                                    />
                                </div>
                            </div>
                        </Menu>
                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
328 329
                    <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
330 331
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Category</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
332
                        <div style={{ display: 'grid', alignContent: 'center', width: '20%' }}>
Riri Novita's avatar
Riri Novita committed
333 334
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>KPI</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
335
                        <div style={{ display: 'grid', alignContent: 'center', width: '25%' }}>
Riri Novita's avatar
Riri Novita committed
336 337
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Trends</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
338
                        <div style={{ display: 'grid', alignContent: 'center', width: '10%' }}>
d.arizona's avatar
d.arizona committed
339
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Current ({this.props.dataPayload.month.month_value})</Typography>
Riri Novita's avatar
Riri Novita committed
340
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
341
                        <div style={{ display: 'grid', alignContent: 'center', width: '10%' }}>
Riri Novita's avatar
Riri Novita committed
342 343
                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Achievement</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
344 345 346
                        <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
347
                    </div>
d.arizona's avatar
d.arizona committed
348
                    {this.state.dataStrategyNew.map((i) => (
Deni Rinaldi's avatar
Deni Rinaldi committed
349
                        i.nodes.map((item, index) => {
d.arizona's avatar
d.arizona committed
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 379 380 381 382 383 384 385
                            // 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
386 387 388
                            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
389
                                        <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{index > 0 ? '' : newTitleCase(String(i.category_name).toLocaleLowerCase())}</Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
390 391 392 393 394 395 396
                                    </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
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 427 428 429 430 431 432 433
                                            {!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
434 435
                                                        left: 50,
                                                        bottom: 50
d.arizona's avatar
d.arizona committed
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 529 530 531 532 533 534 535
                                                    },
                                                    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
536 537 538 539
                                        </div>

                                    </div>
                                    <div style={{ width: '10%', display: 'grid', alignContent: 'center' }}>
d.arizona's avatar
d.arizona committed
540 541
                                        <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
542
                                    </div>
d.arizona's avatar
d.arizona committed
543
                                    <div style={{ width: '10%', display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
d.arizona's avatar
d.arizona committed
544
                                        <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
545
                                            {item.achievement == '-' || item.achievement == "" ?
d.arizona's avatar
d.arizona committed
546
                                                <Typography style={{ color: '#fff', fontWeight: 'bold', fontSize: 12 }}>-</Typography>
d.arizona's avatar
d.arizona committed
547 548
                                                :
                                                <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
549 550 551
                                        </div>
                                    </div>
                                    <div style={{ width: '5%', display: 'grid', alignContent: 'center' }}>
d.arizona's avatar
d.arizona committed
552
                                        {item.trends.act.length == 0 ?
d.arizona's avatar
d.arizona committed
553 554
                                            <Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>-</Typography>
                                            :
d.arizona's avatar
d.arizona committed
555 556 557 558 559
                                            (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
560
                                        }
Deni Rinaldi's avatar
Deni Rinaldi committed
561
                                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
562
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
563 564
                            )
                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
565 566
                    ))}
                    {/* <div style={{ height: 56, backgroundColor: '#ffffff', display: 'flex' }}>
Riri Novita's avatar
Riri Novita committed
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
                        <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
583
                    <div style={{ height: 56, backgroundColor: '#ffffff', display: 'flex' }}>
Riri Novita's avatar
Riri Novita committed
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
                        <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
599
                    </div> */}
Riri Novita's avatar
Riri Novita committed
600 601 602 603 604
                </Paper>
            </div>
        )
    }
}