Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
clone_excelso
Project
Project
Details
Activity
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
Prasetya Saputra
clone_excelso
Commits
347ff4c8
Commit
347ff4c8
authored
Aug 21, 2020
by
William Goszal
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
halaman account, claim balance nya juga dikasih loading
parent
b310545b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
46 deletions
+50
-46
Account.js
view/Account.js
+43
-40
Home.js
view/Home.js
+7
-6
No files found.
view/Account.js
View file @
347ff4c8
...
@@ -14,12 +14,14 @@ import { connect } from 'react-redux';
...
@@ -14,12 +14,14 @@ import { connect } from 'react-redux';
import
requestParams
from
'../helper/requestParams'
;
import
requestParams
from
'../helper/requestParams'
;
import
ActionType
from
'../redux/globalActionType'
;
import
ActionType
from
'../redux/globalActionType'
;
import
CustomIosStatusBar
from
'./CustomIosStatusBar'
;
import
CustomIosStatusBar
from
'./CustomIosStatusBar'
;
import
Spinner
from
'react-native-loading-spinner-overlay'
;
class
Account
extends
React
.
Component
{
class
Account
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
state
=
{
spinner
:
false
,
email
:
""
,
email
:
""
,
points
:
""
,
points
:
""
,
balance
:
""
,
balance
:
""
,
...
@@ -119,47 +121,47 @@ class Account extends React.Component {
...
@@ -119,47 +121,47 @@ class Account extends React.Component {
}
}
}
}
onClickClaimCredit
()
{
try
{
Alert
.
alert
(
""
,
i18n
.
t
(
'makeSureClaimCredit'
),
[
{
text
:
i18n
.
t
(
'alertno'
),
onPress
:
()
=>
console
.
log
(
'Cancel Claim Credit'
),
style
:
'cancel'
,
},
{
text
:
i18n
.
t
(
'alertyes'
),
onPress
:
()
=>
this
.
handleClaimCredit
()
},
],
{
cancelable
:
false
},
)
}
catch
(
error
)
{
Alert
.
alert
(
'Error: '
+
error
)
}
}
handleClaimCredit
()
{
handleClaimCredit
()
{
try
{
this
.
setState
({
spinner
:
true
})
let
params
=
Object
.
assign
(
requestParams
,
{
this
.
setState
({
old_balance_claimed
:
true
})
/** set jadi true dulu buat hilangkan bagian claim credit */
session_id
:
this
.
props
.
session_id
,
this
.
setState
({
indicator
:
true
})
/** atau sekalian dibuat loading aja bagian profilecardnya */
})
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/card/claim_old_balance'
,
params
).
then
(
res
=>
{
let
params
=
Object
.
assign
(
requestParams
,
{
Alert
.
alert
(
i18n
.
t
(
'success'
),
i18n
.
t
(
'alertclaimcredit'
))
session_id
:
this
.
props
.
session_id
,
}).
catch
(
error
=>
{
})
let
response
=
error
.
response
.
data
Alert
.
alert
(
error
,
response
.
msg
)
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/card/claim_old_balance'
,
params
).
then
(
res
=>
{
})
this
.
setState
({
spinner
:
false
})
}
catch
(
error
)
{
this
.
_getProfile
()
Alert
.
alert
(
'Error : '
+
error
)
// Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
}
}).
catch
(
error
=>
{
this
.
setState
({
spinner
:
false
})
}
this
.
_getProfile
()
let
response
=
error
.
response
.
data
Alert
.
alert
(
error
,
response
.
msg
)
})
}
onClickClaimCredit
()
{
Alert
.
alert
(
""
,
i18n
.
t
(
'makeSureClaimCredit'
),
[
{
text
:
i18n
.
t
(
'alertno'
),
onPress
:
()
=>
console
.
log
(
'Cancel Claim Credit'
),
style
:
'cancel'
,
},
{
text
:
i18n
.
t
(
'alertyes'
),
onPress
:
()
=>
{
this
.
handleClaimCredit
()
}
},
],
{
cancelable
:
false
},
)
}
_getProfile
()
{
_getProfile
()
{
try
{
try
{
...
@@ -292,6 +294,7 @@ class Account extends React.Component {
...
@@ -292,6 +294,7 @@ class Account extends React.Component {
const
navigation
=
this
.
props
.
navigation
const
navigation
=
this
.
props
.
navigation
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
Spinner
visible
=
{
this
.
state
.
spinner
}
textContent
=
{
'Loading...'
}
textStyle
=
{{
color
:
"white"
}}
/
>
{
Platform
.
OS
===
'ios'
?
(
{
Platform
.
OS
===
'ios'
?
(
<
CustomIosStatusBar
color
=
'#CFB368'
/>
<
CustomIosStatusBar
color
=
'#CFB368'
/>
)
:
null
}
)
:
null
}
...
...
view/Home.js
View file @
347ff4c8
...
@@ -299,6 +299,10 @@ class Home extends React.Component {
...
@@ -299,6 +299,10 @@ class Home extends React.Component {
}
}
handleClaimCredit
()
{
handleClaimCredit
()
{
this
.
setState
({
spinner
:
true
})
this
.
setState
({
old_balance_claimed
:
true
})
/** set jadi true dulu buat hilangkan bagian claim credit */
this
.
setState
({
indicatorProfileCard
:
true
})
/** atau sekalian dibuat loading aja bagian profilecardnya */
let
params
=
Object
.
assign
(
requestParams
,
{
let
params
=
Object
.
assign
(
requestParams
,
{
session_id
:
this
.
props
.
session_id
,
session_id
:
this
.
props
.
session_id
,
})
})
...
@@ -306,7 +310,7 @@ class Home extends React.Component {
...
@@ -306,7 +310,7 @@ class Home extends React.Component {
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/card/claim_old_balance'
,
params
).
then
(
res
=>
{
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/card/claim_old_balance'
,
params
).
then
(
res
=>
{
this
.
setState
({
spinner
:
false
})
this
.
setState
({
spinner
:
false
})
this
.
_account
()
this
.
_account
()
Alert
.
alert
(
i18n
.
t
(
'success'
),
i18n
.
t
(
'alertclaimcredit'
))
//
Alert.alert(i18n.t('success'), i18n.t('alertclaimcredit'))
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
this
.
setState
({
spinner
:
false
})
this
.
setState
({
spinner
:
false
})
this
.
_account
()
this
.
_account
()
...
@@ -326,10 +330,7 @@ class Home extends React.Component {
...
@@ -326,10 +330,7 @@ class Home extends React.Component {
style
:
'cancel'
,
style
:
'cancel'
,
},
},
{
{
text
:
i18n
.
t
(
'alertyes'
),
onPress
:
()
=>
{
text
:
i18n
.
t
(
'alertyes'
),
onPress
:
()
=>
{
this
.
setState
({
spinner
:
true
})
this
.
setState
({
old_balance_claimed
:
true
})
/** set jadi true dulu buat hilangkan bagian claim credit */
this
.
setState
({
indicatorProfileCard
:
true
})
/** atau sekalian dibuat loading aja bagian profilecardnya */
this
.
handleClaimCredit
()
this
.
handleClaimCredit
()
}
}
},
},
...
@@ -561,7 +562,7 @@ class Home extends React.Component {
...
@@ -561,7 +562,7 @@ class Home extends React.Component {
<
Text
style
=
{{
fontSize
:
14
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
IDR
{
this
.
state
.
point
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
14
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
IDR
{
this
.
state
.
point
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/Card
>
<
/Card>
{
this
.
state
.
old_balance_claimed
==
false
?
(
{
this
.
state
.
old_balance_claimed
==
false
?
(
this
.
state
.
old_balance
==
0
?
(
null
)
:
this
.
state
.
old_balance
==
0
?
(
null
)
:
(
<
Card
style
=
{{
padding
:
10
,
margin
:
10
,
alignContent
:
'center'
}}
>
(
<
Card
style
=
{{
padding
:
10
,
margin
:
10
,
alignContent
:
'center'
}}
>
...
...
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