From dd0cbb8e2955d986de00c3de93b105620400d126 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Mon, 22 Sep 2025 14:57:29 +0330 Subject: [PATCH] fixed: force issues --- src/app/layout.tsx | 2 +- .../FormElements/InputGroup/tag-input.tsx | 2 +- src/components/Tables/companies/index.tsx | 2 +- src/components/forms/admins/CreateAdmin.tsx | 61 ++++++++++--------- .../companies/useCreateCompanyPresenter.ts | 17 +++++- .../forms/customers/CreateCustomer.tsx | 50 ++++++++------- 6 files changed, 78 insertions(+), 56 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 62150e0..26c9ba9 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -12,7 +12,7 @@ import { Providers } from "./providers"; export const metadata: Metadata = { title: { template: "%s | NextAdmin - Next.js Dashboard Kit", - default: "NextAdmin - Next.js Dashboard Kit", + default: "Opp lens - panel", }, description: "Next.js admin dashboard toolkit with 200+ templates, UI components, and integrations for fast dashboard development.", diff --git a/src/components/FormElements/InputGroup/tag-input.tsx b/src/components/FormElements/InputGroup/tag-input.tsx index 1da2cff..084f2cb 100644 --- a/src/components/FormElements/InputGroup/tag-input.tsx +++ b/src/components/FormElements/InputGroup/tag-input.tsx @@ -167,7 +167,7 @@ const TagInput = ({ 0 ? JSON.stringify(tags) : ''} ref={ref} /> diff --git a/src/components/Tables/companies/index.tsx b/src/components/Tables/companies/index.tsx index f3c11de..ebea5d1 100644 --- a/src/components/Tables/companies/index.tsx +++ b/src/components/Tables/companies/index.tsx @@ -67,7 +67,7 @@ const CompaniesTable = ({}: IProps) => { {company.email} - + {formatPhoneNumber(company.phone)} diff --git a/src/components/forms/admins/CreateAdmin.tsx b/src/components/forms/admins/CreateAdmin.tsx index 6fd71e5..d3135de 100644 --- a/src/components/forms/admins/CreateAdmin.tsx +++ b/src/components/forms/admins/CreateAdmin.tsx @@ -116,36 +116,37 @@ const CreateAdminForm: FC = ({ defaultValues, editMode, id }) => {

)} - -
- - {errors.password && ( -

- {errors.password.message} -

- )} -
+ {!editMode && ( +
+ + {errors.password && ( +

+ {errors.password.message} +

+ )} +
+ )}
{ useEffect(() => { if (defaultValues) { - const categories = defaultValues?.tags.categories.map( + const categories = defaultValues?.tags?.categories?.map( (item: any) => item.id, ); setValue("tags.categories", categories); @@ -52,6 +52,19 @@ const useCreateCompanyPresenter = ({ defaultValues, editMode, id }: IProps) => { founded_year: data.founded_year ? +data.founded_year : 0, employee_count: data.employee_count ? +data.employee_count : 0, annual_revenue: data.annual_revenue ? +data.annual_revenue : 0, + tags: { + keywords: data?.tags?.keywords?.length ? data?.tags?.keywords : [], + categories: data?.tags?.categories?.length + ? data?.tags?.categories + : [], + cpv_codes: data?.tags?.cpv_codes?.length ? data?.tags?.cpv_codes : [], + specializations: data?.tags?.specializations?.length + ? data?.tags?.specializations + : [], + certifications: data?.tags?.certifications?.length + ? data?.tags?.certifications + : [], + }, }; if (editMode) { updateCompany({ @@ -61,7 +74,9 @@ const useCreateCompanyPresenter = ({ defaultValues, editMode, id }: IProps) => { } else { createCompany(formattedData as ICreateCompanyCredentials); } + }; + const handleCancel = () => { reset(); router.back(); diff --git a/src/components/forms/customers/CreateCustomer.tsx b/src/components/forms/customers/CreateCustomer.tsx index 3dadf1c..f7ccbce 100644 --- a/src/components/forms/customers/CreateCustomer.tsx +++ b/src/components/forms/customers/CreateCustomer.tsx @@ -108,28 +108,34 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => { placeholder="Select Role" />
-
- - {errors.password && ( -

- {errors.password.message} -

- )} -
+ {!editMode && ( +
+ + {errors.password && ( +

+ {errors.password.message} +

+ )} +
+ )} +