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
33b604a9
Commit
33b604a9
authored
Mar 02, 2021
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
65bd51db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
10 deletions
+25
-10
DashboardCAT.js
src/container/Laporan/DashboardCAT.js
+25
-10
No files found.
src/container/Laporan/DashboardCAT.js
View file @
33b604a9
...
@@ -32,7 +32,8 @@ export default class DashboardCAT extends Component {
...
@@ -32,7 +32,8 @@ export default class DashboardCAT extends Component {
dataDashboard
:
[],
dataDashboard
:
[],
selectedKPI
:
[],
selectedKPI
:
[],
listKPI
:
[],
listKPI
:
[],
rawData
:
{}
selectedMonth
:
[],
rawData
:
null
}
}
}
}
...
@@ -42,7 +43,7 @@ export default class DashboardCAT extends Component {
...
@@ -42,7 +43,7 @@ export default class DashboardCAT extends Component {
let
dataStorageCAT
=
localStorage
.
getItem
(
Constant
.
DATACAT
)
let
dataStorageCAT
=
localStorage
.
getItem
(
Constant
.
DATACAT
)
console
.
log
(
dataStorageCAT
)
console
.
log
(
dataStorageCAT
)
if
(
dataStorageCAT
!=
'datacat'
)
{
if
(
dataStorageCAT
!=
'datacat'
)
{
this
.
setState
({
selectedKPI
:
JSON
.
parse
(
dataStorageCAT
).
listKPI
})
this
.
setState
({
selectedKPI
:
JSON
.
parse
(
dataStorageCAT
).
listKPI
})
console
.
log
(
dataStorageCAT
)
console
.
log
(
dataStorageCAT
)
}
}
if
(
this
.
props
.
location
.
state
!==
undefined
)
{
if
(
this
.
props
.
location
.
state
!==
undefined
)
{
...
@@ -106,7 +107,7 @@ export default class DashboardCAT extends Component {
...
@@ -106,7 +107,7 @@ export default class DashboardCAT extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
comID
=
this
.
state
.
rawData
?
this
.
state
.
rawData
.
companyId
:
0
let
comID
=
this
.
state
.
rawData
!=
null
?
this
.
state
.
rawData
.
companyId
:
0
// console.log(comID)
// console.log(comID)
let
companyData
=
data
.
map
((
item
)
=>
{
let
companyData
=
data
.
map
((
item
)
=>
{
return
{
return
{
...
@@ -172,7 +173,7 @@ export default class DashboardCAT extends Component {
...
@@ -172,7 +173,7 @@ export default class DashboardCAT extends Component {
let
data
=
[]
let
data
=
[]
console
.
log
(
response
.
data
.
data
)
console
.
log
(
response
.
data
.
data
)
console
.
log
(
this
.
state
.
lastPeriod
)
console
.
log
(
this
.
state
.
lastPeriod
)
let
periodeID
=
this
.
state
.
rawData
?
this
.
state
.
rawData
.
periode
:
0
let
periodeID
=
this
.
state
.
rawData
!=
null
?
this
.
state
.
rawData
.
periode
:
0
response
.
data
.
data
.
map
((
item
)
=>
{
response
.
data
.
data
.
map
((
item
)
=>
{
if
(
this
.
state
.
isApprover
)
{
if
(
this
.
state
.
isApprover
)
{
if
(
item
>=
2000
&&
item
<=
(
Number
(
currentYear
)
+
1
))
{
if
(
item
>=
2000
&&
item
<=
(
Number
(
currentYear
)
+
1
))
{
...
@@ -194,7 +195,7 @@ export default class DashboardCAT extends Component {
...
@@ -194,7 +195,7 @@ export default class DashboardCAT extends Component {
getOptionLabel
:
(
option
)
=>
option
.
periode
,
getOptionLabel
:
(
option
)
=>
option
.
periode
,
};
};
let
periode
=
(
this
.
state
.
lastPeriod
==
""
?
String
(
Number
(
currentYear
)
+
1
)
:
this
.
state
.
lastPeriod
)
let
periode
=
(
this
.
state
.
lastPeriod
==
""
?
String
(
Number
(
currentYear
)
+
1
)
:
this
.
state
.
lastPeriod
)
let
index
=
periodeData
.
sort
((
a
,
b
)
=>
a
.
periode
-
b
.
periode
).
findIndex
((
val
)
=>
periodeID
==
0
?
val
.
periode
===
periode
:
val
.
periode
==
periodeID
)
let
index
=
periodeData
.
sort
((
a
,
b
)
=>
a
.
periode
-
b
.
periode
).
findIndex
((
val
)
=>
periodeID
==
0
?
val
.
periode
===
periode
:
val
.
periode
==
periodeID
)
// // console.log(this.props.location.state.rawData)
// // console.log(this.props.location.state.rawData)
// console.log(this.state.lastPeriod)
// console.log(this.state.lastPeriod)
console
.
log
(
data
)
console
.
log
(
data
)
...
@@ -218,7 +219,7 @@ export default class DashboardCAT extends Component {
...
@@ -218,7 +219,7 @@ export default class DashboardCAT extends Component {
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
console
.
log
(
response
);
console
.
log
(
response
);
let
data
=
response
.
data
.
data
let
data
=
response
.
data
.
data
let
monthID
=
this
.
state
.
rawData
?
this
.
state
.
rawData
.
month
:
0
let
monthID
=
this
.
state
.
rawData
!=
null
?
this
.
state
.
rawData
.
month
:
0
let
monthData
=
data
.
map
((
item
)
=>
{
let
monthData
=
data
.
map
((
item
)
=>
{
return
{
return
{
month_id
:
item
.
id
,
month_id
:
item
.
id
,
...
@@ -229,10 +230,16 @@ export default class DashboardCAT extends Component {
...
@@ -229,10 +230,16 @@ export default class DashboardCAT extends Component {
options
:
monthData
,
options
:
monthData
,
getOptionLabel
:
(
option
)
=>
option
.
month_value
,
getOptionLabel
:
(
option
)
=>
option
.
month_value
,
};
};
let
index
=
data
.
findIndex
((
val
)
=>
monthID
==
0
?
val
.
month_name
==
month
:
val
.
id
==
monthID
)
let
index
=
data
.
findIndex
((
val
)
=>
monthID
==
0
?
val
.
month_name
==
month
:
val
.
id
==
monthID
)
console
.
log
(
index
);
console
.
log
(
index
);
let
selectedMonth
=
[]
monthData
.
map
((
item
,
indexs
)
=>
{
if
(
indexs
<=
index
)
{
selectedMonth
.
push
(
item
.
month_value
)
}
})
this
.
setState
({
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
]
},
()
=>
{
this
.
setState
({
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
]
,
selectedMonth
},
()
=>
{
this
.
getDasboardCAT
()
this
.
getDasboardCAT
()
})
})
}
else
{
}
else
{
...
@@ -289,7 +296,7 @@ export default class DashboardCAT extends Component {
...
@@ -289,7 +296,7 @@ export default class DashboardCAT extends Component {
userID
:
localStorage
.
getItem
(
Constant
.
USER
),
userID
:
localStorage
.
getItem
(
Constant
.
USER
),
listKPI
:
this
.
state
.
selectedKPI
listKPI
:
this
.
state
.
selectedKPI
}
}
localStorage
.
setItem
(
Constant
.
DATACAT
,
this
.
state
.
selectedKPI
.
length
==
0
?
'datacat'
:
JSON
.
stringify
(
payloadData
))
localStorage
.
setItem
(
Constant
.
DATACAT
,
this
.
state
.
selectedKPI
.
length
==
0
?
'datacat'
:
JSON
.
stringify
(
payloadData
))
})
})
}
}
...
@@ -362,6 +369,14 @@ export default class DashboardCAT extends Component {
...
@@ -362,6 +369,14 @@ export default class DashboardCAT extends Component {
{...
this
.
state
.
listMonth
}
{...
this
.
state
.
listMonth
}
id
=
"month"
id
=
"month"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
month
:
newInputValue
,
loading
:
true
},
()
=>
{
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
month
:
newInputValue
,
loading
:
true
},
()
=>
{
let
index
=
this
.
state
.
listMonth
.
options
.
findIndex
((
val
)
=>
val
.
month_id
==
this
.
state
.
month
.
month_id
)
let
selectedMonth
=
[]
this
.
state
.
listMonth
.
options
.
map
((
item
,
indexs
)
=>
{
if
(
indexs
<=
index
)
{
selectedMonth
.
push
(
item
.
month_value
)
}
})
this
.
setState
({
selectedMonth
})
this
.
getDasboardCAT
()
this
.
getDasboardCAT
()
})}
})}
disableClearable
disableClearable
...
@@ -382,7 +397,7 @@ export default class DashboardCAT extends Component {
...
@@ -382,7 +397,7 @@ export default class DashboardCAT extends Component {
<
/Tabs
>
<
/Tabs
>
<
/AppBar
>
<
/AppBar
>
{
this
.
state
.
tab
===
0
?
{
this
.
state
.
tab
===
0
?
<
ExceutiveScoreboard
selectedKPI
=
{
this
.
state
.
selectedKPI
}
setSelectedKPI
=
{
this
.
setSelectedKPI
.
bind
(
this
)}
height
=
{
this
.
props
.
height
}
data
=
{
this
.
state
.
dataDashboard
}
dataPayload
=
{{
month
:
this
.
state
.
month
,
periode
:
this
.
state
.
periode
,
company
:
this
.
state
.
company
}}
/
>
<
ExceutiveScoreboard
selectedKPI
=
{
this
.
state
.
selectedKPI
}
se
lectedMonth
=
{
this
.
state
.
selectedMonth
}
se
tSelectedKPI
=
{
this
.
setSelectedKPI
.
bind
(
this
)}
height
=
{
this
.
props
.
height
}
data
=
{
this
.
state
.
dataDashboard
}
dataPayload
=
{{
month
:
this
.
state
.
month
,
periode
:
this
.
state
.
periode
,
company
:
this
.
state
.
company
}}
/
>
:
:
this
.
state
.
tab
===
1
?
this
.
state
.
tab
===
1
?
<
StrategiMap
height
=
{
this
.
props
.
height
}
data
=
{
this
.
state
.
dataDashboard
}
dataPayload
=
{{
month
:
this
.
state
.
month
,
periode
:
this
.
state
.
periode
,
company
:
this
.
state
.
company
}}
/
>
<
StrategiMap
height
=
{
this
.
props
.
height
}
data
=
{
this
.
state
.
dataDashboard
}
dataPayload
=
{{
month
:
this
.
state
.
month
,
periode
:
this
.
state
.
periode
,
company
:
this
.
state
.
company
}}
/
>
...
...
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