From 8c906c98b2a2994286731357831ca8005ef0d73f Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Sun, 8 Aug 2021 16:11:08 +0530 Subject: Added better support for saving client data --- src/components/Form/People/RegisterPersonForm.tsx | 149 +++++++++++++++------- 1 file changed, 104 insertions(+), 45 deletions(-) (limited to 'src/components/Form/People/RegisterPersonForm.tsx') diff --git a/src/components/Form/People/RegisterPersonForm.tsx b/src/components/Form/People/RegisterPersonForm.tsx index 9e3b155..3922975 100644 --- a/src/components/Form/People/RegisterPersonForm.tsx +++ b/src/components/Form/People/RegisterPersonForm.tsx @@ -8,7 +8,7 @@ import React, { useState } from "react"; import "./../Form.scss"; -import { Person } from "./../../../interfaces" +import { Person, Address } from "./../../../interfaces" import axios from "axios"; interface props { @@ -18,9 +18,14 @@ interface props { const RegisterPersonForm: React.FC = (props) => { const [newPersonName, setNewPersonName] = useState(""); - const [newPersonAddress, setNewPersonAddress] = useState(""); - const [newPersonEmail, setNewPersonEmail] = useState(""); const [newPersonPhone, setNewPersonPhone] = useState(""); + const [newPersonEmail, setNewPersonEmail] = useState(""); + + const [newPersonBillAddressLine, setNewPersonBillAddressLine] = useState(""); + const [newPersonBillCity, setNewPersonBillCity] = useState(""); + const [newPersonBillState, setNewPersonBillState] = useState(""); + const [newPersonBillPINCode, setNewPersonBillPINCode] = useState(""); + const [newPersonBillCountry, setNewPersonBillCountry] = useState(""); const hideSelf = () => props.setVisibility(false); @@ -32,9 +37,25 @@ const RegisterPersonForm: React.FC = (props) => { const newClient: Person = { Name: newPersonName, - Address: newPersonAddress, Phone: newPersonPhone, - Email: newPersonEmail + Email: newPersonEmail, + + BillAddress: { + AddressLine: newPersonBillAddressLine, + City: newPersonBillCity, + State: newPersonBillState, + PINCode: newPersonBillPINCode, + Country: newPersonBillCountry + }, + + // currently same as BillAddress + ShipAddress: { + AddressLine: newPersonBillAddressLine, + City: newPersonBillCity, + State: newPersonBillState, + PINCode: newPersonBillPINCode, + Country: newPersonBillCountry + }, } // TODO: show confirmation before being invisible @@ -57,46 +78,84 @@ const RegisterPersonForm: React.FC = (props) => {
-
- - - - - - - -
- -
- hideSelf()} /> - - +
+
+ + + + + +
+ +
+

Billing Address

+ + + + + + + + + + +
+ +
+ hideSelf()} /> + + +
-- cgit v1.2.3