From b1b874ba771d8dc78d6b17c320ca9993b25d93a1 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 16 Oct 2022 19:36:22 +0530 Subject: Items can now strictly have whole number quantities --- src/components/pickers/item-picker.js | 15 ++++++++------- src/components/pickers/scss/item-picker.scss | 6 +++++- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src/components/pickers') 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}) => { 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} /> @@ -169,10 +168,12 @@ const ItemPicker = ({invoiceItems, addInvoiceItem}) => { name="GSTPercentage" onChange={handleInput} /> - +
+ +
: diff --git a/src/components/pickers/scss/item-picker.scss b/src/components/pickers/scss/item-picker.scss index 63ddbcf..394782e 100644 --- a/src/components/pickers/scss/item-picker.scss +++ b/src/components/pickers/scss/item-picker.scss @@ -56,6 +56,10 @@ input { width: 7rem; } } + input { + transition: border 0.2s; + } + input[type=number] { -moz-appearance: textfield; width: 7rem; @@ -76,7 +80,7 @@ border: 1px solid $primaryAccentColor; color: $fgColor; border-radius: 4px; - transition: background-color 0.4s, color 0.4s; + transition: background-color 0.4s, color 0.4s, border 0.4s; } input[type=button]:hover, input[type=submit]:hover { -- cgit v1.2.3