Commit bd70bae7 authored by Deni Rinaldi's avatar Deni Rinaldi

Merge branch 'deni-' into 'master'

kpis

See merge request !1229
parents 31a33676 d3ffc8a4
......@@ -95,8 +95,8 @@ export default class DashboardCAT extends Component {
company_id: item.company_id,
company_name: item.company_name,
}
})
})
let arrayBaru = []
this.state.userCompany.map((item, index) => {
let indexID = companyData.findIndex((val) => val.company_id == item)
......@@ -106,7 +106,7 @@ export default class DashboardCAT extends Component {
})
let defaultProps = {
options: arrayBaru,
options: arrayBaru.sort((a, b) => a.company_name.localeCompare(b.company_name)),
getOptionLabel: (option) => titleCase(option.company_name),
};
let index = arrayBaru.findIndex((val) => val.company_id == comID)
......
import React, { Component } from 'react'
import { Paper, Typography } from '@material-ui/core'
import { Checkbox, FormControlLabel, Menu, Paper, Typography, Button } from '@material-ui/core'
import LineChart from 'react-linechart';
import Images from '../../assets/Images'
......@@ -7,19 +7,12 @@ export default class StrategiMap extends Component {
constructor(props) {
super(props)
this.state = {
dataDummy: [
{ nama: 'Financial Perspective', kpi: 'Revenue', statKpi: 'IDR Bio', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' },
{ nama: '', kpi: 'EBITDA', statKpi: 'IDR Bio', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' },
{ nama: '', kpi: 'TPAT', statKpi: 'IDR Bio', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' },
{ nama: 'Customer Perspective', kpi: 'Parts Service Rate', statKpi: '%', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: -40, val: 'down' },
{ nama: '', kpi: 'CSI (Customer Satisfaction Index)', statKpi: 'Index', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: -4, val: 'down' },
{ nama: '', kpi: 'Dealer Productivity', statKpi: 'Unit/ Month', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' },
{ nama: 'Internal Business Process Perspective', kpi: 'NSI', statKpi: 'IDR Bio', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' },
{ nama: '', kpi: 'DEP', statKpi: 'IDR Bio', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' },
{ nama: '', kpi: 'AEP', statKpi: 'IDR Bio', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' },
{ nama: '', kpi: 'DDMS', statKpi: 'IDR Bio', trends: ["1", "4", "2", "5", "3"], current: '913975', achievment: 108, val: 'up' }
],
data: [],
openMenu: false,
dataStrategy: this.props.data.kpi.category,
checkAll: true,
checkYTD: true,
checkAB: true,
checkYoy: true
}
}
......@@ -31,12 +24,113 @@ export default class StrategiMap extends Component {
const data = [
{
color: "steelblue",
points: [{ x: 1, y: 1 }, { x: 2, y: 2 }, { x: 3, y: 2 }]
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 }]
}
];
return (
<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 }}>
<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,
checkYoy: true
})
}}
name="checkedB"
color="primary"
/>
}
style={{ marginRight: 20 }}
label={"Pilih Semua"}
/>
<FormControlLabel
control={
<Checkbox
checked={!this.state.checkAll}
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={() => {
this.setState({
checkYTD: !this.state.checkYTD
})
}}
name="checkedB"
color="primary"
/>
}
label={"Tren YTD"}
/>
<FormControlLabel
control={
<Checkbox
checked={this.state.checkAB}
onChange={() => {
this.setState({ checkAB: !this.state.checkAB })
}}
name="checkedB"
color="primary"
/>
}
label={"Actual vs Budget"}
/>
<FormControlLabel
control={
<Checkbox
checked={this.state.checkYoy}
onChange={() => {
this.setState({ checkYoy: !this.state.checkYoy })
}}
name="checkedB"
color="primary"
/>
}
label={"Yoy"}
/>
</div>
</div>
</Menu>
</div>
<div style={{ height: 56, backgroundColor: '#ffffff', display: 'flex', justifyContent: 'space-between', borderBottom: 'solid 3px #979696 ' }}>
<div style={{ display: 'grid', alignContent: 'center', width: '20%' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Category</Typography>
......@@ -50,44 +144,91 @@ export default class StrategiMap extends Component {
<div style={{ display: 'grid', alignContent: 'center', width: '10%' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Current</Typography>
</div>
<div style={{ display: 'grid', alignContent: 'center', width: '15%' }}>
<div style={{ display: 'grid', alignContent: 'center', width: '10%' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>Achievement</Typography>
</div>
<div style={{ display: 'grid', alignContent: 'center', width: '5%' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>vs Prev. Month</Typography>
</div>
</div>
{this.state.dataDummy.map((item, index) => (
<div style={{ backgroundColor: '#ffffff', display: 'flex', justifyContent: 'space-between', borderBottom: 'solid 3px #979696', padding: '10px 0px' }}>
<div style={{ width: '20%', display: 'grid', alignContent: 'center' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.nama}</Typography>
</div>
<div style={{ width: '20%', display: 'grid', alignContent: 'center' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.kpi}</Typography>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.statKpi}</Typography>
</div>
<div style={{ width: '25%', display: 'grid', alignContent: 'center' }}>
<div style={{ marginLeft: -50 }}>
<LineChart
width={400}
height={50}
data={data}
yMin={0}
yMax={10}
hideXAxis={true}
hideYAxis={true}
hideXLabel={true}
hideYLabel={true}
/>
</div>
</div>
<div style={{ width: '10%', display: 'grid', alignContent: 'center' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.current}</Typography>
</div>
<div style={{ width: '15%', display: 'flex' }}>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', backgroundColor: item.achievment < -10 ? 'red' : item.achievment < 0 ? 'yellow' : 'green', height: 70, width: 105, marginRight: 20 }}>
<Typography style={{ color: '#fff', fontWeight: 'bold', fontSize: 12 }}>{item.achievment}%</Typography>
{this.state.dataStrategy.map((i) => (
i.nodes.map((item, index) => {
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: "yellow",
points: dataAB
})
}
if (this.state.checkYoy === true) {
option.push( {
color: "red",
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
})
})
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' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{index > 0 ? '' : i.category_name}</Typography>
</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 }}>
<LineChart
width={400}
height={70}
data={option}
// yMin={0}
// yMax={10}
hideXAxis={true}
hideYAxis={true}
hideXLabel={true}
hideYLabel={true}
/>
</div>
</div>
<div style={{ width: '10%', display: 'grid', alignContent: 'center' }}>
<Typography style={{ color: '#656565', fontWeight: 'bold', fontSize: 12 }}>{item.current_value}</Typography>
</div>
<div style={{ width: '10%', display: 'flex' }}>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', backgroundColor: item.achievement < -10 ? '#333333' : item.achievement < 0 ? '#333333' : '#333333', height: 70, width: 105, marginRight: 20 }}>
<Typography style={{ color: '#fff', fontWeight: 'bold', fontSize: 12 }}>{item.achievement}</Typography>
</div>
</div>
<div style={{ width: '5%', display: 'grid', alignContent: 'center' }}>
<img src={item.is_higher === false ? Images.down : Images.up} />
</div>
</div>
<img src={item.val === 'up' ? Images.up : Images.down} />
</div>
</div>
)
})
))}
{/* <div style={{ height: 56, backgroundColor: '#ffffff', display: 'flex' }}>
<div style={{ width: '100%', borderBottom: 'solid 1px #979696 ', display: 'grid', alignContent: 'center', marginLeft: 20 }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment