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
696c03bf
Commit
696c03bf
authored
Apr 29, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ini ya
parent
2ef8194c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
142 deletions
+87
-142
Auth.js
view/Auth.js
+1
-1
DeliveryAddrees.js
view/DeliveryAddrees.js
+44
-48
MenuConfirmation.js
view/MenuConfirmation.js
+12
-8
MenuSelection.js
view/MenuSelection.js
+1
-0
OrderHistory.js
view/OrderHistory.js
+5
-4
ShoppingCart.js
view/ShoppingCart.js
+23
-79
TransactionHistory.js
view/TransactionHistory.js
+1
-2
No files found.
view/Auth.js
View file @
696c03bf
...
...
@@ -106,7 +106,7 @@ function HomePage() {
<
Tab
.
Screen
name
=
"HOME"
component
=
{
Home
}
/
>
<
Tab
.
Screen
name
=
"MENU"
component
=
{
MenuSelection
}
/
>
<
Tab
.
Screen
name
=
"REWARDS"
component
=
{
Rewards
}
/
>
<
Tab
.
Screen
name
=
"ORDER"
component
=
{
Order
History
}
/
>
<
Tab
.
Screen
name
=
"ORDER"
component
=
{
Transaction
History
}
/
>
<
Tab
.
Screen
name
=
"OUTLETS"
component
=
{
Outlets
}
/
>
<
Tab
.
Screen
name
=
"ACCOUNT"
component
=
{
Account
}
/
>
<
/Tab.Navigator
>
...
...
view/DeliveryAddrees.js
View file @
696c03bf
...
...
@@ -17,37 +17,7 @@ class DeliveryAddrees extends React.Component {
componentDidMount
()
{
this
.
getAddreess
()
this
.
getRate
()
console
.
log
(
"INI SESSION : "
+
this
.
props
.
session_id
)
}
getRate
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
address_id
:
this
.
props
.
addressId
,
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate'
,
params
).
then
(
res
=>
{
console
.
log
(
"INI LHO CUY : "
+
JSON
.
stringify
(
res
.
data
.
data
.
outlet_name
))
this
.
setState
({
outlet_id
:
res
.
data
.
data
.
outlet_id
,
grabamount
:
res
.
data
.
data
.
amount
,
})
let
setGrabProps
=
{
grabdestination
:
this
.
state
.
grabdestination
,
grabamount
:
this
.
state
.
grabamount
,
}
this
.
props
.
setGrab
(
setGrabProps
);
}).
catch
(
error
=>
{
console
.
log
(
'ini error '
+
error
)
})
console
.
log
(
"INI ADDRESS ID : "
+
this
.
props
.
addressId
)
}
onChangeAddress
=
data
=>
{
...
...
@@ -69,12 +39,9 @@ class DeliveryAddrees extends React.Component {
address
.
push
(
element
)
}
this
.
setState
({
data
:
address
})
console
.
log
(
this
.
state
.
data
[
0
].
id
)
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
Alert
.
alert
(
...
...
@@ -84,16 +51,53 @@ class DeliveryAddrees extends React.Component {
})
}
getRate
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
address_id
:
this
.
props
.
addressId
,
}
console
.
log
(
"INI PRAMETER NYA : "
+
JSON
.
stringify
(
params
))
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate'
,
params
).
then
(
res
=>
{
this
.
setState
({
grabamount
:
res
.
data
.
data
.
amount
,
grabdestination
:
res
.
data
.
data
.
outlet_name
,
})
let
setGrabProps
=
{
grabdestination
:
this
.
state
.
grabdestination
,
grabamount
:
this
.
state
.
grabamount
,
}
this
.
props
.
setGrab
(
setGrabProps
);
console
.
log
(
"INI SUKSES RESPONNYA "
)
let
setOrdersProps
=
{
balanceUsed
:
this
.
state
.
balanceused
,
pointused
:
this
.
state
.
pointsused
,
}
this
.
props
.
setOrder
(
setOrdersProps
);
}).
catch
(
error
=>
{
console
.
log
(
'ini error '
+
error
)
})
}
addAdreess
()
{
this
.
props
.
navigation
.
navigate
(
'Address Detail'
,
{
'data'
:
'sample'
,
onChangeAddress
:
this
.
onChangeAddress
})
}
onSave
(
address
)
{
onSave
(
address
,
id
)
{
let
setDataAddress
=
{
address
:
address
,
addressId
:
this
.
state
.
data
[
0
].
id
addressId
:
id
}
this
.
props
.
setAddress
(
setDataAddress
);
...
...
@@ -102,7 +106,7 @@ class DeliveryAddrees extends React.Component {
'Apakah anda akan memilih alamat untuk pengiriman ?'
,
[
{
text
:
'OK'
,
onPress
:
()
=>
this
.
props
.
navigation
.
navigate
(
"Menu Select"
)
},
{
text
:
'OK'
,
onPress
:
()
=>
this
.
getRate
()
},
],
{
cancelable
:
false
}
)
...
...
@@ -114,8 +118,9 @@ class DeliveryAddrees extends React.Component {
renderItem
=
({
item
})
=>
{
return
(
<
View
style
=
{
styles
.
list_addrees
}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
onSave
(
item
.
address
)}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
onSave
(
item
.
address
,
item
.
id
)}
>
<
View
style
=
{{
margin
:
5
,
}}
>
<
Text
style
=
{{
fontWeight
:
'bold'
,
fontSize
:
20
}}
>
{
item
.
id
}
<
/Text
>
<
Text
style
=
{{
fontWeight
:
'bold'
,
fontSize
:
20
}}
>
{
item
.
name
}
<
/Text
>
<
/View
>
<
Text
style
=
{{
margin
:
5
}}
>
...
...
@@ -197,7 +202,7 @@ const styles = StyleSheet.create({
})
const
mapStateToProps
=
(
state
)
=>
{
console
.
log
(
"INI STATE : "
+
JSON
.
stringify
(
state
))
return
{
session_id
:
state
.
session_id
,
...
...
@@ -217,15 +222,6 @@ const mapDispatchToProps = (dispacth) => {
addressId
:
setDataAddress
.
addressId
}
}),
// setChangeOutletProps: (OutletChange) => dispacth({
// type: ActionType.SET_CHANGE_OUTLET,
// data: {
// outlet_id: OutletChange.outlet_id,
// }
// }),
setGrab
:
(
setGrabProps
)
=>
dispacth
({
type
:
ActionType
.
SET_GRAB
,
...
...
view/MenuConfirmation.js
View file @
696c03bf
...
...
@@ -37,20 +37,24 @@ class MenuConfirmation extends React.Component {
order_item
:
this
.
props
.
order_item
,
delivery_charge
:
this
.
props
.
grabamount
,
voucher
:
[],
payment
:
{
balance
:
this
.
props
.
route
.
params
.
balanceUsed
,
point
:
this
.
props
.
route
.
params
.
pointused
}
}
console
.
log
(
"INI PARAMETER UNTUK ORDER : "
+
JSON
.
stringify
())
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/transaction/booking'
,
params
).
then
(
res
=>
{
Alert
.
alert
(
'Transaksi Anda Berhasil'
)
this
.
props
.
navigation
.
navigate
(
'Order History'
);
let
typeProps
=
{
type_pickup
:
false
,
}
this
.
props
.
setTypePickup
(
typeProps
);
//
let typeProps = {
//
type_pickup: false,
//
}
//
this.props.setTypePickup(typeProps);
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
...
...
@@ -87,7 +91,7 @@ class MenuConfirmation extends React.Component {
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
// console.log('error'
)
console
.
log
(
'ini error '
+
error
)
Alert
.
alert
(
response
.
msg
);
})
}
...
...
@@ -188,11 +192,11 @@ class MenuConfirmation extends React.Component {
<
/View
>
<
/View
>
<
View
style
=
{{
margin
:
10
}}
>
{
this
.
props
.
type_pickup
==
true
?
(
{
/* {
this.props.type_pickup == true ? (
<Button title='order' onPress={() => this.setPickup()}/>
):(
):(
*/
}
<
Button
title
=
'order'
onPress
=
{()
=>
this
.
setOrder
()}
/
>
)
}
{
/* )} */
}
<
/View
>
<
/ScrollView
>
...
...
view/MenuSelection.js
View file @
696c03bf
...
...
@@ -25,6 +25,7 @@ class MenuSelection extends React.Component {
}
componentDidMount
()
{
this
.
getMenuList
()
console
.
log
(
"INI OUTLET : "
+
this
.
props
.
outlet_id
)
}
getMenuList
()
{
...
...
view/OrderHistory.js
View file @
696c03bf
...
...
@@ -26,7 +26,7 @@ class OrderHistory extends React.Component {
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/transaction/list'
,
params
).
then
(
res
=>
{
let
data
=
res
.
data
.
data
//
console.log(data)
console
.
log
(
data
)
this
.
setState
({
order_list
:
data
})
...
...
@@ -46,9 +46,10 @@ class OrderHistory extends React.Component {
this
.
state
.
order_list
.
map
((
item
,
key
)
=>
(
<
View
key
=
{
key
}
>
<
Card
style
=
{{
padding
:
10
,
margin
:
10
,
alignContent
:
'center'
}}
>
<
Text
>
{
item
.
outlet
}
<
/Text
>
<
Text
>
{
item
.
trans_date
}
<
/Text
>
<
Text
>
{
item
.
trans_total
}
<
/Text
>
<
Text
>
OUTLET
:
{
item
.
outlet
}
<
/Text
>
<
Text
>
TGL
TRANSAKSI
:
{
item
.
trans_date
}
<
/Text
>
<
Text
>
TOTAL
:
{
item
.
trans_total
}
<
/Text
>
<
Text
>
STATUS
:
{
item
.
trans_status
}
<
/Text
>
<
/Card
>
<
/View
>
...
...
view/ShoppingCart.js
View file @
696c03bf
import
React
from
'react'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
Button
,
TouchableOpacity
,
ScrollView
,
FlatList
,
Image
,
Alert
}
from
'react-native'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
Button
,
TouchableOpacity
,
ScrollView
,
FlatList
,
Image
,
Alert
,
ActivityIndicator
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
// import { CheckBox } from 'react-native-elements'
import
CheckBox
from
'react-native-check-box'
import
{
Card
}
from
'react-native-shadow-cards'
import
{
Entypo
,
Ionicons
,
MaterialCommunityIcons
,
MaterialIcons
,
AntDesign
,
FontAwesome
}
from
'@expo/vector-icons'
import
i18n
from
'i18n-js'
;
import
CurrencyFormat
from
'react-currency-format'
;
import
ItemShoping
from
'./ItemShopingCart'
;
import
Axios
from
'axios'
import
ActionType
from
'../redux/globalActionType'
;
import
{
YellowBox
}
from
'react-native'
;
import
*
as
Location
from
'expo-location'
;
import
*
as
Permissions
from
'expo-permissions'
;
import
*
as
Device
from
'expo-device'
;
YellowBox
.
ignoreWarnings
([
'VirtualizedLists should never be nested'
]);
class
ShoppingCart
extends
React
.
Component
{
...
...
@@ -38,7 +34,8 @@ class ShoppingCart extends React.Component {
grabdropoff
:
''
,
grabdestination
:
''
,
my_lat
:
0
,
my_long
:
0
my_long
:
0
,
indicator
:
true
,
// dummyBalance : 155000,
// dummyPoint : 20000
}
...
...
@@ -46,6 +43,14 @@ class ShoppingCart extends React.Component {
componentDidMount
()
{
this
.
getRate
()
this
.
getBalance
()
console
.
log
(
"INI REDUX PROPS BAGIAN ID : "
+
this
.
props
.
addressId
)
console
.
log
(
"INI REDUX PROPS BAGIAN ID : "
+
this
.
props
.
addressId
)
}
checkChangeTrans
(
val
)
{
console
.
log
(
'hai lg di sini'
)
...
...
@@ -105,27 +110,8 @@ class ShoppingCart extends React.Component {
}
this
.
props
.
removeFromChart
(
order_item
)
// this.props.navigation.navigate('Home', {
// screen: 'Menu Select',
// });
}
}
// else if (is_xist.quantity == 0){
// Alert.alert("Apakah anda akan menghapus pesanan ?")
// const order_item = {
// id: item.id,
// name: item.name,
// price: item.price,
// note: item.note,
// image: item.image,
// description: item.description,
// quantity: item.quantity
// }
// this.props.removeFromChart(order_item)
// console.log(order_item)
// }
}
}
...
...
@@ -192,53 +178,17 @@ class ShoppingCart extends React.Component {
}
}
componentDidMount
()
{
this
.
_getPermissions
()
this
.
getRate
()
console
.
log
(
"INI PROPS"
+
this
.
props
.
address
)
}
_getPermissions
=
async
()
=>
{
let
{
status
}
=
await
Permissions
.
askAsync
(
Permissions
.
LOCATION
);
if
(
status
!==
'granted'
)
{
Alert
.
alert
(
'Akses tidak dizinkan!'
)
}
else
if
(
Platform
.
OS
===
'android'
&&
!
Device
.
isDevice
)
{
Alert
.
alert
(
'Silahkan anda coba di real Device'
)
}
else
{
this
.
_getCurrentPosisition
()
}
}
_getCurrentPosisition
=
async
()
=>
{
this
.
setState
({
spinner
:
true
,
})
let
location
=
await
Location
.
getCurrentPositionAsync
({
accuracy
:
Location
.
Accuracy
.
Highest
})
let
latitude
=
location
.
coords
.
latitude
;
let
longitude
=
location
.
coords
.
longitude
;
this
.
setState
({
my_lat
:
latitude
,
my_long
:
longitude
})
this
.
getBalance
()
}
getRate
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
address_id
:
this
.
props
.
addressId
,
order_item
:
this
.
props
.
order_item
}
console
.
log
(
"INI PRAMETER NYA : "
+
JSON
.
stringify
(
params
))
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/delivery/rate'
,
params
).
then
(
res
=>
{
console
.
log
(
"INI LHO CUY : "
+
JSON
.
stringify
(
res
.
data
.
data
.
outlet_name
))
this
.
setState
({
grabamount
:
res
.
data
.
data
.
amount
,
...
...
@@ -246,15 +196,14 @@ class ShoppingCart extends React.Component {
})
let
setGrabProps
=
{
// grabtype: this.state.grabtype,
// grabpickup: this.state.grabpickup,
// grabdropoff: this.state.grabdropoff,
grabdestination
:
this
.
state
.
grabdestination
,
grabamount
:
this
.
state
.
grabamount
,
}
this
.
props
.
setGrab
(
setGrabProps
);
console
.
log
(
"INI SUKSES RESPONNYA "
)
let
setOrdersProps
=
{
balanceUsed
:
this
.
state
.
balanceused
,
pointused
:
this
.
state
.
pointsused
,
...
...
@@ -268,24 +217,16 @@ class ShoppingCart extends React.Component {
}
checkOut
(){
this
.
props
.
navigation
.
navigate
(
'Confirm Your Order'
,
{
balanceUsed
:
this
.
state
.
balanceused
,
pointused
:
this
.
state
.
pointsused
})
}
getBalance
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
,
lat
:
this
.
state
.
my_lat
,
long
:
this
.
state
.
my_long
,
closest_outlet
:
1
}
Axios
.
post
(
'https://excelsocrm.ravintoladev.com/crm/v2/member/get_profile'
,
params
).
then
(
res
=>
{
// console.log(res.data)
const
{
kaspro_balance
,
kaspro_point
}
=
res
.
data
// console.log(kaspro_balance,kaspro_point)
this
.
setState
({
kasproBalance
:
kaspro_balance
,
kasproPoint
:
kaspro_point
...
...
@@ -311,16 +252,18 @@ class ShoppingCart extends React.Component {
<
View
style
=
{{
alignItems
:
'center'
}}
>
{
this
.
state
.
isDelivery
==
true
?
(
<
TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
"Pickup Name"
)}
>
<
Card
style
=
{{
margin
:
5
,
padding
:
10
}}
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
Ambil
pesanan
kamu
di
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
{
this
.
props
.
addressId
}
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
{
this
.
props
.
name_outlet
}
<
/Text
>
<
/Card
>
<
/TouchableOpacity
>
)
:
(
<
TouchableOpacity
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
"Delivery Address"
)}
>
<
Card
style
=
{{
margin
:
5
,
padding
:
10
}}
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
Pesanan
kamu
dikirim
ke
<
/Text
>
<
Text
style
=
{{
textAlign
:
'center'
}}
>
{
this
.
props
.
address
}
<
/Text
>
...
...
@@ -358,6 +301,7 @@ class ShoppingCart extends React.Component {
<
Text
>
PAYMENT
METHODS
<
/Text
>
<
/View
>
<
View
style
=
{{
alignItems
:
'center'
}}
>
{
this
.
state
.
kasproBalance
<
this
.
props
.
order_total
?
(
<
Card
style
=
{{
margin
:
5
,
padding
:
10
,
backgroundColor
:
'gray'
}}
>
...
...
view/TransactionHistory.js
View file @
696c03bf
...
...
@@ -26,14 +26,13 @@ class TransactionHistory extends React.Component {
this
.
setState
({
history_list
:
data
})
// console.log(this.state.history_list)
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
Alert
.
alert
(
response
.
msg
);
})
}
render
()
{
return
(
<
View
style
=
{
styles
.
container
}
>
...
...
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