aboutsummaryrefslogtreecommitdiff
path: root/src/components/pickers/item-picker.js
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-12 21:04:39 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-12 21:04:39 +0530
commit300a4eb39ccea56da416d83400cddc97118e1649 (patch)
tree9ba1dc0c4f8d64bce52ba9a9fd9a73ac5d090103 /src/components/pickers/item-picker.js
parent0b4343bed2cace86552929f25202680c0d99c541 (diff)
showing total (sum) values in InvoiceItemTable
Diffstat (limited to 'src/components/pickers/item-picker.js')
-rw-r--r--src/components/pickers/item-picker.js10
1 files changed, 5 insertions, 5 deletions
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}) => {
<option key="placeholder" value={""} disabled>Select an Item</option>
{items.map(i =>
<option key={i.Id} value={i.Id} disabled={invoiceItems.some(j => j.Id === i.Id)}>
- {i.Name}{i.Brand.Id === null ? "" : " - " + i.Brand.Name}
+ {i.Name}{i.Brand.Id === undefined ? "" : " - " + i.Brand.Name}
</option>
)}
</select>
@@ -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} />
</label>
<label className={"narrow"}>