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
9a70f352
Commit
9a70f352
authored
May 08, 2020
by
Afid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug pertama kali langsung edit quantity tidak bisa
parent
4aff7651
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
globalReducer.js
redux/globalReducer.js
+22
-10
No files found.
redux/globalReducer.js
View file @
9a70f352
...
...
@@ -606,6 +606,7 @@ const rootReducer = (state = globalState, action) => {
// ini kalau sudah ada diupdate
if
(
!
isNaN
(
parseInt
(
new_quantity
)))
{
console
.
log
(
'Number : '
+
parseInt
(
new_quantity
))
exist
=
false
for
(
let
i
=
0
;
i
<
state
.
order_item
.
length
;
i
++
)
{
const
row
=
state
.
order_item
[
i
];
...
...
@@ -616,31 +617,42 @@ const rootReducer = (state = globalState, action) => {
exist
=
true
}
quantity
+=
parseInt
(
row
.
quantity
)
total
+=
parseInt
(
row
.
price
)
*
parseInt
(
row
.
quantity
)
if
(
row
.
quantity
!=
0
)
{
if
(
row
.
quantity
>
0
)
{
quantity
+=
parseInt
(
row
.
quantity
)
total
+=
parseInt
(
row
.
price
)
*
parseInt
(
row
.
quantity
)
list_item
.
push
(
row
)
}
}
// kalo belum ada
if
(
!
exist
)
{
list_item
.
push
(
item
)
item
.
quantity
=
parseInt
(
new_quantity
)
if
(
item
.
quantity
<
0
)
{
item
.
quantity
=
0
}
console
.
log
(
'sama sekali blm ada : '
+
JSON
.
stringify
(
item
))
if
(
item
.
quantity
>
0
)
{
quantity
+=
parseInt
(
item
.
quantity
)
total
+=
parseInt
(
item
.
price
)
*
parseInt
(
item
.
quantity
)
list_item
.
push
(
item
)
}
}
for
(
let
i
=
0
;
i
<
state
.
menu_item
.
length
;
i
++
)
{
const
row
=
state
.
menu_item
[
i
];
console
.
log
(
'MENU : '
+
JSON
.
stringify
(
row
))
// cari sudah ada belum di redux
let
is_xist
=
list_item
.
find
(
it
=>
it
.
id
==
row
.
id
)
if
(
is_xist
)
{
row
[
'qty'
]
=
is_xist
.
quantity
row
[
'qty'
]
=
is_xist
.
quantity
}
else
{
row
[
'qty'
]
=
0
console
.
log
(
parseInt
(
new_quantity
))
if
(
parseInt
(
new_quantity
)
<
0
)
{
row
.
qty
=
0
}
else
{
row
.
qty
=
0
}
}
list_menu
.
push
(
row
)
}
return
{
...
...
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