react-version #1

Merged
memartel_loc merged 290 commits from react-version into main 2023-11-04 09:48:15 -04:00
Showing only changes of commit e5d0e9bead - Show all commits

View File

@ -59,6 +59,14 @@ const ReviewInvoice = () => {
const handleAddOne = (id) => { 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 { else {
modifiedPQ.quantity--; modifiedPQ.quantity--;
modifiedProd.quantity = modifiedPQ.quantity;
setProdQuant([...(prodQuant.filter((pq) => pq.id !== id)), { ...modifiedPQ }].sort((a, b) => a.id - b.id)); 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)); setProducts([...(products.filter((pq) => pq.product.id !== id)), { ...modifiedProd }].sort((a, b) => a.product.id - b.product.id));
} }