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
21a26477
Commit
21a26477
authored
Jan 17, 2021
by
Rifka Kurnia
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rifka' into 'master'
Rifka See merge request
!976
parents
c2053f47
9f25c4f9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
167 additions
and
63 deletions
+167
-63
HomePage.js
src/container/HomePage.js
+167
-63
No files found.
src/container/HomePage.js
View file @
21a26477
...
...
@@ -26,6 +26,7 @@ class HomePage extends Component {
],
isApprover
:
true
,
listSubcoMB
:
[],
listSubcoMR
:
[],
valueSubmit
:
0
,
listdmb
:
[],
dataTableMB
:
[],
...
...
@@ -69,22 +70,37 @@ class HomePage extends Component {
getListUserSubco
()
{
api
.
create
().
getDashboardUser
().
then
(
response
=>
{
//
console.log(response);
console
.
log
(
response
);
let
valueSubmit
=
0
let
valueSubmitMR
=
0
let
dataMB
=
[]
let
dataMR
=
[]
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
response
.
data
.
data
.
map
((
item
,
index
)
=>
{
if
(
item
.
is_submit
===
true
)
{
if
(
item
.
is_submit
===
true
&&
item
.
type
===
"master_budget"
)
{
valueSubmit
+=
1
}
else
if
(
item
.
is_submit
===
true
&&
item
.
type
===
"monthly_report"
)
{
valueSubmitMR
+=
1
}
if
(
item
.
type
===
"master_budget"
)
{
dataMB
.
push
(
item
)
}
else
{
dataMR
.
push
(
item
)
}
})
this
.
setState
({
listSubcoMB
:
response
.
data
.
data
,
listSubcoMB
:
dataMB
,
listSubcoMR
:
dataMR
,
valueSubmit
,
valueSubmitMR
,
loading
:
false
})
}
}
console
.
log
(
this
.
state
.
listSubcoMB
)
console
.
log
(
this
.
state
.
listSubcoMR
)
})
}
...
...
@@ -92,13 +108,25 @@ class HomePage extends Component {
let
listDashboard
=
[]
let
rawData
=
[]
api
.
create
().
getDashboard
().
then
((
response
)
=>
{
//
console.log(response);
console
.
log
(
response
);
if
(
String
(
response
.
data
.
status
).
toLocaleLowerCase
()
==
'success'
)
{
let
data
=
response
.
data
.
data
data
.
map
((
item
,
index
)
=>
{
let
statusConvert
=
item
.
status
==
'approval_review'
?
'Waiting For Review'
:
item
.
status
==
'approval_proccess'
?
'Waiting For Approval'
:
titleCase
(
item
.
status
)
if
(
this
.
state
.
isApproverMB
&&
this
.
state
.
isApproverMR
){
listDashboard
.
push
([
index
+
1
,
item
.
approval_id
,
item
.
company_name
,
`
${
item
.
type_report
}
-
${
item
.
periode
}
`
,
item
.
revision
,
item
.
status
,
statusConvert
])
rawData
.
push
(
item
)
}
else
if
(
this
.
state
.
isApproverMB
)
{
if
(
String
(
item
.
type_report
).
toLocaleLowerCase
().
includes
(
"master"
)){
listDashboard
.
push
([
index
+
1
,
item
.
approval_id
,
item
.
company_name
,
`
${
item
.
type_report
}
-
${
item
.
periode
}
`
,
item
.
revision
,
item
.
status
,
statusConvert
])
rawData
.
push
(
item
)
}
}
else
if
(
this
.
state
.
isApproverMR
)
{
if
(
String
(
item
.
type_report
).
toLocaleLowerCase
().
includes
(
"monthly"
)){
listDashboard
.
push
([
index
+
1
,
item
.
approval_id
,
item
.
company_name
,
`
${
item
.
type_report
}
-
${
item
.
periode
}
`
,
item
.
revision
,
item
.
status
,
statusConvert
])
rawData
.
push
(
item
)
}
}
})
this
.
setState
({
listDashboard
,
rawData
})
}
...
...
@@ -107,6 +135,10 @@ class HomePage extends Component {
getApprMat
()
{
this
.
setState
({
loading
:
true
})
let
isApproverMR
=
false
let
isApproverMB
=
false
// let isApproverMRTabel = false
// let isApproverMBTabel = false
api
.
create
().
getAM
().
then
((
response
)
=>
{
console
.
log
(
response
);
let
actAMActive
=
[]
...
...
@@ -117,11 +149,35 @@ class HomePage extends Component {
}
})
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
console
.
log
(
userId
);
let
indexId
=
actAMActive
.
findIndex
((
val
)
=>
val
.
user_id
==
userId
)
actAMActive
.
map
((
item
,
index
)
=>
{
if
(
item
.
approval_type_name
===
"MONTHLY_REPORT"
){
isApproverMR
=
true
}
else
if
(
item
.
approval_type_name
===
"MASTER_BUDGET"
){
isApproverMB
=
true
}
})
if
(
indexId
===
-
1
)
{
this
.
setState
({
isApprover
:
false
})
this
.
getListUserSubco
()
}
// else if (isApproverMR){
// if (isApproverMBTabel === false){
// this.setState({ isApproverMRTabel: true, isApproverMBList: true })
// } else {
// this.setState({ isApproverMRTabel: true })
// }
// }
// else if (isApproverMB){
// if (isApproverMRTabel === false){
// this.setState({ isApproverMBTabel: true, isApproverMRList: true })
// } else {
// this.setState({ isApproverMBTabel: true })
// }
// }
this
.
setState
({
isApproverMB
,
isApproverMR
})
this
.
getDashboardMB
()
// console.log(actAM)
this
.
setState
({
loading
:
false
})
...
...
@@ -130,7 +186,7 @@ class HomePage extends Component {
getDashboardMB
()
{
api
.
create
().
getDashboardMB
().
then
((
response
)
=>
{
//
console.log(response)
console
.
log
(
response
)
if
(
String
(
response
.
data
.
status
).
toLocaleLowerCase
()
==
'success'
)
{
let
data
=
response
.
data
.
data
let
listdmb
=
data
.
sort
((
a
,
b
)
=>
a
.
company_id
-
b
.
company_id
).
map
((
item
,
index
)
=>
{
...
...
@@ -156,11 +212,11 @@ class HomePage extends Component {
name
:
"Action"
,
options
:
{
customBodyRender
:
(
val
,
tableMeta
)
=>
{
//
console.log(tableMeta);
console
.
log
(
tableMeta
);
return
(
<
div
style
=
{{
display
:
'flex'
}}
>
<
Link
to
=
{{
pathname
:
`/home/master-budge
t/`
,
pathname
:
this
.
state
.
isApproverMB
?
`/home/master-budget/`
:
`/home/monthly-repor
t/`
,
state
:
{
userType
:
'approver'
,
rawData
:
this
.
state
.
rawData
[
tableMeta
.
rowIndex
]
...
...
@@ -241,6 +297,9 @@ class HomePage extends Component {
/
>
<
/div
>
);
let
bulan
=
new
Date
().
toLocaleString
(
'default'
,
{
month
:
'long'
})
let
tahun
=
new
Date
().
getFullYear
()
return
(
<
div
style
=
{{
flex
:
1
,
backgroundColor
:
'#f8f8f8'
,
minHeight
:
this
.
props
.
height
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
...
...
@@ -249,12 +308,14 @@ class HomePage extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'24px'
,
color
:
'white'
}}
>
{
this
.
state
.
userData
===
null
?
''
:
`Welcome,
${
this
.
state
.
userData
.
fullname
}
!`
}
<
/Typography
>
<
/div
>
<
div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Typography
style
=
{{
color
:
'#656565'
,
fontSize
:
'16px'
,
fontWeight
:
'bold'
}}
>
Waiting
Your
Approval
<
/Typography
>
<
/div
>
<
/div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
div
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
...
...
@@ -277,6 +338,7 @@ class HomePage extends Component {
<
/MuiThemeProvider
>
<
/div
>
<
/div
>
<
/div
>
{
/* <div style={{ marginTop: 20 }}>
<Typography style={{ color: '#656565', fontSize: '16px', fontWeight: 'bold' }}>Status Laporan</Typography>
<div style={{ marginTop: 10, display: 'flex' }}>
...
...
@@ -417,6 +479,7 @@ class HomePage extends Component {
<
Typography
style
=
{{
color
:
'#656565'
,
fontSize
:
'16px'
,
fontWeight
:
'bold'
}}
>
Tasks
to
be
Complete
<
/Typography
>
<
/div
>
<
/div
>
<
div
style
=
{{
display
:
'inline-flex'
}}
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
width
:
450
,
padding
:
20
,
borderRadius
:
10
}}
>
<
Typography
style
=
{{
fontWeight
:
'bold'
,
textDecorationLine
:
'underline'
}}
>
{
`Master Budget
${
this
.
state
.
valueSubmit
}
/
${
this
.
state
.
listSubcoMB
.
length
}
`
}
<
/Typography
>
...
...
@@ -454,6 +517,47 @@ class HomePage extends Component {
})}
<
/Paper
>
<
/div
>
{
/* : this.state.isApproverMRList === true || this.state.isApprover === false ? */
}
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
width
:
450
,
padding
:
20
,
borderRadius
:
10
}}
>
<
Typography
style
=
{{
fontWeight
:
'bold'
,
textDecorationLine
:
'underline'
}}
>
{
`Monthly Report
${
this
.
state
.
valueSubmitMR
}
/
${
this
.
state
.
listSubcoMR
.
length
}
-
${
bulan
}
${
tahun
}
`
}
<
/Typography
>
{
this
.
state
.
listSubcoMR
.
map
((
item
,
index
)
=>
{
return
(
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
,
marginTop
:
10
,
paddingLeft
:
10
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
img
src
=
{
item
.
is_submit
===
true
?
Images
.
dotDone
:
item
.
is_overdue
===
true
?
Images
.
dotOverdue
:
Images
.
dotOpen
}
/
>
<
Link
to
=
{{
pathname
:
`/home/master-budget/`
,
state
:
{
userType
:
'user'
,
rawData
:
item
}
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
margin
:
5
,
outline
:
'none'
}}
>
<
Typography
style
=
{{
marginLeft
:
10
,
color
:
'#5198ea'
,
fontSize
:
13
}}
>
{
item
.
company_name
}
<
/Typography
>
<
/button
>
<
/Link
>
<
/div
>
{
item
.
is_overdue
&&
(
<
div
style
=
{{
backgroundColor
:
'#f65a4c'
,
paddingRight
:
5
,
paddingLeft
:
5
,
borderRadius
:
5
,
alignSelf
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
11
,
color
:
'#fff'
}}
>
Overdue
<
/Typography
>
<
/div
>
)}
<
/div
>
)
})}
<
/Paper
>
<
/div
>
{
/* : null
} */
}
<
/div
>
<
/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