Commit 0417ffcb authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

update issue

See merge request !1531
parents b678956e a673f6d2
This diff is collapsed.
......@@ -25,12 +25,19 @@ export default class StrategiMap extends Component {
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() {
console.log(this.state.dataStrategy)
let arrayNew = this.state.dataStrategyNew
this.state.dataStrategy.map((item, index) => {
let arrayNodes = []
item.nodes.map((itemz, indexz) => {
let kpi = this.handleKPI(itemz.item_name)
let act = []
let mbv = []
let yoy = []
......@@ -88,7 +95,7 @@ export default class StrategiMap extends Component {
sortMin = [minYOY]
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 })
})
......@@ -166,11 +173,11 @@ export default class StrategiMap extends Component {
}
if (actMo > prevMo) {
isHigh = 'true'
isHigh = item.kpi == 'HIG' ? 'true' : 'false'
} else if (actMo == prevMo) {
isHigh = 'same'
} else {
isHigh = 'false'
isHigh = item.kpi == 'HIB' ? 'true' : 'false'
}
return isHigh
......@@ -185,8 +192,9 @@ export default class StrategiMap extends Component {
let trendsMBLength = trendsMB.length
actMR = trendsAct[trendsActLength-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
} else {
isHigh = true
......
......@@ -237,7 +237,7 @@ export default class ProfitLossMR extends Component {
const handlePushChild = (item) => {
let indexIDzz = dataTable.findIndex((val) => val[1] === item.id)
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
}
}
......@@ -279,7 +279,7 @@ export default class ProfitLossMR extends Component {
}
res.map((item, index) => {
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
}
}
......@@ -610,7 +610,7 @@ export default class ProfitLossMR extends Component {
this.state.dataTable.map((i, index) => {
if (i[0] === 3) {
// 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(i);
err = true
......@@ -1533,7 +1533,7 @@ export default class ProfitLossMR extends Component {
control={
<NumberFormat
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"
placeholder=""
suffix={'%'}
......@@ -1612,7 +1612,7 @@ export default class ProfitLossMR extends Component {
control={
<NumberFormat
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={'%'}
type="text"
placeholder=""
......@@ -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' }}
type="text"
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={'%'}
disabled={true}
value={Number(handleVariancePercent(tableMeta, 3, 5)).toFixed(1)}
......@@ -1790,7 +1790,7 @@ export default class ProfitLossMR extends Component {
defaultValue={tableMeta.rowData[19]}
inputProps={{
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'
}
}}
......@@ -1803,7 +1803,7 @@ export default class ProfitLossMR extends Component {
style={{ margin: 0 }}
// value={tableMeta.rowData[19]}
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>
<Input
disableUnderline={true}
......@@ -1839,7 +1839,7 @@ export default class ProfitLossMR extends Component {
defaultValue={tableMeta.rowData[19]}
inputProps={{
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'
}
}}
......
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