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
d5824a92
Commit
d5824a92
authored
Nov 08, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tinggal issue be
parent
4fd26de9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
6 deletions
+73
-6
BudgetTahunan.js
src/container/BudgetTahunan.js
+73
-6
No files found.
src/container/BudgetTahunan.js
View file @
d5824a92
...
@@ -66,7 +66,8 @@ export default class BudgetTahunan extends Component {
...
@@ -66,7 +66,8 @@ export default class BudgetTahunan extends Component {
latestPeriode
:
''
,
latestPeriode
:
''
,
minDateRevision
:
new
Date
(),
minDateRevision
:
new
Date
(),
maxDateRevision
:
new
Date
(),
maxDateRevision
:
new
Date
(),
btnApprove
:
false
btnApprove
:
false
,
isAdmin
:
false
}
}
this
.
myRef
=
React
.
createRef
()
this
.
myRef
=
React
.
createRef
()
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
@@ -89,12 +90,42 @@ export default class BudgetTahunan extends Component {
...
@@ -89,12 +90,42 @@ export default class BudgetTahunan extends Component {
}
}
}
}
getRole
(
id
)
{
api
.
create
().
getDetailRole
(
id
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
// this.setState({ tempData: response.data.data, privileges: response.data.data.privileges })
// console.log(response.data.data)
if
(
String
(
response
.
data
.
data
.
role_name
).
toLocaleLowerCase
()
==
'superadmin'
)
{
this
.
setState
({
isAdmin
:
true
})
}
}
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
);
}
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
})
}
})
}
componentWillUnmount
()
{
componentWillUnmount
()
{
document
.
body
.
style
.
overflow
=
'unset'
;
document
.
body
.
style
.
overflow
=
'unset'
;
}
}
checkApprover
()
{
checkApprover
()
{
api
.
create
().
checkApprover
().
then
(
response
=>
{
api
.
create
().
checkApprover
().
then
(
response
=>
{
console
.
log
(
response
.
data
.
data
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
// console.log(response);
// console.log(response);
...
@@ -262,6 +293,7 @@ export default class BudgetTahunan extends Component {
...
@@ -262,6 +293,7 @@ export default class BudgetTahunan extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
getRole
(
response
.
data
.
data
.
role_id
)
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
},
()
=>
{
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
},
()
=>
{
this
.
getCompanyActive
()
this
.
getCompanyActive
()
})
})
...
@@ -423,7 +455,7 @@ export default class BudgetTahunan extends Component {
...
@@ -423,7 +455,7 @@ export default class BudgetTahunan extends Component {
"is_approver"
:
this
.
state
.
isApprover
"is_approver"
:
this
.
state
.
isApprover
}
}
api
.
create
().
getSubmission
(
payload
).
then
(
response
=>
{
api
.
create
().
getSubmission
(
payload
).
then
(
response
=>
{
// console.log(response
)
console
.
log
(
response
.
data
.
data
.
last_status
)
if
(
response
.
data
)
{
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
this
.
setState
({
...
@@ -502,15 +534,16 @@ export default class BudgetTahunan extends Component {
...
@@ -502,15 +534,16 @@ export default class BudgetTahunan extends Component {
"min_periode"
:
moment
(
this
.
state
.
minDateRevision
).
format
(
'YYYY-MM-DD'
),
"min_periode"
:
moment
(
this
.
state
.
minDateRevision
).
format
(
'YYYY-MM-DD'
),
"max_periode"
:
moment
(
this
.
state
.
maxDateRevision
).
format
(
'YYYY-MM-DD'
)
"max_periode"
:
moment
(
this
.
state
.
maxDateRevision
).
format
(
'YYYY-MM-DD'
)
}
}
// console.log(payload)
console
.
log
(
payload
)
console
.
log
(
body
)
api
.
create
().
approvalSubmission
(
body
).
then
((
res
)
=>
{
api
.
create
().
approvalSubmission
(
body
).
then
((
res
)
=>
{
//
console.log(res)
console
.
log
(
res
)
// this.setState({ loading: false }, () => {
// this.setState({ loading: false }, () => {
this
.
getSubmission
()
// })
// })
if
(
type
==
'revision'
)
{
if
(
type
==
'revision'
)
{
api
.
create
().
createPeriodeRevision
(
payload
).
then
((
res
))
api
.
create
().
createPeriodeRevision
(
payload
).
then
((
res
))
}
}
this
.
getSubmission
()
})
})
}
}
...
@@ -1198,7 +1231,41 @@ export default class BudgetTahunan extends Component {
...
@@ -1198,7 +1231,41 @@ export default class BudgetTahunan extends Component {
<
/div
>
<
/div
>
)}
)}
<
/div
>
<
/div
>
{
this
.
state
.
checkApprover
===
true
?
{
this
.
state
.
isAdmin
&&
this
.
state
.
lastStatus
==
'APPROVED'
?
<
div
className
=
"grid grid-2x"
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
}}
>
<
div
className
=
"col-1"
/>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
setState
({
visibleRevision
:
true
})}
>
<
div
style
=
{{
backgroundColor
:
'#019ce5'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Revision
<
/Typography
>
<
/div
>
<
/button
>
{
/* <button
style={{
backgroundColor: 'transparent',
cursor: 'pointer',
borderColor: 'transparent',
outline: 'none',
}}
onClick={() => this.approvalSubmission('approve')}
>
<div style={{ backgroundColor: '#354960', width: 105, height: 25, borderRadius: 3, justifyContent: 'center', display: 'flex', alignItems: 'center' }}>
<Typography style={{ fontSize: '11px', color: '#fff', textAlign: 'center' }}>Approve</Typography>
</div>
</button> */
}
<
/div
>
<
/div
>
:
this
.
state
.
checkApprover
===
true
?
this
.
state
.
lastStatus
===
'WAITING FOR REVIEW'
?
this
.
state
.
lastStatus
===
'WAITING FOR REVIEW'
?
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
button
<
button
...
...
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