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
4e3edb32
Commit
4e3edb32
authored
May 12, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fungsi expired sudah jalan
parent
58fe8ad6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
87 deletions
+139
-87
app.json
app.json
+1
-1
Home.js
view/Home.js
+1
-1
RewardDetail.js
view/RewardDetail.js
+137
-85
No files found.
app.json
View file @
4e3edb32
{
"expo"
:
{
"name"
:
"Excelso_update v1.1
1
.05.2020"
,
"name"
:
"Excelso_update v1.1
2
.05.2020"
,
"slug"
:
"excelso-pro"
,
"privacy"
:
"public"
,
"sdkVersion"
:
"36.0.0"
,
...
...
view/Home.js
View file @
4e3edb32
...
...
@@ -294,7 +294,7 @@ class Home extends React.Component {
<
TouchableOpacity
style
=
{
styles
.
submitUpgradePemium
}
activeOpacity
=
{.
5
}
onPress
=
{
this
.
onPress
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
bottom
:
5
,
color
:
'white'
}}
>
TOP
BALANCE
<
/Text
>
<
/TouchableOpacity
>
<
Text
>
1
1
May
2019
<
/Text
>
<
Text
>
1
2
May
2019
<
/Text
>
<
View
style
=
{{
height
:
60
}}
><
/View
>
<
/View
>
<
/View
>
...
...
view/RewardDetail.js
View file @
4e3edb32
import
React
from
'react'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
,
Image
,
Button
}
from
'react-native'
;
import
{
CheckBox
,
Separator
,
Grid
,
Row
,
Card
,
Icon
,
CardItem
,
Body
}
from
'native-base'
;
import
{
Collapse
,
CollapseHeader
,
CollapseBody
,
AccordionList
}
from
'accordion-collapse-react-native'
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
,
Image
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
Axios
from
'axios'
;
import
session
from
'../function/session'
;
...
...
@@ -9,6 +7,7 @@ import HTML from 'react-native-render-html';
import
{
WebView
}
from
'react-native-webview'
;
import
ActionType
from
'../redux/globalActionType'
;
import
moment
from
'moment'
;
import
{
Button
}
from
'react-native-elements'
;
class
RewardDetail
extends
React
.
Component
{
constructor
(
props
)
{
...
...
@@ -23,11 +22,21 @@ class RewardDetail extends React.Component {
used
:
''
,
dateNow
:
''
,
value
:
''
,
cur_time
:
''
,
exp_time
:
''
,
}
}
componentDidMount
()
{
this
.
detailReward
()
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
this
.
detailReward
()
});
}
componentWillUnmount
()
{
this
.
_unsubscribe
()
}
detailReward
()
{
...
...
@@ -38,109 +47,102 @@ class RewardDetail extends React.Component {
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail'
,
params
).
then
(
res
=>
{
let
expire_date
=
moment
(
res
.
data
.
reward
.
expire_time
).
format
(
'DD MMMM YYYY'
)
let
exp_time
=
new
Date
(
res
.
data
.
reward
.
expire_time
)
exp_time
.
setHours
(
0
,
0
,
0
,
0
);
let
cur_time
=
new
Date
()
cur_time
.
setHours
(
0
,
0
,
0
,
0
);
this
.
setState
({
image
:
res
.
data
.
reward
.
reward
.
content_image
,
title
:
res
.
data
.
reward
.
reward
.
title
,
subtitle
:
res
.
data
.
reward
.
reward
.
subtitle
,
content
:
res
.
data
.
reward
.
reward
.
content
,
expire
:
res
.
data
.
reward
.
expire_tim
e
,
expire
:
expire_dat
e
,
code
:
res
.
data
.
reward
.
verification_number
,
used
:
res
.
data
.
reward
.
used
,
value
:
res
.
data
.
reward
.
reward
.
value
,
cur_time
:
cur_time
,
exp_time
:
exp_time
})
let
date
=
new
Date
(
this
.
state
.
expire
);
let
year
=
date
.
getFullYear
();
let
month
=
date
.
getMonth
()
+
1
;
let
dt
=
date
.
getDate
();
if
(
dt
<
10
)
{
dt
=
'0'
+
dt
;
}
if
(
month
<
10
)
{
month
=
'0'
+
month
;
}
let
hasil
=
year
+
'-'
+
month
+
'-'
+
dt
;
this
.
setState
({
expire
:
hasil
,
})
}).
catch
(
error
=>
{
const
{
navigation
}
=
this
.
props
let
response
=
error
.
response
.
data
session
(
response
,
navigation
)
Alert
.
alert
(
response
.
msg
);
})
}
useVoucher
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
reward_id
:
this
.
props
.
route
.
params
.
rewardId
,
lat
:
this
.
props
.
lat
,
long
:
this
.
props
.
long
let
voucherProps
=
{
value_voucher
:
this
.
state
.
value
,
voucher
:
this
.
state
.
code
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/use_reward'
,
params
).
then
(
res
=>
{
let
voucherProps
=
{
value_voucher
:
this
.
state
.
value
,
voucher
:
this
.
state
.
code
}
this
.
props
.
setVoucher
(
voucherProps
);
Alert
.
alert
(
''
,
res
.
data
.
message
,
[
{
text
:
'OK'
,
onPress
:
()
=>
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'MENU'
})
}
]
)
this
.
props
.
setVoucher
(
voucherProps
);
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'MENU'
})
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
Alert
.
alert
(
''
,
response
.
msg
,
[
{
text
:
'OK'
}
]
)
})
}
useDVoucher
()
{
this
.
props
.
navigation
.
navigate
(
'Order Detail'
)
}
render
()
{
const
deskripsi
=
this
.
state
.
deskripsi
return
(
<
View
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{
styles
.
body
}
>
<
ScrollView
>
<
View
style
=
{
styles
.
body
}
>
<
Image
style
=
{{
height
:
250
,
width
:
'100%'
}}
source
=
{
this
.
state
.
image
?
{
uri
:
this
.
state
.
image
}
:
null
}
/
>
<
View
style
=
{{
height
:
70
,
flex
:
1
,
backgroundColor
:
'#03989E'
,
top
:
-
60
,
marginRight
:
10
,
marginLeft
:
10
}}
>
<
Text
style
=
{{
margin
:
5
}}
>
Voucher
code
:
<
/Text
>
<
Text
style
=
{{
fontSize
:
30
,
textAlign
:
'center'
,
fontWeight
:
'bold'
,
bottom
:
5
}}
>
{
this
.
state
.
code
}
<
/Text
>
<
View
style
=
{
styles
.
content_code_expire
}
>
<
View
style
=
{
styles
.
voucher_code
}
>
<
Text
style
=
{
styles
.
text_voucher
}
>
Voucher
Code
:
<
/Text
>
<
Text
style
=
{
styles
.
text_c_voucher
}
>
{
this
.
state
.
code
}
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
expire_time
}
>
<
Text
style
=
{
styles
.
text_expire
}
>
Expire
Time
:
<
/Text
>
<
Text
style
=
{
styles
.
text_c_expire
}
>
{
this
.
state
.
expire
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
height
:
70
,
flex
:
1
,
backgroundColor
:
'black'
,
top
:
-
70
,
marginRight
:
10
,
marginLeft
:
10
}}
>
<
Text
style
=
{{
margin
:
5
,
color
:
'white'
}}
>
Expired
Date
:
<
/Text
>
<
Text
style
=
{{
fontSize
:
30
,
textAlign
:
'center'
,
fontWeight
:
'bold'
,
bottom
:
5
,
color
:
'white'
}}
>
{
this
.
state
.
expire
}
<
/Text
>
<
View
style
=
{
styles
.
content
}
>
{
this
.
state
.
cur_time
>=
this
.
state
.
exp_time
?
(
<
Button
style
=
{{
margin
:
5
}}
title
=
"EXPIRED"
onPress
=
{()
=>
console
.
log
(
'inin'
)}
buttonStyle
=
{{
height
:
50
,
backgroundColor
:
'red'
}}
/>
)
:
this
.
state
.
used
==
0
?
(
<
Button
style
=
{{
margin
:
5
}}
title
=
"USE VOUCHER"
onPress
=
{()
=>
this
.
useVoucher
()}
buttonStyle
=
{{
height
:
50
,
backgroundColor
:
'#2ead28'
}}
/
>
)
:
(
<
Button
style
=
{{
margin
:
5
}}
title
=
"USED"
onPress
=
{()
=>
this
.
useDVoucher
()}
buttonStyle
=
{{
height
:
50
,
backgroundColor
:
'#2ead28'
}}
/
>
)}
<
View
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
15
,
top
:
5
,
fontWeight
:
'bold'
}}
>
{
this
.
state
.
title
}
<
/Text
>
<
/View
>
<
View
style
=
{{
margin
:
10
}}
>
<
HTML
html
=
{
this
.
state
.
content
}
/
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{{
flex
:
1
,
top
:
-
60
,
margin
:
10
}}
>
{
this
.
state
.
used
==
0
?
(
<
Button
title
=
"USE VOUCHER"
onPress
=
{()
=>
this
.
useVoucher
()}
><
/Button
>
)
:
this
.
state
.
expire
>=
Date
.
now
()
?
(
<
Button
title
=
"EXPIRED"
><
/Button>
)
:
(
<
Button
title
=
"USED"
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Menu Select'
)()}
><
/Button>
)
}
<
HTML
html
=
{
this
.
state
.
title
}
/
>
<
HTML
html
=
{
this
.
state
.
content
}
/
>
<
/View
>
<
/ScrollView
>
<
/View
>
)
...
...
@@ -153,23 +155,71 @@ const styles = StyleSheet.create({
flex
:
1
,
backgroundColor
:
'white'
,
},
header
:
{
body
:
{
flex
:
1
,
},
flex
:
0.5
,
content_code_expire
:
{
top
:
-
140
,
flex
:
1
,
backgroundColor
:
'green'
,
marginRight
:
30
,
marginLeft
:
30
,
},
images
:
{
margin
:
10
,
flex
:
2
,
justifyContent
:
'center'
,
voucher_code
:
{
height
:
70
,
backgroundColor
:
'#01919c'
,
flex
:
1
,
},
content
:
{
flex
:
2
,
expire_time
:
{
flex
:
1
,
height
:
70
,
backgroundColor
:
'black'
,
},
body
:
{
flex
:
3
,
text_voucher
:
{
fontSize
:
15
,
marginLeft
:
10
,
top
:
5
,
color
:
'white'
},
text_c_voucher
:
{
textAlign
:
'center'
,
fontWeight
:
'bold'
,
fontSize
:
30
,
top
:
5
,
color
:
'white'
},
text_expire
:
{
fontSize
:
15
,
marginLeft
:
10
,
top
:
5
,
color
:
'white'
},
text_c_expire
:
{
textAlign
:
'center'
,
fontWeight
:
'bold'
,
fontSize
:
30
,
top
:
5
,
color
:
'white'
},
content
:
{
top
:
-
140
,
flex
:
1
,
},
button
:
{
flex
:
1
,
height
:
60
,
backgroundColor
:
'#2ead28'
,
borderRadius
:
5
,
},
})
...
...
@@ -198,4 +248,6 @@ const mapStateToProps = (state) => {
}
}
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
RewardDetail
);
\ No newline at end of file
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
RewardDetail
);
{
/* */
}
\ No newline at end of file
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