diff options
author | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-02 20:09:09 +0530 |
---|---|---|
committer | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-02 20:09:09 +0530 |
commit | 2f9d7e2584330fdabc351ea3d04bade1104e5aa5 (patch) | |
tree | 3e400e51bfe2881b8f931ee915ba311dc6638f44 | |
parent | 748e70a86633c8bb3ba57a5136ed55bbaebe9c4c (diff) |
Bug fix: the GST reset button appearing when item was added
-rw-r--r-- | src/components/Form/Items/AddNewItemForm.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
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 ( |