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
2ef8194c
Commit
2ef8194c
authored
Apr 29, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
home spinner
parent
dc1734cc
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
142 additions
and
160 deletions
+142
-160
globalReducer.js
redux/globalReducer.js
+0
-4
DeliveryAddrees.js
view/DeliveryAddrees.js
+8
-14
Home.js
view/Home.js
+106
-91
MenuSelection.js
view/MenuSelection.js
+28
-47
ShoppingCart.js
view/ShoppingCart.js
+0
-4
No files found.
redux/globalReducer.js
View file @
2ef8194c
...
@@ -261,9 +261,7 @@ const rootReducer = (state = globalState, action) => {
...
@@ -261,9 +261,7 @@ const rootReducer = (state = globalState, action) => {
session_id
:
action
.
data
.
session_id
,
session_id
:
action
.
data
.
session_id
,
}
}
}
}
case
ActionType
.
ADD_TO_CHART
:
{
case
ActionType
.
ADD_TO_CHART
:
{
let
addedItem
=
action
.
data
.
item
let
addedItem
=
action
.
data
.
item
...
@@ -366,8 +364,6 @@ const rootReducer = (state = globalState, action) => {
...
@@ -366,8 +364,6 @@ const rootReducer = (state = globalState, action) => {
order_quantity
:
quantity
,
order_quantity
:
quantity
,
order_total
:
total
order_total
:
total
}
}
}
}
...
...
view/DeliveryAddrees.js
View file @
2ef8194c
...
@@ -44,13 +44,6 @@ class DeliveryAddrees extends React.Component {
...
@@ -44,13 +44,6 @@ class DeliveryAddrees extends React.Component {
}
}
this
.
props
.
setGrab
(
setGrabProps
);
this
.
props
.
setGrab
(
setGrabProps
);
// let OutletChange = {
// outlet_id: this.state.outlet_id ,
// }
// this.props.setChangeOutletProps(OutletChange);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
'ini error '
+
error
)
console
.
log
(
'ini error '
+
error
)
...
@@ -98,22 +91,23 @@ class DeliveryAddrees extends React.Component {
...
@@ -98,22 +91,23 @@ class DeliveryAddrees extends React.Component {
onSave
(
address
)
{
onSave
(
address
)
{
let
setDataAddress
=
{
address
:
address
,
addressId
:
this
.
state
.
data
[
0
].
id
}
this
.
props
.
setAddress
(
setDataAddress
);
Alert
.
alert
(
Alert
.
alert
(
''
,
''
,
'Apakah anda akan memilih alamat untuk pengiriman ?'
,
'Apakah anda akan memilih alamat untuk pengiriman ?'
,
[
[
{
text
:
'OK'
,
onPress
:
()
=>
this
.
props
.
navigation
.
navigate
(
'Home'
,
{
screen
:
'MENU'
}
)},
{
text
:
'OK'
,
onPress
:
()
=>
this
.
props
.
navigation
.
navigate
(
"Menu Select"
)},
],
],
{
cancelable
:
false
}
{
cancelable
:
false
}
)
)
let
setDataAddress
=
{
address
:
address
,
addressId
:
this
.
state
.
data
[
0
].
id
}
this
.
props
.
setAddress
(
setDataAddress
);
}
}
...
...
view/Home.js
View file @
2ef8194c
This diff is collapsed.
Click to expand it.
view/MenuSelection.js
View file @
2ef8194c
import
React
from
'react'
;
import
React
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
ScrollView
,
TouchableOpacity
,
Image
,
FlatList
,
Button
,
Alert
,
StatusBar
,
SafeAreaView
,
SectionList
}
from
'react-native'
;
import
{
View
,
Text
,
StyleSheet
,
ScrollView
,
TouchableOpacity
,
Image
,
FlatList
,
Button
,
StatusBar
,
ActivityIndicator
}
from
'react-native'
;
import
Axios
from
'axios'
;
import
Axios
from
'axios'
;
import
Item
from
'./Item'
;
import
Item
from
'./Item'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
...
@@ -19,10 +19,11 @@ class MenuSelection extends React.Component {
...
@@ -19,10 +19,11 @@ class MenuSelection extends React.Component {
qty
:
1
,
qty
:
1
,
order_list
:
[],
order_list
:
[],
list_cart
:
[],
list_cart
:
[],
indicator
:
true
,
}
}
}
}
componentDidMount
()
{
componentDidMount
()
{
console
.
log
(
"INI YA :"
+
JSON
.
stringify
(
this
.
props
.
outlet_id
)
)
this
.
getMenuList
()
this
.
getMenuList
()
}
}
...
@@ -37,16 +38,15 @@ class MenuSelection extends React.Component {
...
@@ -37,16 +38,15 @@ class MenuSelection extends React.Component {
console
.
log
(
"INI DATANYA"
+
JSON
.
stringify
(
data
))
console
.
log
(
"INI DATANYA"
+
JSON
.
stringify
(
data
))
this
.
setState
({
this
.
setState
({
listCategory
:
data
.
category
,
listCategory
:
data
.
category
,
listMenu
:
data
.
menu
listMenu
:
data
.
menu
,
indicator
:
false
})
})
let
last_category
=
''
let
last_category
=
''
let
list_menu
=
[]
let
list_menu
=
[]
for
(
let
i
=
0
;
i
<
data
.
menu
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
menu
.
length
;
i
++
)
{
const
row
=
data
.
menu
[
i
];
const
row
=
data
.
menu
[
i
];
// cari sudah ada belum di redux
// cari sudah ada belum di redux
let
is_xist
=
this
.
props
.
order_item
.
find
(
item
=>
row
.
id
==
item
.
id
)
let
is_xist
=
this
.
props
.
order_item
.
find
(
item
=>
row
.
id
==
item
.
id
)
if
(
is_xist
)
{
if
(
is_xist
)
{
...
@@ -85,25 +85,11 @@ class MenuSelection extends React.Component {
...
@@ -85,25 +85,11 @@ class MenuSelection extends React.Component {
<
/View
>
<
/View
>
)
)
}
}
// scroll(item) {
// this.refs._scrollView.scrollTo(0);
// }
refresh
()
{
refresh
()
{
this
.
setState
({
isFetching
:
true
},
function
()
{
this
.
getMenuList
()
});
this
.
setState
({
isFetching
:
true
},
function
()
{
this
.
getMenuList
()
});
}
}
// handleRemove(item, index) {
// const listMenu = [...this.state.listMenu]
// if (listMenu[index].qty !== 0) {
// listMenu[index].qty -= 1
// this.setState({
// listMenu
// })
// }
// }
scrollToItem
=
()
=>
{
scrollToItem
=
()
=>
{
this
.
props
.
_scrollView
.
scrollTo
({
y
:
1
*
100
});
this
.
props
.
_scrollView
.
scrollTo
({
y
:
1
*
100
});
...
@@ -114,11 +100,11 @@ class MenuSelection extends React.Component {
...
@@ -114,11 +100,11 @@ class MenuSelection extends React.Component {
const
order_item
=
{
const
order_item
=
{
id
:
item
.
id
,
id
:
item
.
id
,
code
:
item
.
code
,
code
:
item
.
code
,
name
:
item
.
name
,
name
:
item
.
name
,
description
:
item
.
description
,
description
:
item
.
description
,
note
:
'jangan garing'
,
note
:
'jangan garing'
,
image
:
item
.
image
,
image
:
item
.
image
,
price
:
parseInt
(
item
.
price
),
price
:
parseInt
(
item
.
price
),
}
}
...
@@ -144,9 +130,9 @@ class MenuSelection extends React.Component {
...
@@ -144,9 +130,9 @@ class MenuSelection extends React.Component {
}
}
clearNegatif
(
item
,
index
)
{
clearNegatif
(
item
,
index
)
{
const
list_order_item
=
this
.
props
.
order_item
;
const
list_order_item
=
this
.
props
.
order_item
;
for
(
let
i
=
0
;
i
<
list_order_item
.
length
;
index
++
)
{
for
(
let
i
=
0
;
i
<
list_order_item
.
length
;
index
++
)
{
const
row
=
list_order_item
[
i
];
const
row
=
list_order_item
[
i
];
if
(
row
.
quantity
!==
0
)
{
if
(
row
.
quantity
!==
0
)
{
const
order_item
=
{
const
order_item
=
{
...
@@ -156,7 +142,7 @@ class MenuSelection extends React.Component {
...
@@ -156,7 +142,7 @@ class MenuSelection extends React.Component {
}
}
this
.
props
.
reduceQuantityItem
(
order_item
)
this
.
props
.
reduceQuantityItem
(
order_item
)
}
}
}
}
}
}
...
@@ -169,7 +155,7 @@ class MenuSelection extends React.Component {
...
@@ -169,7 +155,7 @@ class MenuSelection extends React.Component {
id
:
item
.
id
,
id
:
item
.
id
,
name
:
item
.
name
,
name
:
item
.
name
,
price
:
item
.
price
,
price
:
item
.
price
,
}
}
this
.
props
.
reduceQuantityItem
(
order_item
)
this
.
props
.
reduceQuantityItem
(
order_item
)
...
@@ -180,16 +166,6 @@ class MenuSelection extends React.Component {
...
@@ -180,16 +166,6 @@ class MenuSelection extends React.Component {
this
.
setState
({
this
.
setState
({
listMenu
listMenu
})
})
// for (let i = 0; i < list_order_item.length; i++) {
// const row = list_order_item[i];
// if (row.id == item.id) {
// quantity = row.quantity
// }
// }
}
}
}
}
}
}
...
@@ -199,6 +175,7 @@ class MenuSelection extends React.Component {
...
@@ -199,6 +175,7 @@ class MenuSelection extends React.Component {
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
StatusBar
hidden
=
{
true
}
/
>
<
StatusBar
hidden
=
{
true
}
/
>
<
View
style
=
{{
flex
:
0.7
,
height
:
90
,
flexDirection
:
'row'
,
borderWidth
:
1
,
}}
>
<
View
style
=
{{
flex
:
0.7
,
height
:
90
,
flexDirection
:
'row'
,
borderWidth
:
1
,
}}
>
<
FlatList
horizontal
=
{
true
}
style
=
{{
flexDirection
:
'row'
}}
<
FlatList
horizontal
=
{
true
}
style
=
{{
flexDirection
:
'row'
}}
showsHorizontalScrollIndicator
=
{
false
}
showsHorizontalScrollIndicator
=
{
false
}
data
=
{
this
.
state
.
listCategory
}
data
=
{
this
.
state
.
listCategory
}
...
@@ -207,18 +184,22 @@ class MenuSelection extends React.Component {
...
@@ -207,18 +184,22 @@ class MenuSelection extends React.Component {
/
>
/
>
<
/View
>
<
/View
>
<
View
style
=
{{
flex
:
3
}}
>
<
View
style
=
{{
flex
:
3
}}
>
<
FlatList
{
this
.
state
.
indicator
==
true
?
(
<
ActivityIndicator
style
=
{{
top
:
10
}}
size
=
"large"
color
=
"#c9af6d"
/>
data
=
{
this
.
state
.
listMenu
}
)
:
(
renderItem
=
{({
item
,
index
})
=>
(
<
FlatList
<
Item
navigation
=
{
this
.
props
.
navigation
}
item
=
{
item
}
data
=
{
this
.
state
.
listMenu
}
handleAdd
=
{()
=>
this
.
handleAdd
(
item
,
index
)}
renderItem
=
{({
item
,
index
})
=>
(
handleMin
=
{()
=>
this
.
handleMin
(
item
,
index
)}
<
Item
navigation
=
{
this
.
props
.
navigation
}
item
=
{
item
}
handleAdd
=
{()
=>
this
.
handleAdd
(
item
,
index
)}
handleMin
=
{()
=>
this
.
handleMin
(
item
,
index
)}
/
>
)}
keyExtractor
=
{
item
=>
item
.
id
}
/
>
/
>
)}
)}
keyExtractor
=
{
item
=>
item
.
id
}
/
>
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
shadow
}
>
<
View
style
=
{
styles
.
shadow
}
>
<
View
style
=
{{
flexDirection
:
'row'
,
}}
>
<
View
style
=
{{
flexDirection
:
'row'
,
}}
>
...
@@ -267,7 +248,7 @@ const mapStateToProps = (state) => {
...
@@ -267,7 +248,7 @@ const mapStateToProps = (state) => {
order_total
:
state
.
order_total
,
order_total
:
state
.
order_total
,
quantity
:
state
.
quantity
,
quantity
:
state
.
quantity
,
address
:
state
.
address
,
address
:
state
.
address
,
}
}
}
}
...
...
view/ShoppingCart.js
View file @
2ef8194c
...
@@ -65,7 +65,6 @@ class ShoppingCart extends React.Component {
...
@@ -65,7 +65,6 @@ class ShoppingCart extends React.Component {
}
}
}
}
handleMin
(
item
,
index
)
{
handleMin
(
item
,
index
)
{
console
.
log
(
"hai"
)
console
.
log
(
"hai"
)
const
list_order_item
=
this
.
props
.
order_item
;
const
list_order_item
=
this
.
props
.
order_item
;
...
@@ -200,7 +199,6 @@ class ShoppingCart extends React.Component {
...
@@ -200,7 +199,6 @@ class ShoppingCart extends React.Component {
console
.
log
(
"INI PROPS"
+
this
.
props
.
address
)
console
.
log
(
"INI PROPS"
+
this
.
props
.
address
)
}
}
_getPermissions
=
async
()
=>
{
_getPermissions
=
async
()
=>
{
let
{
status
}
=
await
Permissions
.
askAsync
(
Permissions
.
LOCATION
);
let
{
status
}
=
await
Permissions
.
askAsync
(
Permissions
.
LOCATION
);
if
(
status
!==
'granted'
)
{
if
(
status
!==
'granted'
)
{
...
@@ -736,8 +734,6 @@ const mapDispatchToProps = (dispacth) => {
...
@@ -736,8 +734,6 @@ const mapDispatchToProps = (dispacth) => {
pointused
:
setOrdersProps
.
pointused
,
pointused
:
setOrdersProps
.
pointused
,
}
}
}),
}),
}
}
}
}
...
...
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