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
58b846ad
Commit
58b846ad
authored
Nov 05, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update handle response
parent
5a8a5513
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
330 additions
and
260 deletions
+330
-260
CashFlow.js
src/container/BudgetTahunan/CashFlow.js
+106
-76
CorporateAnnualTarget.js
src/container/BudgetTahunan/CorporateAnnualTarget.js
+224
-184
No files found.
src/container/BudgetTahunan/CashFlow.js
View file @
58b846ad
import
{
createMuiTheme
,
FormControlLabel
,
MuiThemeProvider
,
Paper
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
import
{
createMuiTheme
,
FormControlLabel
,
MuiThemeProvider
,
Paper
,
Snackbar
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
import
MUIDataTable
from
'mui-datatables'
;
import
React
,
{
Component
}
from
'react'
import
NumberFormat
from
'react-number-format'
;
...
...
@@ -7,6 +7,8 @@ import api from '../../api';
import
Images
from
'../../assets/Images'
;
import
*
as
R
from
'ramda'
import
{
PropagateLoader
}
from
'react-spinners'
;
import
Constant
from
'../../library/Constant'
;
import
{
Alert
}
from
'@material-ui/lab'
;
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable3
());
...
...
@@ -58,84 +60,103 @@ export default class CashFlow extends Component {
// console.log(JSON.stringify(payload))
api
.
create
().
getDetailReportCF
(
payload
).
then
(
response
=>
{
let
dataTable
=
[]
console
.
log
(
response
)
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
cash_flow
.
total_actual_before
===
null
?
"0"
:
item
.
cash_flow
.
total_actual_before
===
""
?
"0"
:
item
.
cash_flow
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
january
,
formula
:
item
.
cash_flow
.
january_formula
}
:
item
.
cash_flow
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
february
,
formula
:
item
.
cash_flow
.
february_formula
}
:
item
.
cash_flow
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
march
,
formula
:
item
.
cash_flow
.
march_formula
}
:
item
.
cash_flow
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
april
,
formula
:
item
.
cash_flow
.
april_formula
}
:
item
.
cash_flow
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
may
,
formula
:
item
.
cash_flow
.
may_formula
}
:
item
.
cash_flow
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
june
,
formula
:
item
.
cash_flow
.
june_formula
}
:
item
.
cash_flow
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
july
,
formula
:
item
.
cash_flow
.
july_formula
}
:
item
.
cash_flow
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
august
,
formula
:
item
.
cash_flow
.
august_formula
}
:
item
.
cash_flow
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
september
,
formula
:
item
.
cash_flow
.
september_formula
}
:
item
.
cash_flow
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
october
,
formula
:
item
.
cash_flow
.
october_formula
}
:
item
.
cash_flow
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
november
,
formula
:
item
.
cash_flow
.
november_formula
}
:
item
.
cash_flow
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
december
,
formula
:
item
.
cash_flow
.
december_formula
}
:
item
.
cash_flow
.
december
,
item
.
cash_flow
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_more_year
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
cash_flow
.
forecast_formula
==
null
?
[]
:
item
.
cash_flow
.
forecast_formula
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
cash_flow
.
total_actual_before
===
null
?
"0"
:
item
.
cash_flow
.
total_actual_before
===
""
?
"0"
:
item
.
cash_flow
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
january
,
formula
:
item
.
cash_flow
.
january_formula
}
:
item
.
cash_flow
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
february
,
formula
:
item
.
cash_flow
.
february_formula
}
:
item
.
cash_flow
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
march
,
formula
:
item
.
cash_flow
.
march_formula
}
:
item
.
cash_flow
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
april
,
formula
:
item
.
cash_flow
.
april_formula
}
:
item
.
cash_flow
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
may
,
formula
:
item
.
cash_flow
.
may_formula
}
:
item
.
cash_flow
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
june
,
formula
:
item
.
cash_flow
.
june_formula
}
:
item
.
cash_flow
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
july
,
formula
:
item
.
cash_flow
.
july_formula
}
:
item
.
cash_flow
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
august
,
formula
:
item
.
cash_flow
.
august_formula
}
:
item
.
cash_flow
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
september
,
formula
:
item
.
cash_flow
.
september_formula
}
:
item
.
cash_flow
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
october
,
formula
:
item
.
cash_flow
.
october_formula
}
:
item
.
cash_flow
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
november
,
formula
:
item
.
cash_flow
.
november_formula
}
:
item
.
cash_flow
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
december
,
formula
:
item
.
cash_flow
.
december_formula
}
:
item
.
cash_flow
.
december
,
item
.
cash_flow
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_more_year
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
cash_flow
.
forecast_formula
==
null
?
[]
:
item
.
cash_flow
.
forecast_formula
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
cash_flow
.
total_actual_before
===
null
?
"0"
:
item
.
cash_flow
.
total_actual_before
===
""
?
"0"
:
item
.
cash_flow
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
january
,
formula
:
item
.
cash_flow
.
january_formula
}
:
item
.
cash_flow
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
february
,
formula
:
item
.
cash_flow
.
february_formula
}
:
item
.
cash_flow
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
march
,
formula
:
item
.
cash_flow
.
march_formula
}
:
item
.
cash_flow
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
april
,
formula
:
item
.
cash_flow
.
april_formula
}
:
item
.
cash_flow
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
may
,
formula
:
item
.
cash_flow
.
may_formula
}
:
item
.
cash_flow
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
june
,
formula
:
item
.
cash_flow
.
june_formula
}
:
item
.
cash_flow
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
july
,
formula
:
item
.
cash_flow
.
july_formula
}
:
item
.
cash_flow
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
august
,
formula
:
item
.
cash_flow
.
august_formula
}
:
item
.
cash_flow
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
september
,
formula
:
item
.
cash_flow
.
september_formula
}
:
item
.
cash_flow
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
october
,
formula
:
item
.
cash_flow
.
october_formula
}
:
item
.
cash_flow
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
november
,
formula
:
item
.
cash_flow
.
november_formula
}
:
item
.
cash_flow
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
december
,
formula
:
item
.
cash_flow
.
december_formula
}
:
item
.
cash_flow
.
december
,
item
.
cash_flow
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_more_year
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
cash_flow
.
forecast_formula
==
null
?
[]
:
item
.
cash_flow
.
forecast_formula
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
}
}
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
item
.
description
,
item
.
cash_flow
.
total_actual_before
===
null
?
"0"
:
item
.
cash_flow
.
total_actual_before
===
""
?
"0"
:
item
.
cash_flow
.
total_actual_before
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
january
,
formula
:
item
.
cash_flow
.
january_formula
}
:
item
.
cash_flow
.
january
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
february
,
formula
:
item
.
cash_flow
.
february_formula
}
:
item
.
cash_flow
.
february
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
march
,
formula
:
item
.
cash_flow
.
march_formula
}
:
item
.
cash_flow
.
march
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
april
,
formula
:
item
.
cash_flow
.
april_formula
}
:
item
.
cash_flow
.
april
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
may
,
formula
:
item
.
cash_flow
.
may_formula
}
:
item
.
cash_flow
.
may
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
june
,
formula
:
item
.
cash_flow
.
june_formula
}
:
item
.
cash_flow
.
june
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
july
,
formula
:
item
.
cash_flow
.
july_formula
}
:
item
.
cash_flow
.
july
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
august
,
formula
:
item
.
cash_flow
.
august_formula
}
:
item
.
cash_flow
.
august
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
september
,
formula
:
item
.
cash_flow
.
september_formula
}
:
item
.
cash_flow
.
september
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
october
,
formula
:
item
.
cash_flow
.
october_formula
}
:
item
.
cash_flow
.
october
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
november
,
formula
:
item
.
cash_flow
.
november_formula
}
:
item
.
cash_flow
.
november
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
{
value
:
item
.
cash_flow
.
december
,
formula
:
item
.
cash_flow
.
december_formula
}
:
item
.
cash_flow
.
december
,
item
.
cash_flow
.
total_current_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_next_year
,
item
.
type_report_id
==
5
||
item
.
type_report_id
==
6
||
item
.
type_report_id
==
7
?
0
:
item
.
cash_flow
.
total_more_year
,
item
.
order
,
item
.
condition_it_should_be
,
item
.
condition_if_wrong
,
item
.
cash_flow
.
forecast_formula
==
null
?
[]
:
item
.
cash_flow
.
forecast_formula
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
res
,
editable
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
res
,
editable
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
...
...
@@ -160,6 +181,10 @@ export default class CashFlow extends Component {
}
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
loading
=
false
...
...
@@ -2281,6 +2306,11 @@ export default class CashFlow extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/Typography
>
<
/div
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
3000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
...
...
src/container/BudgetTahunan/CorporateAnnualTarget.js
View file @
58b846ad
...
...
@@ -111,122 +111,137 @@ export default class CorporateAnnualTarget extends Component {
let
dataInternalBsn
=
[]
// // console.log(response)\
if
(
response
.
data
)
{
let
res
=
response
.
data
.
data
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'
if
(
item
.
parent_name
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
)
{
if
(
item
.
type_report_id
!==
4
)
{
dataInternalBsn
.
push
({
id
:
item
.
id
,
name
:
item
.
description
,
check
:
false
})
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
res
=
response
.
data
.
data
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'
if
(
item
.
parent_name
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
)
{
if
(
item
.
type_report_id
!==
4
)
{
dataInternalBsn
.
push
({
id
:
item
.
id
,
name
:
item
.
description
,
check
:
false
})
}
}
if
(
item
.
parent_name
==
'CUSTOMER PERSPECTIVE'
)
{
if
(
item
.
type_report_id
!==
4
)
{
dataCustomerPrs
.
push
({
id
:
item
.
id
,
name
:
item
.
description
,
check
:
false
})
}
}
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
""
,
item
.
description
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
cat
.
weight
).
indexOf
(
"."
)
==
-
1
?
item
.
cat
.
weight
:
`
${
Number
(
item
.
weight
)
*
100
}
%`
),
parentTrue
?
item
.
cat
.
uom
:
item
.
uom
,
parentTrue
?
item
.
cat
.
kpi_type
==
""
?
null
:
{
value
:
item
.
cat
.
kpi_type
}
:
item
.
kpi_type
==
""
?
null
:
{
value
:
item
.
kpi_type
},
parentTrue
?
item
.
cat
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
cat
.
max_ach
)
}
:
item
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
max_ach
)
},
parentTrue
?
item
.
cat
.
formula
==
""
?
null
:
{
value
:
item
.
cat
.
formula
}
:
item
.
formula_ytd
==
""
?
null
:
{
value
:
item
.
formula_ytd
},
item
.
cat
.
total_actual_before
==
""
?
item
.
cat
.
total_actual_before
:
String
(
item
.
cat
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_actual_before
)
:
Number
(
item
.
cat
.
total_actual_before
).
toFixed
(
1
),
item
.
cat
.
january
==
""
?
item
.
cat
.
january
:
String
(
item
.
cat
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
january
)
:
Number
(
item
.
cat
.
january
).
toFixed
(
1
),
item
.
cat
.
february
==
""
?
item
.
cat
.
february
:
String
(
item
.
cat
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
february
)
:
Number
(
item
.
cat
.
february
).
toFixed
(
1
),
item
.
cat
.
march
==
""
?
item
.
cat
.
march
:
String
(
item
.
cat
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
march
)
:
Number
(
item
.
cat
.
march
).
toFixed
(
1
),
item
.
cat
.
april
==
""
?
item
.
cat
.
april
:
String
(
item
.
cat
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
april
)
:
Number
(
item
.
cat
.
april
).
toFixed
(
1
),
item
.
cat
.
may
==
""
?
item
.
cat
.
may
:
String
(
item
.
cat
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
may
)
:
Number
(
item
.
cat
.
may
).
toFixed
(
1
),
item
.
cat
.
june
==
""
?
item
.
cat
.
june
:
String
(
item
.
cat
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
june
)
:
Number
(
item
.
cat
.
june
).
toFixed
(
1
),
item
.
cat
.
july
==
""
?
item
.
cat
.
july
:
String
(
item
.
cat
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
july
)
:
Number
(
item
.
cat
.
july
).
toFixed
(
1
),
item
.
cat
.
august
==
""
?
item
.
cat
.
august
:
String
(
item
.
cat
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
august
)
:
Number
(
item
.
cat
.
august
).
toFixed
(
1
),
item
.
cat
.
september
==
""
?
item
.
cat
.
september
:
String
(
item
.
cat
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
september
)
:
Number
(
item
.
cat
.
september
).
toFixed
(
1
),
item
.
cat
.
october
==
""
?
item
.
cat
.
october
:
String
(
item
.
cat
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
october
)
:
Number
(
item
.
cat
.
october
).
toFixed
(
1
),
item
.
cat
.
november
==
""
?
item
.
cat
.
november
:
String
(
item
.
cat
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
november
)
:
Number
(
item
.
cat
.
november
).
toFixed
(
1
),
item
.
cat
.
december
==
""
?
item
.
cat
.
december
:
String
(
item
.
cat
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
december
)
:
Number
(
item
.
cat
.
december
).
toFixed
(
1
),
item
.
cat
.
total_current_year
==
""
?
item
.
cat
.
total_current_year
:
String
(
item
.
cat
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_current_year
)
:
Number
(
item
.
cat
.
total_current_year
).
toFixed
(
1
),
item
.
cat
.
total_next_year
==
""
?
item
.
cat
.
total_next_year
:
String
(
item
.
cat
.
total_next_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_next_year
)
:
Number
(
item
.
cat
.
total_next_year
).
toFixed
(
1
),
item
.
cat
.
total_more_year
==
""
?
item
.
cat
.
total_more_year
:
String
(
item
.
cat
.
total_more_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_more_year
)
:
Number
(
item
.
cat
.
total_more_year
).
toFixed
(
1
),
item
.
cat
.
strategic
,
item
.
cat
.
pic
])
}
}
if
(
item
.
parent_name
==
'CUSTOMER PERSPECTIVE'
)
{
if
(
item
.
type_report_id
!==
4
)
{
dataCustomerPrs
.
push
({
id
:
item
.
id
,
name
:
item
.
description
,
check
:
false
})
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
}
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
""
,
item
.
description
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
cat
.
weight
).
indexOf
(
"."
)
==
-
1
?
item
.
cat
.
weight
:
`
${
Number
(
item
.
weight
)
*
100
}
%`
),
parentTrue
?
item
.
cat
.
uom
:
item
.
uom
,
parentTrue
?
item
.
cat
.
kpi_type
==
""
?
null
:
{
value
:
item
.
cat
.
kpi_type
}
:
item
.
kpi_type
==
""
?
null
:
{
value
:
item
.
kpi_type
},
parentTrue
?
item
.
cat
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
cat
.
max_ach
)
}
:
item
.
max_ach
==
""
?
null
:
{
value
:
titleCase
(
item
.
max_ach
)
},
parentTrue
?
item
.
cat
.
formula
==
""
?
null
:
{
value
:
item
.
cat
.
formula
}
:
item
.
formula_ytd
==
""
?
null
:
{
value
:
item
.
formula_ytd
},
item
.
cat
.
total_actual_before
==
""
?
item
.
cat
.
total_actual_before
:
String
(
item
.
cat
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_actual_before
)
:
Number
(
item
.
cat
.
total_actual_before
).
toFixed
(
1
),
item
.
cat
.
january
==
""
?
item
.
cat
.
january
:
String
(
item
.
cat
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
january
)
:
Number
(
item
.
cat
.
january
).
toFixed
(
1
),
item
.
cat
.
february
==
""
?
item
.
cat
.
february
:
String
(
item
.
cat
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
february
)
:
Number
(
item
.
cat
.
february
).
toFixed
(
1
),
item
.
cat
.
march
==
""
?
item
.
cat
.
march
:
String
(
item
.
cat
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
march
)
:
Number
(
item
.
cat
.
march
).
toFixed
(
1
),
item
.
cat
.
april
==
""
?
item
.
cat
.
april
:
String
(
item
.
cat
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
april
)
:
Number
(
item
.
cat
.
april
).
toFixed
(
1
),
item
.
cat
.
may
==
""
?
item
.
cat
.
may
:
String
(
item
.
cat
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
may
)
:
Number
(
item
.
cat
.
may
).
toFixed
(
1
),
item
.
cat
.
june
==
""
?
item
.
cat
.
june
:
String
(
item
.
cat
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
june
)
:
Number
(
item
.
cat
.
june
).
toFixed
(
1
),
item
.
cat
.
july
==
""
?
item
.
cat
.
july
:
String
(
item
.
cat
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
july
)
:
Number
(
item
.
cat
.
july
).
toFixed
(
1
),
item
.
cat
.
august
==
""
?
item
.
cat
.
august
:
String
(
item
.
cat
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
august
)
:
Number
(
item
.
cat
.
august
).
toFixed
(
1
),
item
.
cat
.
september
==
""
?
item
.
cat
.
september
:
String
(
item
.
cat
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
september
)
:
Number
(
item
.
cat
.
september
).
toFixed
(
1
),
item
.
cat
.
october
==
""
?
item
.
cat
.
october
:
String
(
item
.
cat
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
october
)
:
Number
(
item
.
cat
.
october
).
toFixed
(
1
),
item
.
cat
.
november
==
""
?
item
.
cat
.
november
:
String
(
item
.
cat
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
november
)
:
Number
(
item
.
cat
.
november
).
toFixed
(
1
),
item
.
cat
.
december
==
""
?
item
.
cat
.
december
:
String
(
item
.
cat
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
december
)
:
Number
(
item
.
cat
.
december
).
toFixed
(
1
),
item
.
cat
.
total_current_year
==
""
?
item
.
cat
.
total_current_year
:
String
(
item
.
cat
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_current_year
)
:
Number
(
item
.
cat
.
total_current_year
).
toFixed
(
1
),
item
.
cat
.
total_next_year
==
""
?
item
.
cat
.
total_next_year
:
String
(
item
.
cat
.
total_next_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_next_year
)
:
Number
(
item
.
cat
.
total_next_year
).
toFixed
(
1
),
item
.
cat
.
total_more_year
==
""
?
item
.
cat
.
total_more_year
:
String
(
item
.
cat
.
total_more_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_more_year
)
:
Number
(
item
.
cat
.
total_more_year
).
toFixed
(
1
),
item
.
cat
.
strategic
,
item
.
cat
.
pic
])
}
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
""
,
item
.
description
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
item
.
cat
.
weight
,
item
.
cat
.
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
.
cat
.
total_actual_before
==
""
?
item
.
cat
.
total_actual_before
:
String
(
item
.
cat
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_actual_before
)
:
Number
(
item
.
cat
.
total_actual_before
).
toFixed
(
1
),
item
.
cat
.
january
==
""
?
item
.
cat
.
january
:
String
(
item
.
cat
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
january
)
:
Number
(
item
.
cat
.
january
).
toFixed
(
1
),
item
.
cat
.
february
==
""
?
item
.
cat
.
february
:
String
(
item
.
cat
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
february
)
:
Number
(
item
.
cat
.
february
).
toFixed
(
1
),
item
.
cat
.
march
==
""
?
item
.
cat
.
march
:
String
(
item
.
cat
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
march
)
:
Number
(
item
.
cat
.
march
).
toFixed
(
1
),
item
.
cat
.
april
==
""
?
item
.
cat
.
april
:
String
(
item
.
cat
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
april
)
:
Number
(
item
.
cat
.
april
).
toFixed
(
1
),
item
.
cat
.
may
==
""
?
item
.
cat
.
may
:
String
(
item
.
cat
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
may
)
:
Number
(
item
.
cat
.
may
).
toFixed
(
1
),
item
.
cat
.
june
==
""
?
item
.
cat
.
june
:
String
(
item
.
cat
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
june
)
:
Number
(
item
.
cat
.
june
).
toFixed
(
1
),
item
.
cat
.
july
==
""
?
item
.
cat
.
july
:
String
(
item
.
cat
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
july
)
:
Number
(
item
.
cat
.
july
).
toFixed
(
1
),
item
.
cat
.
august
==
""
?
item
.
cat
.
august
:
String
(
item
.
cat
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
august
)
:
Number
(
item
.
cat
.
august
).
toFixed
(
1
),
item
.
cat
.
september
==
""
?
item
.
cat
.
september
:
String
(
item
.
cat
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
september
)
:
Number
(
item
.
cat
.
september
).
toFixed
(
1
),
item
.
cat
.
october
==
""
?
item
.
cat
.
october
:
String
(
item
.
cat
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
october
)
:
Number
(
item
.
cat
.
october
).
toFixed
(
1
),
item
.
cat
.
november
==
""
?
item
.
cat
.
november
:
String
(
item
.
cat
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
november
)
:
Number
(
item
.
cat
.
november
).
toFixed
(
1
),
item
.
cat
.
december
==
""
?
item
.
cat
.
december
:
String
(
item
.
cat
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
december
)
:
Number
(
item
.
cat
.
december
).
toFixed
(
1
),
item
.
cat
.
total_current_year
==
""
?
item
.
cat
.
total_current_year
:
String
(
item
.
cat
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_current_year
)
:
Number
(
item
.
cat
.
total_current_year
).
toFixed
(
1
),
item
.
cat
.
total_next_year
==
""
?
item
.
cat
.
total_next_year
:
String
(
item
.
cat
.
total_next_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_next_year
)
:
Number
(
item
.
cat
.
total_next_year
).
toFixed
(
1
),
item
.
cat
.
total_more_year
==
""
?
item
.
cat
.
total_more_year
:
String
(
item
.
cat
.
total_more_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_more_year
)
:
Number
(
item
.
cat
.
total_more_year
).
toFixed
(
1
),
item
.
cat
.
strategic
,
item
.
cat
.
pic
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
res
,
editable
:
true
,
dataCustomerPrs
,
dataInternalBsn
},
()
=>
{
// console.log(dataCustomerPrs)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
res
.
map
((
item
,
index
)
=>
{
dataTable
.
push
([
item
.
type_report_id
,
item
.
id
,
item
.
parent
,
item
.
formula
,
item
.
level
,
""
,
item
.
description
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
item
.
cat
.
weight
,
item
.
cat
.
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
.
cat
.
total_actual_before
==
""
?
item
.
cat
.
total_actual_before
:
String
(
item
.
cat
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_actual_before
)
:
Number
(
item
.
cat
.
total_actual_before
).
toFixed
(
1
),
item
.
cat
.
january
==
""
?
item
.
cat
.
january
:
String
(
item
.
cat
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
january
)
:
Number
(
item
.
cat
.
january
).
toFixed
(
1
),
item
.
cat
.
february
==
""
?
item
.
cat
.
february
:
String
(
item
.
cat
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
february
)
:
Number
(
item
.
cat
.
february
).
toFixed
(
1
),
item
.
cat
.
march
==
""
?
item
.
cat
.
march
:
String
(
item
.
cat
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
march
)
:
Number
(
item
.
cat
.
march
).
toFixed
(
1
),
item
.
cat
.
april
==
""
?
item
.
cat
.
april
:
String
(
item
.
cat
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
april
)
:
Number
(
item
.
cat
.
april
).
toFixed
(
1
),
item
.
cat
.
may
==
""
?
item
.
cat
.
may
:
String
(
item
.
cat
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
may
)
:
Number
(
item
.
cat
.
may
).
toFixed
(
1
),
item
.
cat
.
june
==
""
?
item
.
cat
.
june
:
String
(
item
.
cat
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
june
)
:
Number
(
item
.
cat
.
june
).
toFixed
(
1
),
item
.
cat
.
july
==
""
?
item
.
cat
.
july
:
String
(
item
.
cat
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
july
)
:
Number
(
item
.
cat
.
july
).
toFixed
(
1
),
item
.
cat
.
august
==
""
?
item
.
cat
.
august
:
String
(
item
.
cat
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
august
)
:
Number
(
item
.
cat
.
august
).
toFixed
(
1
),
item
.
cat
.
september
==
""
?
item
.
cat
.
september
:
String
(
item
.
cat
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
september
)
:
Number
(
item
.
cat
.
september
).
toFixed
(
1
),
item
.
cat
.
october
==
""
?
item
.
cat
.
october
:
String
(
item
.
cat
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
october
)
:
Number
(
item
.
cat
.
october
).
toFixed
(
1
),
item
.
cat
.
november
==
""
?
item
.
cat
.
november
:
String
(
item
.
cat
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
november
)
:
Number
(
item
.
cat
.
november
).
toFixed
(
1
),
item
.
cat
.
december
==
""
?
item
.
cat
.
december
:
String
(
item
.
cat
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
december
)
:
Number
(
item
.
cat
.
december
).
toFixed
(
1
),
item
.
cat
.
total_current_year
==
""
?
item
.
cat
.
total_current_year
:
String
(
item
.
cat
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_current_year
)
:
Number
(
item
.
cat
.
total_current_year
).
toFixed
(
1
),
item
.
cat
.
total_next_year
==
""
?
item
.
cat
.
total_next_year
:
String
(
item
.
cat
.
total_next_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_next_year
)
:
Number
(
item
.
cat
.
total_next_year
).
toFixed
(
1
),
item
.
cat
.
total_more_year
==
""
?
item
.
cat
.
total_more_year
:
String
(
item
.
cat
.
total_more_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
cat
.
total_more_year
)
:
Number
(
item
.
cat
.
total_more_year
).
toFixed
(
1
),
item
.
cat
.
strategic
,
item
.
cat
.
pic
])
if
(
item
.
children
!==
null
)
{
if
(
item
.
children
.
length
>
0
)
{
item
.
children
.
map
((
items
,
indexs
)
=>
{
handlePushChild
(
items
)
})
}
}
})
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
res
,
editable
:
true
,
dataCustomerPrs
,
dataInternalBsn
},
()
=>
{
// console.log(dataCustomerPrs)
})
}
else
{
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
[],
editable
:
true
,
dataCustomerPrs
,
dataInternalBsn
},
()
=>
{
// console.log(dataCustomerPrs)
})
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
...
...
@@ -361,80 +376,95 @@ export default class CorporateAnnualTarget extends Component {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
// this.setState({ visibleUpload: false, visibleCAT: false })
this
.
setState
({
visibleUpload
:
false
,
visibleCAT
:
false
})
let
dataTable
=
[]
let
custoId
=
0
let
bisnsId
=
0
let
dataDelete
=
this
.
state
.
dataDelete
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
item_report
==
'CUSTOMER PERSPECTIVE'
)
{
custoId
=
item
.
item_report_id
}
if
(
item
.
item_report
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
)
{
bisnsId
=
item
.
item_report_id
}
if
(
item
.
type_report_id
!==
4
&&
item
.
parent
!==
null
&&
(
item
.
parent
==
custoId
||
item
.
parent
==
bisnsId
))
{
let
indexCust
=
this
.
state
.
dataCustomerPrs
.
findIndex
((
val
)
=>
val
.
name
==
item
.
item_report
)
let
indexBisn
=
this
.
state
.
dataInternalBsn
.
findIndex
((
val
)
=>
val
.
name
==
item
.
item_report
)
if
(
indexCust
!==
-
1
&&
item
.
item_report_id
==
0
)
{
dataDelete
.
push
(
this
.
state
.
dataCustomerPrs
[
indexCust
].
id
)
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
// this.setState({ visibleUpload: false, visibleCAT: false })
this
.
setState
({
visibleUpload
:
false
,
visibleCAT
:
false
})
let
dataTable
=
[]
let
custoId
=
0
let
bisnsId
=
0
let
dataDelete
=
this
.
state
.
dataDelete
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
item_report
==
'CUSTOMER PERSPECTIVE'
)
{
custoId
=
item
.
item_report_id
}
if
(
i
ndexBisn
!==
-
1
&&
item
.
item_report_id
==
0
)
{
dataDelete
.
push
(
this
.
state
.
dataInternalBsn
[
indexBisn
].
id
)
if
(
i
tem
.
item_report
==
'INTERNAL BUSINESS PROCESS PERSPECTIVE'
)
{
bisnsId
=
item
.
item_report_id
}
}
dataTable
.
push
([
item
.
type_report_id
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
==
null
?
1
:
item
.
level
,
""
,
item
.
item_report
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
weight
).
indexOf
(
"."
)
==
-
1
?
item
.
weight
:
`
${
Number
(
item
.
weight
)
*
100
}
%`
),
item
.
uom
,
item
.
kpi_type
==
""
||
item
.
kpi_type
==
null
?
null
:
{
value
:
item
.
kpi_type
},
item
.
max_ach
==
""
||
item
.
max_ach
==
null
?
null
:
{
value
:
titleCase
(
item
.
max_ach
)
},
item
.
formula_ytd
==
""
||
item
.
formula_ytd
==
null
?
null
:
{
value
:
item
.
formula_ytd
},
item
.
total_actual_before
==
""
?
item
.
total_actual_before
:
String
(
item
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_actual_before
)
:
Number
(
item
.
total_actual_before
).
toFixed
(
1
),
item
.
january
==
""
?
item
.
january
:
String
(
item
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
january
)
:
Number
(
item
.
january
).
toFixed
(
1
),
item
.
february
==
""
?
item
.
february
:
String
(
item
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
february
)
:
Number
(
item
.
february
).
toFixed
(
1
),
item
.
march
==
""
?
item
.
march
:
String
(
item
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
march
)
:
Number
(
item
.
march
).
toFixed
(
1
),
item
.
april
==
""
?
item
.
april
:
String
(
item
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
april
)
:
Number
(
item
.
april
).
toFixed
(
1
),
item
.
may
==
""
?
item
.
may
:
String
(
item
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
may
)
:
Number
(
item
.
may
).
toFixed
(
1
),
item
.
june
==
""
?
item
.
june
:
String
(
item
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
june
)
:
Number
(
item
.
june
).
toFixed
(
1
),
item
.
july
==
""
?
item
.
july
:
String
(
item
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
july
)
:
Number
(
item
.
july
).
toFixed
(
1
),
item
.
august
==
""
?
item
.
august
:
String
(
item
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
august
)
:
Number
(
item
.
august
).
toFixed
(
1
),
item
.
september
==
""
?
item
.
september
:
String
(
item
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
september
)
:
Number
(
item
.
september
).
toFixed
(
1
),
item
.
october
==
""
?
item
.
october
:
String
(
item
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
october
)
:
Number
(
item
.
october
).
toFixed
(
1
),
item
.
november
==
""
?
item
.
november
:
String
(
item
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
november
)
:
Number
(
item
.
november
).
toFixed
(
1
),
item
.
december
==
""
?
item
.
december
:
String
(
item
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
december
)
:
Number
(
item
.
december
).
toFixed
(
1
),
item
.
total_current_year
==
""
?
item
.
total_current_year
:
String
(
item
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_current_year
)
:
Number
(
item
.
total_current_year
).
toFixed
(
1
),
item
.
total_next_year
==
""
?
item
.
total_next_year
:
String
(
item
.
total_next_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_next_year
)
:
Number
(
item
.
total_next_year
).
toFixed
(
1
),
item
.
total_more_year
==
""
?
item
.
total_more_year
:
String
(
item
.
total_more_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_more_year
)
:
Number
(
item
.
total_more_year
).
toFixed
(
1
),
item
.
strategic
,
item
.
pic
,
item
.
error
])
})
// console.log(dataTable)
// // console.log(this.state.buttonError)
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
editable
:
true
,
dataDelete
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
30
].
length
>
0
)
{
// // console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
,
editable
:
true
})
if
(
item
.
type_report_id
!==
4
&&
item
.
parent
!==
null
&&
(
item
.
parent
==
custoId
||
item
.
parent
==
bisnsId
))
{
let
indexCust
=
this
.
state
.
dataCustomerPrs
.
findIndex
((
val
)
=>
val
.
name
==
item
.
item_report
)
let
indexBisn
=
this
.
state
.
dataInternalBsn
.
findIndex
((
val
)
=>
val
.
name
==
item
.
item_report
)
if
(
indexCust
!==
-
1
&&
item
.
item_report_id
==
0
)
{
dataDelete
.
push
(
this
.
state
.
dataCustomerPrs
[
indexCust
].
id
)
}
if
(
indexBisn
!==
-
1
&&
item
.
item_report_id
==
0
)
{
dataDelete
.
push
(
this
.
state
.
dataInternalBsn
[
indexBisn
].
id
)
}
}
dataTable
.
push
([
item
.
type_report_id
,
item
.
item_report_id
,
item
.
parent
,
item
.
formula
,
item
.
level
==
null
?
1
:
item
.
level
,
""
,
item
.
item_report
,
item
.
type_report_id
==
1
?
`
${
Number
(
item
.
weight
)
*
100
}
%`
:
(
String
(
item
.
weight
).
indexOf
(
"."
)
==
-
1
?
item
.
weight
:
`
${
Number
(
item
.
weight
)
*
100
}
%`
),
item
.
uom
,
item
.
kpi_type
==
""
||
item
.
kpi_type
==
null
?
null
:
{
value
:
item
.
kpi_type
},
item
.
max_ach
==
""
||
item
.
max_ach
==
null
?
null
:
{
value
:
titleCase
(
item
.
max_ach
)
},
item
.
formula_ytd
==
""
||
item
.
formula_ytd
==
null
?
null
:
{
value
:
item
.
formula_ytd
},
item
.
total_actual_before
==
""
?
item
.
total_actual_before
:
String
(
item
.
total_actual_before
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_actual_before
)
:
Number
(
item
.
total_actual_before
).
toFixed
(
1
),
item
.
january
==
""
?
item
.
january
:
String
(
item
.
january
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
january
)
:
Number
(
item
.
january
).
toFixed
(
1
),
item
.
february
==
""
?
item
.
february
:
String
(
item
.
february
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
february
)
:
Number
(
item
.
february
).
toFixed
(
1
),
item
.
march
==
""
?
item
.
march
:
String
(
item
.
march
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
march
)
:
Number
(
item
.
march
).
toFixed
(
1
),
item
.
april
==
""
?
item
.
april
:
String
(
item
.
april
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
april
)
:
Number
(
item
.
april
).
toFixed
(
1
),
item
.
may
==
""
?
item
.
may
:
String
(
item
.
may
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
may
)
:
Number
(
item
.
may
).
toFixed
(
1
),
item
.
june
==
""
?
item
.
june
:
String
(
item
.
june
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
june
)
:
Number
(
item
.
june
).
toFixed
(
1
),
item
.
july
==
""
?
item
.
july
:
String
(
item
.
july
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
july
)
:
Number
(
item
.
july
).
toFixed
(
1
),
item
.
august
==
""
?
item
.
august
:
String
(
item
.
august
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
august
)
:
Number
(
item
.
august
).
toFixed
(
1
),
item
.
september
==
""
?
item
.
september
:
String
(
item
.
september
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
september
)
:
Number
(
item
.
september
).
toFixed
(
1
),
item
.
october
==
""
?
item
.
october
:
String
(
item
.
october
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
october
)
:
Number
(
item
.
october
).
toFixed
(
1
),
item
.
november
==
""
?
item
.
november
:
String
(
item
.
november
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
november
)
:
Number
(
item
.
november
).
toFixed
(
1
),
item
.
december
==
""
?
item
.
december
:
String
(
item
.
december
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
december
)
:
Number
(
item
.
december
).
toFixed
(
1
),
item
.
total_current_year
==
""
?
item
.
total_current_year
:
String
(
item
.
total_current_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_current_year
)
:
Number
(
item
.
total_current_year
).
toFixed
(
1
),
item
.
total_next_year
==
""
?
item
.
total_next_year
:
String
(
item
.
total_next_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_next_year
)
:
Number
(
item
.
total_next_year
).
toFixed
(
1
),
item
.
total_more_year
==
""
?
item
.
total_more_year
:
String
(
item
.
total_more_year
).
indexOf
(
"."
)
==
-
1
?
Number
(
item
.
total_more_year
)
:
Number
(
item
.
total_more_year
).
toFixed
(
1
),
item
.
strategic
,
item
.
pic
,
item
.
error
])
})
// // // console.log(this.state.dataTable);
})
// console.log(dataTable)
// // console.log(this.state.buttonError)
this
.
setState
({
dataTable
,
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
editable
:
true
,
dataDelete
},
()
=>
{
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
30
].
length
>
0
)
{
// // console.log('masuk')
this
.
setState
({
buttonError
:
true
,
errorPreview
:
true
,
editable
:
true
})
}
})
// // // console.log(this.state.dataTable);
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
...
...
@@ -499,14 +529,25 @@ export default class CorporateAnnualTarget extends Component {
api
.
create
(
'UPLOAD'
).
uploadMasterBudget
(
body
).
then
(
response
=>
{
// // console.log(response);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
onClickClose
()
this
.
props
.
getReport
()
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
onClickClose
()
this
.
props
.
getReport
()
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
}
else
{
alert
(
response
.
data
.
status
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
}
)
}
}
else
{
alert
(
response
.
problem
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
}
)
}
})
}
...
...
@@ -752,7 +793,6 @@ export default class CorporateAnnualTarget extends Component {
},
1000
);
}
})
// alert(response.data.message)
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
...
...
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