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
da0eaad7
Commit
da0eaad7
authored
May 13, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://repo.cs.co.id:2222/wahyu/bahanoprek
# Conflicts: # view/ShoppingCart.js
parents
1c458e5e
d5d28a34
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
44 deletions
+55
-44
MenuConfirmation.js
view/MenuConfirmation.js
+23
-9
RewardDetail.js
view/RewardDetail.js
+1
-1
RewardSelect.js
view/RewardSelect.js
+1
-1
ShoppingCart.js
view/ShoppingCart.js
+30
-33
No files found.
view/MenuConfirmation.js
View file @
da0eaad7
...
@@ -16,6 +16,7 @@ class MenuConfirmation extends React.Component {
...
@@ -16,6 +16,7 @@ class MenuConfirmation extends React.Component {
ongkir
:
0
,
ongkir
:
0
,
diskon
:
0
,
diskon
:
0
,
totalOrder
:
0
,
totalOrder
:
0
,
type
:
''
,
spinner
:
false
,
spinner
:
false
,
}
}
}
}
...
@@ -37,26 +38,34 @@ class MenuConfirmation extends React.Component {
...
@@ -37,26 +38,34 @@ class MenuConfirmation extends React.Component {
spinner
:
true
,
spinner
:
true
,
})
})
if
(
is_pickup
)
{
if
(
is_pickup
)
{
type
=
'Pick Up'
this
.
setState
({
type
:
'Pick Up'
})
}
else
{
}
else
{
type
=
'Delivery'
this
.
setState
({
type
:
'Delivery'
})
}
}
// console.log(is_pickup)
let
params
=
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
session_id
:
this
.
props
.
session_id
,
outlet_id
:
this
.
props
.
outlet_id
,
outlet_id
:
this
.
props
.
outlet_id
,
address_id
:
this
.
props
.
addressId
,
address_id
:
this
.
props
.
addressId
,
trans_type
:
type
,
trans_type
:
t
his
.
state
.
t
ype
,
order_item
:
this
.
props
.
order_item
,
order_item
:
this
.
props
.
order_item
,
delivery_charge
:
this
.
props
.
grabamount
,
delivery_charge
:
this
.
props
.
grabamount
,
voucher
:
[],
voucher
:
[{
value
:
this
.
props
.
voucher
.
reward
.
value
,
verification_number
:
this
.
props
.
voucher
.
verification_number
}],
payment
:
{
payment
:
{
balance
:
this
.
props
.
route
.
params
.
balanceUsed
,
balance
:
this
.
props
.
route
.
params
.
balanceUsed
,
point
:
this
.
props
.
route
.
params
.
pointused
point
:
this
.
props
.
route
.
params
.
pointused
}
}
}
}
console
.
log
(
'BOOK : '
+
JSON
.
stringify
(
params
)
)
console
.
log
(
params
)
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/transaction/booking'
,
params
).
then
(
res
=>
{
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/transaction/booking'
,
params
).
then
(
res
=>
{
let
data_order
=
res
.
data
.
data
.
id
let
data_order
=
res
.
data
.
data
.
id
...
@@ -68,6 +77,9 @@ class MenuConfirmation extends React.Component {
...
@@ -68,6 +77,9 @@ class MenuConfirmation extends React.Component {
trans_id
:
data_order
trans_id
:
data_order
}
}
this
.
props
.
setTransId
(
transIdProps
);
this
.
props
.
setTransId
(
transIdProps
);
// add API use voucher here
Alert
.
alert
(
Alert
.
alert
(
"Berhasil"
,
"Berhasil"
,
"Transaksi sudah berhasil, terimakasih sudah menggunakan excelso untuk ngopi"
,
"Transaksi sudah berhasil, terimakasih sudah menggunakan excelso untuk ngopi"
,
...
@@ -98,7 +110,7 @@ class MenuConfirmation extends React.Component {
...
@@ -98,7 +110,7 @@ class MenuConfirmation extends React.Component {
render
()
{
render
()
{
console
.
log
(
this
.
props
)
//
console.log(this.props)
let
total
=
0
let
total
=
0
return
(
return
(
<
ScrollView
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{
styles
.
container
}
>
...
@@ -138,7 +150,7 @@ class MenuConfirmation extends React.Component {
...
@@ -138,7 +150,7 @@ class MenuConfirmation extends React.Component {
<
Text
>
Voucher
Discount
<
/Text
>
<
Text
>
Voucher
Discount
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
margin
:
10
}}
>
<
View
style
=
{{
margin
:
10
}}
>
<
Text
>
0
<
/Text
>
<
Text
>
{
this
.
props
.
voucher
.
reward
.
value
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
margin
:
10
,
justifyContent
:
'space-between'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
margin
:
10
,
justifyContent
:
'space-between'
}}
>
...
@@ -164,7 +176,7 @@ class MenuConfirmation extends React.Component {
...
@@ -164,7 +176,7 @@ class MenuConfirmation extends React.Component {
<
/View
>
<
/View
>
{
this
.
props
.
type_pickup
==
true
?
(
{
this
.
props
.
type_pickup
==
true
?
(
<
View
style
=
{{
margin
:
10
}}
>
<
View
style
=
{{
margin
:
10
}}
>
<
Text
>
{
this
.
props
.
order_total
+
this
.
state
.
diskon
}
<
/Text
>
<
Text
>
{
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
)
}
<
/Text
>
<
/View
>
<
/View
>
):(
):(
<
View
style
=
{{
margin
:
10
}}
>
<
View
style
=
{{
margin
:
10
}}
>
...
@@ -249,9 +261,11 @@ const mapDispatchToProps = (dispacth) => {
...
@@ -249,9 +261,11 @@ const mapDispatchToProps = (dispacth) => {
}
}
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
console
.
log
(
state
)
//
console.log(state)
return
{
return
{
session_id
:
state
.
session_id
,
session_id
:
state
.
session_id
,
value_voucher
:
state
.
value_voucher
,
voucher
:
state
.
voucher
,
type_pickup
:
state
.
type_pickup
,
type_pickup
:
state
.
type_pickup
,
outlet_id
:
state
.
outlet_id
,
outlet_id
:
state
.
outlet_id
,
order_quantity
:
state
.
order_quantity
,
order_quantity
:
state
.
order_quantity
,
...
...
view/RewardDetail.js
View file @
da0eaad7
...
@@ -61,7 +61,7 @@ class RewardDetail extends React.Component {
...
@@ -61,7 +61,7 @@ class RewardDetail extends React.Component {
expire
:
expire_date
,
expire
:
expire_date
,
code
:
res
.
data
.
reward
.
verification_number
,
code
:
res
.
data
.
reward
.
verification_number
,
used
:
res
.
data
.
reward
.
used
,
used
:
res
.
data
.
reward
.
used
,
value
:
res
.
data
.
reward
.
reward
,
value
:
res
.
data
.
reward
,
cur_time
:
cur_time
,
cur_time
:
cur_time
,
exp_time
:
exp_time
exp_time
:
exp_time
...
...
view/RewardSelect.js
View file @
da0eaad7
...
@@ -45,7 +45,7 @@ class RewardSelect extends React.Component {
...
@@ -45,7 +45,7 @@ class RewardSelect extends React.Component {
}
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail'
,
params
).
then
(
res
=>
{
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/reward/get_detail'
,
params
).
then
(
res
=>
{
// console.log(res.data.reward)
// console.log(res.data.reward)
let
detail
=
res
.
data
.
reward
.
reward
let
detail
=
res
.
data
.
reward
let
voucherProps
=
{
let
voucherProps
=
{
value_voucher
:
detail
,
value_voucher
:
detail
,
voucher
:
detail
voucher
:
detail
...
...
view/ShoppingCart.js
View file @
da0eaad7
...
@@ -43,7 +43,7 @@ class ShoppingCart extends React.Component {
...
@@ -43,7 +43,7 @@ class ShoppingCart extends React.Component {
componentDidMount
()
{
componentDidMount
()
{
console
.
log
(
"INI VOUCHERNYA : "
+
JSON
.
stringify
(
this
.
props
.
voucher
)
)
console
.
log
(
this
.
props
.
voucher
.
reward
.
value
)
console
.
log
(
'INI VALUE : '
+
this
.
props
.
value_voucher
)
console
.
log
(
'INI VALUE : '
+
this
.
props
.
value_voucher
)
if
(
!
this
.
props
.
type_pickup
)
{
if
(
!
this
.
props
.
type_pickup
)
{
this
.
getRate
()
this
.
getRate
()
...
@@ -114,6 +114,17 @@ class ShoppingCart extends React.Component {
...
@@ -114,6 +114,17 @@ class ShoppingCart extends React.Component {
console
.
log
(
params
);
console
.
log
(
params
);
}
}
handleChangeVoucher
()
{
this
.
setState
({
checkedBalance
:
false
,
checkedPoint
:
false
,
checkedBalancePoint
:
false
,
pointsused
:
0
,
balanceused
:
0
})
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)
}
handleMin
(
item
,
index
)
{
handleMin
(
item
,
index
)
{
this
.
setState
({
this
.
setState
({
checkedBalance
:
false
,
checkedBalance
:
false
,
...
@@ -220,7 +231,7 @@ class ShoppingCart extends React.Component {
...
@@ -220,7 +231,7 @@ class ShoppingCart extends React.Component {
checkedBalance
:
true
,
checkedBalance
:
true
,
checkedPoint
:
false
,
checkedPoint
:
false
,
checkedBalancePoint
:
false
,
checkedBalancePoint
:
false
,
balanceused
:
this
.
props
.
order_total
,
balanceused
:
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
)
,
pointsused
:
0
pointsused
:
0
})
})
}
else
{
}
else
{
...
@@ -228,7 +239,7 @@ class ShoppingCart extends React.Component {
...
@@ -228,7 +239,7 @@ class ShoppingCart extends React.Component {
checkedBalance
:
true
,
checkedBalance
:
true
,
checkedPoint
:
false
,
checkedPoint
:
false
,
checkedBalancePoint
:
false
,
checkedBalancePoint
:
false
,
balanceused
:
this
.
props
.
order_total
+
this
.
props
.
grabamount
,
balanceused
:
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
+
this
.
props
.
grabamount
)
,
pointsused
:
0
pointsused
:
0
})
})
}
}
...
@@ -426,38 +437,24 @@ class ShoppingCart extends React.Component {
...
@@ -426,38 +437,24 @@ class ShoppingCart extends React.Component {
/
>
/
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
voucher
}
>
<
View
style
=
{
styles
.
voucher
}
>
{
this
.
props
.
voucher
===
[]
?
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)}
>
<
Text
style
=
{{
color
:
'#ccb46c'
}}
>+
ADD
VOUCHER
<
/Text
>
<
Text
style
=
{{
color
:
'#ccb46c'
}}
>+
ADD
VOUCHER
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
{
this
.
props
.
voucher
===
[]
?
(
<>
<
/
>
)
:
(
)
:
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
Card
style
=
{{
padding
:
5
,
margin
:
10
}}
>
<
View
>
<
View
>
<
Image
source
=
{{
uri
:
this
.
props
.
voucher
.
title_image
}}
<
Text
style
=
{{
fontWeight
:
'bold'
}}
>
{
this
.
props
.
voucher
.
reward
.
title
}
<
/Text
>
resizeMethod
=
"resize"
resizeMode
=
'cover'
style
=
{{
height
:
150
,
width
:
'100%'
}}
/
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
padding
:
10
}}
>
<
View
>
<
View
>
<
Text
style
=
{{
fontWeight
:
'bold'
,
textAlign
:
'left'
}}
>
{
this
.
props
.
voucher
.
title
}
<
/Text
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
handleChangeVoucher
()}
>
<
Text
style
=
{{
textAlign
:
'left'
}}
>
{
this
.
props
.
voucher
.
subtitle
}
<
/Text
>
<
Text
style
=
{{
color
:
'#ccb46c'
}}
>
Change
Voucher
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
View
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
Diskon
<
/Text
>
<
Text
style
=
{{
textAlign
:
'right'
}}
>
{
this
.
props
.
voucher
.
value
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/Card
>
<
/TouchableOpacity
>
)
)
}
}
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
payment
}
>
<
View
style
=
{
styles
.
payment
}
>
<
Text
>
PAYMENT
METHODS
<
/Text
>
<
Text
>
PAYMENT
METHODS
<
/Text
>
...
@@ -640,7 +637,7 @@ class ShoppingCart extends React.Component {
...
@@ -640,7 +637,7 @@ class ShoppingCart extends React.Component {
<
Text
style
=
{{
paddingLeft
:
20
,
paddingTop
:
10
,
color
:
'gray'
}}
>
Diskon
<
/Text
>
<
Text
style
=
{{
paddingLeft
:
20
,
paddingTop
:
10
,
color
:
'gray'
}}
>
Diskon
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
View
style
=
{{
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
Text
style
=
{{
color
:
'gray'
}}
>
{
this
.
props
.
voucher
.
value
}
<
/Text
>
<
Text
style
=
{{
color
:
'gray'
}}
>
{
this
.
props
.
voucher
.
reward
.
value
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
,
marginTop
:
10
,
justifyContent
:
'space-between'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
marginTop
:
10
,
justifyContent
:
'space-between'
}}
>
...
@@ -649,12 +646,12 @@ class ShoppingCart extends React.Component {
...
@@ -649,12 +646,12 @@ class ShoppingCart extends React.Component {
<
/View
>
<
/View
>
{
this
.
props
.
type_pickup
==
true
?
(
{
this
.
props
.
type_pickup
==
true
?
(
<
View
style
=
{{
marginTop
:
15
,
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
View
style
=
{{
marginTop
:
15
,
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
this
.
props
.
order_total
-
this
.
props
.
voucher
.
value
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
)
}
<
/Text
>
<
/View
>
<
/View
>
)
:
(
)
:
(
<
View
style
=
{{
marginTop
:
15
,
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
View
style
=
{{
marginTop
:
15
,
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
{
this
.
props
.
order_item
.
length
?
(
{
this
.
props
.
order_item
.
length
?
(
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
this
.
props
.
order_total
+
this
.
props
.
grabamount
+
this
.
state
.
diskon
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
Math
.
max
(
0
,
this
.
props
.
order_total
-
this
.
props
.
voucher
.
reward
.
value
+
this
.
props
.
grabamount
)
}
<
/Text
>
)
:
(
)
:
(
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
this
.
props
.
order_total
+
this
.
state
.
diskon
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
35
,
color
:
'#ccb46c'
}}
>
{
this
.
props
.
order_total
+
this
.
state
.
diskon
}
<
/Text
>
)}
)}
...
...
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