From 2f9d7e2584330fdabc351ea3d04bade1104e5aa5 Mon Sep 17 00:00:00 2001
From: MikunoNaka <bokuwakanojogahoshii@yahoo.com>
Date: Fri, 2 Jul 2021 20:09:09 +0530
Subject: Bug fix: the GST reset button appearing when item was added

---
 src/components/Form/Items/AddNewItemForm.tsx | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 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 7060f51..d3c873f 100644
--- a/src/components/Form/Items/AddNewItemForm.tsx
+++ b/src/components/Form/Items/AddNewItemForm.tsx
@@ -29,13 +29,16 @@ const AddNewItemForm: React.FC<Props> = (props) => {
   const [itemQTYValue, setItemQTYValue] = useState<number>(1);
   const [itemHSNValue, setItemHSNValue] = useState<string>("");
 
-  // store the current item to easily reset a value to the default one
-  const [currentItem, setCurrentItem] = useState<Item|any>({
+  // default item object
+  const defaultItem: any = {
     Description: "",
     UnitPrice: 0.00,
-    GSTPercentage: props.defGSTValue,
+    TotalGST: props.defGSTValue,
     HSN: ""
-  });
+  }
+
+  // store the current item to easily reset a value to the default one
+  const [currentItem, setCurrentItem] = useState<Item|any>(defaultItem);
 
   // to be handled by DocumentInfo
   // check if client is in same state
@@ -67,10 +70,11 @@ const AddNewItemForm: React.FC<Props> = (props) => {
     setItemNameValue("");
     setItemDescValue("");
     setItemQTYValue(1);
-    setItemPriceValue(1);
+    setItemPriceValue(0);
     setItemDiscountPercentage(0);
     setItemHSNValue("");
     setItemGSTPercentage(props.defGSTValue);
+    setCurrentItem(defaultItem);
   }
 
   return (
-- 
cgit v1.2.3

