Commit a673f6d2 authored by d.arizona's avatar d.arizona

update issue

parent 54f32a51
This diff is collapsed.
...@@ -25,12 +25,19 @@ export default class StrategiMap extends Component { ...@@ -25,12 +25,19 @@ export default class StrategiMap extends Component {
this.olahDataKPI() this.olahDataKPI()
} }
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]
}
olahDataKPI() { olahDataKPI() {
console.log(this.state.dataStrategy) console.log(this.state.dataStrategy)
let arrayNew = this.state.dataStrategyNew let arrayNew = this.state.dataStrategyNew
this.state.dataStrategy.map((item, index) => { this.state.dataStrategy.map((item, index) => {
let arrayNodes = [] let arrayNodes = []
item.nodes.map((itemz, indexz) => { item.nodes.map((itemz, indexz) => {
let kpi = this.handleKPI(itemz.item_name)
let act = [] let act = []
let mbv = [] let mbv = []
let yoy = [] let yoy = []
...@@ -88,7 +95,7 @@ export default class StrategiMap extends Component { ...@@ -88,7 +95,7 @@ export default class StrategiMap extends Component {
sortMin = [minYOY] sortMin = [minYOY]
sortMax = [maxYOY] sortMax = [maxYOY]
} }
arrayNodes.push({ ...itemz, trends: { act, mbv, yoy, minACT, maxACT, minMBV, maxMBV, minYOY, maxYOY, sortMin, sortMax } }) arrayNodes.push({ ...itemz, kpi, trends: { act, mbv, yoy, minACT, maxACT, minMBV, maxMBV, minYOY, maxYOY, sortMin, sortMax } })
}) })
arrayNew.push({ ...item, nodes: arrayNodes }) arrayNew.push({ ...item, nodes: arrayNodes })
}) })
...@@ -166,11 +173,11 @@ export default class StrategiMap extends Component { ...@@ -166,11 +173,11 @@ export default class StrategiMap extends Component {
} }
if (actMo > prevMo) { if (actMo > prevMo) {
isHigh = 'true' isHigh = item.kpi == 'HIG' ? 'true' : 'false'
} else if (actMo == prevMo) { } else if (actMo == prevMo) {
isHigh = 'same' isHigh = 'same'
} else { } else {
isHigh = 'false' isHigh = item.kpi == 'HIB' ? 'true' : 'false'
} }
return isHigh return isHigh
...@@ -185,8 +192,9 @@ export default class StrategiMap extends Component { ...@@ -185,8 +192,9 @@ export default class StrategiMap extends Component {
let trendsMBLength = trendsMB.length let trendsMBLength = trendsMB.length
actMR = trendsAct[trendsActLength-1] actMR = trendsAct[trendsActLength-1]
actMB = trendsMB[trendsMBLength-1] actMB = trendsMB[trendsMBLength-1]
let percentage = String(item.achievement).includes('%')? Number(String(item.achievement).substr(0,String(item.achievement).length -1)) : Number(item.achievement)
if (actMR < actMB) { if (percentage < 100) {
isHigh = false isHigh = false
} else { } else {
isHigh = true isHigh = true
......
...@@ -237,7 +237,7 @@ export default class ProfitLossMR extends Component { ...@@ -237,7 +237,7 @@ export default class ProfitLossMR extends Component {
const handlePushChild = (item) => { const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id) let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
if (item.type_report_id === 3) { if (item.type_report_id === 3) {
if (item.profit_loss.mtd_vs_mb == "" && Number(item.profit_loss.percent_act_vs_mb) < this.state.minValue || Number(item.profit_loss.percent_act_vs_mb) > this.state.maxValue) { if (item.profit_loss.mtd_vs_mb == "" && Number(item.profit_loss.percent_act_vs_mb).toFixed(1) < this.state.minValue || Number(item.profit_loss.percent_act_vs_mb).toFixed(1) > this.state.maxValue) {
err = true err = true
} }
} }
...@@ -279,7 +279,7 @@ export default class ProfitLossMR extends Component { ...@@ -279,7 +279,7 @@ export default class ProfitLossMR extends Component {
} }
res.map((item, index) => { res.map((item, index) => {
if (item.type_report_id === 3) { if (item.type_report_id === 3) {
if (item.profit_loss.mtd_vs_mb == "" && Number(item.profit_loss.percent_act_vs_mb) < this.state.minValue || Number(item.profit_loss.percent_act_vs_mb) > this.state.maxValue) { if (item.profit_loss.mtd_vs_mb == "" && Number(item.profit_loss.percent_act_vs_mb).toFixed(1) < this.state.minValue || Number(item.profit_loss.percent_act_vs_mb).toFixed(1) > this.state.maxValue) {
err = true err = true
} }
} }
...@@ -610,7 +610,7 @@ export default class ProfitLossMR extends Component { ...@@ -610,7 +610,7 @@ export default class ProfitLossMR extends Component {
this.state.dataTable.map((i, index) => { this.state.dataTable.map((i, index) => {
if (i[0] === 3) { if (i[0] === 3) {
// console.log(i); // console.log(i);
if (i[19] === "" && (Number(i[16]) < this.state.minValue || Number(i[16]) > this.state.maxValue)) { if (i[19] === "" && (Number(i[16]).toFixed(1) < this.state.minValue || Number(i[16]).toFixed(1) > this.state.maxValue)) {
console.log('msk 1'); console.log('msk 1');
// console.log(i); // console.log(i);
err = true err = true
...@@ -1533,7 +1533,7 @@ export default class ProfitLossMR extends Component { ...@@ -1533,7 +1533,7 @@ export default class ProfitLossMR extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: Number(tableMeta.rowData[14]) < this.state.minValue || Number(tableMeta.rowData[14]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: Number(tableMeta.rowData[14]).toFixed(1) < this.state.minValue || Number(tableMeta.rowData[14]).toFixed(1) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
suffix={'%'} suffix={'%'}
...@@ -1612,7 +1612,7 @@ export default class ProfitLossMR extends Component { ...@@ -1612,7 +1612,7 @@ export default class ProfitLossMR extends Component {
control={ control={
<NumberFormat <NumberFormat
thousandSeparator={true} thousandSeparator={true}
style={{ color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: Number(tableMeta.rowData[16]).toFixed(1) < this.state.minValue || Number(tableMeta.rowData[16]).toFixed(1) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
suffix={'%'} suffix={'%'}
type="text" type="text"
placeholder="" placeholder=""
...@@ -1693,7 +1693,7 @@ export default class ProfitLossMR extends Component { ...@@ -1693,7 +1693,7 @@ export default class ProfitLossMR extends Component {
style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: 'red', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
type="text" type="text"
placeholder="" placeholder=""
style={{ color: Number(tableMeta.rowData[18]) < this.state.minValue || Number(tableMeta.rowData[18]) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }} style={{ color: Number(tableMeta.rowData[18]).toFixed(1) < this.state.minValue || Number(tableMeta.rowData[18]).toFixed(1) > this.state.maxValue ? 'red' : '#000000b0', fontSize: 12, textAlign: 'right', borderColor: 'transparent', margin: 0, width: 96, backgroundColor: 'transparent' }}
suffix={'%'} suffix={'%'}
disabled={true} disabled={true}
value={Number(handleVariancePercent(tableMeta, 3, 5)).toFixed(1)} value={Number(handleVariancePercent(tableMeta, 3, 5)).toFixed(1)}
...@@ -1790,7 +1790,7 @@ export default class ProfitLossMR extends Component { ...@@ -1790,7 +1790,7 @@ export default class ProfitLossMR extends Component {
defaultValue={tableMeta.rowData[19]} defaultValue={tableMeta.rowData[19]}
inputProps={{ inputProps={{
style: { style: {
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea', color: Number(tableMeta.rowData[16]).toFixed(1) < this.state.minValue || Number(tableMeta.rowData[16]).toFixed(1) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left' textAlign: 'left'
} }
}} }}
...@@ -1803,7 +1803,7 @@ export default class ProfitLossMR extends Component { ...@@ -1803,7 +1803,7 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }} style={{ margin: 0 }}
// value={tableMeta.rowData[19]} // value={tableMeta.rowData[19]}
control={ control={
tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue) ? tableMeta.rowData[19] === "" && (Number(tableMeta.rowData[16]).toFixed(1) < this.state.minValue || Number(tableMeta.rowData[16]).toFixed(1) > this.state.maxValue) ?
<LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow> <LightTooltipError title={"MTD Explanation vs MB is Reqiured"} arrow>
<Input <Input
disableUnderline={true} disableUnderline={true}
...@@ -1839,7 +1839,7 @@ export default class ProfitLossMR extends Component { ...@@ -1839,7 +1839,7 @@ export default class ProfitLossMR extends Component {
defaultValue={tableMeta.rowData[19]} defaultValue={tableMeta.rowData[19]}
inputProps={{ inputProps={{
style: { style: {
color: Number(tableMeta.rowData[16]) < this.state.minValue || Number(tableMeta.rowData[16]) > this.state.maxValue ? "#5198ea" : '#5198ea', color: Number(tableMeta.rowData[16]).toFixed(1) < this.state.minValue || Number(tableMeta.rowData[16]).toFixed(1) > this.state.maxValue ? "#5198ea" : '#5198ea',
textAlign: 'left' textAlign: 'left'
} }
}} }}
......
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