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
da2e8427
Commit
da2e8427
authored
Jun 06, 2020
by
Trisno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logic remove voucher di shopping cart
parent
0cc3e4d5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
14 deletions
+26
-14
globalActionType.js
redux/globalActionType.js
+2
-1
globalReducer.js
redux/globalReducer.js
+8
-0
ShoppingCart.js
view/ShoppingCart.js
+16
-13
No files found.
redux/globalActionType.js
View file @
da2e8427
...
@@ -40,7 +40,8 @@ const ActionType = {
...
@@ -40,7 +40,8 @@ const ActionType = {
SET_VOUCHER
:
'SET_VOUCHER'
,
SET_VOUCHER
:
'SET_VOUCHER'
,
SET_EDIT_NOTE
:
'SET_EDIT_NOTE'
,
SET_EDIT_NOTE
:
'SET_EDIT_NOTE'
,
SET_HOME_ADDRESS
:
'SET_HOME_ADDRESS'
,
SET_HOME_ADDRESS
:
'SET_HOME_ADDRESS'
,
SET_REEDEM
:
'SET_REEDEM'
SET_REEDEM
:
'SET_REEDEM'
,
REMOVE_VOUCHER
:
'REMOVE_VOUCHER'
}
}
export
default
ActionType
;
export
default
ActionType
;
\ No newline at end of file
redux/globalReducer.js
View file @
da2e8427
...
@@ -576,6 +576,14 @@ const rootReducer = (state = globalState, action) => {
...
@@ -576,6 +576,14 @@ const rootReducer = (state = globalState, action) => {
}
}
}
}
case
ActionType
.
REMOVE_VOUCHER
:
{
return
{
...
state
,
voucher
:
[],
value_voucher
:
''
}
}
case
ActionType
.
UPDATE_MENU
:
{
case
ActionType
.
UPDATE_MENU
:
{
const
menu
=
action
.
data
.
menu
;
const
menu
=
action
.
data
.
menu
;
let
total
=
0
let
total
=
0
...
...
view/ShoppingCart.js
View file @
da2e8427
...
@@ -116,7 +116,7 @@ class ShoppingCart extends React.Component {
...
@@ -116,7 +116,7 @@ class ShoppingCart extends React.Component {
console
.
log
(
params
);
console
.
log
(
params
);
}
}
handle
Chang
eVoucher
()
{
handle
Remov
eVoucher
()
{
this
.
setState
({
this
.
setState
({
checkedBalance
:
false
,
checkedBalance
:
false
,
checkedPoint
:
false
,
checkedPoint
:
false
,
...
@@ -124,7 +124,7 @@ class ShoppingCart extends React.Component {
...
@@ -124,7 +124,7 @@ class ShoppingCart extends React.Component {
pointsused
:
0
,
pointsused
:
0
,
balanceused
:
0
balanceused
:
0
})
})
this
.
props
.
navigation
.
navigate
(
'Reward Select'
)
this
.
props
.
removeVoucher
(
)
}
}
handleAddVoucher
()
{
handleAddVoucher
()
{
...
@@ -420,7 +420,7 @@ class ShoppingCart extends React.Component {
...
@@ -420,7 +420,7 @@ class ShoppingCart extends React.Component {
render
()
{
render
()
{
// console.log('496000'.replace(/,/g, ''))
// console.log('496000'.replace(/,/g, ''))
// console.log(this.
state.kasproBalance
)
// console.log(this.
props
)
// console.log(this.props.order_total)
// console.log(this.props.order_total)
// console.log(this.props.order_item.length)
// console.log(this.props.order_item.length)
return
(
return
(
...
@@ -459,7 +459,7 @@ class ShoppingCart extends React.Component {
...
@@ -459,7 +459,7 @@ class ShoppingCart extends React.Component {
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
header
}
>
<
View
style
=
{
styles
.
header
}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'grey'
}}
>
YOUR
ORDER
(
S
)
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'grey'
}}
>
YOUR
ORDER
(
S
)
<
/Text
>
<
TouchableOpacity
style
=
{{
marginRight
:
-
8
}}
onPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
>
<
TouchableOpacity
style
=
{{
marginRight
:
-
8
}}
onPress
=
{()
=>
this
.
props
.
navigation
.
goBack
()}
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Light'
}}
>+
ADD
MORE
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Light'
}}
>+
ADD
MORE
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
...
@@ -489,8 +489,8 @@ class ShoppingCart extends React.Component {
...
@@ -489,8 +489,8 @@ class ShoppingCart extends React.Component {
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#838383'
}}
>
{
this
.
props
.
voucher
.
reward
.
title
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Black'
,
color
:
'#838383'
}}
>
{
this
.
props
.
voucher
.
reward
.
title
}
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
flex
:
0.5
,
alignItems
:
'flex-end'
,
marginRight
:
-
5
}}
>
<
View
style
=
{{
flex
:
0.5
,
alignItems
:
'flex-end'
,
marginRight
:
-
5
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
handle
Chang
eVoucher
()}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
handle
Remov
eVoucher
()}
>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'#CFB368'
}}
>
Chang
e
Voucher
<
/Text
>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'#CFB368'
}}
>
Remov
e
Voucher
<
/Text
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
@@ -603,7 +603,7 @@ class ShoppingCart extends React.Component {
...
@@ -603,7 +603,7 @@ class ShoppingCart extends React.Component {
<
/View
>
<
/View
>
<
/Card
>
<
/Card
>
<
/TouchableOpacity
>
<
/TouchableOpacity
>
)
:
(
)
:
(
<
Card
style
=
{{
margin
:
5
,
padding
:
10
,
backgroundColor
:
'gray'
}}
>
<
Card
style
=
{{
margin
:
5
,
padding
:
10
,
backgroundColor
:
'gray'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
}}
>
...
@@ -653,7 +653,7 @@ class ShoppingCart extends React.Component {
...
@@ -653,7 +653,7 @@ class ShoppingCart extends React.Component {
<
View
style
=
{{
paddingLeft
:
20
}}
>
<
View
style
=
{{
paddingLeft
:
20
}}
>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Harga
<
/Text
>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Harga
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
alignItems
:
'flex-end'
,
paddingRight
:
20
}}
>
<
View
style
=
{{
alignItems
:
'flex-end'
,
paddingRight
:
20
}}
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
order_total
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
order_total
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
@@ -670,7 +670,7 @@ class ShoppingCart extends React.Component {
...
@@ -670,7 +670,7 @@ class ShoppingCart extends React.Component {
{
/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{this.props.grabamount}</Text> */
}
{
/* <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', color: 'gray' }}>{this.props.grabamount}</Text> */
}
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
grabamount
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
grabamount
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
/View
>
<
/View
>
)
:
(
<
View
style
=
{{
paddingRight
:
20
,
paddingTop
:
5
,
alignItems
:
'flex-end'
}}
>
)
:
(
<
View
style
=
{{
paddingRight
:
20
,
paddingTop
:
5
,
alignItems
:
'flex-end'
}}
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
0
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
0
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
/View>
)
}
<
/View>
)
}
<
/View>
)
}
<
/View>
)
}
...
@@ -683,7 +683,7 @@ class ShoppingCart extends React.Component {
...
@@ -683,7 +683,7 @@ class ShoppingCart extends React.Component {
<
View
style
=
{{
paddingLeft
:
20
,
paddingTop
:
5
,
}}
>
<
View
style
=
{{
paddingLeft
:
20
,
paddingTop
:
5
,
}}
>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Diskon
<
/Text
>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Diskon
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
paddingRight
:
20
,
paddingTop
:
5
,
alignItems
:
'flex-end'
}}
>
<
View
style
=
{{
paddingRight
:
20
,
paddingTop
:
5
,
alignItems
:
'flex-end'
}}
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
voucher
.
reward
.
value
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
voucher
.
reward
.
value
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
12
,
fontFamily
:
'Gotham-Light'
,
color
:
'gray'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
...
@@ -691,12 +691,12 @@ class ShoppingCart extends React.Component {
...
@@ -691,12 +691,12 @@ class ShoppingCart extends React.Component {
)
)
}
}
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'space-between'
}}
>
<
View
style
=
{{
marginTop
:
10
,
paddingLeft
:
20
}}
>
<
View
style
=
{{
marginTop
:
10
,
paddingLeft
:
20
}}
>
<
Text
style
=
{{
fontSize
:
20
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Black'
,
}}
>
TOTAL
<
/Text
>
<
Text
style
=
{{
fontSize
:
20
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Black'
,
}}
>
TOTAL
<
/Text
>
<
/View
>
<
/View
>
{
this
.
props
.
type_pickup
==
true
?
(
{
this
.
props
.
type_pickup
==
true
?
(
<
View
style
=
{{
marginTop
:
10
,
paddingRight
:
20
,
alignItems
:
'flex-end'
}}
>
<
View
style
=
{{
marginTop
:
10
,
paddingRight
:
20
,
alignItems
:
'flex-end'
}}
>
{
{
this
.
props
.
value_voucher
==
''
?
(
this
.
props
.
value_voucher
==
''
?
(
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
order_total
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
20
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Black'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
<
NumberFormat
decimalScale
=
{
0
}
value
=
{
this
.
props
.
order_total
}
renderText
=
{
value
=>
<
Text
style
=
{{
fontSize
:
20
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Black'
}}
>
Rp
.
{
value
}
<
/Text>} displayType={'text'} thousandSeparator={true} prefix={''} /
>
...
@@ -832,7 +832,7 @@ const styles = StyleSheet.create({
...
@@ -832,7 +832,7 @@ const styles = StyleSheet.create({
marginVertical
:
25
,
marginVertical
:
25
,
marginHorizontal
:
30
,
marginHorizontal
:
30
,
borderRadius
:
10
,
borderRadius
:
10
,
height
:
40
,
height
:
40
,
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
justifyContent
:
'center'
},
},
...
@@ -980,6 +980,9 @@ const mapDispatchToProps = (dispacth) => {
...
@@ -980,6 +980,9 @@ const mapDispatchToProps = (dispacth) => {
}
}
}),
}),
removeVoucher
:
()
=>
dispacth
({
type
:
ActionType
.
REMOVE_VOUCHER
}),
}
}
}
}
...
...
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