diff --git a/modules/customers/src/common/dto/request/create-customer.request.dto.ts b/modules/customers/src/common/dto/request/create-customer.request.dto.ts index 1f19d889..f3ab592d 100644 --- a/modules/customers/src/common/dto/request/create-customer.request.dto.ts +++ b/modules/customers/src/common/dto/request/create-customer.request.dto.ts @@ -15,10 +15,15 @@ export const CreateCustomerRequestSchema = z.object({ city: z.string().default(""), province: z.string().default(""), postal_code: z.string().default(""), - country: z.string().default(""), + country: z.string().default("es"), + + email_primary: z.string().default(""), + email_secondary: z.string().default(""), + phone_primary: z.string().default(""), + phone_secondary: z.string().default(""), + mobile_primary: z.string().default(""), + mobile_secondary: z.string().default(""), - email: z.string().default(""), - phone: z.string().default(""), fax: z.string().default(""), website: z.string().default(""), diff --git a/modules/customers/src/common/dto/request/update-customer-by-id.request.dto.ts b/modules/customers/src/common/dto/request/update-customer-by-id.request.dto.ts index 5bd4a7df..4b3e87ca 100644 --- a/modules/customers/src/common/dto/request/update-customer-by-id.request.dto.ts +++ b/modules/customers/src/common/dto/request/update-customer-by-id.request.dto.ts @@ -19,8 +19,13 @@ export const UpdateCustomerByIdRequestSchema = z.object({ postal_code: z.string().optional(), country: z.string().optional(), - email: z.string().optional(), - phone: z.string().optional(), + email_primary: z.string().optional(), + email_secondary: z.string().optional(), + phone_primary: z.string().optional(), + phone_secondary: z.string().optional(), + mobile_primary: z.string().optional(), + mobile_secondary: z.string().optional(), + fax: z.string().optional(), website: z.string().optional(), diff --git a/modules/customers/src/web/pages/update/customer-additional-config-fields.tsx b/modules/customers/src/web/pages/update/customer-additional-config-fields.tsx index cd417889..1fa39ba3 100644 --- a/modules/customers/src/web/pages/update/customer-additional-config-fields.tsx +++ b/modules/customers/src/web/pages/update/customer-additional-config-fields.tsx @@ -7,13 +7,15 @@ import { CardHeader, CardTitle, } from "@repo/shadcn-ui/components"; -import { useForm } from "react-hook-form"; +import { Control } from "react-hook-form"; import { CURRENCY_OPTIONS, LANGUAGE_OPTIONS } from "../../constants"; import { useTranslation } from "../../i18n"; +import { CustomerUpdateData } from "../../schemas"; -export const CustomerAdditionalConfigFields = () => { +export const CustomerAdditionalConfigFields = ({ + control, +}: { control: Control }) => { const { t } = useTranslation(); - const { control } = useForm(); return ( diff --git a/modules/customers/src/web/pages/update/customer-address-fields.tsx b/modules/customers/src/web/pages/update/customer-address-fields.tsx index f879b1c7..3034a822 100644 --- a/modules/customers/src/web/pages/update/customer-address-fields.tsx +++ b/modules/customers/src/web/pages/update/customer-address-fields.tsx @@ -6,10 +6,12 @@ import { CardHeader, CardTitle, } from "@repo/shadcn-ui/components"; +import { Control } from "react-hook-form"; import { COUNTRY_OPTIONS } from "../../constants"; import { useTranslation } from "../../i18n"; +import { CustomerUpdateData } from "../../schemas"; -export function CustomerAddressFields({ control }: { control: any }) { +export const CustomerAddressFields = ({ control }: { control: Control }) => { const { t } = useTranslation(); return ( @@ -75,4 +77,4 @@ export function CustomerAddressFields({ control }: { control: any }) { ); -} +}; diff --git a/modules/customers/src/web/pages/update/customer-basic-info-fields.tsx b/modules/customers/src/web/pages/update/customer-basic-info-fields.tsx index d2717525..c232489c 100644 --- a/modules/customers/src/web/pages/update/customer-basic-info-fields.tsx +++ b/modules/customers/src/web/pages/update/customer-basic-info-fields.tsx @@ -14,9 +14,11 @@ import { RadioGroup, RadioGroupItem, } from "@repo/shadcn-ui/components"; +import { Control } from "react-hook-form"; import { useTranslation } from "../../i18n"; +import { CustomerUpdateData } from "../../schemas"; -export const CustomerBasicInfoFields = ({ control }: { control: any }) => { +export const CustomerBasicInfoFields = ({ control }: { control: Control }) => { const { t } = useTranslation(); return ( diff --git a/modules/customers/src/web/pages/update/customer-contact-fields.tsx b/modules/customers/src/web/pages/update/customer-contact-fields.tsx index d43d9b69..c0a1b92e 100644 --- a/modules/customers/src/web/pages/update/customer-contact-fields.tsx +++ b/modules/customers/src/web/pages/update/customer-contact-fields.tsx @@ -12,9 +12,11 @@ import { import { TextField } from "@repo/rdx-ui/components"; import { ChevronDown, MailIcon, PhoneIcon, SmartphoneIcon } from "lucide-react"; import { useState } from "react"; +import { Control } from "react-hook-form"; import { useTranslation } from "../../i18n"; +import { CustomerUpdateData } from "../../schemas"; -export function CustomerContactFields({ control }: { control: any }) { +export const CustomerContactFields = ({ control }: { control: Control }) => { const { t } = useTranslation(); const [open, setOpen] = useState(true); @@ -137,4 +139,4 @@ export function CustomerContactFields({ control }: { control: any }) { ); -} +}; diff --git a/modules/customers/src/web/pages/update/customer-edit-form.tsx b/modules/customers/src/web/pages/update/customer-edit-form.tsx index 3492328a..adde4ba2 100644 --- a/modules/customers/src/web/pages/update/customer-edit-form.tsx +++ b/modules/customers/src/web/pages/update/customer-edit-form.tsx @@ -1,12 +1,3 @@ -import { - Card, - CardContent, - CardDescription, - CardFooter, - CardHeader, - CardTitle, -} from "@repo/shadcn-ui/components"; - import { zodResolver } from "@hookform/resolvers/zod"; import { FieldErrors, useForm } from "react-hook-form"; @@ -86,45 +77,4 @@ export const CustomerEditForm = ({ defaultValues, onSubmit, isPending }: Custome ); - - return ( -
- - -
-
- - - {t("form_groups.basic_info.title")} - {t("form_groups.basic_info.description")} - - - - - -

 

-
-
-
-
- -
-
- - - ); - - return ( -
- - -
- - - - -
- - - ); };