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
58b846ad
Commit
58b846ad
authored
Nov 05, 2020
by
Dida Adams Arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update handle response
parent
5a8a5513
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
330 additions
and
260 deletions
+330
-260
CashFlow.js
src/container/BudgetTahunan/CashFlow.js
+106
-76
CorporateAnnualTarget.js
src/container/BudgetTahunan/CorporateAnnualTarget.js
+224
-184
No files found.
src/container/BudgetTahunan/CashFlow.js
View file @
58b846ad
import
{
createMuiTheme
,
FormControlLabel
,
MuiThemeProvider
,
Paper
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
import
{
createMuiTheme
,
FormControlLabel
,
MuiThemeProvider
,
Paper
,
Snackbar
,
TableCell
,
Tooltip
,
Typography
,
withStyles
}
from
'@material-ui/core'
import
MUIDataTable
from
'mui-datatables'
;
import
React
,
{
Component
}
from
'react'
import
NumberFormat
from
'react-number-format'
;
...
...
@@ -7,6 +7,8 @@ import api from '../../api';
import
Images
from
'../../assets/Images'
;
import
*
as
R
from
'ramda'
import
{
PropagateLoader
}
from
'react-spinners'
;
import
Constant
from
'../../library/Constant'
;
import
{
Alert
}
from
'@material-ui/lab'
;
var
ct
=
require
(
"../../library/CustomTable"
);
const
getMuiTheme
=
()
=>
createMuiTheme
(
ct
.
customTable3
());
...
...
@@ -58,7 +60,10 @@ export default class CashFlow extends Component {
// console.log(JSON.stringify(payload))
api
.
create
().
getDetailReportCF
(
payload
).
then
(
response
=>
{
let
dataTable
=
[]
console
.
log
(
response
)
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
dataTable
.
push
([
...
...
@@ -136,6 +141,22 @@ export default class CashFlow extends Component {
}
})
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
res
,
editable
:
true
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
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'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
...
...
@@ -160,6 +181,10 @@ export default class CashFlow extends Component {
}
}
closeAlert
()
{
this
.
setState
({
alert
:
false
})
}
render
()
{
let
dataTable2
=
this
.
state
.
dataTable
let
loading
=
false
...
...
@@ -2281,6 +2306,11 @@ export default class CashFlow extends Component {
<
div
className
=
{
"main-color"
}
style
=
{{
height
:
78
,
flex
:
1
,
display
:
'flex'
,
alignItems
:
'center'
,
paddingLeft
:
20
}}
>
<
Typography
style
=
{{
fontSize
:
'16px'
,
color
:
'white'
}}
>
Pengajuan
Budget
Tahunan
<
/Typography
>
<
/div
>
<
Snackbar
open
=
{
this
.
state
.
alert
}
autoHideDuration
=
{
3000
}
onClose
=
{()
=>
this
.
closeAlert
()}
>
<
Alert
onClose
=
{()
=>
this
.
closeAlert
()}
severity
=
{
this
.
state
.
tipeAlert
}
>
{
this
.
state
.
messageAlert
}
<
/Alert
>
<
/Snackbar
>
<
div
style
=
{{
flex
:
1
,
padding
:
20
,
width
:
'100%'
}}
>
<
Paper
style
=
{{
paddingTop
:
10
,
paddingBottom
:
20
}}
>
<
div
style
=
{{
borderBottom
:
'solid 1px #c4c4c4'
}}
>
...
...
src/container/BudgetTahunan/CorporateAnnualTarget.js
View file @
58b846ad
...
...
@@ -111,6 +111,8 @@ export default class CorporateAnnualTarget extends Component {
let
dataInternalBsn
=
[]
// // console.log(response)\
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
==
'success'
)
{
let
res
=
response
.
data
.
data
const
handlePushChild
=
(
item
)
=>
{
let
indexIDzz
=
dataTable
.
findIndex
((
val
)
=>
val
[
1
]
===
item
.
id
)
...
...
@@ -223,10 +225,23 @@ export default class CorporateAnnualTarget extends Component {
// console.log(dataCustomerPrs)
})
}
else
{
this
.
setState
({
dataTable
,
loading
:
false
,
dataReal
:
[],
editable
:
true
,
dataCustomerPrs
,
dataInternalBsn
},
()
=>
{
// console.log(dataCustomerPrs)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
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'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
...
...
@@ -361,6 +376,7 @@ export default class CorporateAnnualTarget extends Component {
// console.log(JSON.stringify(this.state.payload));
// console.log(response)
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
'success'
)
{
// this.setState({ visibleUpload: false, visibleCAT: false })
this
.
setState
({
visibleUpload
:
false
,
visibleCAT
:
false
})
...
...
@@ -434,7 +450,21 @@ export default class CorporateAnnualTarget extends Component {
})
// // // console.log(this.state.dataTable);
})
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
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'
,
loading
:
false
})
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
})
}
})
}
...
...
@@ -499,14 +529,25 @@ export default class CorporateAnnualTarget extends Component {
api
.
create
(
'UPLOAD'
).
uploadMasterBudget
(
body
).
then
(
response
=>
{
// // console.log(response);
if
(
response
.
data
)
{
if
(
response
.
ok
)
{
if
(
response
.
data
.
status
===
"success"
)
{
this
.
props
.
onClickClose
()
this
.
props
.
getReport
()
}
else
{
alert
(
response
.
data
.
status
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'warning'
,
loading
:
false
},
()
=>
{
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'
,
loading
:
false
})
}
}
else
{
alert
(
response
.
problem
)
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
problem
,
tipeAlert
:
'error'
,
loading
:
false
}
)
}
})
}
...
...
@@ -752,7 +793,6 @@ export default class CorporateAnnualTarget extends Component {
},
1000
);
}
})
// alert(response.data.message)
}
}
else
{
this
.
setState
({
alert
:
true
,
messageAlert
:
response
.
data
.
message
,
tipeAlert
:
'error'
})
...
...
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