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 | |
parent | c1600045a243e3547fe589bfc7e474d2decaea4c (diff) |
-rw-r--r-- | src/Interfaces/dummies.ts | 38 | ||||
-rw-r--r-- | src/components/Form/Address/NewAddressPane.tsx | 2 | ||||
-rw-r--r-- | src/components/Form/Items/AddNewItemForm.tsx | 17 | ||||
-rw-r--r-- | src/components/Form/People/RegisterPersonForm.tsx | 10 |
4 files changed, 46 insertions, 21 deletions
diff --git a/src/Interfaces/dummies.ts b/src/Interfaces/dummies.ts new file mode 100644 index 0000000..2d7c713 --- /dev/null +++ b/src/Interfaces/dummies.ts @@ -0,0 +1,38 @@ +import { Item, NewItem, Address } from "./interfaces" + +export const DummyItem: Item = { + Model: "", + Description: "", + Quantity: 0, + UnitPrice: 0, + TotalValue: 0, + Discount: 0, + DiscountValue: 0, + HSN: "", + TotalGST: 0, + SGST: 0, + CGST: 0, + IGST: 0, + TotalGSTValue: 0, + Brand: "", + Category: "" +} + +export const DummyNewItem: NewItem = { + Model: "", + Description: "", + UnitPrice: 0, + HSN: "", + TotalGST: 0, + Brand: "", + Category: "" +} + +export const DummyAddress: Address = { + AddressLine: "", + City: "", + State: "", + PINCode: "", + Country: "" +} + diff --git a/src/components/Form/Address/NewAddressPane.tsx b/src/components/Form/Address/NewAddressPane.tsx index 4dd3788..f1b9a63 100644 --- a/src/components/Form/Address/NewAddressPane.tsx +++ b/src/components/Form/Address/NewAddressPane.tsx @@ -6,7 +6,7 @@ * Copyright (c) 2021 Vidhu Kant Sharma */ -import React, { Dispatch, SetStateAction, useState } from "react"; +import React, { Dispatch, SetStateAction } from "react"; import "./../Form.scss"; import { Address } from "./../../../Interfaces/interfaces" 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 ( diff --git a/src/components/Form/People/RegisterPersonForm.tsx b/src/components/Form/People/RegisterPersonForm.tsx index 9c8752d..b702ef9 100644 --- a/src/components/Form/People/RegisterPersonForm.tsx +++ b/src/components/Form/People/RegisterPersonForm.tsx @@ -9,6 +9,7 @@ import React, { useState } from "react"; import NewAddressPane from "./../Address/NewAddressPane" import { Person, Address } from "./../../../Interfaces/interfaces" +import { DummyAddress } from "../../../Interfaces/dummies"; import axios from "axios"; import "./../Form.scss"; @@ -22,15 +23,10 @@ const RegisterPersonForm: React.FC<props> = (props) => { const [newPersonPhone, setNewPersonPhone] = useState<string>(""); const [newPersonEmail, setNewPersonEmail] = useState<string>(""); + const [newPersonBillAddress, setNewPersonBillAddress] = useState<Address>(DummyAddress); + const [shipToBillAddress, setShipToBillAddress] = useState<boolean>(true); - const [newPersonBillAddress, setNewPersonBillAddress] = useState<Address>({ - AddressLine: "", - City: "", - State: "", - PINCode: "", - Country: "" - }) const hideSelf = () => props.setVisibility(false); |