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
3b96fe36
Commit
3b96fe36
authored
Sep 01, 2020
by
Afid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renew until dapat dari server sekarang
parent
06909b82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
53 deletions
+63
-53
Renewal.js
view/Renewal.js
+63
-53
No files found.
view/Renewal.js
View file @
3b96fe36
import
React
from
'react'
;
import
React
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
Button
,
Alert
,
TouchableOpacity
}
from
'react-native'
;
import
{
View
,
Text
,
StyleSheet
,
Button
,
Alert
,
TouchableOpacity
,
ActivityIndicator
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
Axios
from
'axios'
;
import
Axios
from
'axios'
;
import
MyStatusBar
from
'./MyStatusBar'
;
import
MyStatusBar
from
'./MyStatusBar'
;
import
i18n
from
'i18n-js'
;
import
i18n
from
'i18n-js'
;
import
Toast
from
'react-native-tiny-toast'
;
import
Toast
from
'react-native-tiny-toast'
;
import
Spinner
from
'react-native-loading-spinner-overlay'
;
import
moment
from
'moment'
import
moment
from
'moment'
class
Renewal
extends
React
.
Component
{
class
Renewal
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -16,6 +18,8 @@ class Renewal extends React.Component {
...
@@ -16,6 +18,8 @@ class Renewal extends React.Component {
card_number
:
""
,
card_number
:
""
,
biaya_renewal
:
"100.000"
,
biaya_renewal
:
"100.000"
,
renew_until
:
""
,
renew_until
:
""
,
indicator
:
true
,
spinner
:
false
,
}
}
}
}
...
@@ -43,19 +47,22 @@ class Renewal extends React.Component {
...
@@ -43,19 +47,22 @@ class Renewal extends React.Component {
}
}
_renewal
()
{
_renewal
()
{
this
.
setState
({
spinner
:
true
})
let
params
=
{
let
params
=
{
session_id
:
this
.
props
.
session_id
session_id
:
this
.
props
.
session_id
}
}
// console.log(params);
// console.log(params);
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/card/renewal'
,
params
).
then
(
res
=>
{
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/card/renewal'
,
params
).
then
(
res
=>
{
// console.log('ini res ' + JSON.stringify(res.data))
// console.log('ini res ' + JSON.stringify(res.data))
this
.
_getProfile
();
this
.
_getProfile
();
Toast
.
show
(
i18n
.
t
(
'successRenewal'
))
Toast
.
show
(
i18n
.
t
(
'successRenewal'
))
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'ACCOUNT'
});
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'ACCOUNT'
});
this
.
setState
({
spinner
:
false
})
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
let
response
=
error
.
response
.
data
;
// console.log(response.msg)
// console.log(response.msg)
Alert
.
alert
(
''
,
response
.
msg
);
Alert
.
alert
(
''
,
response
.
msg
);
this
.
setState
({
spinner
:
false
})
})
})
}
}
...
@@ -64,26 +71,20 @@ class Renewal extends React.Component {
...
@@ -64,26 +71,20 @@ class Renewal extends React.Component {
session_id
:
this
.
props
.
session_id
session_id
:
this
.
props
.
session_id
}
}
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/member/get_profile'
,
params
).
then
(
res
=>
{
Axios
.
post
(
this
.
props
.
BASE_URL
+
'crm/v2/member/get_profile'
,
params
).
then
(
res
=>
{
//
console.log('ini res ' + JSON.stringify(res.data))
console
.
log
(
'ini res '
+
JSON
.
stringify
(
res
.
data
))
const
dataCard
=
res
.
data
const
dataCard
=
res
.
data
let
balance
=
dataCard
.
kaspro_balance
let
balance
=
dataCard
.
kaspro_balance
let
expired
=
dataCard
.
expire_date
let
expired
=
dataCard
.
expire_date
let
c_renew_until
=
dataCard
.
expire_date
let
renew
=
dataCard
.
renew_until
var
date_string
=
c_renew_until
var
date_arr
=
date_string
.
split
(
'-'
);
var
date
=
new
Date
(
date_arr
[
0
],
date_arr
[
1
],
date_arr
[
2
]);
date
.
setFullYear
(
date
.
getFullYear
()
+
1
);
let
date_nextyear_string
=
moment
([
date
.
getFullYear
(),
date
.
getMonth
(),
date
.
getDate
()]).
month
(
date
.
getMonth
()
-
1
).
format
(
"YYYY-MM-DD"
)
// console.log("INI YA : " + date_nextyear_string)
this
.
setState
({
this
.
setState
({
current_balance
:
balance
,
current_balance
:
balance
,
expired
:
expired
,
expired
:
expired
,
renew_until
:
date_nextyear_string
renew_until
:
renew
,
indicator
:
false
,
})
})
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
...
@@ -98,49 +99,58 @@ class Renewal extends React.Component {
...
@@ -98,49 +99,58 @@ class Renewal extends React.Component {
{
/* <View style={styles.header}> */
}
{
/* <View style={styles.header}> */
}
{
/* <Text style={{ textAlign: 'center', margin: 20, fontSize: 25, alignSelf: 'center' }}>Renewal</Text> */
}
{
/* <Text style={{ textAlign: 'center', margin: 20, fontSize: 25, alignSelf: 'center' }}>Renewal</Text> */
}
{
/* </View> */
}
{
/* </View> */
}
<
View
style
=
{
styles
.
body
}
>
<
Spinner
<
View
style
=
{
styles
.
cont_curent_balance
}
>
visible
=
{
this
.
state
.
spinner
}
<
View
style
=
{
styles
.
current_balance
}
>
textContent
=
{
'Loading...'
}
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'currentbalance'
)}
<
/Text
>
textStyle
=
{
styles
.
spinnerTextStyle
}
<
/View
>
/
>
<
View
style
=
{
styles
.
value_current_balance
}
>
{
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
IDR
{
this
.
state
.
current_balance
}
<
/Text
>
this
.
state
.
indicator
?
(
<
ActivityIndicator
style
=
{{
top
:
20
,
justifyContent
:
"center"
}}
size
=
"large"
color
=
"#c9af6d"
/>
)
:
(
<
/View
>
<
View
style
=
{
styles
.
body
}
>
<
/View
>
<
View
style
=
{
styles
.
cont_curent_balance
}
>
<
View
style
=
{
styles
.
cont_curent_balance
}
>
<
View
style
=
{
styles
.
current_balance
}
>
<
View
style
=
{
styles
.
current_balance
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'currentbalance'
)}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'renewalfees'
)}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
value_current_balance
}
>
<
View
style
=
{
styles
.
value_current_balance
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
IDR
{
this
.
state
.
current_balance
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
IDR
{
this
.
state
.
biaya_renewal
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
cont_curent_balance
}
>
<
View
style
=
{
styles
.
cont_curent_balance
}
>
<
View
style
=
{
styles
.
current_balance
}
>
<
View
style
=
{
styles
.
current_balance
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'renewalfees'
)}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'expired'
)}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
value_current_balance
}
>
<
View
style
=
{
styles
.
value_current_balance
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
IDR
{
this
.
state
.
biaya_renewal
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
{
this
.
state
.
expired
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
cont_curent_balance
}
>
<
View
style
=
{
styles
.
current_balance
}
>
<
View
style
=
{
styles
.
cont_curent_balance
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'expired'
)}
<
/Text
>
<
View
style
=
{
styles
.
current_balance
}
>
<
/View
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'renewuntil'
)}
<
/Text
>
<
View
style
=
{
styles
.
value_current_balance
}
>
<
/View
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
{
this
.
state
.
expired
}
<
/Text
>
<
View
style
=
{
styles
.
value_current_balance
}
>
<
/View
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
{
this
.
state
.
renew_until
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
cont_curent_balance
}
>
{
/* <View style={styles.btn_renewal}>
<
View
style
=
{
styles
.
current_balance
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#CFB368'
}}
>
{
i18n
.
t
(
'renewuntil'
)}
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
value_current_balance
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'gray'
}}
>
{
this
.
state
.
renew_until
}
<
/Text
>
<
/View
>
<
/View
>
{
/* <View style={styles.btn_renewal}>
<Button title="Renew" onPress={() => this._renewal()}></Button>
<Button title="Renew" onPress={() => this._renewal()}></Button>
</View> */
}
</View> */
}
<
TouchableOpacity
onPress
=
{()
=>
this
.
_handleRenewal
()}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
_handleRenewal
()}
>
<
View
style
=
{
styles
.
button
}
>
<
View
style
=
{
styles
.
button
}
>
<
Text
style
=
{{
color
:
'white'
,
fontSize
:
16
,
textAlign
:
'center'
,
fontFamily
:
'Gotham-Black'
}}
>
{
i18n
.
t
(
'renew'
)}
<
/Text
>
<
Text
style
=
{{
color
:
'white'
,
fontSize
:
16
,
textAlign
:
'center'
,
fontFamily
:
'Gotham-Black'
}}
>
{
i18n
.
t
(
'renew'
)}
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/TouchableOpacity
>
)
<
/View
>
}
<
/View
>
<
/View
>
)
)
}
}
...
...
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