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
b88bbefb
Commit
b88bbefb
authored
Nov 24, 2023
by
Riri Novita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c618f6c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
162 additions
and
176 deletions
+162
-176
LOCFMR.js
src/container/MonthlyReport/LOCFMR.js
+3
-3
LOVMR.js
src/container/MonthlyReport/LOVMR.js
+24
-73
ListOfCreditFacilitiesMR.js
src/container/MonthlyReport/ListOfCreditFacilitiesMR.js
+135
-100
No files found.
src/container/MonthlyReport/LOCFMR.js
View file @
b88bbefb
...
...
@@ -555,8 +555,8 @@ export default class LOCF extends Component {
let
lastArray
=
dataTable
[
dataTable
.
length
-
1
]
this
.
setState
({
dataTable
,
diff
:
lastArray
[
46
],
perBS
:
lastArray
[
47
],
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
dataDelete
:
[]
},
()
=>
{
console
.
log
(
lastArray
);
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOCF'
,
'upload'
)
console
.
log
(
this
.
state
.
visibleLOCFMR
);
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOCF'
,
'upload'
,
this
.
state
.
visibleLOCFMR
)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
typeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
...
...
@@ -3592,7 +3592,7 @@ export default class LOCF extends Component {
<
Typography
style
=
{{
fontSize
:
'12px'
,
color
:
'#4b4b4b'
}}
>
Diff
<
/Typography
>
<
/div
>
<
div
style
=
{{
borderStyle
:
'solid'
,
borderWidth
:
'0px 1px 1px 1px'
,
padding
:
5
,
minWidth
:
200
,
display
:
'flex'
,
justifyContent
:
'flex-end'
}}
>
<
Typography
style
=
{{
fontSize
:
'14px'
,
color
:
Number
(
this
.
state
.
diff
)
>
0
?
'red'
:
'#4b4b4b'
}}
><
NumberFormat
value
=
{
this
.
state
.
diff
}
displayType
=
{
'text'
}
thousandSeparator
=
{
true
}
prefix
=
{
''
}
/></
Typography
>
<
Typography
style
=
{{
fontSize
:
'14px'
,
color
:
Number
(
this
.
state
.
diff
)
>
'0.0'
||
Number
(
this
.
state
.
diff
)
<
'0.0'
?
'red'
:
'#4b4b4b'
}}
><
NumberFormat
value
=
{
this
.
state
.
diff
}
displayType
=
{
'text'
}
thousandSeparator
=
{
true
}
prefix
=
{
''
}
/></
Typography
>
<
/div
>
<
/div
>
<
/div
>
...
...
src/container/MonthlyReport/LOVMR.js
View file @
b88bbefb
...
...
@@ -475,9 +475,8 @@ export default class LOV extends Component {
})
console
.
log
(
dataTable
)
let
lastArray
=
dataTable
[
dataTable
.
length
-
1
]
console
.
log
(
lastArray
);
this
.
setState
({
dataTable
,
diff
:
lastArray
[
16
],
perBS
:
lastArray
[
18
],
loading
:
false
,
visibleLOVMR
:
true
},
()
=>
{
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOV'
,
'upload'
)
this
.
setState
({
dataTable
,
diff
:
lastArray
[
16
],
perBS
:
lastArray
[
18
],
dataLoaded
:
true
,
loading
:
false
,
buttonError
:
false
,
dataDelete
:
[]
},
()
=>
{
this
.
props
.
sendToParent
(
dataTable
,
lastArray
,
'LOV'
,
'upload'
,
this
.
state
.
visibleLOVMR
)
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
typeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
...
...
@@ -660,7 +659,7 @@ export default class LOV extends Component {
// }
getListCurrency
()
{
this
.
setState
({
dataLoaded
:
false
})
//
this.setState({ dataLoaded: false })
api
.
create
().
getDataCurrency
().
then
(
response
=>
{
console
.
log
(
response
)
if
(
response
.
data
)
{
...
...
@@ -995,18 +994,17 @@ export default class LOV extends Component {
let
prevData
=
dataTable2
[
index
-
1
]
==
undefined
?
null
:
dataTable2
[
index
-
1
][
6
]
let
currentData
=
dataTable2
[
index
][
6
]
let
nextData
=
dataTable2
[
index
+
1
]
==
undefined
?
null
:
dataTable2
[
index
+
1
][
6
]
console
.
log
(
nextData
);
if
(
nextData
==
null
)
{
dataTable2
.
splice
(
index
,
1
)
}
else
if
(
nextData
.
value
.
includes
(
'Total'
))
{
}
else
if
(
nextData
.
includes
(
'Total'
))
{
if
(
prevData
!==
null
&&
currentData
==
null
)
{
dataTable2
.
splice
(
index
,
1
)
}
else
if
(
prevData
!==
null
&&
prevData
.
value
==
currentData
.
value
)
{
}
else
if
(
prevData
!==
null
&&
prevData
==
currentData
)
{
dataTable2
.
splice
(
index
,
1
)
}
else
if
(
dataTable2
.
length
>
3
)
{
if
(
prevData
==
null
)
{
if
(
nextData
.
value
.
includes
(
'Grand'
))
{
if
(
nextData
.
includes
(
'Grand'
))
{
dataTable2
.
splice
(
index
,
1
)
}
else
{
dataTable2
.
splice
(
index
,
2
)
...
...
@@ -1016,7 +1014,7 @@ export default class LOV extends Component {
}
}
else
if
(
dataTable2
.
length
==
3
)
{
if
(
prevData
==
null
)
{
if
(
nextData
.
value
.
includes
(
'Grand'
))
{
if
(
nextData
.
includes
(
'Grand'
))
{
dataTable2
.
splice
(
index
,
1
)
}
else
{
dataTable2
.
splice
(
index
,
3
)
...
...
@@ -1832,6 +1830,7 @@ export default class LOV extends Component {
<
div
style
=
{{
marginTop
:
20
,
width
:
this
.
props
.
width
-
(
this
.
props
.
open
===
true
?
400
:
150
)
}}
>
{
this
.
state
.
loading
&&
loadingComponent
}
{
this
.
state
.
dataLoaded
&&
!
this
.
state
.
loading
&&
<
MuiThemeProvider
theme
=
{
getMuiTheme
()}
>
<
div
>
cuuuk
<
/div
>
<
MUIDataTable
data
=
{
dataTable2
}
columns
=
{
columns
}
...
...
@@ -1840,54 +1839,6 @@ export default class LOV extends Component {
<
/MuiThemeProvider>
}
<
/div
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"col-1"
style
=
{{
paddingLeft
:
0
}}
>
<
button
type
=
"button"
onClick
=
{()
=>
this
.
setState
({
loading
:
true
,
visiblePLMR
:
true
},
()
=>
{
setTimeout
(()
=>
{
this
.
getItemHierarkiLOV
()
},
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'
}}
>
<
Typography
style
=
{{
fontSize
:
'11px'
,
color
:
'#fff'
,
textAlign
:
'center'
}}
>
Back
<
/Typography
>
<
/div
>
<
/button
>
<
/div
>
<
div
className
=
"col-2"
style
=
{{
display
:
'flex'
,
justifyContent
:
'flex-end'
,
maxWidth
:
'100%'
,
paddingRight
:
5
}}
>
<
button
className
=
"button"
type
=
"button"
style
=
{{
backgroundColor
:
'transparent'
,
cursor
:
'pointer'
,
borderColor
:
'transparent'
,
outline
:
'none'
,
marginRight
:
20
}}
onClick
=
{()
=>
{
this
.
setState
({
loading
:
true
},
()
=>
{
setTimeout
(()
=>
{
// this.setState({ loading: false })
this
.
handleValidate
()
},
100
);
})
}}
>
<
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
>
<
/div
>
<
/div
>
<
div
style
=
{{
display
:
'flex'
,
justifyContent
:
'space-between'
,
maxWidth
:
'100%'
,
paddingLeft
:
5
,
paddingRight
:
15
,
marginTop
:
5
}}
>
<
div
>
<
div
style
=
{{
display
:
'flex'
}}
>
...
...
@@ -1948,25 +1899,25 @@ export default class LOV extends Component {
<
/div
>
{
/* <div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15, marginTop: 5}}>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
</div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.totalOutStand)}</Typography>
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>
<div style={{padding: 5}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Total Outstanding Loan</Typography>
</div>
<div style={{border: '1px solid black', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{formatSeparator(this.state.perBS)}</Typography>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15}}
>
<div style={{display: 'flex', flexDirection: 'row'
}}>
<div style={{padding: 5
}}>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography
>
<
/div
>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}
>
<Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{(formatSeparator(this.state.diff))}</Typography
>
<
/div
>
</div
>
<div style={{ display: 'flex', justifyContent: 'flex-end', maxWidth: '100%', paddingLeft: 15, paddingRight: 15
}}>
<div style={{display: 'flex', flexDirection: 'row'
}}>
<div style={{padding: 5}}
>
<
Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>Diff</Typography
>
</div
>
<div style={{borderStyle: 'solid', borderWidth: '0px 1px 1px 1px', padding: 5, minWidth: 200, display: 'flex', justifyContent: 'flex-end'}}
>
<
Typography style={{ fontSize: '11px', color: '#4b4b4b' }}>{(formatSeparator(this.state.diff))}</Typography
>
</div>
</div> */
}
</div>
</div> */
}
<
/div
>
}
...
...
src/container/MonthlyReport/ListOfCreditFacilitiesMR.js
View file @
b88bbefb
...
...
@@ -120,9 +120,11 @@ export default class ListOfCreditFacilities extends Component {
perBSLOV
:
0
,
snekbar
:
false
,
snekbarMsg
:
''
,
visibleLOCFMR
:
true
,
visibleParent
:
true
,
buttonError
:
false
,
saveDraft
:
true
,
saveComp
:
true
,
saveCompLOV
:
true
,
get_for
:
'view'
,
updateBy
:
[],
notes
:
""
,
...
...
@@ -153,14 +155,16 @@ export default class ListOfCreditFacilities extends Component {
})
}
dataTableForChild
(
data
,
array
,
params
,
type
)
{
dataTableForChild
(
data
,
array
,
params
,
type
,
visibleView
)
{
console
.
log
(
visibleView
);
console
.
log
(
type
);
switch
(
params
)
{
case
"LOV"
:
console
.
log
(
data
);
this
.
setState
({
dataTableLOV
:
data
,
diffLOV
:
array
[
16
],
perBSLOV
:
array
[
18
],
tambahLOV
:
type
})
this
.
setState
({
dataTableLOV
:
data
,
diffLOV
:
array
[
16
],
perBSLOV
:
array
[
18
],
tambahLOV
:
type
,
visibleParent
:
visibleView
==
undefined
?
true
:
visibleView
})
break
;
case
"LOCF"
:
this
.
setState
({
dataTableLOCF
:
data
,
diffLOCF
:
array
[
46
],
perBSLOCF
:
array
[
48
],
tambah
:
type
})
this
.
setState
({
dataTableLOCF
:
data
,
diffLOCF
:
array
[
46
],
perBSLOCF
:
array
[
48
],
tambah
:
type
,
visibleParent
:
visibleView
==
undefined
?
true
:
visibleView
})
break
default
:
break
;
...
...
@@ -266,7 +270,7 @@ export default class ListOfCreditFacilities extends Component {
})
}
else
{
this
.
setState
({
submissionID
:
null
,
loading
:
false
,
visibleLOCFMR
:
true
})
this
.
setState
({
submissionID
:
null
,
loading
:
false
})
}
}
})
...
...
@@ -274,6 +278,7 @@ export default class ListOfCreditFacilities extends Component {
backToMonthlyReportLOCF
(
type
)
{
// this.setState({ loading: true })
console
.
log
(
'kok kesiniii'
);
let
dataTable2
=
this
.
state
.
dataTablelocf
==
undefined
||
this
.
state
.
tambah
==
'tambah'
||
this
.
state
.
tambah
==
'upload'
?
this
.
state
.
dataTableLOCF
:
this
.
state
.
dataTablelocf
let
data
=
[]
let
error
=
false
...
...
@@ -401,46 +406,46 @@ export default class ListOfCreditFacilities extends Component {
"total_loan"
:
this
.
state
.
perBSLOCF
}
console
.
log
(
JSON
.
stringify
(
payload
)
)
console
.
log
(
payload
)
if
(
error
&&
type
==
'submitted'
)
{
this
.
setState
({
handleDoubleClick
:
0
,
saveDraft
:
false
,
saveComp
:
true
,
loading
:
false
,
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete'
,
handleDoubleClick
:
0
})
}
else
{
api
.
create
(
'UPLOAD'
).
createMonthlyReportLOCF
(
payload
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
)
}
else
{
if
(
response
.
data
?.
message
==
"Please Set Up Rate Currency First"
)
{
this
.
setState
({
visibleAlertSave
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
document
.
body
.
style
.
overflow
=
'unset'
;
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
this
.
props
.
saveToMonthlyReport
()
})
}
}
// else {
// this.setState({ loading: false }, () => {
// this.props.saveToMonthlyReport()
// })
// }
}
else
{
this
.
setState
({
loading
:
false
},
()
=>
{
// this.getSubmission()
document
.
body
.
style
.
overflow
=
'unset'
;
})
}
this
.
setState
({
handleDoubleClick
:
0
})
})
}
//
if (error && type == 'submitted') {
//
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
//
} else {
//
api.create('UPLOAD').createMonthlyReportLOCF(payload).then(response => {
//
console.log(response);
//
if (response.data) {
//
if (response.data.status === "success") {
//
this.props.saveToMonthlyReport('LOCF')
//
} else {
//
if (response.data?.message == "Please Set Up Rate Currency First") {
//
this.setState({ visibleAlertSave: true })
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
//
document.body.style.overflow = 'unset';
//
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
//
setTimeout(() => {
//
localStorage.removeItem(Constant.TOKEN)
//
window.location.reload();
//
}, 1000);
//
}
//
this.props.saveToMonthlyReport()
//
})
//
}
//
}
//
// else {
//
// this.setState({ loading: false }, () => {
//
// this.props.saveToMonthlyReport()
//
// })
//
// }
//
} else {
//
this.setState({ loading: false }, () => {
//
// this.getSubmission()
//
document.body.style.overflow = 'unset';
//
})
//
}
//
this.setState({ handleDoubleClick: 0 })
//
})
//
}
}
handleCalculateLOCF
=
()
=>
{
...
...
@@ -448,9 +453,11 @@ export default class ListOfCreditFacilities extends Component {
let
dataTable2
=
this
.
state
.
dataTablelocf
==
undefined
||
this
.
state
.
tambah
==
'tambah'
||
this
.
state
.
tambah
==
'upload'
?
this
.
state
.
dataTableLOCF
:
this
.
state
.
dataTablelocf
let
data
=
[]
let
error
=
false
console
.
log
(
dataTable2
);
let
bankNameEmpty
=
false
dataTable2
.
map
(
i
=>
{
console
.
log
(
i
[
12
]);
if
(
i
[
6
]
==
null
)
{
bankNameEmpty
=
true
}
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
)
{
error
=
true
...
...
@@ -701,9 +708,22 @@ export default class ListOfCreditFacilities extends Component {
}
}
})
console
.
log
(
error
);
let
lastArrayLOCF
=
dataTablelocf
[
res
.
length
-
1
]
this
.
setState
({
dataTablelocf
,
diffLOCF
:
lastArrayLOCF
[
46
],
perBSLOCF
:
lastArrayLOCF
[
48
],
visibleLOCFMR
:
true
,
loading
:
false
},
()
=>
{
if
(
bankNameEmpty
)
{
if
(
this
.
state
.
get_for
==
'view'
)
{
this
.
setState
({
saveDraft
:
false
,
saveComp
:
true
})
}
else
{
this
.
setState
({
saveDraft
:
false
,
saveComp
:
true
})
}
}
else
{
if
(
this
.
state
.
get_for
==
'view'
)
{
console
.
log
(
"view"
);
}
else
{
this
.
setState
({
saveDraft
:
false
,
saveComp
:
lastArrayLOCF
[
46
]
==
0
||
lastArrayLOCF
[
46
]
==
'0.0'
||
lastArrayLOCF
[
46
]
==
"-0.0"
?
false
:
true
})
}
}
this
.
setState
({
dataTablelocf
,
diffLOCF
:
lastArrayLOCF
[
46
],
perBSLOCF
:
lastArrayLOCF
[
48
],
loading
:
false
},
()
=>
{
this
.
handleCalculateLOV
()
})
}
...
...
@@ -712,13 +732,17 @@ export default class ListOfCreditFacilities extends Component {
}
handleCalculateLOV
=
()
=>
{
console
.
log
(
this
.
state
.
visibleParent
);
this
.
setState
({
loading
:
true
})
console
.
log
(
this
.
state
.
dataTablelov
);
console
.
log
(
this
.
state
.
dataTableLOV
);
let
dataTable2
=
this
.
state
.
dataTablelov
==
undefined
||
this
.
state
.
tambahLOV
==
'tambah'
||
this
.
state
.
tambahLOV
==
'upload'
?
this
.
state
.
dataTableLOV
:
this
.
state
.
dataTablelov
let
data
=
[]
let
error
=
false
let
bankNameEmpty
=
false
console
.
log
(
dataTable2
);
dataTable2
.
map
(
i
=>
{
if
(
i
[
6
]
==
null
)
{
bankNameEmpty
=
true
}
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
||
i
[
12
]
==
""
)
{
error
=
true
...
...
@@ -849,9 +873,21 @@ export default class ListOfCreditFacilities extends Component {
}
}
})
console
.
log
(
dataTablelov
);
let
lastArrayLOV
=
dataTablelov
[
res
.
length
-
1
]
this
.
setState
({
dataTablelov
,
diffLOV
:
lastArrayLOV
[
16
],
perBSLOV
:
lastArrayLOV
[
18
],
loading
:
false
,
visibleLOCFMR
:
true
,
loadingChild
:
false
},
()
=>
{
if
(
bankNameEmpty
)
{
if
(
this
.
state
.
get_for
==
'view'
)
{
this
.
setState
({
saveDraft
:
false
,
saveCompLOV
:
true
})
}
else
{
this
.
setState
({
saveDraft
:
false
,
saveCompLOV
:
true
})
}
}
else
{
if
(
this
.
state
.
get_for
==
'view'
)
{
console
.
log
(
"view"
);
}
else
{
this
.
setState
({
saveDraft
:
false
,
saveCompLOV
:
lastArrayLOV
[
16
]
==
0
||
lastArrayLOV
[
16
]
==
'0.0'
||
lastArrayLOV
[
16
]
==
"-0.0"
?
false
:
true
})
}
}
this
.
setState
({
dataTablelov
,
diffLOV
:
lastArrayLOV
[
16
],
perBSLOV
:
lastArrayLOV
[
18
],
loading
:
false
,
loadingChild
:
false
},
()
=>
{
// this.handleCalculateLOV()
})
}
else
{
...
...
@@ -862,10 +898,13 @@ export default class ListOfCreditFacilities extends Component {
}
uploadLOCF
(
type
)
{
console
.
log
(
'masooook'
);
let
dataTable2
=
this
.
state
.
dataTablelocf
==
undefined
||
this
.
state
.
tambah
==
'tambah'
||
this
.
state
.
tambah
==
'upload'
?
this
.
state
.
dataTableLOCF
:
this
.
state
.
dataTablelocf
let
data
=
[]
let
error
=
false
this
.
deleteReport
()
this
.
state
.
dataTable
.
map
(
i
=>
{
// this.deleteReport()
console
.
log
(
dataTable2
);
dataTable2
.
map
(
i
=>
{
if
(
i
[
0
]
==
3
)
{
if
(
i
[
6
]
==
null
||
i
[
7
]
==
null
||
i
[
8
]
==
""
||
i
[
9
]
==
""
||
i
[
10
]
==
""
||
i
[
11
]
==
""
)
{
error
=
true
...
...
@@ -989,55 +1028,50 @@ export default class ListOfCreditFacilities extends Component {
"diff"
:
this
.
state
.
diff
,
"total_loan"
:
this
.
state
.
perBS
}
console
.
log
(
JSON
.
stringify
(
body
)
);
if
(
error
&&
type
==
'submitted'
)
{
this
.
setState
({
handleDoubleClick
:
0
,
saveDraft
:
false
,
saveComp
:
true
,
loading
:
false
,
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete'
,
handleDoubleClick
:
0
})
}
else
{
api
.
create
(
'UPLOAD'
).
uploadMonthlyReportLOCF
(
body
).
then
(
response
=>
{
console
.
log
(
response
);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
saveToMonthlyReport
(
'LOCF'
)
// this.props.onClickClose()
// this.props.getReport()
}
else
{
if
(
response
.
data
?.
message
==
"Please Set Up Rate Currency First"
)
{
this
.
setState
({
visibleAlertSave
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
if
(
response
.
data
.
message
.
includes
(
"Someone Logged In"
)
||
response
.
data
.
message
.
includes
(
"Token Expired"
))
{
setTimeout
(()
=>
{
localStorage
.
removeItem
(
Constant
.
TOKEN
)
window
.
location
.
reload
();
},
1000
);
}
})
}
// alert(response.data.status)
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
,
handleDoubleClick
:
0
})
}
this
.
setState
({
handleDoubleClick
:
0
})
})
}
console
.
log
(
body
);
//
if (error && type == 'submitted') {
//
this.setState({ handleDoubleClick: 0, saveDraft: false, saveComp: true, loading: false, snekbar: true, snekbarMsg: 'Data Incomplete', handleDoubleClick: 0 })
//
} else {
//
api.create('UPLOAD').uploadMonthlyReportLOCF(body).then(response => {
//
console.log(response);
//
if (response.data) {
//
if (response.ok) {
//
if (response.data.status === "success") {
//
this.props.saveToMonthlyReport('LOCF')
//
// this.props.onClickClose()
//
// this.props.getReport()
//
} else {
//
if (response.data?.message == "Please Set Up Rate Currency First") {
//
this.setState({ visibleAlertSave: true })
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning', loading: false }, () => {
//
if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
//
setTimeout(() => {
//
localStorage.removeItem(Constant.TOKEN)
//
window.location.reload();
//
}, 1000);
//
}
//
})
//
}
//
// alert(response.data.status)
//
}
//
} else {
//
this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
//
}
//
} else {
//
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false, handleDoubleClick: 0 })
//
}
//
this.setState({ handleDoubleClick: 0 })
//
})
//
}
}
// handleCalculateLOV = () => {
// let dataTable2 = this.state.dataTableLOV
// console.log(dataTable2);
// }
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
loading
=
this
.
state
.
loading
let
totalLoan
=
0
const
loadingComponent
=
(
<
div
style
=
{{
position
:
'fixed'
,
zIndex
:
110
,
top
:
0
,
left
:
0
,
width
:
'100%'
,
height
:
'100%'
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
background
:
'rgba(255,255,255,0.8)'
}}
>
...
...
@@ -1067,7 +1101,7 @@ export default class ListOfCreditFacilities extends Component {
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Monthly
Report
<
/Typography
>
<
/div
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
{
this
.
state
.
visible
LOCFMR
?
{
this
.
state
.
visible
Parent
?
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
Snackbar
open
=
{
this
.
state
.
snekbar
}
autoHideDuration
=
{
3000
}
onClose
=
{
handleClose
}
>
<
Alert
onClose
=
{
handleClose
}
severity
=
"error"
>
...
...
@@ -1210,7 +1244,7 @@ export default class ListOfCreditFacilities extends Component {
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
state
.
saveComp
||
this
.
state
.
saveTambahan
?
this
.
state
.
saveComp
||
this
.
state
.
save
CompLOV
||
this
.
state
.
save
Tambahan
?
this
.
setState
({
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete / Diff must be 0'
})
:
this
.
state
.
handleDoubleClick
==
1
?
null
:
...
...
@@ -1261,6 +1295,7 @@ export default class ListOfCreditFacilities extends Component {
width
=
{
this
.
props
.
width
}
sendToParent
=
{
this
.
dataTableForChild
.
bind
(
this
)}
dataTablelocf
=
{
this
.
state
.
dataTablelocf
}
loadingChild
=
{
this
.
state
.
loadingChild
}
/
>
<
hr
/>
<
LOV
...
...
@@ -1278,8 +1313,8 @@ export default class ListOfCreditFacilities extends Component {
height
=
{
this
.
props
.
height
}
width
=
{
this
.
props
.
width
}
sendToParent
=
{
this
.
dataTableForChild
.
bind
(
this
)}
sendDataTable
=
{
this
.
olahDataTable
.
bind
(
this
)}
dataTablelov
=
{
this
.
state
.
dataTablelov
}
loadingChild
=
{
this
.
state
.
loadingChild
}
/
>
<
div
className
=
"grid grid-2x"
style
=
{{
marginTop
:
20
}}
>
<
div
className
=
"col-1"
>
...
...
@@ -1354,7 +1389,7 @@ export default class ListOfCreditFacilities extends Component {
type
=
"button"
// disabled={this.state.buttonError}
onClick
=
{()
=>
this
.
state
.
saveComp
||
this
.
state
.
saveTambahan
?
this
.
state
.
saveComp
||
this
.
state
.
save
CompLOV
||
this
.
state
.
save
Tambahan
?
this
.
setState
({
snekbar
:
true
,
snekbarMsg
:
'Data Incomplete / Diff must be 0'
})
:
this
.
state
.
handleDoubleClick
==
1
?
null
:
...
...
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