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
c6d01124
Commit
c6d01124
authored
Jun 06, 2020
by
Wahyu Adjie Prasetyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memperbaiki bug menu selection bagian edit note
parent
25f722ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
45 deletions
+49
-45
Item.js
view/Item.js
+49
-45
No files found.
view/Item.js
View file @
c6d01124
import
React
from
'react'
;
import
React
from
'react'
;
import
{
View
,
Text
,
StyleSheet
,
ScrollView
,
TouchableOpacity
,
Image
,
TextInput
,
Modal
,
Alert
}
from
'react-native'
;
import
{
View
,
Text
,
StyleSheet
,
ScrollView
,
TouchableOpacity
,
Image
,
TextInput
,
Modal
,
Alert
}
from
'react-native'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
,
connectAdvanced
}
from
'react-redux'
;
import
ActionType
from
'../redux/globalActionType'
;
import
ActionType
from
'../redux/globalActionType'
;
import
NumberFormat
from
'react-number-format'
;
import
NumberFormat
from
'react-number-format'
;
import
{
Icon
}
from
'react-native-elements'
import
{
Icon
}
from
'react-native-elements'
...
@@ -13,7 +13,7 @@ class Item extends React.Component {
...
@@ -13,7 +13,7 @@ class Item extends React.Component {
this
.
state
=
{
this
.
state
=
{
value
:
0
,
value
:
0
,
modalVisible
:
false
,
modalVisible
:
false
,
note
:
''
note
s
:
''
}
}
}
}
handleChangeQuantity
=
(
item
,
qty
)
=>
{
handleChangeQuantity
=
(
item
,
qty
)
=>
{
...
@@ -27,7 +27,6 @@ class Item extends React.Component {
...
@@ -27,7 +27,6 @@ class Item extends React.Component {
code
:
item
.
code
,
code
:
item
.
code
,
name
:
item
.
name
,
name
:
item
.
name
,
description
:
item
.
description
,
description
:
item
.
description
,
note
:
this
.
state
.
note
,
image
:
item
.
image
,
image
:
item
.
image
,
price
:
parseInt
(
item
.
price
),
price
:
parseInt
(
item
.
price
),
}
}
...
@@ -42,12 +41,17 @@ class Item extends React.Component {
...
@@ -42,12 +41,17 @@ class Item extends React.Component {
})
})
}
}
handleEdit
=
(
item
)
=>
{
handleEdit
=
(
item
)
=>
{
let
note
=
''
if
(
this
.
state
.
note
===
''
)
{
note
=
item
.
note
;
}
else
{
note
=
this
.
state
.
notes
;
}
const
order_item
=
{
const
order_item
=
{
id
:
item
.
id
,
id
:
item
.
id
,
note
:
this
.
state
.
note
,
note
:
note
,
}
}
this
.
props
.
setNotes
({
item
:
order_item
})
this
.
props
.
setNotes
({
item
:
order_item
})
this
.
setState
({
this
.
setState
({
modalVisible
:
false
modalVisible
:
false
...
@@ -56,52 +60,51 @@ class Item extends React.Component {
...
@@ -56,52 +60,51 @@ class Item extends React.Component {
render
()
{
render
()
{
const
{
item
}
=
this
.
props
const
{
item
}
=
this
.
props
console
.
log
(
"ini id itemnya "
+
item
.
note
)
return
(
return
(
<
View
style
=
{{
flex
:
1
,
margin
:
10
}}
key
=
{
item
.
id
}
ref
=
{
this
.
props
.
_scrollView
}
>
<
View
style
=
{{
flex
:
1
,
margin
:
10
}}
key
=
{
item
.
id
}
ref
=
{
this
.
props
.
_scrollView
}
>
<
Modal
animationType
=
"slide"
transparent
=
{
true
}
visible
=
{
this
.
state
.
modalVisible
}
onRequestClose
=
{()
=>
{
this
.
setState
({
modalVisible
:
false
})
}}
>
<
View
style
=
{
styles
.
centerViewModal
}
>
<
View
style
=
{
styles
.
modalView
}
>
<
Text
style
=
{{
fontSize
:
12
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Black'
}}
>
Add
Description
<
/Text
>
<
View
style
=
{{
margin
:
10
}}
>
<
TextInput
style
=
{
styles
.
textInput
}
onChangeText
=
{(
note
)
=>
this
.
setState
({
note
})}
textAlign
=
'center'
>
{
this
.
state
.
note
}
{
item
.
note
}
<
/TextInput
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
TouchableOpacity
style
=
{{
margin
:
5
}}
onPress
=
{()
=>
this
.
handleEdit
(
item
)
}
>
<
View
style
=
{
styles
.
button
}
>
<
Text
style
=
{{
color
:
'white'
,
fontWeight
:
'bold'
,
fontSize
:
16
}}
>
CONFIRM
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
margin
:
5
}}
onPress
=
{()
=>
this
.
setState
({
modalVisible
:
false
})}
>
<
View
style
=
{
styles
.
button
}
>
<
Text
style
=
{{
color
:
'white'
,
fontWeight
:
'bold'
,
fontSize
:
16
}}
>
CANCEL
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
/Modal
>
<
ScrollView
ref
=
{
view
=>
this
.
_scrollView
=
view
}
>
<
ScrollView
ref
=
{
view
=>
this
.
_scrollView
=
view
}
>
{
item
.
code
==
'CATEGORY'
?
(
{
item
.
code
==
'CATEGORY'
?
(
<
Text
style
=
{{
fontSize
:
15
,
color
:
'#c9af6d'
,
fontFamily
:
'Gotham-Black'
}}
>
{
item
.
name
}
<
/Text
>
<
Text
style
=
{{
fontSize
:
15
,
color
:
'#c9af6d'
,
fontFamily
:
'Gotham-Black'
}}
>
{
item
.
name
}
<
/Text
>
)
:
(
)
:
(
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
height
:
100
}}
>
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
height
:
100
}}
>
<
Modal
animationType
=
"slide"
transparent
=
{
true
}
visible
=
{
this
.
state
.
modalVisible
}
onRequestClose
=
{()
=>
{
this
.
setState
({
modalVisible
:
false
})
}}
>
<
View
style
=
{
styles
.
centerViewModal
}
>
<
View
style
=
{
styles
.
modalView
}
>
<
Text
style
=
{{
fontSize
:
12
,
color
:
'#CFB368'
,
fontFamily
:
'Gotham-Black'
}}
>
Add
Description
<
/Text
>
<
View
style
=
{{
margin
:
10
}}
>
<
TextInput
style
=
{
styles
.
textInput
}
onChangeText
=
{(
notes
)
=>
this
.
setState
({
notes
})}
textAlign
=
'center'
>
{
item
.
note
}
<
/TextInput
>
<
/View
>
<
View
style
=
{{
flexDirection
:
'row'
}}
>
<
TouchableOpacity
style
=
{{
margin
:
5
}}
onPress
=
{()
=>
this
.
handleEdit
(
item
)}
>
<
View
style
=
{
styles
.
button
}
>
<
Text
style
=
{{
color
:
'white'
,
fontWeight
:
'bold'
,
fontSize
:
16
}}
>
CONFIRM
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
TouchableOpacity
style
=
{{
margin
:
5
}}
onPress
=
{()
=>
this
.
setState
({
modalVisible
:
false
})}
>
<
View
style
=
{
styles
.
button
}
>
<
Text
style
=
{{
color
:
'white'
,
fontWeight
:
'bold'
,
fontSize
:
16
}}
>
CANCEL
<
/Text
>
<
/View
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
<
/Modal
>
<
View
style
=
{{
flex
:
1
,
height
:
100
}}
>
<
View
style
=
{{
flex
:
1
,
height
:
100
}}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Menu Detail'
,
{
nameMenu
:
item
.
name
,
desc
:
item
.
description
,
image
:
item
.
image
})}
>
<
TouchableOpacity
onPress
=
{()
=>
this
.
props
.
navigation
.
navigate
(
'Menu Detail'
,
{
nameMenu
:
item
.
name
,
desc
:
item
.
description
,
image
:
item
.
image
})}
>
<
Image
source
=
{{
uri
:
item
.
image
}}
style
=
{{
height
:
100
,
width
:
100
,
borderRadius
:
10
,
}}
><
/Image
>
<
Image
source
=
{{
uri
:
item
.
image
}}
style
=
{{
height
:
100
,
width
:
100
,
borderRadius
:
10
,
}}
><
/Image
>
...
@@ -235,7 +238,7 @@ const styles = StyleSheet.create({
...
@@ -235,7 +238,7 @@ const styles = StyleSheet.create({
button
:
{
button
:
{
backgroundColor
:
'#CFB368'
,
backgroundColor
:
'#CFB368'
,
height
:
40
,
height
:
40
,
paddingHorizontal
:
20
,
paddingHorizontal
:
20
,
borderRadius
:
10
,
borderRadius
:
10
,
alignItems
:
'center'
,
alignItems
:
'center'
,
justifyContent
:
'center'
justifyContent
:
'center'
...
@@ -273,6 +276,7 @@ const mapStateToProps = (state) => {
...
@@ -273,6 +276,7 @@ const mapStateToProps = (state) => {
order_quantity
:
state
.
order_quantity
,
order_quantity
:
state
.
order_quantity
,
order_total
:
state
.
order_total
,
order_total
:
state
.
order_total
,
quantity
:
state
.
quantity
,
quantity
:
state
.
quantity
,
menu_item
:
state
.
menu_item
}
}
}
}
...
...
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