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
85df3e25
Commit
85df3e25
authored
Dec 09, 2020
by
faisalhamdi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pilkada
parent
0dd4add5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
33 deletions
+87
-33
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+87
-33
No files found.
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
85df3e25
...
...
@@ -55,6 +55,11 @@ export default class CorporateAnnualTargetMR extends Component {
dataTables
:
[],
loading
:
true
,
kpiTypeList
:
[],
maxAchList
:
[],
formulaYtdList
:
{
options
:
[{
value
:
'SUM'
},
{
value
:
'AVG'
},
{
value
:
'LAST'
}],
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
value
),
},
}
}
...
...
@@ -62,6 +67,7 @@ export default class CorporateAnnualTargetMR extends Component {
this
.
getItemHierarki
()
this
.
getLatestUpdate
()
this
.
getKPIType
()
this
.
getMaxAch
()
}
getLatestUpdate
()
{
...
...
@@ -116,6 +122,7 @@ export default class CorporateAnnualTargetMR extends Component {
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
if
(
indexIDzz
===
-
1
)
{
let
parentTrue
=
item
.
parent_name
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
||
item
.
parent_name
==
'CUSTOMER PERSPECTIVE'
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
...
...
@@ -123,17 +130,17 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
corporate_annual_target
.
weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
weight
===
""
?
""
:
item
.
corporate_annual_target
.
weight
,
item
.
corporate_annual_target
.
oum
===
null
?
"0"
:
item
.
corporate_annual_target
.
oum
===
""
?
"6"
:
item
.
corporate_annual_target
.
uom
,
item
.
corporate_annual_target
.
jenis_kpi
===
null
?
"0"
:
item
.
corporate_annual_target
.
jenis_kpi
===
""
?
"7"
:
item
.
corporate_annual_target
.
jenis_kpi
,
item
.
corporate_annual_target
.
max_ach
===
null
?
"0"
:
item
.
corporate_annual_target
.
max_ach
===
""
?
"8"
:
item
.
corporate_annual_target
.
max_ach
,
item
.
corporate_annual_target
.
formula_ytd
===
null
?
"0"
:
item
.
corporate_annual_target
.
formula_ytd
===
""
?
"9"
:
item
.
corporate_annual_target
.
formula_ytd
,
item
.
corporate_annual_target
.
actual_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
actual_monthly
===
""
?
"10"
:
item
.
corporate_annual_target
.
actual_monthly
,
item
.
corporate_annual_target
.
target_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
target_monthly
===
""
?
"11"
:
item
.
corporate_annual_target
.
target_monthly
,
item
.
corporate_annual_target
.
achivement_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
achivement_monthly
===
""
?
"12"
:
item
.
corporate_annual_target
.
achivement_monthly
,
item
.
corporate_annual_target
.
score
===
null
?
"0"
:
item
.
corporate_annual_target
.
score
===
""
?
"13"
:
item
.
corporate_annual_target
.
score
,
item
.
corporate_annual_target
.
score_x_weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
score_x_weight
===
""
?
"14"
:
item
.
corporate_annual_target
.
score_x_weight
,
item
.
corporate_annual_target
.
notes
===
null
?
"
0"
:
item
.
corporate_annual_target
.
notes
===
""
?
"15
"
:
item
.
corporate_annual_target
.
notes
,
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
.
kpi_type
==
""
?
null
:
{
value
:
item
.
corporate_annual_target
.
kpi_type
}
:
item
.
kpi_type
==
""
?
null
:
{
value
:
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
.
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
.
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
.
score
===
null
?
"0"
:
item
.
corporate_annual_target
.
score
,
item
.
corporate_annual_target
.
score_x_weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
score_x_weight
,
item
.
corporate_annual_target
.
notes
===
null
?
""
:
item
.
corporate_annual_target
.
notes
,
])
}
if
(
item
.
children
!==
null
)
{
...
...
@@ -152,17 +159,17 @@ export default class CorporateAnnualTargetMR extends Component {
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
corporate_annual_target
.
weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
weight
===
""
?
""
:
item
.
corporate_annual_target
.
weight
,
item
.
corporate_annual_target
.
oum
===
null
?
"0"
:
item
.
corporate_annual_target
.
oum
===
""
?
"6"
:
item
.
corporate_annual_target
.
uom
,
item
.
corporate_annual_target
.
jenis_kpi
===
null
?
"0"
:
item
.
corporate_annual_target
.
jenis_kpi
===
""
?
"7"
:
item
.
corporate_annual_target
.
jenis_kpi
,
item
.
corporate_annual_target
.
max_ach
===
null
?
"0"
:
item
.
corporate_annual_target
.
max_ach
===
""
?
"8"
:
item
.
corporate_annual_target
.
max_ach
,
item
.
corporate_annual_target
.
formula_ytd
===
null
?
"0"
:
item
.
corporate_annual_target
.
formula_ytd
===
""
?
"9"
:
item
.
corporate_annual_target
.
formula_ytd
,
item
.
corporate_annual_target
.
actual_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
actual_monthly
===
""
?
"10"
:
item
.
corporate_annual_target
.
actual_monthly
,
item
.
corporate_annual_target
.
target_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
target_monthly
===
""
?
"11"
:
item
.
corporate_annual_target
.
target_monthly
,
item
.
corporate_annual_target
.
achivement_monthly
===
null
?
"0"
:
item
.
corporate_annual_target
.
achivement_monthly
===
""
?
"12"
:
item
.
corporate_annual_target
.
achivement_monthly
,
item
.
corporate_annual_target
.
score
===
null
?
"0"
:
item
.
corporate_annual_target
.
score
===
""
?
"13"
:
item
.
corporate_annual_target
.
score
,
item
.
corporate_annual_target
.
score_x_weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
score_x_weight
===
""
?
"14"
:
item
.
corporate_annual_target
.
score_x_weight
,
item
.
corporate_annual_target
.
notes
===
null
?
"
0"
:
item
.
corporate_annual_target
.
notes
===
""
?
"15
"
:
item
.
corporate_annual_target
.
notes
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
item
.
weight
,
item
.
corporate_annual_target
.
uom
,
item
.
kpi_type
==
""
?
null
:
{
value
:
item
.
kpi_type
}
,
item
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
max_ach
)
}
,
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
.
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
.
score
===
null
?
"0"
:
item
.
corporate_annual_target
.
score
,
item
.
corporate_annual_target
.
score_x_weight
===
null
?
"0"
:
item
.
corporate_annual_target
.
score_x_weight
,
item
.
corporate_annual_target
.
notes
===
null
?
""
:
item
.
corporate_annual_target
.
notes
,
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
...
...
@@ -225,6 +232,51 @@ export default class CorporateAnnualTargetMR extends Component {
})
}
getMaxAch
()
{
let
body
=
{
group
:
'CAT'
,
company_id
:
this
.
props
.
company
.
company_id
,
type
:
'MAX_ACHIEVEMENT'
}
api
.
create
().
getAllSettingByType
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
inputMaxAch
=
data
.
map
((
item
)
=>
{
return
{
value
:
item
.
value
}
})
let
defaultProps
=
{
options
:
inputMaxAch
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
value
),
};
// setTimeout(() => {
this
.
setState
({
maxAchList
:
defaultProps
})
// }, 300);
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
// alert(response.data.message)
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
this
.
getItemHierarki
()
})
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
dataDelete
=
this
.
state
.
dataDelete
...
...
@@ -267,18 +319,20 @@ export default class CorporateAnnualTargetMR extends Component {
}
const
handleValueDropdown
=
(
value
,
type
,
tableMeta
)
=>
{
// console.log(value,type, tableMeta);
console
.
log
(
value
,
type
,
tableMeta
);
console
.
log
(
this
.
state
.
maxAchList
.
options
);
let
data
=
type
==
'KPI'
?
this
.
state
.
kpiTypeList
.
options
:
(
type
==
'MAX'
?
this
.
state
.
maxAchList
.
options
:
this
.
state
.
formulaYtdList
.
options
)
console
.
log
(
data
);
let
index
=
0
if
(
value
==
null
)
{
console
.
log
(
"masuk"
);
index
=
-
1
}
else
{
index
=
data
.
findIndex
((
val
)
=>
val
.
value
==
value
.
value
)
}
console
.
log
(
value
)
console
.
log
(
data
)
console
.
log
(
index
)
//
console.log(value)
//
console.log(data)
//
console.log(index)
if
(
index
==
-
1
)
{
dataTable2
[
tableMeta
.
rowIndex
][
tableMeta
.
columnIndex
]
=
null
return
null
...
...
@@ -661,8 +715,7 @@ export default class CorporateAnnualTargetMR extends Component {
onChange
=
{(
event
,
newInputValue
)
=>
handleChangeDropdown
(
newInputValue
,
tableMeta
)}
debug
disableClearable
// disabled={!handleAction(tableMeta.rowData[2], tableMeta.rowData[0])}
disabled
=
{
false
}
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
])}
value
=
{
handleValueDropdown
(
val
,
'KPI'
,
tableMeta
)}
style
=
{{
padding
:
0
,
margin
:
0
}}
renderInput
=
{(
params
)
=>
...
...
@@ -696,9 +749,9 @@ export default class CorporateAnnualTargetMR extends Component {
onChange
=
{(
event
,
newInputValue
)
=>
handleChangeDropdown
(
newInputValue
,
tableMeta
)}
debug
disableClearable
//
value={handleValueDropdown(val, 'MAX', tableMeta)}
value
=
{
handleValueDropdown
(
val
,
'MAX'
,
tableMeta
)}
style
=
{{
padding
:
0
,
margin
:
0
}}
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
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
}
/
>
...
...
@@ -734,7 +787,7 @@ export default class CorporateAnnualTargetMR extends Component {
}
debug
disableClearable
//
value={handleValueDropdown(val, 'FORMULA', tableMeta)}
value
=
{
handleValueDropdown
(
val
,
'FORMULA'
,
tableMeta
)}
disabled
=
{
!
handleAction
(
tableMeta
.
rowData
[
2
],
tableMeta
.
rowData
[
0
])}
style
=
{{
padding
:
0
,
margin
:
0
}}
renderInput
=
{(
params
)
=>
...
...
@@ -770,11 +823,12 @@ export default class CorporateAnnualTargetMR extends Component {
control
=
{
<
NumberFormat
thousandSeparator
=
{
true
}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
style
=
{{
color
:
"#5198ea"
,
fontSize
:
12
,
textAlign
:
'center'
,
borderColor
:
'transparent'
,
margin
:
0
,
width
:
96
,
backgroundColor
:
'transparent'
}}
type
=
"text"
placeholder
=
""
value
=
{
Number
(
value
).
toFixed
(
1
)}
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
)}
// 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)}
disabled
=
{
false
}
decimalScale
=
{
1
}
onBlur
=
{(
event
)
=>
{
// updateValue(event.target.value)
...
...
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