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
0dbefb51
Commit
0dbefb51
authored
Oct 02, 2020
by
Deni Rinaldi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lastper
parent
7e5ce462
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
index.js
src/api/index.js
+3
-1
BudgetTahunan.js
src/container/BudgetTahunan.js
+16
-5
No files found.
src/api/index.js
View file @
0dbefb51
...
@@ -204,6 +204,7 @@ const create = (type = "") => {
...
@@ -204,6 +204,7 @@ const create = (type = "") => {
const
checkApprover
=
()
=>
api
.
get
(
'transaction/master_budget/is_approver'
)
const
checkApprover
=
()
=>
api
.
get
(
'transaction/master_budget/is_approver'
)
const
approvalSubmission
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/approval_submission'
,
body
)
const
approvalSubmission
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/approval_submission'
,
body
)
const
getCompanySubmitted
=
(
body
)
=>
api
.
post
(
'transaction/get_company_submitted'
,
body
)
const
getCompanySubmitted
=
(
body
)
=>
api
.
post
(
'transaction/get_company_submitted'
,
body
)
const
getLastPeriod
=
(
idCompany
)
=>
api
.
get
(
`transaction/get_last_periode/
${
idCompany
}
`
)
const
getIdDeleteFromExcel
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/delete_from_excel'
,
body
)
const
getIdDeleteFromExcel
=
(
body
)
=>
api
.
post
(
'transaction/master_budget/delete_from_excel'
,
body
)
const
getOpetratingIndID
=
(
body
)
=>
api
.
post
(
'transaction/get_operating_indicator_id'
,
body
)
const
getOpetratingIndID
=
(
body
)
=>
api
.
post
(
'transaction/get_operating_indicator_id'
,
body
)
...
@@ -367,7 +368,8 @@ const create = (type = "") => {
...
@@ -367,7 +368,8 @@ const create = (type = "") => {
historyApproval
,
historyApproval
,
checkApprover
,
checkApprover
,
approvalSubmission
,
approvalSubmission
,
getCompanySubmitted
getCompanySubmitted
,
getLastPeriod
}
}
}
}
...
...
src/container/BudgetTahunan.js
View file @
0dbefb51
...
@@ -70,7 +70,7 @@ export default class BudgetTahunan extends Component {
...
@@ -70,7 +70,7 @@ export default class BudgetTahunan extends Component {
this
.
props
.
selectIndex
(
'Master Budget & CAT'
)
this
.
props
.
selectIndex
(
'Master Budget & CAT'
)
if
(
this
.
props
.
location
.
state
!==
undefined
)
{
if
(
this
.
props
.
location
.
state
!==
undefined
)
{
console
.
log
(
this
.
props
);
console
.
log
(
this
.
props
);
this
.
setState
({
userType
:
this
.
props
.
location
.
state
.
userType
,
intent
:
'Home'
,
rawData
:
this
.
props
.
location
.
state
.
rawData
},
()
=>
{
this
.
setState
({
userType
:
this
.
props
.
location
.
state
.
userType
,
intent
:
'Home'
,
lastPeriod
:
this
.
props
.
location
.
state
.
rawData
},
()
=>
{
this
.
checkApprover
()
this
.
checkApprover
()
})
})
}
else
{
}
else
{
...
@@ -232,7 +232,7 @@ export default class BudgetTahunan extends Component {
...
@@ -232,7 +232,7 @@ export default class BudgetTahunan extends Component {
};
};
let
index
=
arrayBaru
.
findIndex
((
val
)
=>
val
.
company_id
==
comID
)
let
index
=
arrayBaru
.
findIndex
((
val
)
=>
val
.
company_id
==
comID
)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
index
==
-
1
?
arrayBaru
[
0
]
:
arrayBaru
[
index
]
},
()
=>
{
this
.
setState
({
listCompany
:
defaultProps
,
company
:
index
==
-
1
?
arrayBaru
[
0
]
:
arrayBaru
[
index
]
},
()
=>
{
this
.
get
Periode
()
this
.
get
LastPeriod
()
})
})
}
else
{
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
@@ -250,10 +250,21 @@ export default class BudgetTahunan extends Component {
...
@@ -250,10 +250,21 @@ export default class BudgetTahunan extends Component {
})
})
}
}
getLastPeriod
(){
api
.
create
().
getLastPeriod
(
this
.
state
.
company
.
company_id
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
.
status
===
"success"
)
{
this
.
setState
({
lastPeriod
:
response
.
data
.
data
.
last_periode
},
()
=>
{
this
.
getPeriode
()
})
}
})
}
getPeriode
()
{
getPeriode
()
{
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
api
.
create
().
getPeriodeTransaction
().
then
(
response
=>
{
let
dateNow
=
new
Date
//
let dateNow = new Date
let
year
=
this
.
state
.
rawData
?
this
.
state
.
rawData
.
periode
:
format
(
dateNow
,
'yyyy'
)
//
let year = this.state.rawData ? this.state.rawData.periode : format(dateNow, 'yyyy')
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
...
@@ -266,7 +277,7 @@ export default class BudgetTahunan extends Component {
...
@@ -266,7 +277,7 @@ export default class BudgetTahunan extends Component {
options
:
periodeData
,
options
:
periodeData
,
getOptionLabel
:
(
option
)
=>
option
.
periode
,
getOptionLabel
:
(
option
)
=>
option
.
periode
,
};
};
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
===
year
)
let
index
=
data
.
sort
((
a
,
b
)
=>
a
-
b
).
findIndex
((
val
)
=>
val
===
this
.
state
.
lastPeriod
)
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
===
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
===
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getCompanySubmitted
()
this
.
getCompanySubmitted
()
...
...
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