From ce832a0bddc02a21d9c382f46b81dd6c114f35f9 Mon Sep 17 00:00:00 2001
From: MikunoNaka <bokuwakanojogahoshii@yahoo.com>
Date: Sat, 26 Jun 2021 03:18:55 +0530
Subject: Storing HSN as string now

---
 src/components/Form/Items/AddNewItemForm.tsx | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

(limited to 'src/components/Form/Items/AddNewItemForm.tsx')

diff --git a/src/components/Form/Items/AddNewItemForm.tsx b/src/components/Form/Items/AddNewItemForm.tsx
index 48ca4b2..2c4669d 100644
--- a/src/components/Form/Items/AddNewItemForm.tsx
+++ b/src/components/Form/Items/AddNewItemForm.tsx
@@ -25,7 +25,7 @@ const AddNewItemForm: React.FC<props> = (props) => {
   const [itemDiscountPercentage, setItemDiscountPercentage] = useState<number>(0.00);
   const [itemGSTPercentage, setItemGSTValue] = useState<number>(props.defGSTValue);
   const [itemQTYValue, setItemQTYValue] = useState<number>(1);
-  const [itemHSNValue, setItemHSNValue] = useState<number>(0);
+  const [itemHSNValue, setItemHSNValue] = useState<string>("");
 
   // to be handled by DocumentInfo
   // check if client is in same state
@@ -57,7 +57,7 @@ const AddNewItemForm: React.FC<props> = (props) => {
     setItemQTYValue(1);
     setItemPriceValue(1);
     setItemDiscountPercentage(0);
-    setItemHSNValue(0);
+    setItemHSNValue("");
     setItemGSTValue(props.defGSTValue);
   }
 
@@ -157,10 +157,7 @@ const AddNewItemForm: React.FC<props> = (props) => {
           <label>
             HSN: 
               <input className={"smallInputBox"} type="number" min="0" value={itemHSNValue} 
-                onInput={
-                  (event: React.FormEvent<HTMLInputElement>) => 
-                    setItemHSNValue(parseInt(event.currentTarget.value))
-                } 
+                onChange={(event) => setItemHSNValue(event.target.value)} 
               required />
           </label>
 
-- 
cgit v1.2.3

