From 300a4eb39ccea56da416d83400cddc97118e1649 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 12 Oct 2022 21:04:39 +0530 Subject: showing total (sum) values in InvoiceItemTable --- src/components/pickers/item-picker.js | 10 +-- src/components/tables/invoice-item-table.js | 116 ++++++++++++++++++---------- src/components/tables/scss/table.scss | 8 ++ 3 files changed, 87 insertions(+), 47 deletions(-) (limited to 'src/components') diff --git a/src/components/pickers/item-picker.js b/src/components/pickers/item-picker.js index 339319f..d756427 100644 --- a/src/components/pickers/item-picker.js +++ b/src/components/pickers/item-picker.js @@ -37,10 +37,10 @@ const ItemPicker = ({invoiceItems, addInvoiceItem}) => { } const handleInput = e => { - const { name, value } = e.target; + const { name, value, type } = e.target; setItem(prevItem => ({ ...prevItem, - [name]: value + [name]: type === "number" ? parseFloat(value) : value })); } @@ -65,7 +65,7 @@ const ItemPicker = ({invoiceItems, addInvoiceItem}) => { {items.map(i => )} @@ -76,8 +76,8 @@ const ItemPicker = ({invoiceItems, addInvoiceItem}) => { type="number" value={item.Quantity} name="Quantity" - min={item.MinQuantity} - max={item.MaxQuantity} + min={item.MinQuantity > 0 ? item.MinQuantity : 1} + max={item.MaxQuantity > 0 ? item.MaxQuantity : null} onChange={handleInput} />