diff options
author | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-09-13 17:40:13 +0530 |
---|---|---|
committer | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-09-13 17:40:13 +0530 |
commit | 794b16479649b1a7d4eac6f7c5f5bda7f97ee406 (patch) | |
tree | 4884d0583ddf59a19e15314f31287dbf1ba6cfa1 /src/components/Form/Items/AddNewItemForm.tsx | |
parent | c1600045a243e3547fe589bfc7e474d2decaea4c (diff) |
Diffstat (limited to 'src/components/Form/Items/AddNewItemForm.tsx')
-rw-r--r-- | src/components/Form/Items/AddNewItemForm.tsx | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/components/Form/Items/AddNewItemForm.tsx b/src/components/Form/Items/AddNewItemForm.tsx index 7988ddd..13a1d4e 100644 --- a/src/components/Form/Items/AddNewItemForm.tsx +++ b/src/components/Form/Items/AddNewItemForm.tsx @@ -7,7 +7,8 @@ */ import React, { useState } from "react"; -import { Item } from "../../../Interfaces/interfaces"; +import { Item, NewItem } from "../../../Interfaces/interfaces"; +import { DummyNewItem } from "../../../Interfaces/dummies"; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faSync } from '@fortawesome/free-solid-svg-icons' import "./../Form.scss"; @@ -31,18 +32,8 @@ const AddNewItemForm: React.FC<Props> = (props) => { const [itemBrand, setItemBrand] = useState<string>(""); const [itemCategory, setItemCategory] = useState<string>(""); - // default item object - const defaultItem: any = { - Description: "", - UnitPrice: 0.00, - TotalGST: props.defGSTValue, - HSN: "", - Brand: "", - Category: "" - } - // store the current item to easily reset a value to the default one - const [currentItem, setCurrentItem] = useState<Item|any>(defaultItem); + const [currentItem, setCurrentItem] = useState<Item|NewItem>(DummyNewItem); // to be handled by DocumentInfo // check if client is in same state @@ -80,7 +71,7 @@ const AddNewItemForm: React.FC<Props> = (props) => { setItemDiscountPercentage(0); setItemHSNValue(""); setItemGSTPercentage(props.defGSTValue); - setCurrentItem(defaultItem); + setCurrentItem(DummyNewItem); } return ( |