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
2b3c5ad7
Commit
2b3c5ad7
authored
Aug 01, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update locf
parent
07754f12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
284 additions
and
20 deletions
+284
-20
ListOfCreditFacilitiesMR.js
src/container/MonthlyReport/ListOfCreditFacilitiesMR.js
+284
-20
No files found.
src/container/MonthlyReport/ListOfCreditFacilitiesMR.js
View file @
2b3c5ad7
...
...
@@ -122,7 +122,8 @@ export default class ListOfCreditFacilities extends Component {
saveTambahan
:
true
,
defaultCurrencyUpload
:
this
.
props
.
defaultCurrency
,
visibleAlertSave
:
false
,
visibleButtonUpload
:
false
visibleButtonUpload
:
false
,
uploadData
:
false
}
this
.
fileHandler
=
this
.
fileHandler
.
bind
(
this
);
this
.
fileHandlerSimulasi
=
this
.
fileHandlerSimulasi
.
bind
(
this
);
...
...
@@ -762,6 +763,7 @@ export default class ListOfCreditFacilities extends Component {
}
checkUploadSimulasi
()
{
console
.
log
(
this
.
state
.
uploadData
);
let
payload
=
{
...
this
.
state
.
payload
,
currency_id
:
this
.
state
.
defaultCurrencyUpload
?.
id
...
...
@@ -1002,22 +1004,22 @@ export default class ListOfCreditFacilities extends Component {
}
this
.
setState
({
loading
:
true
,
dataTable
:
[]
})
console
.
log
(
body
)
api
.
create
().
uploadSimulasiMRLOCF
(
body
).
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
,
"simulasiLOCF"
)
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
'Error saving data. Please try again'
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
//
api.create().uploadSimulasiMRLOCF(body).then(response => {
//
console.log(response)
//
if (response.data) {
//
if (response.ok) {
//
if (response.data.status === "success") {
//
this.props.saveToMonthlyReport('LOCF', "simulasiLOCF")
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
//
}
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false })
//
}
//
} else {
//
this.setState({ alert: true, messageAlert: 'Error saving data. Please try again', tipeAlert: 'error', loading: false })
//
}
//
})
}
uploadLOCF
(
type
)
{
...
...
@@ -1762,6 +1764,233 @@ export default class ListOfCreditFacilities extends Component {
})
}
handleCalculateSimulasi
=
()
=>
{
let
dataTable2
=
this
.
state
.
dataTable
this
.
setState
({
loading
:
true
,
uploadData
:
true
},
()
=>
{
let
bankPrev
=
""
let
idPrev
=
0
let
newData
=
[]
let
dataCoba
=
[]
let
bankNameEmpty
=
false
let
totalLoan
=
0
dataTable2
.
map
((
item
,
index
)
=>
{
if
(
item
[
0
]
!==
8
)
{
if
(
item
[
6
]
==
null
)
{
bankNameEmpty
=
true
}
else
{
let
groupName
=
String
(
item
[
6
].
value
).
split
(
"-"
)
let
indexAS
=
dataCoba
.
findIndex
((
val
)
=>
item
[
6
].
value
.
includes
(
val
.
groupName
))
if
(
indexAS
==
-
1
)
{
dataCoba
.
push
({
groupName
:
groupName
[
groupName
.
length
-
1
],
data
:
[
item
]
})
}
else
{
let
indexDD
=
dataCoba
[
indexAS
].
data
.
length
-
1
==
-
1
?
0
:
dataCoba
[
indexAS
].
data
.
length
-
1
if
(
String
(
dataCoba
[
indexAS
].
data
[
indexDD
]).
includes
(
'Total'
))
{
let
dataAwal
=
[]
let
dataAkhir
=
[]
dataAwal
=
dataCoba
[
indexAS
].
data
.
splice
(
0
,
dataCoba
[
indexAS
].
data
.
length
-
2
)
dataAkhir
=
dataCoba
[
indexAS
].
data
.
splice
(
dataCoba
[
indexAS
].
data
.
length
-
1
,
1
)
dataAwal
.
push
(
item
)
dataCoba
[
indexAS
].
data
=
dataAwal
.
concat
(
dataAkhir
)
}
else
{
dataCoba
[
indexAS
].
data
.
push
(
item
)
}
}
}
}
})
let
dataGabung
=
[]
if
(
!
bankNameEmpty
)
{
dataCoba
.
map
((
item
,
index
)
=>
{
item
.
data
.
map
((
items
,
index
)
=>
{
dataGabung
.
push
(
items
)
})
})
dataGabung
.
map
((
items
,
index
)
=>
{
if
(
items
[
0
]
==
3
)
{
this
.
props
.
defaultCurrency
.
id
==
1
?
totalLoan
+=
items
[
22
]
:
totalLoan
+=
items
[
21
]
}
if
(
bankPrev
!=
""
)
{
if
(
items
[
6
].
value
!==
bankPrev
)
{
bankPrev
=
items
[
6
].
value
if
(
items
[
6
].
value
==
'Grand Total'
)
{
// if (dataTable2.length > 2) {
// newData.push(items)
// } else {
if
(
String
(
dataGabung
[
index
-
1
][
6
].
value
).
includes
(
'Total '
))
{
newData
.
push
(
items
)
}
else
{
// if (String(dataGabung[index][6].value).includes('Total ')) {
// newData.push(items)
// } else {
// items[46] = index + 1
let
nameTotal
=
String
(
dataGabung
[
index
-
1
][
6
].
value
).
split
(
"-"
)
newData
.
push
([
8
,
""
,
""
,
""
,
""
,
""
,
{
value
:
'Total '
+
nameTotal
[
nameTotal
.
length
-
1
]
},
null
,
""
,
null
,
"0.00"
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
index
],
items
,
)
// }
}
// }
}
else
{
if
(
String
(
dataGabung
[
index
-
1
][
6
].
value
).
includes
(
'Total '
))
{
newData
.
push
(
items
)
}
else
{
if
(
String
(
dataGabung
[
index
][
6
].
value
).
includes
(
'Total '
))
{
newData
.
push
(
items
)
}
else
{
items
[
46
]
=
index
+
1
let
nameTotal
=
String
(
dataGabung
[
index
-
1
][
6
].
value
).
split
(
"-"
)
newData
.
push
([
8
,
""
,
""
,
""
,
""
,
""
,
{
value
:
'Total '
+
nameTotal
[
nameTotal
.
length
-
1
]
},
null
,
""
,
null
,
"0.00"
,
""
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
"0"
,
"0"
,
"0"
,
"0"
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
"0"
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
""
,
index
],
items
,
)
}
}
}
}
else
{
newData
.
push
(
items
)
}
}
else
{
bankPrev
=
items
[
6
].
value
idPrev
=
items
[
0
]
newData
.
push
(
items
)
}
})
}
else
{
if
(
this
.
state
.
get_for
==
'edit'
)
{
this
.
setState
({
snekbar
:
true
,
snekbarMsg
:
'Bank Names Cannot be Empty'
})
}
}
setTimeout
(()
=>
{
// console.log(dataCoba)
// console.log(dataGabung)
console
.
log
(
newData
)
// console.log(dataTampungBank)
console
.
log
(
Number
(
totalLoan
).
toFixed
(
1
));
console
.
log
(
this
.
state
.
perBS
)
console
.
log
(
this
.
state
.
diff
)
// console.log(bankNameEmpty)
// dataTable: newData, totalOutStand: newData[newData.length-1][22]
if
(
bankNameEmpty
)
{
if
(
this
.
state
.
get_for
==
'view'
)
{
this
.
setState
({
loading
:
false
,
dataTable
:
this
.
state
.
dataTable
,
diff
:
this
.
state
.
diff
==
null
?
"0.0"
:
Number
(
0
-
this
.
state
.
perBS
).
toFixed
(
1
),
perBS
:
this
.
state
.
totalOutStand
==
null
?
"0.0"
:
this
.
state
.
totalOutStand
,
saveDraft
:
false
,
saveComp
:
true
})
}
else
{
this
.
setState
({
loading
:
false
,
dataTable
:
this
.
state
.
dataTable
,
diff
:
Number
(
0
-
this
.
state
.
perBS
).
toFixed
(
1
),
saveDraft
:
false
,
saveComp
:
true
})
}
}
else
{
if
(
this
.
state
.
get_for
==
'view'
)
{
this
.
setState
({
loading
:
false
,
dataTable
:
newData
,
diff
:
this
.
state
.
diff
==
null
?
"0.0"
:
Number
(
Number
(
totalLoan
).
toFixed
(
1
)
-
this
.
state
.
perBS
).
toFixed
(
1
),
perBS
:
this
.
state
.
totalOutStand
==
null
?
"0.0"
:
this
.
state
.
totalOutStand
})
}
else
{
this
.
setState
({
loading
:
false
,
dataTable
:
newData
,
diff
:
Number
(
Number
(
totalLoan
).
toFixed
(
1
)
-
this
.
state
.
perBS
).
toFixed
(
1
),
saveDraft
:
false
,
saveComp
:
Number
(
Number
(
totalLoan
).
toFixed
(
1
)
-
this
.
state
.
perBS
)
==
0
||
Number
(
Number
(
totalLoan
).
toFixed
(
1
)
-
this
.
state
.
perBS
)
==
"-0.0"
?
false
:
true
},
()
=>
{
// alert(this.state.saveComp)
// console.log(Number(Number(totalLoan).toFixed(1) - this.state.perBS));
})
}
}
},
100
);
})
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
...
...
@@ -4579,14 +4808,49 @@ export default class ListOfCreditFacilities extends Component {
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"col-1"
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
props
.
onClickClose
()
},
100
);
})}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
}}
>
<
div
style
=
{{
backgroundColor
:
'#019ce5'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
marginLeft
:
10
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Back
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
{
/* {this.props.isApprover === true || this.state.dataTable.length == 0 ? null :
(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') ? */
}
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
}}
>
<
button
className
=
"button"
type
=
"button"
// disabled={this.state.buttonError}
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
this
.
setState
({
totalOutStand
:
totalLoan
,
saveTambahan
:
false
},
()
=>
{
this
.
handleCalculateSimulasi
()
})}
>
<
div
style
=
{{
backgroundColor
:
'#fff'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
,
border
:
'solid 1px #354960'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#354960'
,
textAlign
:
'center'
}}
>
Calculate
<
/Typography
>
<
/div
>
<
/button
>
<
button
type
=
"button"
disabled
=
{
this
.
state
.
uploadData
===
true
?
false
:
true
}
onClick
=
{()
=>
this
.
setState
({
handleDoubleClick
:
1
,
loading
:
true
},
()
=>
{
this
.
uploadSimulasi
(
'submitted'
)
...
...
@@ -4599,7 +4863,7 @@ export default class ListOfCreditFacilities extends Component {
outline
:
'none'
,
}}
>
<
div
style
=
{{
backgroundColor
:
'#354960
'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
div
style
=
{{
backgroundColor
:
this
.
state
.
uploadData
===
true
?
'#354960'
:
'#5559
'
,
width
:
105
,
height
:
25
,
borderRadius
:
3
,
justifyContent
:
'center'
,
display
:
'flex'
,
alignItems
:
'center'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Save
Data
<
/Typography
>
<
/div
>
<
/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