Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
new_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
new_excelso
Commits
f2e78982
Commit
f2e78982
authored
Jun 24, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Menambahkan fungsi use balance
parent
5ee9d456
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
61 deletions
+50
-61
Account.js
view/Account.js
+16
-8
Home.js
view/Home.js
+34
-53
No files found.
view/Account.js
View file @
f2e78982
...
...
@@ -180,14 +180,22 @@ class Account extends React.Component {
this
.
props
.
navigation
.
navigate
(
'Transfer Balance'
);
}
}
_useBalance
()
{
if
(
this
.
props
.
in_payment
)
{
this
.
props
.
navigation
.
navigate
(
'Redeem Code'
)
}
else
{
this
.
props
.
navigation
.
navigate
(
'UseBalance'
)
handleuseBalance
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
}
}
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/point/check'
,
params
).
then
(
res
=>
{
if
(
res
.
data
.
in_process_redeem
==
false
)
{
this
.
props
.
navigation
.
navigate
(
'UseBalance'
)
}
else
{
this
.
props
.
navigation
.
navigate
(
'Redeem Code'
)
}
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
Alert
.
alert
(
error
,
response
.
msg
)
})
}
render
()
{
const
navigation
=
this
.
props
.
navigation
...
...
@@ -325,7 +333,7 @@ class Account extends React.Component {
<
/Card
>
<
/TouchableOpacity
>
<
View
style
=
{{
width
:
5
}}
><
/View
>
<
TouchableOpacity
style
=
{{
marginBottom
:
5
,
margin
:
3
}}
onPress
=
{()
=>
this
.
_
useBalance
()}
>
<
TouchableOpacity
style
=
{{
marginBottom
:
5
,
margin
:
3
}}
onPress
=
{()
=>
this
.
handle
useBalance
()}
>
<
Card
style
=
{{
height
:
120
,
width
:
155
}}
>
<
View
style
=
{{
height
:
50
,
alignItems
:
'center'
,
padding
:
10
,
flex
:
1
}}
>
<
Image
...
...
view/Home.js
View file @
f2e78982
...
...
@@ -44,8 +44,8 @@ class Home extends React.Component {
}
componentDidMount
()
{
this
.
CheckInbox
()
console
.
log
(
"INI BASE_URL : "
+
this
.
props
.
BASE_URL
)
const
screenWidth
=
Math
.
round
(
Dimensions
.
get
(
'window'
).
width
);
this
.
setState
({
slider_height
:
screenWidth
...
...
@@ -190,8 +190,6 @@ class Home extends React.Component {
old_balance_claimed
:
old_balance_claimed
,
member_since
:
member_since
})
console
.
log
(
"INI HASIL RESPON NYA :"
+
JSON
.
stringify
(
res
))
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
// Alert.alert('',response.msg);
...
...
@@ -229,13 +227,20 @@ class Home extends React.Component {
})
}
_useBalance
()
{
if
(
this
.
props
.
in_payment
)
{
this
.
props
.
navigation
.
navigate
(
'Redeem Code'
)
}
else
{
this
.
props
.
navigation
.
navigate
(
'UseBalance'
)
handleuseBalance
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
}
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/point/check'
,
params
).
then
(
res
=>
{
if
(
res
.
data
.
in_process_redeem
==
false
)
{
this
.
props
.
navigation
.
navigate
(
'UseBalance'
)
}
else
{
this
.
props
.
navigation
.
navigate
(
'Redeem Code'
)
}
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
Alert
.
alert
(
error
,
response
.
msg
)
})
}
_pickup
()
{
...
...
@@ -259,19 +264,17 @@ class Home extends React.Component {
Toast
.
show
(
'Belum dapat outlet terdekat'
)
}
}
handleClaimCredit
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
}
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
=>
{
Alert
.
alert
(
i18n
.
t
(
'success'
),
i18n
.
t
(
'alertclaimcredit'
))
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
Alert
.
alert
(
error
,
response
.
msg
)
console
.
log
(
"INI RESPON CLAMI"
+
JSON
.
stringify
(
error
))
Alert
.
alert
(
error
,
response
.
msg
)
})
}
...
...
@@ -428,7 +431,7 @@ class Home extends React.Component {
<
ActivityIndicator
style
=
{{
justifyContent
:
"center"
}}
size
=
"large"
color
=
"#c9af6d"
/>
<
/Card
>
<
/View
>
)
:
)
:
this
.
state
.
account_number
==
""
?
(
<
View
style
=
{
styles
.
card
}
>
<
Card
style
=
{{
padding
:
10
,
margin
:
10
,
alignContent
:
'center'
,
backgroundColor
:
'#838383'
}}
>
...
...
@@ -602,45 +605,23 @@ class Home extends React.Component {
<
/View
>
)
}
<
View
style
=
{{
flexDirection
:
'row'
,
flex
:
1
}}
>
<
TouchableOpacity
// style={styles.submitUpgradePemium}
activeOpacity
=
{.
5
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'TopUpInfo'
)}
>
<
View
style
=
{{
flex
:
0.5
,
height
:
40
,
top
:
20
,
margin
:
5
,
marginLeft
:
-
10
,
paddingVertical
:
12
,
paddingRight
:
10
,
paddingLeft
:
10
,
borderRadius
:
10
,
backgroundColor
:
'#CFB368'
,
}}
>
<
Text
style
=
{{
textAlign
:
'center'
,
color
:
'white'
,
fontFamily
:
'Gotham-Black'
,
fontSize
:
14
}}
>
{
i18n
.
t
(
'topup'
)}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
_useBalance
()}
>
<
View
style
=
{{
flex
:
0.5
,
height
:
40
,
top
:
20
,
margin
:
5
,
marginRight
:
-
10
,
paddingVertical
:
12
,
paddingHorizontal
:
24
,
borderRadius
:
10
,
backgroundColor
:
'#CFB368'
,
}}
>
<
Text
style
=
{{
textAlign
:
'center'
,
color
:
'white'
,
fontFamily
:
'Gotham-Black'
,
fontSize
:
14
}}
>
{
i18n
.
t
(
'usebalance'
)}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
View
style
=
{{
flexDirection
:
'row'
,
flex
:
1
,
height
:
40
,
marginTop
:
40
}}
>
<
View
style
=
{{
justifyContent
:
'center'
,
flex
:
1
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'TopUpInfo'
)}
>
<
View
style
=
{{
height
:
40
,
borderRadius
:
10
,
backgroundColor
:
'#CFB368'
,
marginRight
:
20
,
marginLeft
:
20
,
justifyContent
:
'center'
}}
>
<
Text
style
=
{{
textAlign
:
'center'
,
color
:
'white'
,
fontFamily
:
'Gotham-Black'
,
fontSize
:
14
}}
>
{
i18n
.
t
(
'topup'
)}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
justifyContent
:
'center'
,
flex
:
1
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
handleuseBalance
()}
>
<
View
style
=
{{
height
:
40
,
borderRadius
:
10
,
backgroundColor
:
'#CFB368'
,
marginRight
:
20
,
marginLeft
:
20
,
justifyContent
:
'center'
}}
>
<
Text
style
=
{{
textAlign
:
'center'
,
color
:
'white'
,
fontFamily
:
'Gotham-Black'
,
fontSize
:
14
}}
>
{
i18n
.
t
(
'usebalance'
)}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
View
style
=
{{
height
:
6
0
}}
><
/View
>
<
View
style
=
{{
height
:
4
0
}}
><
/View
>
<
/View
>
<
/View
>
<
/ScrollView
>
...
...
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