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
af5a51a0
Commit
af5a51a0
authored
Dec 24, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'didam' into 'master'
pusing asli list See merge request
!859
parents
5d59f4b0
52f7f1e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
58 deletions
+146
-58
MonthlyReport.js
src/container/MonthlyReport.js
+132
-46
ListOfCreditFacilities.js
src/container/MonthlyReport/ListOfCreditFacilities.js
+14
-12
No files found.
src/container/MonthlyReport.js
View file @
af5a51a0
import
React
,
{
Component
}
from
'react'
;
import
{
Typography
,
Paper
,
TextField
,
MenuItem
,
Select
,
FormControlLabel
,
Snackbar
,
withStyles
,
createMuiTheme
,
MuiThemeProvider
}
from
'@material-ui/core'
;
import
{
Typography
,
Paper
,
TextField
,
MenuItem
,
Select
,
FormControlLabel
,
Snackbar
,
withStyles
,
createMuiTheme
,
MuiThemeProvider
,
Checkbox
}
from
'@material-ui/core'
;
import
MUIDataTable
from
'mui-datatables'
;
import
Images
from
'../assets/Images'
;
import
api
from
'../api'
;
...
...
@@ -55,7 +55,11 @@ export default class MonthlyReport extends Component {
tipeAlert
:
''
,
messageAlert
:
''
,
btnCreate
:
false
,
loadview
:
false
loadview
:
false
,
submittedOnly
:
false
,
company_active
:
null
,
company_submit
:
null
,
still_approver
:
false
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
}
...
...
@@ -102,10 +106,16 @@ 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
},
()
=>
this
.
getMonth
())
this
.
setState
({
isApprover
:
true
,
checkApprover
:
true
,
still_approver
:
true
},
()
=>
{
if
(
this
.
state
.
submittedOnly
)
{
this
.
getMonth
()
}
else
{
this
.
getCompanyActive
()
}
})
}
else
{
this
.
setState
({
isApprover
:
false
,
checkApprover
:
false
},
()
=>
this
.
setState
({
isApprover
:
false
,
checkApprover
:
false
,
still_approver
:
false
},
()
=>
this
.
getCompanyActive
())
}
}
else
{
...
...
@@ -206,8 +216,9 @@ export default class MonthlyReport extends Component {
options
:
companyData
,
getOptionLabel
:
(
option
)
=>
titleCase
(
option
.
company_name
),
};
this
.
setState
({
listCompany
:
defaultProps
,
company
:
companyData
[
0
]
},
()
=>
{
this
.
setState
({
listCompany
:
defaultProps
,
company
:
companyData
[
0
]
,
company_active
:
defaultProps
},
()
=>
{
this
.
getMonth
()
// console.log(this.state.company_active)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
},
()
=>
{
...
...
@@ -248,7 +259,11 @@ export default class MonthlyReport extends Component {
console
.
log
(
index
);
this
.
setState
({
listMonth
:
defaultProps
,
month
:
index
==
-
1
?
monthData
[
0
]
:
monthData
[
index
]
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getPeriode
()
if
(
this
.
state
.
submittedOnly
)
{
this
.
getPeriode
()
}
else
{
this
.
getLastPeriod
()
}
}
else
{
this
.
getLastPeriod
()
}
...
...
@@ -313,7 +328,7 @@ export default class MonthlyReport extends Component {
// console.log(periodeData)
console
.
log
(
index
)
this
.
setState
({
listPeriode
:
defaultProps
,
periode
:
index
===
-
1
?
periodeData
[
0
]
:
periodeData
[
index
]
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
if
(
this
.
state
.
isApprover
===
true
&&
this
.
state
.
submittedOnly
)
{
this
.
getCompanySubmitted
()
}
else
{
this
.
getRevision
()
...
...
@@ -361,17 +376,20 @@ export default class MonthlyReport extends Component {
if
(
this
.
state
.
rawData
!==
undefined
)
{
indexID
=
companyData
.
findIndex
((
val
)
=>
val
.
company_id
==
this
.
state
.
rawData
.
company_id
)
}
this
.
setState
({
listCompany
:
defaultProps
,
company
:
indexID
==
null
?
companyData
[
0
]
:
companyData
[
indexID
]
},
()
=>
{
// console.log(response.data.data.length)
this
.
setState
({
listCompany
:
defaultProps
,
company
:
indexID
==
null
?
companyData
[
0
]
:
companyData
[
indexID
],
company_submit
:
defaultProps
},
()
=>
{
// console.log(response.data.data.length)
if
(
response
.
data
.
data
.
length
>
0
)
{
this
.
getRevision
()
}
else
{
// console.log(this.state.listCompany)
// console.log(this.state.company_submit)
this
.
setState
({
listRevision
:
null
,
revision
:
null
,
dataTable
:
[],
checkApprover
:
false
,
lastRevision
:
""
,
visibleTableHistory
:
false
})
}
//
})
}
else
{
this
.
setState
({
listRevision
:
null
,
revision
:
null
,
dataTable
:
[],
checkApprover
:
false
,
lastRevision
:
""
,
visibleTableHistory
:
false
,
loading
:
false
},
()
=>
{
this
.
setState
({
listRevision
:
null
,
revision
:
null
,
listCompany
:
null
,
company
:
null
,
dataTable
:
[],
checkApprover
:
false
,
lastRevision
:
""
,
visibleTableHistory
:
false
,
loading
:
false
},
()
=>
{
document
.
body
.
style
.
overflow
=
'unset'
;
})
}
...
...
@@ -458,10 +476,9 @@ export default class MonthlyReport extends Component {
this
.
getReport
()
this
.
getReportAttachment
()
api
.
create
().
checkApproverMonthly
().
then
(
response
=>
{
// // console.log(response);
if
(
this
.
state
.
btnCreate
===
true
&&
this
.
state
.
btnEdit
===
true
)
{
console
.
log
(
'editable'
);
this
.
setState
({
isApprover
:
false
,
checkApprover
:
false
})
this
.
setState
({
isApprover
:
this
.
state
.
still_approver
?
true
:
false
,
checkApprover
:
false
})
}
else
{
console
.
log
(
'just view'
);
this
.
setState
({
isApprover
:
true
,
checkApprover
:
true
})
...
...
@@ -871,39 +888,108 @@ export default class MonthlyReport extends Component {
<
/div
>
<
div
style
=
{{
padding
:
20
}}
>
<
div
style
=
{{
display
:
'flex'
}}
>
<
Autocomplete
{...
this
.
state
.
listMonth
}
id
=
"month"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
month
:
newInputValue
,
loading
:
true
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getCompanySubmitted
()
}
else
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
}
})}
disableClearable
style
=
{{
width
:
250
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Month"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
month
}
/
>
<
Autocomplete
{...
this
.
state
.
listPeriode
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
,
loading
:
true
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getCompanySubmitted
()
}
else
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
}
})}
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Period"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
periode
}
/
>
{
this
.
state
.
isApprover
?
<
div
className
=
"grid grid-2x"
style
=
{{}}
>
<
div
className
=
"col-1"
style
=
{{
display
:
'flex'
,
maxWidth
:
'100%'
,
paddingLeft
:
0
}}
>
<
Autocomplete
{...
this
.
state
.
listMonth
}
id
=
"month"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
month
:
newInputValue
,
loading
:
true
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getCompanySubmitted
()
}
else
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
}
})}
disableClearable
style
=
{{
width
:
250
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Month"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
month
}
/
>
<
Autocomplete
{...
this
.
state
.
listPeriode
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
,
loading
:
true
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getCompanySubmitted
()
}
else
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
}
})}
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Period"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
periode
}
/
>
<
/div
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
,
alignSelf
:
'flex-end'
}}
>
<
FormControlLabel
style
=
{{
margin
:
0
}}
value
=
{
this
.
state
.
submittedOnly
}
control
=
{
<
Checkbox
checked
=
{
this
.
state
.
submittedOnly
}
onClick
=
{()
=>
this
.
setState
({
submittedOnly
:
!
this
.
state
.
submittedOnly
,
loading
:
true
},
()
=>
{
this
.
getChecApprover
()
// console.log(this.state.company)
// this.setState({listCompany: this.state.submittedOnly? this.state.company_submit : this.state.company_active, company: this.state.listCompany != null? this.state.listCompany.options[0] : null})
// console.log(this.state.company_active)
// console.log(this.state.company_submit)
// console.log(this.state.company)
// console.log(this.state.submittedOnly)
// if (this.state.submittedOnly) {
// this.getCompanySubmitted()
// } else {
// this.getCompanyActive()
// }
})}
/
>
}
/
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'#4b4b4b'
,
fontWeight
:
'bold'
,
marginLeft
:
5
,
alignSelf
:
'center'
}}
>
Submitted
Only
<
/Typography
>
<
/div
>
<
/div
>
:
<
div
style
=
{{
display
:
'flex'
}}
>
<
Autocomplete
{...
this
.
state
.
listMonth
}
id
=
"month"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
month
:
newInputValue
,
loading
:
true
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getCompanySubmitted
()
}
else
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
}
})}
disableClearable
style
=
{{
width
:
250
,
marginRight
:
20
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Month"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
month
}
/
>
<
Autocomplete
{...
this
.
state
.
listPeriode
}
id
=
"periode"
onChange
=
{(
event
,
newInputValue
)
=>
this
.
setState
({
periode
:
newInputValue
,
loading
:
true
},
()
=>
{
if
(
this
.
state
.
isApprover
===
true
)
{
this
.
getCompanySubmitted
()
}
else
{
this
.
setState
({
visibleTableHistory
:
false
})
this
.
getRevision
()
}
})}
disableClearable
style
=
{{
width
:
250
}}
renderInput
=
{(
params
)
=>
<
TextField
{...
params
}
label
=
"Period"
margin
=
"normal"
style
=
{{
marginTop
:
7
}}
/>
}
value
=
{
this
.
state
.
periode
}
/
>
<
/div
>
}
<
/div
>
<
div
style
=
{{
marginTop
:
20
}}
>
<
Autocomplete
...
...
src/container/MonthlyReport/ListOfCreditFacilities.js
View file @
af5a51a0
...
...
@@ -1198,7 +1198,7 @@ export default class ListOfCreditFacilities extends Component {
// console.log(totalLoan);
// dataTable: newData, totalOutStand: newData[newData.length-1][22]
if
(
bankNameEmpty
)
{
this
.
setState
({
loading
:
false
,
dataTable
:
this
.
state
.
dataTable
,
totalOutStand
:
0
,
diff
:
Number
(
0
-
this
.
state
.
perBS
),
saveDraft
:
false
})
this
.
setState
({
loading
:
false
,
dataTable
:
this
.
state
.
dataTable
,
totalOutStand
:
0
,
diff
:
Number
(
0
-
this
.
state
.
perBS
),
saveDraft
:
true
,
saveComp
:
true
})
}
else
{
this
.
setState
({
loading
:
false
,
dataTable
:
newData
,
totalOutStand
:
totalLoan
,
diff
:
Number
(
totalLoan
-
this
.
state
.
perBS
),
saveDraft
:
false
,
saveComp
:
Number
(
totalLoan
-
this
.
state
.
perBS
)
==
0
?
false
:
true
})
}
...
...
@@ -3490,7 +3490,7 @@ export default class ListOfCreditFacilities extends Component {
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
{
this
.
state
.
visibleLOCFMR
?
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
Snackbar
open
=
{
this
.
state
.
snekbar
}
autoHideDuration
=
{
6
000
}
onClose
=
{
handleClose
}
>
<
Snackbar
open
=
{
this
.
state
.
snekbar
}
autoHideDuration
=
{
3
000
}
onClose
=
{
handleClose
}
>
<
Alert
onClose
=
{
handleClose
}
severity
=
"error"
>
{
this
.
state
.
snekbarMsg
}
<
/Alert
>
...
...
@@ -3507,7 +3507,7 @@ export default class ListOfCreditFacilities extends Component {
<
/div
>
<
div
style
=
{{
width
:
'50%'
}}
>
<
div
style
=
{{
justifyContent
:
'flex-end'
,
display
:
'flex'
,
flexFlow
:
'wrap'
}}
>
{(
this
.
state
.
get_for
==
'edit'
&&
(
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
))
&&
(
{(
this
.
state
.
get_for
==
'edit'
&&
<
div
>
<
a
data
-
tip
=
{
'Download Template'
}
data
-
for
=
"template"
>
<
button
...
...
@@ -3525,7 +3525,7 @@ export default class ListOfCreditFacilities extends Component {
<
ReactTooltip
border
=
{
true
}
id
=
"template"
place
=
"bottom"
type
=
"light"
effect
=
"solid"
/>
<
/div
>
)}
{(
this
.
state
.
get_for
==
'edit'
&&
(
this
.
props
.
lastStatus
===
'SUBMIT'
||
this
.
props
.
lastStatus
===
'REVISION'
)
&&
this
.
props
.
prevRevision
===
false
&&
(
this
.
props
.
status
===
'revision'
||
this
.
props
.
status
===
'not-yet'
||
this
.
props
.
status
===
'draft'
||
this
.
props
.
status
===
'submitted'
))
&&
(
{(
this
.
state
.
get_for
==
'edit'
&&
<
div
>
<
a
data
-
tip
=
{
'Upload'
}
data
-
for
=
"upload"
>
<
button
...
...
@@ -3670,7 +3670,8 @@ export default class ListOfCreditFacilities extends Component {
type
=
"button"
onClick
=
{()
=>
this
.
state
.
saveDraft
===
true
?
null
:
this
.
setState
({
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete !'
})
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
,
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
...
...
@@ -3680,7 +3681,7 @@ export default class ListOfCreditFacilities extends Component {
}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
saveDraft
!==
true
?
'pointer'
:
'default
'
,
cursor
:
'pointer
'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
...
...
@@ -3699,7 +3700,7 @@ export default class ListOfCreditFacilities extends Component {
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
state
.
saveComp
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
this
.
setState
({
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete !'
})
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
,
loading
:
true
},
()
=>
{
...
...
@@ -3710,7 +3711,7 @@ export default class ListOfCreditFacilities extends Component {
}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
saveComp
===
true
?
'default'
:
'pointer'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
...
...
@@ -3824,7 +3825,8 @@ export default class ListOfCreditFacilities extends Component {
type
=
"button"
onClick
=
{()
=>
this
.
state
.
saveDraft
===
true
?
null
:
this
.
setState
({
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete !'
})
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
,
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
...
...
@@ -3834,7 +3836,7 @@ export default class ListOfCreditFacilities extends Component {
}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
saveDraft
!==
true
?
'pointer'
:
'default
'
,
cursor
:
'pointer
'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
...
...
@@ -3855,7 +3857,7 @@ export default class ListOfCreditFacilities extends Component {
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
state
.
saveComp
?
this
.
setState
({
alert
:
true
,
messageAlert
:
'Data is not complete !'
,
tipeAlert
:
'warning'
})
this
.
setState
({
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete !'
})
:
this
.
state
.
handleTekTekTek
==
1
?
null
:
this
.
setState
({
handleTekTekTek
:
1
,
loading
:
true
},
()
=>
{
...
...
@@ -3866,7 +3868,7 @@ export default class ListOfCreditFacilities extends Component {
}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
this
.
state
.
saveComp
===
true
?
'default'
:
'pointer'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
...
...
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