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
fd26ccc5
Commit
fd26ccc5
authored
Apr 30, 2020
by
Trisno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug improvement
parent
57f11248
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
103 additions
and
68 deletions
+103
-68
DeliveryAddrees.js
view/DeliveryAddrees.js
+61
-36
Home.js
view/Home.js
+2
-2
PickupName.js
view/PickupName.js
+12
-7
ShoppingCart.js
view/ShoppingCart.js
+28
-23
No files found.
view/DeliveryAddrees.js
View file @
fd26ccc5
...
@@ -10,14 +10,14 @@ class DeliveryAddrees extends React.Component {
...
@@ -10,14 +10,14 @@ class DeliveryAddrees extends React.Component {
super
(
props
)
super
(
props
)
this
.
state
=
{
this
.
state
=
{
data
:
[],
data
:
[],
outlet_id
:
''
,
outlet_id
:
''
,
grabamount
:
''
grabamount
:
''
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getAddreess
()
this
.
getAddreess
()
console
.
log
(
"INI ADDRESS ID : "
+
this
.
props
.
addressId
)
console
.
log
(
"INI ADDRESS ID : "
+
this
.
props
.
addressId
)
}
}
onChangeAddress
=
data
=>
{
onChangeAddress
=
data
=>
{
...
@@ -72,15 +72,20 @@ class DeliveryAddrees extends React.Component {
...
@@ -72,15 +72,20 @@ class DeliveryAddrees extends React.Component {
grabamount
:
this
.
state
.
grabamount
,
grabamount
:
this
.
state
.
grabamount
,
}
}
this
.
props
.
setGrab
(
setGrabProps
);
let
OutletChange
=
{
outlet_id
:
res
.
data
.
data
.
outlet_id
,
name_outlet
:
res
.
data
.
data
.
outlet_name
,
}
this
.
props
.
setGrab
(
setGrabProps
);
this
.
props
.
setChangeOutletProps
(
OutletChange
);
console
.
log
(
"INI SUKSES RESPONNYA "
)
console
.
log
(
"INI SUKSES RESPONNYA "
)
let
setOrdersProps
=
{
//
let setOrdersProps = {
balanceUsed
:
this
.
state
.
balanceused
,
//
balanceUsed: this.state.balanceused,
pointused
:
this
.
state
.
pointsused
,
//
pointused: this.state.pointsused,
}
//
}
this
.
props
.
setOrder
(
setOrdersProps
);
//
this.props.setOrder(setOrdersProps);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
...
@@ -93,40 +98,52 @@ class DeliveryAddrees extends React.Component {
...
@@ -93,40 +98,52 @@ class DeliveryAddrees extends React.Component {
}
}
onSave
(
address
,
id
)
{
onSave
(
address
,
id
)
{
let
setDataAddress
=
{
let
setDataAddress
=
{
address
:
address
,
address
:
address
,
addressId
:
id
addressId
:
id
}
}
this
.
props
.
setAddress
(
setDataAddress
);
this
.
props
.
setAddress
(
setDataAddress
);
let
recalculateProps
=
{
this
.
getRate
()
order_total
:
0
,
order_quantity
:
0
,
// console.log(this.props)
order_item
:[]
if
(
this
.
props
.
route
.
params
.
from
==
'shoppingCart'
)
{
this
.
props
.
navigation
.
navigate
(
'Shopping Cart'
)
}
else
{
this
.
props
.
navigation
.
navigate
(
"Menu Select"
)
}
}
this
.
props
.
setRecalculate
(
recalculateProps
)
Alert
.
alert
(
''
,
// let recalculateProps = {
'Apakah anda akan memilih alamat untuk pengiriman ?'
,
// order_total: 0,
[
// order_quantity:0,
// order_item:[]
{
text
:
'OK'
,
onPress
:
()
=>
this
.
props
.
navigation
.
navigate
(
"Menu Select"
)
},
// }
],
// this.props.setRecalculate(recalculateProps)
{
cancelable
:
false
}
)
// Alert.alert(
// '',
// 'Apakah anda akan memilih alamat untuk pengiriman ?',
// [
// {text: 'OK', onPress: () => this.props.navigation.navigate("Menu Select") },
// ],
// { cancelable: false }
// )
}
}
renderItem
=
({
item
})
=>
{
renderItem
=
({
item
})
=>
{
return
(
return
(
<
View
style
=
{
styles
.
list_addrees
}
>
<
View
style
=
{
styles
.
list_addrees
}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
onSave
(
item
.
address
,
item
.
id
)}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
onSave
(
item
.
address
,
item
.
id
)}
>
<
View
style
=
{{
margin
:
5
,
}}
>
<
View
style
=
{{
margin
:
5
,
}}
>
<
Text
style
=
{{
fontWeight
:
'bold'
,
fontSize
:
20
}}
>
{
item
.
name
}
<
/Text
>
<
Text
style
=
{{
fontWeight
:
'bold'
,
fontSize
:
20
}}
>
{
item
.
name
}
<
/Text
>
<
/View
>
<
/View
>
...
@@ -142,7 +159,7 @@ class DeliveryAddrees extends React.Component {
...
@@ -142,7 +159,7 @@ class DeliveryAddrees extends React.Component {
}
}
render
()
{
render
()
{
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
header
}
>
<
View
style
=
{
styles
.
header
}
>
...
@@ -200,14 +217,22 @@ const mapStateToProps = (state) => {
...
@@ -200,14 +217,22 @@ const mapStateToProps = (state) => {
return
{
return
{
session_id
:
state
.
session_id
,
session_id
:
state
.
session_id
,
addressId
:
state
.
addressId
addressId
:
state
.
addressId
}
}
}
}
const
mapDispatchToProps
=
(
dispacth
)
=>
{
const
mapDispatchToProps
=
(
dispacth
)
=>
{
return
{
return
{
setChangeOutletProps
:
(
OutletChange
)
=>
dispacth
({
type
:
ActionType
.
SET_CHANGE_OUTLET
,
data
:
{
outlet_id
:
OutletChange
.
outlet_id
,
name_outlet
:
OutletChange
.
name_outlet
,
}
}),
setAddress
:
(
setDataAddress
)
=>
dispacth
({
setAddress
:
(
setDataAddress
)
=>
dispacth
({
type
:
ActionType
.
SET_ADDRESS
,
type
:
ActionType
.
SET_ADDRESS
,
data
:
{
data
:
{
...
@@ -230,7 +255,7 @@ const mapDispatchToProps = (dispacth) => {
...
@@ -230,7 +255,7 @@ const mapDispatchToProps = (dispacth) => {
type
:
ActionType
.
SET_RECALCULATE
,
type
:
ActionType
.
SET_RECALCULATE
,
data
:
{
data
:
{
order_total
:
recalculateProps
.
order_total
,
order_total
:
recalculateProps
.
order_total
,
order_quantity
:
recalculateProps
.
order_quantity
,
order_quantity
:
recalculateProps
.
order_quantity
,
order_item
:
recalculateProps
.
order_item
order_item
:
recalculateProps
.
order_item
...
@@ -239,5 +264,5 @@ const mapDispatchToProps = (dispacth) => {
...
@@ -239,5 +264,5 @@ const mapDispatchToProps = (dispacth) => {
}
}
}
}
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
DeliveryAddrees
)
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
DeliveryAddrees
)
view/Home.js
View file @
fd26ccc5
...
@@ -137,7 +137,7 @@ class Home extends React.Component {
...
@@ -137,7 +137,7 @@ class Home extends React.Component {
type_pickup
:
true
,
type_pickup
:
true
,
}
}
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
navigation
.
navigate
(
'Pickup Name'
);
this
.
props
.
navigation
.
navigate
(
'Pickup Name'
,
{
from
:
'home'
}
);
}
}
_order
(){
_order
(){
...
@@ -145,7 +145,7 @@ class Home extends React.Component {
...
@@ -145,7 +145,7 @@ class Home extends React.Component {
type_pickup
:
false
,
type_pickup
:
false
,
}
}
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
navigation
.
navigate
(
'Delivery Address'
);
this
.
props
.
navigation
.
navigate
(
'Delivery Address'
,
{
from
:
'home'
}
);
}
}
...
...
view/PickupName.js
View file @
fd26ccc5
...
@@ -75,15 +75,20 @@ class PickupName extends React.Component {
...
@@ -75,15 +75,20 @@ class PickupName extends React.Component {
type_pickup
:
true
,
type_pickup
:
true
,
}
}
let
recalculateProps
=
{
//
let recalculateProps = {
order_total
:
0
,
//
order_total: 0,
order_quantity
:
0
,
//
order_quantity:0,
order_item
:[]
//
order_item:[]
}
//
}
this
.
props
.
setRecalculate
(
recalculateProps
)
//
this.props.setRecalculate(recalculateProps)
this
.
props
.
setChangeOutletProps
(
OutletChange
);
this
.
props
.
setChangeOutletProps
(
OutletChange
);
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
navigation
.
navigate
(
'Menu Select'
)
if
(
this
.
props
.
route
.
params
.
from
==
'shoppingCart'
)
{
this
.
props
.
navigation
.
navigate
(
'Shopping Cart'
)
}
else
{
this
.
props
.
navigation
.
navigate
(
"Menu Select"
)
}
}
}
getOutlet
()
{
getOutlet
()
{
...
...
view/ShoppingCart.js
View file @
fd26ccc5
...
@@ -31,9 +31,9 @@ class ShoppingCart extends React.Component {
...
@@ -31,9 +31,9 @@ class ShoppingCart extends React.Component {
grabpickup
:
''
,
grabpickup
:
''
,
grabdropoff
:
''
,
grabdropoff
:
''
,
grabdestination
:
''
,
grabdestination
:
''
,
my_lat
:
0
,
my_lat
:
0
,
my_long
:
0
,
my_long
:
0
,
indicator
:
true
,
indicator
:
true
,
// dummyBalance : 155000,
// dummyBalance : 155000,
// dummyPoint : 20000
// dummyPoint : 20000
...
@@ -60,6 +60,7 @@ class ShoppingCart extends React.Component {
...
@@ -60,6 +60,7 @@ class ShoppingCart extends React.Component {
pointsused
:
0
,
pointsused
:
0
,
balanceused
:
0
balanceused
:
0
})
})
this
.
props
.
navigation
.
navigate
(
"Delivery Address"
,
{
from
:
'shoppingCart'
})
}
else
{
}
else
{
let
typeProps
=
{
let
typeProps
=
{
type_pickup
:
true
,
type_pickup
:
true
,
...
@@ -72,6 +73,7 @@ class ShoppingCart extends React.Component {
...
@@ -72,6 +73,7 @@ class ShoppingCart extends React.Component {
pointsused
:
0
,
pointsused
:
0
,
balanceused
:
0
balanceused
:
0
})
})
this
.
props
.
navigation
.
navigate
(
'Pickup Name'
,
{
from
:
'shoppingCart'
})
}
}
}
}
...
@@ -117,7 +119,7 @@ class ShoppingCart extends React.Component {
...
@@ -117,7 +119,7 @@ class ShoppingCart extends React.Component {
this
.
props
.
removeFromChart
(
order_item
)
this
.
props
.
removeFromChart
(
order_item
)
}
}
}
}
}
}
}
}
...
@@ -217,7 +219,7 @@ class ShoppingCart extends React.Component {
...
@@ -217,7 +219,7 @@ class ShoppingCart extends React.Component {
}
}
}
}
getRate
()
{
getRate
()
{
let
params
=
{
let
params
=
{
...
@@ -297,22 +299,15 @@ class ShoppingCart extends React.Component {
...
@@ -297,22 +299,15 @@ class ShoppingCart extends React.Component {
{
{
this
.
props
.
type_pickup
==
true
?
(
this
.
props
.
type_pickup
==
true
?
(
<
TouchableOpacity
>
<
Card
style
=
{{
margin
:
5
,
padding
:
10
}}
>
<
Card
style
=
{{
margin
:
5
,
padding
:
10
}}
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
Ambil
pesanan
kamu
di
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
Ambil
pesanan
kamu
di
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
top
:
5
,
fontWeight
:
'bold'
}}
>
Excelso
{
this
.
props
.
name_outlet
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
,
fontSize
:
12
,
top
:
5
,
fontWeight
:
'bold'
}}
>
Excelso
{
this
.
props
.
name_outlet
}
<
/Text
>
<
/Card
>
<
/Card
>
<
/TouchableOpacity
>
)
:
(
)
:
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
"Delivery Address"
)}
>
<
Card
style
=
{{
margin
:
5
,
padding
:
10
}}
>
<
Card
style
=
{{
margin
:
5
,
padding
:
10
}}
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
Pesanan
kamu
dikirim
ke
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
Pesanan
kamu
dikirim
ke
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
{
this
.
props
.
address
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
{
this
.
props
.
address
}
<
/Text
>
<
/Card>
<
/Card
>
<
/TouchableOpacity
>
)
)
}
}
<
/View
>
<
/View
>
...
@@ -345,8 +340,8 @@ class ShoppingCart extends React.Component {
...
@@ -345,8 +340,8 @@ class ShoppingCart extends React.Component {
<
/View
>
<
/View
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
{
{
this
.
state
.
kasproBalance
<
this
.
props
.
order_total
?
(
this
.
state
.
kasproBalance
<
this
.
props
.
order_total
||
this
.
props
.
order_total
==
0
?
(
<
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'
}}
>
<
View
>
<
View
>
...
@@ -384,7 +379,7 @@ class ShoppingCart extends React.Component {
...
@@ -384,7 +379,7 @@ class ShoppingCart extends React.Component {
<
/View
>
<
/View
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
{
{
this
.
state
.
kasproPoint
<
this
.
props
.
order_total
?
(
this
.
state
.
kasproPoint
<
this
.
props
.
order_total
||
this
.
props
.
order_total
==
0
?
(
<
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'
}}
>
<
View
>
<
View
>
...
@@ -506,9 +501,14 @@ class ShoppingCart extends React.Component {
...
@@ -506,9 +501,14 @@ class ShoppingCart extends React.Component {
<
View
>
<
View
>
<
Text
style
=
{{
paddingLeft
:
20
,
paddingTop
:
10
,
color
:
'gray'
}}
>
Ongkos
Kirim
<
/Text
>
<
Text
style
=
{{
paddingLeft
:
20
,
paddingTop
:
10
,
color
:
'gray'
}}
>
Ongkos
Kirim
<
/Text
>
<
/View
>
<
/View
>
<
View
style
=
{{
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
{
this
.
props
.
order_item
.
length
?
(
<
Text
style
=
{{
color
:
'gray'
}}
>
{
this
.
props
.
grabamount
}
<
/Text
>
<
View
style
=
{{
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
/View
>
<
Text
style
=
{{
color
:
'gray'
}}
>
{
this
.
props
.
grabamount
}
<
/Text
>
<
/View
>
)
:
(
<
View
style
=
{{
paddingRight
:
30
,
paddingTop
:
10
,
alignItems
:
'flex-end'
}}
>
<
Text
style
=
{{
color
:
'gray'
}}
>
0
<
/Text
>
<
/View>
)
}
<
/View>
)
}
<
/View>
)
}
<
View
style
=
{{
flexDirection
:
'row'
,
marginTop
:
10
,
justifyContent
:
'space-between'
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
marginTop
:
10
,
justifyContent
:
'space-between'
}}
>
...
@@ -529,7 +529,12 @@ class ShoppingCart extends React.Component {
...
@@ -529,7 +529,12 @@ class ShoppingCart extends React.Component {
<
/View
>
<
/View
>
)
:
(
)
:
(
<
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
.
grabamount
+
this
.
state
.
diskon
}
<
/Text
>
{
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'
}}
>
{
this
.
props
.
order_total
+
this
.
state
.
diskon
}
<
/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