aboutsummaryrefslogtreecommitdiff
path: root/src/components/pickers/item-picker.js
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-16 19:36:22 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2022-10-16 19:36:22 +0530
commitb1b874ba771d8dc78d6b17c320ca9993b25d93a1 (patch)
tree03807df5b991736a6fd4e83ae3d31c5a045db448 /src/components/pickers/item-picker.js
parent1b3702b241f02ab16c3b5366acb47cefbf089521 (diff)
Items can now strictly have whole number quantities
Diffstat (limited to 'src/components/pickers/item-picker.js')
-rw-r--r--src/components/pickers/item-picker.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/components/pickers/item-picker.js b/src/components/pickers/item-picker.js
index 3029fb5..630eb34 100644
--- a/src/components/pickers/item-picker.js
+++ b/src/components/pickers/item-picker.js
@@ -19,8 +19,6 @@ import './scss/item-picker.scss';
import { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
-//import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
-//import { faPhone, faEnvelope, faGlobe } from '@fortawesome/free-solid-svg-icons'
const ItemPicker = ({invoiceItems, addInvoiceItem}) => {
const [items, setItems] = useState([new Item()]);
@@ -113,9 +111,10 @@ const ItemPicker = ({invoiceItems, addInvoiceItem}) => {
<input
type="number"
className={((!isNumeric(item.Quantity) || (item.MaxQuantity > 0 && item.Quantity > item.MaxQuantity) || (item.Quantity < item.MinQuantity))) ? "warning" : ""}
- step="0.01"
+ step={item.HasDecimalQuantity ? "0.01" : "1"}
value={item.Quantity}
name="Quantity"
+ min="0"
max={item.MaxQuantity > 0 ? item.MaxQuantity : null}
onChange={handleInput} />
</label>
@@ -169,10 +168,12 @@ const ItemPicker = ({invoiceItems, addInvoiceItem}) => {
name="GSTPercentage"
onChange={handleInput} />
</label>
- <input
- type="submit"
- value="Add"
- disabled={!validate()} />
+ <div className={"buttons"}>
+ <input
+ type="submit"
+ value="Add"
+ disabled={!validate()} />
+ </div>
</> :
<Link to="/manage/items">
<input type="button" value="Add Items" />