From d48b4c4ef3ed97aaf54e0f1e27ec6ed59f631c1f Mon Sep 17 00:00:00 2001 From: pramod mahajan Date: Tue, 5 Aug 2025 02:13:38 +0530 Subject: [PATCH 1/6] initially setup tenant manag. setup wizard-form and properly manage data. handle two sperate form with on wizard --- src/components/Tenanat/ContactInfro.jsx | 107 +++++++++ src/components/Tenanat/OrganizationInfo.jsx | 234 ++++++++++++++++++++ src/components/Tenanat/SubScription.jsx | 9 + src/components/Tenanat/TenantForm.jsx | 133 +++++++++++ src/components/Tenanat/TenantSchema.js | 100 +++++++++ src/components/Tenanat/TenantsList.jsx | 37 ++++ src/components/common/Label.jsx | 12 + src/data/menuData.json | 4 +- src/hooks/useTenant.js | 22 ++ src/pages/Tenant/CreateTenant.jsx | 20 ++ src/pages/Tenant/TenantPage.jsx | 21 ++ src/repositories/TenantRepository.jsx | 10 + src/router/AppRoutes.jsx | 4 + 13 files changed, 711 insertions(+), 2 deletions(-) create mode 100644 src/components/Tenanat/ContactInfro.jsx create mode 100644 src/components/Tenanat/OrganizationInfo.jsx create mode 100644 src/components/Tenanat/SubScription.jsx create mode 100644 src/components/Tenanat/TenantForm.jsx create mode 100644 src/components/Tenanat/TenantSchema.js create mode 100644 src/components/Tenanat/TenantsList.jsx create mode 100644 src/components/common/Label.jsx create mode 100644 src/hooks/useTenant.js create mode 100644 src/pages/Tenant/CreateTenant.jsx create mode 100644 src/pages/Tenant/TenantPage.jsx create mode 100644 src/repositories/TenantRepository.jsx diff --git a/src/components/Tenanat/ContactInfro.jsx b/src/components/Tenanat/ContactInfro.jsx new file mode 100644 index 00000000..34da10c3 --- /dev/null +++ b/src/components/Tenanat/ContactInfro.jsx @@ -0,0 +1,107 @@ +import React from "react"; +import Label from "../common/Label"; +import { useFormContext } from "react-hook-form"; + +const ContactInfro = ({ onNext }) => { + const { + register, + control, + trigger, + formState: { errors }, + } = useFormContext(); + + + const handleNext = async () => { + const valid = await trigger([ + "firstName", + "lastName", + "email", + "contactNumber", + "billingAddress", + ]); + if (valid) { + onNext(); // go to next tab + } + }; + return ( +
+
+ + + {errors.firstName && ( +
{errors.firstName.message}
+ )} +
+
+ + + {errors.lastName && ( +
{errors.lastName.message}
+ )} +
+
+ + + {errors.email && ( +
{errors.email.message}
+ )} +
+
+ + + {errors.contactNumber && ( +
{errors.contactNumber.message}
+ )} +
+
+ +