Update ReviewInvoice.js
This commit is contained in:
parent
576152cc12
commit
e5d0e9bead
@ -59,6 +59,14 @@ const ReviewInvoice = () => {
|
||||
|
||||
const handleAddOne = (id) => {
|
||||
|
||||
var modifiedPQ = prodQuant.filter((pq) => pq.id == id);
|
||||
var modifiedProd = prodQuant.filter((pq) => pq.product.id == id);
|
||||
|
||||
modifiedPQ.quantity++;
|
||||
modifiedProd.quantity = modifiedPQ.quantity;
|
||||
|
||||
setProdQuant([...(prodQuant.filter((pq) => pq.id !== id)), { ...modifiedPQ }].sort((a, b) => a.id - b.id));
|
||||
setProducts([...(products.filter((pq) => pq.product.id !== id)), { ...modifiedProd }].sort((a, b) => a.product.id - b.product.id));
|
||||
|
||||
|
||||
}
|
||||
@ -73,6 +81,7 @@ const ReviewInvoice = () => {
|
||||
}
|
||||
else {
|
||||
modifiedPQ.quantity--;
|
||||
modifiedProd.quantity = modifiedPQ.quantity;
|
||||
setProdQuant([...(prodQuant.filter((pq) => pq.id !== id)), { ...modifiedPQ }].sort((a, b) => a.id - b.id));
|
||||
setProducts([...(products.filter((pq) => pq.product.id !== id)), { ...modifiedProd }].sort((a, b) => a.product.id - b.product.id));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user