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
0f3a3559
Commit
0f3a3559
authored
May 12, 2020
by
Trisno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update reward select dan reward list
parent
f813a651
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
16 deletions
+44
-16
RewardSelect.js
view/RewardSelect.js
+42
-14
RewardsList.js
view/RewardsList.js
+2
-2
No files found.
view/RewardSelect.js
View file @
0f3a3559
...
@@ -4,12 +4,14 @@ import { Card } from 'react-native-shadow-cards'
...
@@ -4,12 +4,14 @@ import { Card } from 'react-native-shadow-cards'
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
Axios
from
'axios'
;
import
Axios
from
'axios'
;
import
moment
from
'moment'
import
moment
from
'moment'
import
ActionType
from
'../redux/globalActionType'
;
class
RewardSelect
extends
React
.
Component
{
class
RewardSelect
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
rewardsList
:
[]
rewardsList
:
[],
selectedReward
:
[]
}
}
}
}
...
@@ -25,12 +27,38 @@ class RewardSelect extends React.Component {
...
@@ -25,12 +27,38 @@ class RewardSelect extends React.Component {
this
.
_unsubscribe
()
this
.
_unsubscribe
()
}
}
handleSelect
(
item
){
// useVoucher() {
console
.
log
(
item
)
// let voucherProps = {
console
.
log
(
this
.
props
.
voucher
)
// value_voucher: this.state.value,
console
.
log
(
this
.
props
.
value_voucher
)
// voucher: this.state.code
}
// }
// this.props.setVoucher(voucherProps);
// this.props.navigation.navigate('Home', { screen: 'MENU' })
// }
handleSelect
(
item
)
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
reward_id
:
item
.
id
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail'
,
params
).
then
(
res
=>
{
// console.log(res.data.reward)
let
detail
=
res
.
data
.
reward
.
reward
let
voucherProps
=
{
value_voucher
:
detail
,
voucher
:
detail
}
// console.log(voucherProps)
this
.
props
.
setVoucher
(
voucherProps
);
// this.props.navigation.navigate('Home', { screen: 'MENU' })
// console.log(this.props.voucher)
// console.log(this.props.value_voucher)
this
.
props
.
navigation
.
goBack
()
})
}
getRewardsList
()
{
getRewardsList
()
{
let
params
=
{
let
params
=
{
session_id
:
this
.
props
.
session_id
session_id
:
this
.
props
.
session_id
...
@@ -38,9 +66,9 @@ class RewardSelect extends React.Component {
...
@@ -38,9 +66,9 @@ class RewardSelect extends React.Component {
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/get_list'
,
params
).
then
(
res
=>
{
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/get_list'
,
params
).
then
(
res
=>
{
let
data
=
res
.
data
.
rewards
let
data
=
res
.
data
.
rewards
// console.log(data)
// console.log(data)
data
.
map
((
item
,
key
)
=>
{
data
.
map
((
item
,
key
)
=>
{
// console.log(item.expire_time)
// console.log(item.expire_time)
item
.
expire_time
=
moment
(
item
.
expire_time
).
format
(
"DD MMMM YYYY"
)
item
.
expire_time
=
moment
(
item
.
expire_time
).
format
(
"DD MMMM YYYY"
)
})
})
// console.log(data)
// console.log(data)
this
.
setState
({
this
.
setState
({
...
@@ -67,18 +95,18 @@ class RewardSelect extends React.Component {
...
@@ -67,18 +95,18 @@ class RewardSelect extends React.Component {
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
View
>
<
View
>
<
Image
source
=
{{
uri
:
item
.
reward
.
title_image
}}
<
Image
source
=
{{
uri
:
item
.
reward
.
title_image
}}
resizeMethod
=
"
scal
e"
resizeMethod
=
"
resiz
e"
resizeMode
=
'stretch'
resizeMode
=
'stretch'
style
=
{{
height
:
150
,
width
:
430
}}
/
>
style
=
{{
height
:
150
,
width
:
430
}}
/
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
<
View
>
<
View
>
<
Text
>
{
item
.
reward
.
title
}
<
/Text
>
<
Text
style
=
{{
fontWeight
:
'bold'
}}
>
{
item
.
reward
.
title
}
<
/Text
>
<
Text
>
{
item
.
reward
.
subtitle
}
<
/Text
>
<
Text
>
{
item
.
reward
.
subtitle
}
<
/Text
>
<
/View
>
<
/View
>
<
View
>
<
View
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
Expired
<
/Text
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
Expired
<
/Text
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
{
item
.
expire_time
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
{
item
.
expire_time
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/Card
>
<
/Card
>
...
@@ -142,4 +170,4 @@ const mapDispatchToProps = (dispacth) => {
...
@@ -142,4 +170,4 @@ const mapDispatchToProps = (dispacth) => {
}
}
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
RewardSelect
);
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
RewardSelect
);
\ No newline at end of file
\ No newline at end of file
view/RewardsList.js
View file @
0f3a3559
...
@@ -61,13 +61,13 @@ class RewardsList extends React.Component {
...
@@ -61,13 +61,13 @@ class RewardsList extends React.Component {
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
View
>
<
View
>
<
Image
source
=
{{
uri
:
item
.
reward
.
title_image
}}
<
Image
source
=
{{
uri
:
item
.
reward
.
title_image
}}
resizeMethod
=
"
scal
e"
resizeMethod
=
"
resiz
e"
resizeMode
=
'stretch'
resizeMode
=
'stretch'
style
=
{{
height
:
150
,
width
:
430
}}
/
>
style
=
{{
height
:
150
,
width
:
430
}}
/
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
<
View
>
<
View
>
<
Text
>
{
item
.
reward
.
title
}
<
/Text
>
<
Text
style
=
{{
fontWeight
:
'bold'
}}
>
{
item
.
reward
.
title
}
<
/Text
>
<
Text
>
{
item
.
reward
.
subtitle
}
<
/Text
>
<
Text
>
{
item
.
reward
.
subtitle
}
<
/Text
>
<
/View
>
<
/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