Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
new_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
new_excelso
Commits
695c4393
Commit
695c4393
authored
Apr 27, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change menu selection
parent
6e3f99c0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
176 additions
and
154 deletions
+176
-154
ItemShopingCart.js
view/ItemShopingCart.js
+6
-14
MenuSelection.js
view/MenuSelection.js
+6
-32
ShoppingCart.js
view/ShoppingCart.js
+164
-108
No files found.
view/ItemShopingCart.js
View file @
695c4393
...
@@ -3,19 +3,14 @@ import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Image, TextInput
...
@@ -3,19 +3,14 @@ import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Image, TextInput
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
class
ItemShoping
extends
React
.
Component
{
class
ItemShoping
extends
React
.
Component
{
render
()
{
render
()
{
const
{
item
}
=
this
.
props
const
{
item
}
=
this
.
props
console
.
log
(
"ini id itemnya "
+
item
.
id
)
return
(
return
(
<
View
style
=
{{
flex
:
1
,
margin
:
10
}}
key
=
{
item
.
id
}
ref
=
{
this
.
props
.
_scrollView
}
>
<
View
style
=
{{
flex
:
1
,
margin
:
10
}}
key
=
{
item
.
id
}
>
<
ScrollView
ref
=
{
view
=>
this
.
_scrollView
=
view
}
>
{
/* <Text style={{ fontSize: 20, color: '#c9af6d' }}>{item.name}</Text> */
}
{
item
.
code
==
'CATEGORY'
?
(
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
Text
style
=
{{
fontSize
:
20
,
color
:
'#c9af6d'
}}
>
{
item
.
name
}
<
/Text
>
):
(
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
View
>
<
View
>
<
Image
source
=
{{
uri
:
item
.
image
}}
style
=
{{
height
:
100
,
width
:
100
,
borderRadius
:
5
,
top
:
5
}}
><
/Image
>
<
Image
source
=
{{
uri
:
item
.
image
}}
style
=
{{
height
:
100
,
width
:
100
,
borderRadius
:
5
,
top
:
5
}}
><
/Image
>
<
/View
>
<
/View
>
...
@@ -31,7 +26,7 @@ class ItemShoping extends React.Component {
...
@@ -31,7 +26,7 @@ class ItemShoping extends React.Component {
<
TextInput
<
TextInput
style
=
{{
height
:
25
,
padding
:
2
,
textAlign
:
'center'
,
margin
:
2
}}
style
=
{{
height
:
25
,
padding
:
2
,
textAlign
:
'center'
,
margin
:
2
}}
autoCapitalize
=
"none"
>
autoCapitalize
=
"none"
>
{
item
.
qty
}
{
item
.
q
uanti
ty
}
<
/TextInput
>
<
/TextInput
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
handleAdd
()}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
handleAdd
()}
>
<
Text
style
=
{{
fontSize
:
20
,
margin
:
2
}}
>
+
<
/Text
>
<
Text
style
=
{{
fontSize
:
20
,
margin
:
2
}}
>
+
<
/Text
>
...
@@ -40,9 +35,6 @@ class ItemShoping extends React.Component {
...
@@ -40,9 +35,6 @@ class ItemShoping extends React.Component {
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
)}
<
/ScrollView
>
<
/View
>
<
/View
>
)
)
}
}
...
@@ -111,4 +103,4 @@ const mapStateToProps = (state) => {
...
@@ -111,4 +103,4 @@ const mapStateToProps = (state) => {
}
}
}
}
export
default
connect
(
mapStateToProps
)(
Item
)
export
default
connect
(
mapStateToProps
)(
Item
Shoping
)
view/MenuSelection.js
View file @
695c4393
...
@@ -5,9 +5,6 @@ import Item from './Item';
...
@@ -5,9 +5,6 @@ import Item from './Item';
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
ActionType
from
'../redux/globalActionType'
;
import
ActionType
from
'../redux/globalActionType'
;
import
CurrencyFormat
from
'react-currency-format'
;
import
CurrencyFormat
from
'react-currency-format'
;
import
Constants
from
"expo-constants"
;
import
{
Ionicons
,
MaterialCommunityIcons
,
MaterialIcons
,
AntDesign
}
from
'@expo/vector-icons'
;
// import { range } from 'lodash';
import
_
from
'lodash'
;
import
_
from
'lodash'
;
class
MenuSelection
extends
React
.
Component
{
class
MenuSelection
extends
React
.
Component
{
...
@@ -26,9 +23,6 @@ class MenuSelection extends React.Component {
...
@@ -26,9 +23,6 @@ class MenuSelection extends React.Component {
}
}
componentDidMount
()
{
componentDidMount
()
{
this
.
getMenuList
()
this
.
getMenuList
()
// console.log("INI TOTAL ORDER : " + this.props.orders)
// console.log("INI TOTAL QTY :" + this.props.quantity)
console
.
log
(
"INI OETLET :"
+
JSON
.
stringify
(
this
.
props
.
outlet_id
))
}
}
getMenuList
()
{
getMenuList
()
{
...
@@ -44,11 +38,9 @@ class MenuSelection extends React.Component {
...
@@ -44,11 +38,9 @@ class MenuSelection extends React.Component {
listMenu
:
data
.
menu
listMenu
:
data
.
menu
})
})
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
];
...
@@ -74,11 +66,6 @@ class MenuSelection extends React.Component {
...
@@ -74,11 +66,6 @@ class MenuSelection extends React.Component {
list_menu
.
push
(
row
)
list_menu
.
push
(
row
)
}
}
}
}
// this.state.listMenu.map((i => {
// i.qty = 0
// }))
console
.
log
(
'After : '
+
JSON
.
stringify
(
list_menu
))
this
.
setState
({
this
.
setState
({
listMenu
:
list_menu
listMenu
:
list_menu
})
})
...
@@ -116,47 +103,35 @@ class MenuSelection extends React.Component {
...
@@ -116,47 +103,35 @@ class MenuSelection extends React.Component {
// }
// }
scrollToItem
=
()
=>
{
scrollToItem
=
()
=>
{
// let newData = []
// newData.push(this.state.listMenu)
// console.log("DATA " + JSON.stringify(newData))
// newData.map((item => {
// let abc = item[0].category
// }))
this
.
props
.
_scrollView
.
scrollTo
({
y
:
1
*
100
});
this
.
props
.
_scrollView
.
scrollTo
({
y
:
1
*
100
});
}
}
handleAdd
(
item
,
index
)
{
handleAdd
(
item
,
index
)
{
console
.
log
(
'TAMPILIN NIH'
)
const
order_item
=
{
const
order_item
=
{
id
:
item
.
id
,
id
:
item
.
id
,
code
:
item
.
code
,
name
:
item
.
name
,
name
:
item
.
name
,
description
:
item
.
description
,
note
:
'jangan garing'
,
price
:
item
.
price
,
price
:
item
.
price
,
image
:
item
.
image
image
:
item
.
image
}
}
this
.
props
.
addToChart
(
order_item
)
this
.
props
.
addToChart
(
order_item
)
// console.log("ORDER ITEM " + this.props.order_item)
const
list_order_item
=
this
.
props
.
order_item
;
const
list_order_item
=
this
.
props
.
order_item
;
let
is_xist
=
list_order_item
.
find
(
row
=>
row
.
id
==
item
.
id
)
let
is_xist
=
list_order_item
.
find
(
row
=>
row
.
id
==
item
.
id
)
let
quantity
=
0
let
quantity
=
0
// for (let i = 0; i < list_order_item.length; i++) {
// const row = list_order_item[i];
// if (row.id == item.id) {
// quantity = row.quantity
// }
// }
if
(
is_xist
)
{
if
(
is_xist
)
{
quantity
=
is_xist
.
quantity
quantity
=
is_xist
.
quantity
}
}
const
listMenu
=
[...
this
.
state
.
listMenu
]
const
listMenu
=
[...
this
.
state
.
listMenu
]
// console.log("INI COY YYYY QUANTITY " + quantity)
listMenu
[
index
].
qty
=
quantity
listMenu
[
index
].
qty
=
quantity
this
.
setState
({
this
.
setState
({
listMenu
listMenu
...
@@ -173,7 +148,6 @@ class MenuSelection extends React.Component {
...
@@ -173,7 +148,6 @@ 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
)
}
}
...
@@ -280,7 +254,7 @@ const styles = StyleSheet.create({
...
@@ -280,7 +254,7 @@ const styles = StyleSheet.create({
})
})
const
mapStateToProps
=
(
state
)
=>
{
const
mapStateToProps
=
(
state
)
=>
{
console
.
log
(
state
)
return
{
return
{
session_id
:
state
.
session_id
,
session_id
:
state
.
session_id
,
outlet_id
:
state
.
outlet_id
,
outlet_id
:
state
.
outlet_id
,
...
...
view/ShoppingCart.js
View file @
695c4393
This diff is collapsed.
Click to expand it.
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