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
e5a92675
Commit
e5a92675
authored
Jun 17, 2020
by
Trisno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
display loading bar and 'No Reward History'
parent
e4660d35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
27 deletions
+37
-27
RewardHistory.js
view/RewardHistory.js
+37
-27
No files found.
view/RewardHistory.js
View file @
e5a92675
import
React
from
'react'
;
import
{
View
,
Text
,
Image
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
}
from
'react-native'
;
import
{
View
,
Text
,
Image
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
,
ActivityIndicator
}
from
'react-native'
;
import
{
Card
}
from
'react-native-shadow-cards'
import
{
connect
}
from
'react-redux'
;
import
Axios
from
'axios'
;
...
...
@@ -9,7 +9,8 @@ class RewardHistory extends React.Component {
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
rewardsList
:
[]
rewardsList
:
[],
indicator
:
true
}
}
...
...
@@ -32,14 +33,15 @@ class RewardHistory extends React.Component {
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/history'
,
params
).
then
(
res
=>
{
let
data
=
res
.
data
.
rewards
// console.log(data)
data
.
map
((
item
,
key
)
=>
{
data
.
map
((
item
,
key
)
=>
{
// console.log(item.expire_time)
item
.
expire_time
=
moment
(
item
.
expire_time
).
format
(
"DD MMMM YYYY"
)
item
.
used_time
=
moment
(
item
.
used_time
).
format
(
"DD MMMM YYYY"
)
item
.
expire_time
=
moment
(
item
.
expire_time
).
format
(
"DD MMMM YYYY"
)
item
.
used_time
=
moment
(
item
.
used_time
).
format
(
"DD MMMM YYYY"
)
})
// console.log(data)
this
.
setState
({
rewardsList
:
data
rewardsList
:
data
,
indicator
:
false
})
}).
catch
(
error
=>
{
...
...
@@ -52,31 +54,39 @@ class RewardHistory extends React.Component {
return
(
<
View
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{
styles
.
body
}
>
{
this
.
state
.
rewardsList
.
map
((
item
,
key
)
=>
(
<
TouchableOpacity
key
=
{
key
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Detail'
,
{
rewardId
:
item
.
id
})}
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
View
>
<
Image
source
=
{{
uri
:
item
.
reward
.
title_image
}}
resizeMethod
=
"resize"
resizeMode
=
'cover'
style
=
{{
height
:
100
,
width
:
'100%'
}}
/
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
{
this
.
state
.
indicator
?
(
<
ActivityIndicator
style
=
{{
justifyContent
:
"center"
,
alignItems
:
'center'
,
margin
:
20
}}
size
=
"large"
color
=
"#c9af6d"
/>
)
:
this
.
state
.
rewardsList
.
length
?
(
this
.
state
.
rewardsList
.
map
((
item
,
key
)
=>
(
<
TouchableOpacity
key
=
{
key
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Detail'
,
{
rewardId
:
item
.
id
})}
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
View
>
<
Text
style
=
{{
textAlign
:
'left'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
}}
>
{
item
.
reward
.
title
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'left'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
}}
>
{
item
.
reward
.
subtitle
}
<
/Text
>
<
Image
source
=
{{
uri
:
item
.
reward
.
title_image
}}
resizeMethod
=
"resize"
resizeMode
=
'cover'
style
=
{{
height
:
100
,
width
:
'100%'
}}
/
>
<
/View
>
<
View
>
<
Text
style
=
{{
textAlign
:
'right'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
}}
>
Used
at
<
/Text
>
<
Text
style
=
{{
textAlign
:
'right'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
}}
>
{
item
.
used_time
}
<
/Text
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
<
View
>
<
Text
style
=
{{
textAlign
:
'left'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
}}
>
{
item
.
reward
.
title
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'left'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
}}
>
{
item
.
reward
.
subtitle
}
<
/Text
>
<
/View
>
<
View
>
<
Text
style
=
{{
textAlign
:
'right'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
}}
>
Used
at
<
/Text
>
<
Text
style
=
{{
textAlign
:
'right'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
}}
>
{
item
.
used_time
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/Card
>
<
/Card
>
<
/View
>
<
/TouchableOpacity
>
))
)
:
(
<
View
style
=
{{
alignItems
:
'center'
,
margin
:
20
}}
>
<
Text
style
=
{{
textAlign
:
'right'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
}}
>
No
Reward
History
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
))
)
}
<
/ScrollView
>
<
/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