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
9ca2ec6b
Commit
9ca2ec6b
authored
May 04, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ini perubahan tapi belum bisa
parent
5dddbe28
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
51 deletions
+87
-51
Account.js
view/Account.js
+23
-24
Home.js
view/Home.js
+12
-6
MenuConfirmation.js
view/MenuConfirmation.js
+3
-2
MenuSelection.js
view/MenuSelection.js
+10
-2
OrderHistory.js
view/OrderHistory.js
+33
-15
PickupName.js
view/PickupName.js
+5
-1
ShoppingCart.js
view/ShoppingCart.js
+1
-1
No files found.
view/Account.js
View file @
9ca2ec6b
...
...
@@ -34,21 +34,20 @@ class Account extends React.Component {
account_number
:
""
,
expire_date
:
""
,
premium
:
""
,
my_lat
:
0
,
my_long
:
0
my_lat
:
0
,
my_long
:
0
}
}
componentDidMount
()
{
this
.
_getPermissions
()
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
// do something
console
.
log
(
'DISINI DI RELOAD ULANG "ACCOUNT"'
)
});
this
.
_getPermissions
()
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
this
.
_getPermissions
()
});
}
componentWillUnmount
()
{
this
.
_unsubscribe
();
this
.
_unsubscribe
();
}
_getPermissions
=
async
()
=>
{
...
...
@@ -56,7 +55,7 @@ class Account extends React.Component {
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
()
...
...
@@ -69,15 +68,15 @@ class Account extends React.Component {
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
.
_getProfile
()
}
...
...
@@ -298,17 +297,17 @@ class Account extends React.Component {
<
/View
>
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
justifyContent
:
'center'
,
top
:
10
}}
>
{
this
.
state
.
premium
===
false
?
(
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Upgrade Premium'
)}
style
=
{{
marginBottom
:
20
,
marginRight
:
5
,
marginLeft
:
5
}}
>
<
Card
style
=
{{
height
:
100
,
width
:
160
}}
>
<
View
style
=
{{
height
:
50
,
alignItems
:
'center'
}}
>
<
MaterialIcons
name
=
"autorenew"
size
=
{
30
}
color
=
"gray"
style
=
{{
top
:
20
}}
/
>
<
Text
style
=
{{
textAlign
:
'center'
,
top
:
30
,
fontSize
:
14
}}
>
UPGRADE
PREMIUM
<
/Text
>
<
/View
>
<
/Card
>
<
/TouchableOpacity
>
)
:
(
null
)}
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Upgrade Premium'
)}
style
=
{{
marginBottom
:
20
,
marginRight
:
5
,
marginLeft
:
5
}}
>
<
Card
style
=
{{
height
:
100
,
width
:
160
}}
>
<
View
style
=
{{
height
:
50
,
alignItems
:
'center'
}}
>
<
MaterialIcons
name
=
"autorenew"
size
=
{
30
}
color
=
"gray"
style
=
{{
top
:
20
}}
/
>
<
Text
style
=
{{
textAlign
:
'center'
,
top
:
30
,
fontSize
:
14
}}
>
UPGRADE
PREMIUM
<
/Text
>
<
/View
>
<
/Card
>
<
/TouchableOpacity
>
)
:
(
null
)}
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Profile'
)}
style
=
{{
marginBottom
:
10
}}
>
<
Card
style
=
{{
height
:
100
,
width
:
160
}}
>
<
View
style
=
{{
height
:
50
,
alignItems
:
'center'
}}
>
...
...
view/Home.js
View file @
9ca2ec6b
...
...
@@ -35,7 +35,9 @@ class Home extends React.Component {
this
.
_account
();
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
// do something
console
.
log
(
'DISINI DI RELOAD ULANG "HOME"'
)
// this._getPermissions()
this
.
_renderCarousell
()
this
.
_account
();
});
}
...
...
@@ -144,15 +146,15 @@ class Home extends React.Component {
type_pickup
:
true
,
}
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
navigation
.
navigate
(
'Pickup Name'
,
{
from
:
'home'
});
this
.
props
.
navigation
.
navigate
(
'Pickup Name'
,
{
from
:
'home'
});
}
_order
(){
_order
()
{
let
typeProps
=
{
type_pickup
:
false
,
}
this
.
props
.
setTypePickup
(
typeProps
);
this
.
props
.
navigation
.
navigate
(
'Delivery Address'
,
{
from
:
'home'
});
this
.
props
.
navigation
.
navigate
(
'Delivery Address'
,
{
from
:
'home'
});
}
...
...
@@ -198,7 +200,7 @@ class Home extends React.Component {
<
View
style
=
{
styles
.
card
}
>
<
Card
>
<
View
style
=
{{
flexDirection
:
'row'
,
justifyContent
:
'center'
}}
>
<
TouchableOpacity
style
=
{
styles
.
buttonDelivery
}
onPress
=
{()
=>
this
.
_order
()
}
>
<
TouchableOpacity
style
=
{
styles
.
buttonDelivery
}
onPress
=
{()
=>
this
.
_order
()}
>
<
Text
style
=
{{
textAlign
:
'center'
,
color
:
'#354175'
,
fontWeight
:
'bold'
}}
>
{
i18n
.
t
(
'delivery'
)}
<
/Text
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{
styles
.
buttonPickup
}
onPress
=
{()
=>
this
.
_pickup
()}
>
...
...
@@ -215,7 +217,11 @@ class Home extends React.Component {
Excelso
{
this
.
props
.
name_outlet
}
<
/Text
>
)}
<
TouchableOpacity
style
=
{
styles
.
submitOrder
}
activeOpacity
=
{.
5
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
"Menu Select"
)}
>
<
TouchableOpacity
style
=
{
styles
.
submitOrder
}
activeOpacity
=
{.
5
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'MENU'
,
params
:
{
user
:
'jckma'
},
})}
>
<
Text
style
=
{{
textAlign
:
'center'
,
bottom
:
5
,
color
:
'white'
}}
>
{
i18n
.
t
(
'orderNow'
)}
<
/Text
>
<
/TouchableOpacity
>
<
/Card
>
...
...
view/MenuConfirmation.js
View file @
9ca2ec6b
...
...
@@ -109,8 +109,9 @@ class MenuConfirmation extends React.Component {
"Berhasil"
,
"Transaksi sudah berhasil, terimakasih sudah menggunakan excelso untuk ngopi"
,
[
{
text
:
"OK"
,
onPress
:
()
=>
this
.
props
.
navigation
.
reset
({
routes
:
[{
name
:
'Home'
}]
{
text
:
"OK"
,
onPress
:
()
=>
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'ORDER'
,
params
:
{
user
:
'jane'
},
})}
],
...
...
view/MenuSelection.js
View file @
9ca2ec6b
...
...
@@ -23,9 +23,17 @@ class MenuSelection extends React.Component {
}
}
componentDidMount
()
{
this
.
getMenuList
()
console
.
log
(
"INI OUTLET : "
+
this
.
props
.
outlet_id
)
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
this
.
getMenuList
()
console
.
log
(
"INI DI RELOAD"
);
});
}
componentWillUnmount
()
{
this
.
_unsubscribe
();
}
getMenuList
()
{
...
...
@@ -186,7 +194,7 @@ class MenuSelection extends React.Component {
<
/View
>
<
View
style
=
{{
flex
:
3
}}
>
{
this
.
state
.
indicator
==
true
?
(
<
ActivityIndicator
style
=
{{
top
:
10
}}
size
=
"large"
color
=
"#c9af6d"
/>
<
ActivityIndicator
style
=
{{
top
:
10
}}
size
=
"large"
color
=
"#c9af6d"
/>
)
:
(
<
FlatList
...
...
view/OrderHistory.js
View file @
9ca2ec6b
import
React
from
'react'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
}
from
'react-native'
;
import
{
View
,
Text
,
TextInput
,
StyleSheet
,
ScrollView
,
Alert
,
TouchableOpacity
,
ActivityIndicator
}
from
'react-native'
;
import
{
Card
}
from
'react-native-shadow-cards'
import
{
connect
}
from
'react-redux'
;
import
Axios
from
'axios'
;
...
...
@@ -9,17 +9,31 @@ class OrderHistory extends React.Component {
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
order_list
:
[]
order_list
:
[],
indicator
:
true
}
}
componentDidMount
()
{
this
.
getOrderHistory
()
this
.
_unsubscribe
=
this
.
props
.
navigation
.
addListener
(
'focus'
,
()
=>
{
return
(
this
.
getOrderHistory
()
)
});
}
componentWillUnmount
()
{
this
.
_unsubscribe
();
}
// componentDidMount() {
// this.getOrderHistory()
// }
getOrderHistory
()
{
let
params
=
{
session_id
:
this
.
props
.
session_id
...
...
@@ -28,11 +42,15 @@ class OrderHistory extends React.Component {
let
data
=
res
.
data
.
data
console
.
log
(
data
)
this
.
setState
({
order_list
:
data
order_list
:
data
,
indicator
:
false
,
})
}).
catch
(
error
=>
{
let
response
=
error
.
response
.
data
;
Alert
.
alert
(
response
.
msg
);
this
.
setState
({
indicator
:
false
,
})
})
}
...
...
@@ -41,18 +59,18 @@ class OrderHistory extends React.Component {
return
(
<
View
style
=
{
styles
.
container
}
>
<
ScrollView
style
=
{
styles
.
body
}
>
{
{
this
.
state
.
indicator
==
true
?
(
<
ActivityIndicator
style
=
{{
justifyContent
:
"center"
}}
size
=
"large"
color
=
"#c9af6d"
/>
)
:
this
.
state
.
order_list
.
map
((
item
,
key
)
=>
(
<
TouchableOpacity
key
=
{
key
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Order Detail'
,
{
idTrans
:
item
.
id
})}
>
<
View
key
=
{
key
}
>
<
Card
style
=
{{
padding
:
10
,
margin
:
10
,
alignContent
:
'center'
}}
>
<
Text
>
OUTLET
:
{
item
.
outlet
}
<
/Text
>
<
Text
>
TGL
TRANSAKSI
:
{
item
.
trans_date
}
<
/Text
>
<
Text
>
TOTAL
:
{
item
.
trans_total
}
<
/Text
>
<
Text
>
STATUS
:
{
item
.
trans_status_display
}
<
/Text
>
<
/Card
>
<
/View
>
<
TouchableOpacity
key
=
{
key
}
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Order Detail'
,
{
idTrans
:
item
.
id
})}
>
<
View
key
=
{
key
}
>
<
Card
style
=
{{
padding
:
10
,
margin
:
10
,
alignContent
:
'center'
}}
>
<
Text
>
OUTLET
:
{
item
.
outlet
}
<
/Text
>
<
Text
>
TGL
TRANSAKSI
:
{
item
.
trans_date
}
<
/Text
>
<
Text
>
TOTAL
:
{
item
.
trans_total
}
<
/Text
>
<
Text
>
STATUS
:
{
item
.
trans_status_display
}
<
/Text
>
<
/Card
>
<
/View
>
<
/TouchableOpacity
>
))
}
...
...
view/PickupName.js
View file @
9ca2ec6b
...
...
@@ -87,7 +87,11 @@ class PickupName extends React.Component {
if
(
this
.
props
.
route
.
params
.
from
==
'shoppingCart'
)
{
this
.
props
.
navigation
.
navigate
(
'Shopping Cart'
)
}
else
{
this
.
props
.
navigation
.
navigate
(
"Menu Select"
)
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'MENU'
,
params
:
{
user
:
'jane'
},
})
}
}
...
...
view/ShoppingCart.js
View file @
9ca2ec6b
...
...
@@ -105,6 +105,7 @@ class ShoppingCart extends React.Component {
}
if
(
quantity
==
0
)
{
Alert
.
alert
(
"Apakah anda akan menghapus pesanan?"
);
const
order_item
=
{
id
:
item
.
id
,
name
:
item
.
name
,
...
...
@@ -757,5 +758,4 @@ const mapStateToProps = (state) => {
}
}
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
ShoppingCart
)
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