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
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
import
{
connect
}
from
'react-redux'
;
class
ItemShoping
extends
React
.
Component
{
render
()
{
const
{
item
}
=
this
.
props
console
.
log
(
"ini id itemnya "
+
item
.
id
)
return
(
<
View
style
=
{{
flex
:
1
,
margin
:
10
}}
key
=
{
item
.
id
}
ref
=
{
this
.
props
.
_scrollView
}
>
<
ScrollView
ref
=
{
view
=>
this
.
_scrollView
=
view
}
>
{
item
.
code
==
'CATEGORY'
?
(
<
Text
style
=
{{
fontSize
:
20
,
color
:
'#c9af6d'
}}
>
{
item
.
name
}
<
/Text
>
):
(
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
View
style
=
{{
flex
:
1
,
margin
:
10
}}
key
=
{
item
.
id
}
>
{
/* <Text style={{ fontSize: 20, color: '#c9af6d' }}>{item.name}</Text> */
}
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
View
>
<
Image
source
=
{{
uri
:
item
.
image
}}
style
=
{{
height
:
100
,
width
:
100
,
borderRadius
:
5
,
top
:
5
}}
><
/Image
>
<
/View
>
...
...
@@ -31,7 +26,7 @@ class ItemShoping extends React.Component {
<
TextInput
style
=
{{
height
:
25
,
padding
:
2
,
textAlign
:
'center'
,
margin
:
2
}}
autoCapitalize
=
"none"
>
{
item
.
qty
}
{
item
.
q
uanti
ty
}
<
/TextInput
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
handleAdd
()}
>
<
Text
style
=
{{
fontSize
:
20
,
margin
:
2
}}
>
+
<
/Text
>
...
...
@@ -40,9 +35,6 @@ class ItemShoping extends React.Component {
<
/View
>
<
/View
>
<
/View
>
)}
<
/ScrollView
>
<
/View
>
)
}
...
...
@@ -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';
import
{
connect
}
from
'react-redux'
;
import
ActionType
from
'../redux/globalActionType'
;
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'
;
class
MenuSelection
extends
React
.
Component
{
...
...
@@ -26,9 +23,6 @@ class MenuSelection extends React.Component {
}
componentDidMount
()
{
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
()
{
...
...
@@ -44,11 +38,9 @@ class MenuSelection extends React.Component {
listMenu
:
data
.
menu
})
let
last_category
=
''
let
list_menu
=
[]
for
(
let
i
=
0
;
i
<
data
.
menu
.
length
;
i
++
)
{
const
row
=
data
.
menu
[
i
];
...
...
@@ -74,11 +66,6 @@ class MenuSelection extends React.Component {
list_menu
.
push
(
row
)
}
}
// this.state.listMenu.map((i => {
// i.qty = 0
// }))
console
.
log
(
'After : '
+
JSON
.
stringify
(
list_menu
))
this
.
setState
({
listMenu
:
list_menu
})
...
...
@@ -116,47 +103,35 @@ class MenuSelection extends React.Component {
// }
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
});
}
handleAdd
(
item
,
index
)
{
console
.
log
(
'TAMPILIN NIH'
)
const
order_item
=
{
id
:
item
.
id
,
code
:
item
.
code
,
name
:
item
.
name
,
description
:
item
.
description
,
note
:
'jangan garing'
,
price
:
item
.
price
,
image
:
item
.
image
}
this
.
props
.
addToChart
(
order_item
)
// console.log("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
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
)
{
quantity
=
is_xist
.
quantity
}
const
listMenu
=
[...
this
.
state
.
listMenu
]
// console.log("INI COY YYYY QUANTITY " + quantity)
listMenu
[
index
].
qty
=
quantity
this
.
setState
({
listMenu
...
...
@@ -173,7 +148,6 @@ class MenuSelection extends React.Component {
id
:
item
.
id
,
name
:
item
.
name
,
price
:
item
.
price
,
}
this
.
props
.
reduceQuantityItem
(
order_item
)
}
...
...
@@ -280,7 +254,7 @@ const styles = StyleSheet.create({
})
const
mapStateToProps
=
(
state
)
=>
{
console
.
log
(
state
)
return
{
session_id
:
state
.
session_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