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
d4c37246
Commit
d4c37246
authored
Jan 17, 2021
by
Riri Novita
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://103.44.149.204/d.arizona/tia-dev
into riri
parents
8a261196
3ef2d52d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
30 deletions
+104
-30
index.js
src/api/index.js
+7
-1
MonthlyReport.js
src/container/MonthlyReport.js
+95
-27
CorporateAnnualTargetMR.js
src/container/MonthlyReport/CorporateAnnualTargetMR.js
+2
-2
No files found.
src/api/index.js
View file @
d4c37246
...
...
@@ -258,6 +258,9 @@ const create = (type = "") => {
// Monthly
const
getMonthlyReport
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/get_all_report'
,
body
)
const
submitMonthlyReport
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/submit_monthly_report'
,
body
)
const
approvalMonthly
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/approval_monthly'
,
body
)
const
createPeriodeRevisionMonthly
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/create_periode_revision'
,
body
)
const
getMonthlyOI
=
(
body
)
=>
api
.
post
(
'transaction/operating_indicator/monthly_report/get_operating_indicator_id'
,
body
)
const
getMonthlyReportID
=
(
body
)
=>
api
.
post
(
'transaction/monthly_report/get_monthly_report_id'
,
body
)
// const getHierarkiMontlyReportBS = (body) => api.post('transaction/monthly_report_bs/get_report_hierarki', body)
...
...
@@ -555,7 +558,10 @@ const create = (type = "") => {
getParameterByGroupName
,
getSubmitMonthlyReport
,
getIdDeleteFromExcelLOCF
,
deleteAllItemReportLOCF
deleteAllItemReportLOCF
,
submitMonthlyReport
,
approvalMonthly
,
createPeriodeRevisionMonthly
}
}
...
...
src/container/MonthlyReport.js
View file @
d4c37246
...
...
@@ -66,7 +66,9 @@ export default class MonthlyReport extends Component {
lastStatus
:
''
,
approverTrue
:
false
,
listStatus
:
[],
selectedStatus
:
[]
selectedStatus
:
[],
detailRevisiCheck
:
[],
isApprovedMB
:
false
}
this
.
myRef
=
React
.
createRef
()
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
...
...
@@ -114,17 +116,17 @@ export default class MonthlyReport extends Component {
getChecApprover
()
{
let
listStatus1
=
[
{
name
:
'Open'
,
value
:
'not-yet'
},
{
name
:
'Submitted'
,
value
:
'
submitted
'
},
{
name
:
'Waiting for Review
'
,
value
:
'approval_review
'
},
{
name
:
'Waiting for Approval'
,
value
:
'approval_pro
cess'
},
{
name
:
'Revision'
,
value
:
'revision'
},
{
name
:
'Submitted'
,
value
:
'
approval_review
'
},
{
name
:
'Waiting for Review
/ Approval'
,
value
:
'approval_proccess
'
},
// {name: 'Waiting for Approval', value: 'approval_proc
cess'},
//
{name: 'Revision', value: 'revision'},
{
name
:
'Approved'
,
value
:
'approved'
},
]
let
listStatus2
=
[
{
name
:
'Open'
,
value
:
'not-yet'
},
{
name
:
'Submitted'
,
value
:
'
submitted
'
},
{
name
:
'Revision'
,
value
:
'revision'
},
{
name
:
'Submitted'
,
value
:
'
approval_review
'
},
//
{name: 'Revision', value: 'revision'},
{
name
:
'Approved'
,
value
:
'approved'
},
]
...
...
@@ -133,7 +135,7 @@ export default class MonthlyReport extends Component {
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
if
(
response
.
data
.
data
.
is_approver
===
true
)
{
this
.
setState
({
isApprover
:
true
,
checkApprover
:
true
,
still_approver
:
true
,
approverTrue
:
true
,
listStatus
:
listStatus1
,
selectedStatus
:
[
listStatus1
[
0
]]
},
()
=>
this
.
setState
({
isApprover
:
true
,
checkApprover
:
true
,
still_approver
:
true
,
approverTrue
:
true
,
listStatus
:
listStatus1
,
selectedStatus
:
listStatus1
},
()
=>
{
// if (this.state.submittedOnly) {
this
.
getMonth
()
...
...
@@ -142,7 +144,7 @@ export default class MonthlyReport extends Component {
// }
})
}
else
{
this
.
setState
({
isApprover
:
false
,
checkApprover
:
false
,
still_approver
:
false
,
approverTrue
:
false
,
listStatus
:
listStatus2
,
selectedStatus
:
[
listStatus2
[
0
]]
},
()
=>
this
.
setState
({
isApprover
:
false
,
checkApprover
:
false
,
still_approver
:
false
,
approverTrue
:
false
,
listStatus
:
listStatus2
,
selectedStatus
:
listStatus2
},
()
=>
this
.
getMonth
())
// this.getCompanyActive())
}
...
...
@@ -205,7 +207,7 @@ export default class MonthlyReport extends Component {
item
.
number
,
item
.
report_name
==
"CAT"
?
"Corporate Annual Target"
:
item
.
report_name
,
item
.
revision
,
this
.
state
.
lastStatus
===
'APPROVED'
?
'CLOSED'
:
this
.
state
.
isSubmit
===
false
?
"CLOSED"
:
item
.
current_status
,
this
.
state
.
isApprovedMB
?
(
this
.
state
.
lastStatus
===
'APPROVED'
?
'CLOSED'
:
this
.
state
.
isSubmit
===
false
?
"CLOSED"
:
item
.
current_status
)
:
"CLOSED"
,
item
.
report_id
,
item
.
is_can_upload
,
item
.
revision
...
...
@@ -346,14 +348,14 @@ export default class MonthlyReport extends Component {
let
data
=
[]
response
.
data
.
data
.
map
((
item
)
=>
{
if
(
this
.
state
.
isApprover
)
{
if
(
item
>=
2000
&&
item
<=
(
Number
(
currentYear
)
+
1
))
{
if
(
item
>=
2000
&&
item
<=
(
Number
(
currentYear
)))
{
data
.
push
(
item
)
}
}
else
{
// if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
// data.push(item)
// }
if
((
item
>=
2000
)
&&
(
item
==
currentYear
||
item
<=
currentYear
+
1
))
{
if
((
item
>=
2000
)
&&
(
item
==
currentYear
||
item
<=
currentYear
))
{
data
.
push
(
item
)
}
}
...
...
@@ -375,7 +377,8 @@ export default class MonthlyReport extends Component {
console
.
log
(
index
)
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
===
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
// if (this.state.isApprover === true && this.state.submittedOnly) {
this
.
getCompanySubmitted
()
this
.
getDetailUser
()
// this.getCompanySubmitted()
// console.log('masuk')
// } else {
// this.getRevision()
...
...
@@ -397,6 +400,51 @@ export default class MonthlyReport extends Component {
})
}
getDetailUser
()
{
let
userId
=
localStorage
.
getItem
(
Constant
.
USER
)
api
.
create
().
getDetailUser
(
userId
).
then
((
response
)
=>
{
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
this
.
getRole
(
response
.
data
.
data
.
role_id
)
this
.
setState
({
userCompany
:
response
.
data
.
data
.
company
},
()
=>
{
this
.
getCompanySubmitted
()
})
}
}
}
})
}
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'
})
}
})
}
getCompanySubmitted
()
{
let
selectedStatus
=
this
.
state
.
selectedStatus
.
map
((
item
)
=>
{
return
item
.
value
...
...
@@ -406,6 +454,7 @@ export default class MonthlyReport extends Component {
"months"
:
this
.
state
.
month
.
month_id
,
"status"
:
selectedStatus
}
api
.
create
().
getCompanySubmittedMonthly
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
...
...
@@ -419,16 +468,27 @@ export default class MonthlyReport extends Component {
}
})
let
arrayBaru
=
[]
this
.
state
.
userCompany
.
map
((
item
,
index
)
=>
{
let
indexID
=
companyData
.
findIndex
((
val
)
=>
val
.
company_id
==
item
)
if
(
indexID
!==
-
1
)
{
arrayBaru
.
push
(
companyData
[
indexID
])
}
})
if
(
arrayBaru
.
length
>
0
)
{
arrayBaru
=
arrayBaru
.
sort
((
a
,
b
)
=>
a
.
company_name
.
localeCompare
(
b
.
company_name
))
}
let
defaultProps
=
{
options
:
companyData
,
options
:
arrayBaru
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
}
let
indexID
=
null
if
(
this
.
state
.
rawData
!==
undefined
)
{
indexID
=
companyData
.
findIndex
((
val
)
=>
val
.
company_id
==
this
.
state
.
rawData
.
company_id
)
indexID
=
arrayBaru
.
findIndex
((
val
)
=>
val
.
company_id
==
this
.
state
.
rawData
.
company_id
)
}
// console.log(response.data.data.length)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
indexID
==
null
?
companyData
[
0
]
:
companyData
[
indexID
],
company_submit
:
defaultProps
},
()
=>
{
this
.
setState
({
listCompany
:
defaultProps
,
company
:
indexID
==
null
?
arrayBaru
[
0
]
:
arrayBaru
[
indexID
],
company_submit
:
defaultProps
},
()
=>
{
// console.log(response.data.data.length)
if
(
response
.
data
.
data
.
length
>
0
)
{
this
.
getRevision
()
...
...
@@ -509,6 +569,7 @@ export default class MonthlyReport extends Component {
"months"
:
this
.
state
.
month
.
month_id
,
"is_approver"
:
this
.
state
.
isApprover
}
this
.
setState
({
visibleTableHistory
:
false
})
api
.
create
().
getMonthlyReportID
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
...
...
@@ -519,7 +580,8 @@ export default class MonthlyReport extends Component {
lastStatus
:
response
.
data
.
data
.
last_status
===
null
?
'SUBMIT'
:
response
.
data
.
data
.
last_status
,
lastRevision
:
response
.
data
.
data
.
last_revision
,
btnApprove
:
response
.
data
.
data
.
is_submit
,
monthlyReportId
:
response
.
data
.
data
?
response
.
data
.
data
.
monthly_report_id
:
null
monthlyReportId
:
response
.
data
.
data
?
response
.
data
.
data
.
monthly_report_id
:
null
,
isApprovedMB
:
response
.
data
.
data
.
is_approved_master_budget
},
()
=>
{
// // console.log(this.state.lastStatus);
this
.
historyApproval
()
...
...
@@ -828,13 +890,13 @@ export default class MonthlyReport extends Component {
})
if
(
canSubmit
===
true
)
{
let
body
=
{
submission_id
:
this
.
state
.
submissionID
monthly_report_id
:
this
.
state
.
monthlyReportId
}
api
.
create
().
submitM
asterBudge
t
(
body
).
then
(
response
=>
{
// // //
console.log(response);
api
.
create
().
submitM
onthlyRepor
t
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
get
Sub
mission
()
this
.
get
Per
mission
()
}
}
})
...
...
@@ -876,6 +938,7 @@ export default class MonthlyReport extends Component {
let
body
=
{
"approval_id"
:
this
.
state
.
approverID
,
"status"
:
type
,
"months"
:
this
.
state
.
month
.
month_id
,
"detail"
:
this
.
state
.
detailRevisiCheck
}
let
payload
=
{
...
...
@@ -887,14 +950,14 @@ export default class MonthlyReport extends Component {
// // // console.log(payload)
// // console.log(this.props.location);
// // console.log(body)
api
.
create
().
approval
Submission
(
body
).
then
((
res
)
=>
{
// // //
console.log(res)
api
.
create
().
approval
Monthly
(
body
).
then
((
res
)
=>
{
console
.
log
(
res
)
// this.setState({ loading: false }, () => {
// })
if
(
type
==
'revision'
)
{
api
.
create
().
createPeriodeRevision
(
payload
).
then
((
res
))
api
.
create
().
createPeriodeRevision
Monthly
(
payload
).
then
((
res
))
}
this
.
get
Sub
mission
()
this
.
get
Per
mission
()
})
}
...
...
@@ -1176,7 +1239,7 @@ export default class MonthlyReport extends Component {
);
return
(
<
div
style
=
{{
flex
:
1
,
backgroundColor
:
'#f8f8f8'
}}
>
<
div
style
=
{{
flex
:
1
,
backgroundColor
:
'#f8f8f8'
}}
ref
=
{
this
.
myRef
}
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
6000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
...
...
@@ -1441,6 +1504,11 @@ export default class MonthlyReport extends Component {
<
/div
>
)}
<
/div
>
{
this
.
state
.
isApprovedMB
===
false
&&
(
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
,
marginTop
:
20
}}
>
<
span
>
Master
Budget
Has
Not
Been
Approved
<
/span
>
<
/div
>
)}
{
this
.
state
.
approverTrue
===
true
?
this
.
state
.
lastStatus
===
'WAITING FOR REVIEW'
?
<
div
style
=
{{
width
:
'100%'
,
padding
:
'10px 20px'
,
backgroundColor
:
'yellow'
,
textAlign
:
'center'
,
marginTop
:
20
}}
>
...
...
@@ -1519,7 +1587,7 @@ export default class MonthlyReport extends Component {
<
/div
>
<
/div
>
:
this
.
state
.
checkApprover
===
true
?
this
.
state
.
approverTrue
?
this
.
state
.
lastStatus
===
'WAITING FOR REVIEW'
?
<
div
style
=
{{
borderTop
:
'solid 1px #c4c4c4'
,
padding
:
10
,
backgroundColor
:
'#f5f5f5'
,
width
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
button
...
...
src/container/MonthlyReport/CorporateAnnualTargetMR.js
View file @
d4c37246
...
...
@@ -662,7 +662,7 @@ export default class CorporateAnnualTargetMR extends Component {
let
listParameterFilter
=
listParameter
.
filter
((
val
)
=>
val
.
setting_type
==
String
(
parameterMix
).
toLocaleUpperCase
())
let
listParameterFilterCompany
=
listParameterFilter
.
filter
((
val
)
=>
val
.
company_id
==
this
.
props
.
company
.
company_id
)
let
totalScore
=
0
let
achx100
=
item
[
9
]
==
'100%'
?
Number
(
totalAch
)
/
100
>
1
?
1
:
Number
(
totalAch
)
/
100
:
Number
(
totalAch
)
/
100
let
achx100
=
item
[
9
]
==
'100%'
&&
(
item
[
8
]
==
'HIB'
||
item
[
8
]
==
'HIG'
)
?
Number
(
totalAch
)
/
100
>
1
?
1
:
Number
(
totalAch
)
/
100
:
Number
(
totalAch
)
/
100
if
(
listParameterFilterCompany
.
length
==
0
)
{
listParameterFilter
.
map
((
item
,
index
)
=>
{
if
(
Number
(
achx100
)
>=
Number
(
item
.
min_value
)
&&
Number
(
achx100
)
<=
Number
(
item
.
max_value
))
{
...
...
@@ -1165,7 +1165,7 @@ export default class CorporateAnnualTargetMR extends Component {
let
listParameterFilter
=
listParameter
.
filter
((
val
)
=>
val
.
setting_type
==
String
(
parameterMix
).
toLocaleUpperCase
())
let
listParameterFilterCompany
=
listParameterFilter
.
filter
((
val
)
=>
val
.
company_id
==
this
.
props
.
company
.
company_id
)
let
totalScore
=
0
let
achx100
=
tableMeta
.
rowData
[
9
]
==
'100%'
?
Number
(
tableMeta
.
rowData
[
13
])
/
100
>
1
?
1
:
Number
(
tableMeta
.
rowData
[
13
])
/
100
:
Number
(
tableMeta
.
rowData
[
13
])
/
100
let
achx100
=
tableMeta
.
rowData
[
9
]
==
'100%'
&&
(
tableMeta
.
rowData
[
8
]
==
'HIB'
||
tableMeta
.
rowData
[
8
]
==
'HIG'
)
?
Number
(
tableMeta
.
rowData
[
13
])
/
100
>
1
?
1
:
Number
(
tableMeta
.
rowData
[
13
])
/
100
:
Number
(
tableMeta
.
rowData
[
13
])
/
100
if
(
listParameterFilterCompany
.
length
==
0
)
{
listParameterFilter
.
map
((
item
,
index
)
=>
{
if
(
Number
(
achx100
)
>=
Number
(
item
.
min_value
)
&&
Number
(
achx100
)
<=
Number
(
item
.
max_value
))
{
...
...
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