Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dida Adams Arizona
Tia-dev
Commits
fb9187b4
Commit
fb9187b4
authored
Dec 15, 2020
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update cat mr
parent
b6e3007a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
161 deletions
+21
-161
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+21
-161
No files found.
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
fb9187b4
...
@@ -137,9 +137,12 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -137,9 +137,12 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
description
,
item
.
description
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
corporate_annual_target
.
weight
).
indexOf
(
"."
)
==
-
1
?
item
.
corporate_annual_target
.
weight
:
`
${
Number
(
item
.
weight
)
*
100
}
%`
),
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
corporate_annual_target
.
weight
).
indexOf
(
"."
)
==
-
1
?
item
.
corporate_annual_target
.
weight
:
`
${
Number
(
item
.
weight
)
*
100
}
%`
),
parentTrue
?
item
.
corporate_annual_target
.
uom
:
item
.
uom
,
parentTrue
?
item
.
corporate_annual_target
.
uom
:
item
.
uom
,
parentTrue
?
item
.
corporate_annual_target
.
kpi_type
==
""
?
null
:
{
value
:
item
.
corporate_annual_target
.
kpi_type
}
:
item
.
kpi_type
==
""
?
null
:
{
value
:
item
.
kpi_type
},
parentTrue
?
item
.
corporate_annual_target
.
kpi_type
==
""
?
null
:
item
.
corporate_annual_target
.
kpi_type
:
item
.
kpi_type
==
""
?
null
:
item
.
kpi_type
,
parentTrue
?
item
.
corporate_annual_target
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
corporate_annual_target
.
max_ach
)
}
:
item
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
max_ach
)
},
// parentTrue ? item.corporate_annual_target.kpi_type == "" ? null : { value: item.corporate_annual_target.kpi_type } : item.kpi_type == "" ? null : { value: item.kpi_type },
parentTrue
?
item
.
corporate_annual_target
.
formula
==
""
?
null
:
{
value
:
item
.
corporate_annual_target
.
formula
}
:
item
.
formula_ytd
==
""
?
null
:
{
value
:
item
.
formula_ytd
},
parentTrue
?
item
.
corporate_annual_target
.
max_ach
==
""
?
null
:
titleCase
(
item
.
corporate_annual_target
.
max_ach
)
:
item
.
max_ach
==
""
?
null
:
titleCase
(
item
.
max_ach
),
// parentTrue ? item.corporate_annual_target.max_ach == "" ? null : { value: titleCase(item.corporate_annual_target.max_ach) } : item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item
.
formula_ytd
==
""
?
null
:
item
.
formula_ytd
,
// parentTrue ? item.corporate_annual_target.formula == "" ? null : { value: item.corporate_annual_target.formula } : item.formula_ytd == "" ? null : { value: item.formula_ytd },
item
.
corporate_annual_target
.
actual_monthly
==
""
?
item
.
corporate_annual_target
.
actual_monthly
:
String
(
item
.
corporate_annual_target
.
actual_monthly
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
corporate_annual_target
.
actual_monthly
)
:
Number
(
item
.
corporate_annual_target
.
actual_monthly
).
toFixed
(
1
),
item
.
corporate_annual_target
.
actual_monthly
==
""
?
item
.
corporate_annual_target
.
actual_monthly
:
String
(
item
.
corporate_annual_target
.
actual_monthly
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
corporate_annual_target
.
actual_monthly
)
:
Number
(
item
.
corporate_annual_target
.
actual_monthly
).
toFixed
(
1
),
item
.
corporate_annual_target
.
target_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
target_monthly
,
item
.
corporate_annual_target
.
target_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
target_monthly
,
item
.
corporate_annual_target
.
achivement_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
achivement_monthly
,
item
.
corporate_annual_target
.
achivement_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
achivement_monthly
,
...
@@ -165,10 +168,13 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -165,10 +168,13 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
level
,
item
.
level
,
item
.
description
,
item
.
description
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
item
.
weight
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
item
.
weight
,
item
.
corporate_annual_target
.
uom
,
item
.
uom
,
item
.
kpi_type
==
""
?
null
:
{
value
:
item
.
kpi_type
},
item
.
kpi_type
==
""
?
null
:
item
.
kpi_type
,
item
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
max_ach
)
},
// item.kpi_type == "" ? null : { value: item.kpi_type },
item
.
formula
==
""
?
null
:
{
value
:
item
.
formula_ytd
},
item
.
max_ach
==
""
?
null
:
titleCase
(
item
.
max_ach
),
// item.max_ach == "" ? null : { value: titleCase(item.max_ach) },
item
.
formula
==
""
?
null
:
item
.
formula_ytd
,
// item.formula == "" ? null : { value: item.formula_ytd },
item
.
corporate_annual_target
.
actual_monthly
==
""
?
item
.
corporate_annual_target
.
actual_monthly
:
String
(
item
.
corporate_annual_target
.
actual_monthly
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
corporate_annual_target
.
actual_monthly
)
:
Number
(
item
.
corporate_annual_target
.
actual_monthly
).
toFixed
(
1
),
item
.
corporate_annual_target
.
actual_monthly
==
""
?
item
.
corporate_annual_target
.
actual_monthly
:
String
(
item
.
corporate_annual_target
.
actual_monthly
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
corporate_annual_target
.
actual_monthly
)
:
Number
(
item
.
corporate_annual_target
.
actual_monthly
).
toFixed
(
1
),
item
.
corporate_annual_target
.
target_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
target_monthly
,
item
.
corporate_annual_target
.
target_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
target_monthly
,
item
.
corporate_annual_target
.
achivement_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
achivement_monthly
,
item
.
corporate_annual_target
.
achivement_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
achivement_monthly
,
...
@@ -249,11 +255,10 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -249,11 +255,10 @@ export default class CorporateAnnualTargetMR extends Component {
isi
.
map
((
i
,
index
)
=>
{
isi
.
map
((
i
,
index
)
=>
{
if
(
i
.
length
>
0
)
{
if
(
i
.
length
>
0
)
{
payload
.
push
({
payload
.
push
({
orders
:
i
[
0
]
===
undefined
?
""
:
String
(
i
[
0
]).
trim
(),
item_report_id
:
i
[
1
]
===
undefined
?
""
:
String
(
i
[
1
]).
trim
(),
item_report_id
:
i
[
1
]
===
undefined
?
""
:
String
(
i
[
1
]).
trim
(),
item_report
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
item_report
:
i
[
2
]
===
undefined
?
""
:
String
(
i
[
2
]).
trim
(),
weight
:
i
[
3
]
===
undefined
?
""
:
(
String
(
i
[
3
]))
===
false
?
"0"
:
String
(
i
[
3
]).
trim
(),
weight
:
i
[
3
]
===
undefined
?
""
:
(
String
(
i
[
3
]))
===
false
?
"0"
:
String
(
i
[
3
]).
trim
(),
ou
m
:
i
[
4
]
===
undefined
?
""
:
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
uo
m
:
i
[
4
]
===
undefined
?
""
:
(
String
(
i
[
4
]))
===
false
?
"0"
:
String
(
i
[
4
]).
trim
(),
jenis_kpi
:
i
[
5
]
===
undefined
?
""
:
(
String
(
i
[
5
]))
===
false
?
"0"
:
String
(
i
[
5
]).
trim
(),
jenis_kpi
:
i
[
5
]
===
undefined
?
""
:
(
String
(
i
[
5
]))
===
false
?
"0"
:
String
(
i
[
5
]).
trim
(),
max_ach
:
i
[
6
]
===
undefined
?
""
:
(
String
(
i
[
6
]))
===
false
?
"0"
:
String
(
i
[
6
]).
trim
(),
max_ach
:
i
[
6
]
===
undefined
?
""
:
(
String
(
i
[
6
]))
===
false
?
"0"
:
String
(
i
[
6
]).
trim
(),
actual_monthly
:
i
[
7
]
===
undefined
?
"0.0"
:
(
String
(
i
[
7
]))
===
false
?
"0"
:
String
(
i
[
7
]).
trim
(),
actual_monthly
:
i
[
7
]
===
undefined
?
"0.0"
:
(
String
(
i
[
7
]))
===
false
?
"0"
:
String
(
i
[
7
]).
trim
(),
...
@@ -292,7 +297,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -292,7 +297,7 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
item_report
,
item
.
item_report
,
item
.
weight
,
item
.
weight
,
item
.
uom
,
item
.
uom
,
item
.
kpi_type
,
item
.
jenis_kpi
,
item
.
max_ach
,
item
.
max_ach
,
item
.
formula_ytd
,
item
.
formula_ytd
,
item
.
actual_monthly
,
item
.
actual_monthly
,
...
@@ -580,36 +585,6 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -580,36 +585,6 @@ export default class CorporateAnnualTargetMR extends Component {
}
}
}
}
const
handleChangePercentage
=
(
value
,
tableMeta
)
=>
{
// let valueReal = value.replace('%', '')
// let indexParentDatatable = dataTable2.findIndex((val) => val[1] == tableMeta.rowData[2])
// let indexParentReal = this.state.dataReal.findIndex((val) => val.id == tableMeta.rowData[2])
// let valParent = dataTable2[indexParentDatatable][7]
// valParent.replace('%', '')
// let valChild = 0
// dataTable2.map((item, index) => {
// if (item[2] == dataTable2[indexParentDatatable][1] && item[1] !== tableMeta.rowData[1]) {
// let weightItem = item[7] == "" ? 0 : item[7].replace('%', '')
// // // console.log(weightItem)
// valChild += Number(weightItem)
// }
// })
// let endVal = ''
// if ((Number(valueReal) + Number(valChild)) > Number(valParent.replace('%', ''))) {
// endVal = `${Number(valParent.replace('%', '')) - (Number(valChild))}%`
// // // console.log(endVal)
// } else {
// endVal = `${Number(valueReal)}%`
// // // console.log(endVal)
// }
// // // // console.log(endVal)
// dataTable2[tableMeta.rowIndex][tableMeta.columnIndex] = endVal
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
}
const
handleChangeText
=
(
value
,
tableMeta
)
=>
{
const
handleChangeText
=
(
value
,
tableMeta
)
=>
{
// // console.log(value)
// // console.log(value)
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
value
...
@@ -844,31 +819,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -844,31 +819,7 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
style
=
{{
textAlign
:
'center'
}}
>
<
div
style
=
{{
textAlign
:
'center'
}}
>
{
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
null
:
// tableMeta.rowData[0] === 1 ?
value
value
// :
// <div style={{ flex: 1 }}>
// <FormControlLabel
// style={{ margin: 0 }}
// value={value}
// control={
// <NumberFormat
// thousandSeparator={true}
// suffix="%"
// style={{ color: "#5198ea", fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 60, backgroundColor: 'transparent' }}
// type="text"
// placeholder=""
// value={value}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false && (this.props.status === 'revision' || this.props.status === 'not-yet' || this.props.status === 'draft' || this.props.status === 'submitted') ? false : true)}
// maxLength={4}
// onBlur={(event) => {
// // updateValue(some)
// handleChangePercentage(event.target.value, tableMeta)
// }}
// />
// }
// />
// </div>
}
}
<
/div
>
<
/div
>
)
)
...
@@ -884,49 +835,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -884,49 +835,7 @@ export default class CorporateAnnualTargetMR extends Component {
),
),
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
value
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
textAlign
:
'center'
}}
>
<
div
style
=
{{
textAlign
:
'center'
}}
>
{
/* {tableMeta.rowData[0] === 1 || tableMeta.rowData[0] === 2 || tableMeta.rowData[0] === 4 ?
null :
<FormControlLabel
style={{ margin: 0 }}
// value={value}
control={
!handleAction(tableMeta.rowData[2], tableMeta.rowData[0]) ?
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 60, backgroundColor: 'transparent', marginTop: -10 }}
type="text"
placeholder=""
defaultValue={value}
color={"#5198ea"}
disabled={true}
onBlur={(event) => {
// // console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/> :
<ThemeProvider theme={theme}>
<Input
disableUnderline={true}
style={{ fontSize: 12, textAlign: 'center', borderColor: 'transparent', margin: 0, width: 60, backgroundColor: 'transparent', marginBottom: -5 }}
type="text"
placeholder=""
defaultValue={value}
color={"#5198ea"}
// disabled={this.props.isApprover ? true : ((this.props.lastStatus == 'SUBMIT' || this.props.lastStatus == 'REVISION') && this.props.prevRevision === false ? false : !handleAction(tableMeta.rowData[2]))}
onBlur={(event) => {
// // console.log(event.target.value)
// updateValue(event.target.value)
handleChangeText(event.target.value, tableMeta)
// // console.log(dataTable2)
}}
/>
</ThemeProvider>
}
/>
} */
}
<
div
style
=
{{
textAlign
:
'center'
,
width
:
60
}}
>
<
div
style
=
{{
textAlign
:
'center'
,
width
:
60
}}
>
{
value
}
{
value
}
<
/div
>
<
/div
>
...
@@ -944,25 +853,10 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -944,25 +853,10 @@ export default class CorporateAnnualTargetMR extends Component {
),
),
customBodyRender
:
(
val
,
tableMeta
)
=>
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
return
(
return
(
<
div
style
=
{{
width
:
96
}}
>
<
div
style
=
{{
textAlign
:
'center'
,
width
:
60
}}
>
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
null
:
<
Autocomplete
val
{...
this
.
state
.
kpiTypeList
}
id
=
"kpiType"
onChange
=
{(
event
,
newInputValue
)
=>
handleChangeDropdown
(
newInputValue
,
tableMeta
)}
debug
disableClearable
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
])}
value
=
{
handleValueDropdown
(
val
,
'KPI'
,
tableMeta
)}
style
=
{{
padding
:
0
,
margin
:
0
}}
renderInput
=
{(
params
)
=>
<
div
ref
=
{
params
.
InputProps
.
ref
}
style
=
{{
padding
:
0
,
margin
:
0
}}
>
<
input
style
=
{{
borderColor
:
'white'
,
width
:
96
,
textAlign
:
'center'
,
padding
:
0
,
margin
:
0
,
color
:
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
])
?
"#5198ea"
:
"black"
}}
type
=
"text"
{...
params
.
inputProps
}
/
>
<
/div
>
}
/
>
// val
}
}
<
/div
>
<
/div
>
)
)
...
@@ -981,22 +875,7 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -981,22 +875,7 @@ export default class CorporateAnnualTargetMR extends Component {
<
div
style
=
{{
textAlign
:
'center'
,
width
:
60
}}
>
<
div
style
=
{{
textAlign
:
'center'
,
width
:
60
}}
>
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
null
:
<
Autocomplete
val
{...
this
.
state
.
maxAchList
}
id
=
"maxAchList"
onChange
=
{(
event
,
newInputValue
)
=>
handleChangeDropdown
(
newInputValue
,
tableMeta
)}
debug
disableClearable
value
=
{
handleValueDropdown
(
val
,
'MAX'
,
tableMeta
)}
style
=
{{
padding
:
0
,
margin
:
0
}}
// disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
renderInput
=
{(
params
)
=>
<
div
ref
=
{
params
.
InputProps
.
ref
}
style
=
{{
padding
:
0
,
margin
:
0
}}
>
<
input
style
=
{{
borderColor
:
'white'
,
width
:
96
,
textAlign
:
'center'
,
padding
:
0
,
margin
:
0
,
color
:
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
])
?
"#5198ea"
:
"black"
}}
type
=
"text"
{...
params
.
inputProps
}
/
>
<
/div
>
}
// value={this.state.parent}
/
>
}
}
<
/div
>
<
/div
>
)
)
...
@@ -1012,29 +891,10 @@ export default class CorporateAnnualTargetMR extends Component {
...
@@ -1012,29 +891,10 @@ export default class CorporateAnnualTargetMR extends Component {
),
),
customBodyRender
:
(
val
,
tableMeta
,
updateValue
)
=>
{
customBodyRender
:
(
val
,
tableMeta
,
updateValue
)
=>
{
return
(
return
(
<
div
style
=
{{
width
:
60
}}
>
<
div
style
=
{{
textAlign
:
'center'
,
width
:
60
}}
>
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
{
tableMeta
.
rowData
[
0
]
===
1
||
tableMeta
.
rowData
[
0
]
===
2
||
tableMeta
.
rowData
[
0
]
===
4
?
null
:
null
:
<
Autocomplete
val
{...
this
.
state
.
formulaYtdList
}
id
=
"formulaYtdList"
onChange
=
{(
event
,
newInputValue
)
=>
{
// updateValue(newInputValue)
handleChangeDropdown
(
newInputValue
,
tableMeta
)
}
}
debug
disableClearable
value
=
{
handleValueDropdown
(
val
,
'FORMULA'
,
tableMeta
)}
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
])}
style
=
{{
padding
:
0
,
margin
:
0
}}
renderInput
=
{(
params
)
=>
<
div
ref
=
{
params
.
InputProps
.
ref
}
style
=
{{
padding
:
0
,
margin
:
0
}}
>
<
input
style
=
{{
borderColor
:
'white'
,
width
:
96
,
textAlign
:
'center'
,
padding
:
0
,
margin
:
0
,
color
:
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
])
?
"#5198ea"
:
"black"
}}
type
=
"text"
{...
params
.
inputProps
}
/
>
<
/div
>
}
// value={this.state.parent}
/
>
}
}
<
/div
>
<
/div
>
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment