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
19076a4b
Commit
19076a4b
authored
Sep 29, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mamam
parent
0703d033
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
184 additions
and
49 deletions
+184
-49
index.js
src/api/index.js
+3
-1
BudgetTahunan.js
src/container/BudgetTahunan.js
+181
-48
No files found.
src/api/index.js
View file @
19076a4b
...
...
@@ -201,6 +201,7 @@ const create = (type = "") => {
const
countingFormula
=
(
body
)
=>
api
.
post
(
'transaction/counting_formula'
,
body
)
const
submitMasterBudget
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/submit_master_budget'
,
body
)
const
checkIsSubmit
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/is_can_submit'
,
body
)
const
checkApprover
=
()
=>
api
.
get
(
'transaction/master_budget/is_approver'
)
const
getIdDeleteFromExcel
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/delete_from_excel'
,
body
)
const
getOpetratingIndID
=
(
body
)
=>
api
.
post
(
'transaction/get_operating_indicator_id'
,
body
)
...
...
@@ -361,7 +362,8 @@ const create = (type = "") => {
checkIsSubmit
,
getIdDeleteFromExcel
,
getDashboard
,
historyApproval
historyApproval
,
checkApprover
}
}
...
...
src/container/BudgetTahunan.js
View file @
19076a4b
...
...
@@ -50,13 +50,32 @@ export default class BudgetTahunan extends Component {
messageAlert
:
''
,
submissionID
:
null
,
isSubmit
:
false
,
visibleTableHistory
:
false
visibleTableHistory
:
false
,
isApprover
:
false
,
lastStatus
:
""
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
componentDidMount
()
{
this
.
getDetailUser
()
this
.
props
.
selectIndex
(
'Master Budget & CAT'
)
if
(
this
.
props
.
location
.
state
!==
undefined
)
{
this
.
setState
({
userType
:
this
.
props
.
location
.
state
.
userType
})
}
this
.
checkApprover
()
}
checkApprover
()
{
api
.
create
().
checkApprover
().
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
.
data
.
is_approver
===
true
)
{
this
.
setState
({
isApprover
:
true
},
()
=>
this
.
getDetailUser
())
}
else
{
this
.
setState
({
isApprover
:
false
},
()
=>
this
.
getDetailUser
())
}
})
}
getReportAttachment
()
{
...
...
@@ -221,13 +240,17 @@ export default class BudgetTahunan extends Component {
getSubmission
()
{
let
payload
=
{
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
"periode"
:
this
.
state
.
periode
.
periode
,
"is_approver"
:
this
.
state
.
isApprover
}
api
.
create
().
getSubmission
(
payload
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
)
{
if
(
response
.
data
.
data
)
{
this
.
setState
({
submissionID
:
response
.
data
.
data
.
submission_id
,
isSubmit
:
false
},
()
=>
{
this
.
setState
({
submissionID
:
response
.
data
.
data
.
submission_id
,
isSubmit
:
false
,
lastStatus
:
response
.
data
.
data
.
last_status
===
null
?
'SUBMIT'
:
response
.
data
.
data
.
last_status
},
()
=>
{
this
.
checkIsSubmit
()
this
.
historyApproval
()
})
...
...
@@ -240,7 +263,8 @@ export default class BudgetTahunan extends Component {
historyApproval
()
{
let
body
=
{
"submission_id"
:
this
.
state
.
submissionID
"company_id"
:
this
.
state
.
company
.
company_id
,
"periode"
:
this
.
state
.
periode
.
periode
}
api
.
create
().
historyApproval
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
...
...
@@ -254,23 +278,23 @@ export default class BudgetTahunan extends Component {
item
.
history_approval_date
]
})
this
.
setState
({
dataTableHistory
,
visibleTableHistory
:
true
})
this
.
setState
({
dataTableHistory
,
visibleTableHistory
:
true
})
}
})
}
checkIsSubmit
()
{
let
body
=
{
"submission_id"
:
this
.
state
.
submissionID
}
api
.
create
().
checkIsSubmit
(
body
).
then
(
response
=>
{
// console.log(response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"Success"
)
{
this
.
setState
({
isSubmit
:
response
.
data
.
data
.
result
})
}
}
})
//
let body = {
//
"submission_id": this.state.submissionID
//
}
//
api.create().checkIsSubmit(body).then(response => {
// console.log(response.data.data.result
);
//
if (response.data) {
//
if (response.data.status === "Success") {
//
this.setState({ isSubmit: response.data.data.result })
//
}
//
}
//
})
}
clickDetail
(
item
,
id
,
revision
,
status
)
{
...
...
@@ -415,30 +439,41 @@ export default class BudgetTahunan extends Component {
validate
()
{
let
array
=
[]
let
canSubmit
=
true
this
.
state
.
dataTable
.
map
(
item
=>
{
if
(
item
[
3
].
includes
(
"not-yet"
)
||
item
[
3
].
includes
(
"draft"
))
{
array
.
push
(
item
[
3
])
}
else
{
array
.
push
(
item
[
3
])
if
(
item
[
1
]
!==
'Cash Flow'
)
{
if
(
item
[
3
]
!==
"submitted"
)
{
canSubmit
=
false
array
.
push
(
item
[
3
])
}
}
// if (item[3].includes("not-yet") || item[3].includes("draft")) {
// array.push(item[3])
// } else {
// array.push(item[3])
// }
})
// if (array.includes("not-yet" || "draft")) {
// console.log('gagal');
// } else {
// console.log('masuk');
// }
let
body
=
{
submission_id
:
this
.
state
.
submissionID
}
if
(
this
.
state
.
isSubmit
===
true
)
{
if
(
canSubmit
===
true
)
{
let
body
=
{
submission_id
:
this
.
state
.
submissionID
}
api
.
create
().
submitMasterBudget
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"Success"
)
{
this
.
getCompanyActive
()
}
}
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data Is Not Complete'
,
tipeAlert
:
'warning'
})
}
// if (array.includes("not-yet" || "draft")) {
// console.log('gagal');
// } else {
// console.log('masuk');
// }
}
render
()
{
...
...
@@ -490,9 +525,11 @@ export default class BudgetTahunan extends Component {
<
span
>
Revisi
<
/span>
:
val
===
"approval_proccess"
?
<
span
>
Approval
Proccess
<
/span>
:
val
===
"not-yet"
?
null
:
<
img
src
=
{
Images
.
cross
}
style
=
{{
width
:
31
,
height
:
24
}}
/
>
val
===
"approval_review"
?
<
span
>
Approval
Review
<
/span>
:
val
===
"not-yet"
?
null
:
<
img
src
=
{
Images
.
cross
}
style
=
{{
width
:
31
,
height
:
24
}}
/
>
}
<
/div
>
);
...
...
@@ -580,6 +617,7 @@ export default class BudgetTahunan extends Component {
{...
this
.
state
.
listPeriode
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
},
()
=>
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
this
.
getReport
()
this
.
getReportAttachment
()
...
...
@@ -598,6 +636,7 @@ export default class BudgetTahunan extends Component {
{...
this
.
state
.
listCompany
}
id
=
"company"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
company
:
newInputValue
},
()
=>
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
this
.
getReport
()
this
.
getReportAttachment
()
...
...
@@ -684,6 +723,32 @@ export default class BudgetTahunan extends Component {
}
<
/div
>
<
/div
>
{
this
.
state
.
isApprover
===
true
?
this
.
state
.
lastStatus
===
'WAITING FOR REVIEW'
?
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
}}
>
<
span
>
{
this
.
state
.
lastStatus
}
<
/span
>
<
/div> : this.state.lastStatus === 'WAITING FOR YOUR APPROVAL'
?
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
}}
>
<
span
>
{
this
.
state
.
lastStatus
}
<
/span
>
<
/div> : nul
l
:
this
.
state
.
lastStatus
===
'SUBMITTED'
?
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
}}
>
<
span
>
{
this
.
state
.
lastStatus
}
<
/span
>
<
/div>
:
this
.
state
.
lastStatus
===
'WAITING FOR APPROVAL'
?
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
}}
>
<
span
>
{
this
.
state
.
lastStatus
}
<
/span
>
<
/div>
:
this
.
state
.
lastStatus
===
'REVISION'
?
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
}}
>
<
span
>
NEED
REVISION
<
/span
>
<
/div>
:
this
.
state
.
lastStatus
===
'APPROVED'
?
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
}}
>
<
span
>
APPROVED
<
/span
>
<
/div> : nul
l
}
{
this
.
state
.
visibleTableHistory
&&
(
<
div
style
=
{{
marginTop
:
20
}}
>
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
...
...
@@ -696,21 +761,89 @@ export default class BudgetTahunan extends Component {
<
/div
>
)}
<
/div
>
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
isSubmit
===
true
?
'pointer'
:
'cursor'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
onClick
=
{()
=>
this
.
state
.
isSubmit
===
true
?
this
.
validate
()
:
null
}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Submit
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
{
this
.
state
.
isApprover
===
true
?
this
.
state
.
lastStatus
===
'WAITING FOR REVIEW'
?
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
onClick
=
{()
=>
null
}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Review
<
/Typography
>
<
/div
>
<
/button
>
<
/div> : this.state.lastStatus === 'WAITING FOR YOUR APPROVAL'
?
<
div
className
=
"grid grid-2x"
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
}}
>
<
div
className
=
"col-1"
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
onClick
=
{()
=>
null
}
>
<
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
>
<
/div
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
onClick
=
{()
=>
null
}
>
<
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> : nul
l
:
this
.
state
.
lastStatus
===
'SUBMIT'
||
this
.
state
.
lastStatus
===
'REVISION'
?
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
onClick
=
{()
=>
this
.
validate
()}
>
<
div
style
=
{{
backgroundColor
:
'#354960'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Submit
<
/Typography
>
<
/div
>
<
/button
>
<
/div>
:
this
.
state
.
lastStatus
===
'SUBMITTED'
?
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
button
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
}}
onClick
=
{()
=>
null
}
>
<
div
style
=
{{
backgroundColor
:
'gray'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Cancel
<
/Typography
>
<
/div
>
<
/button
>
<
/div> : nul
l
}
<
/Paper
>
<
/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