diff --git a/apps/server/package.json b/apps/server/package.json index 14d91a29..779219c3 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -61,7 +61,7 @@ "pg-hstore": "^2.3.4", "reflect-metadata": "^0.2.2", "response-time": "^2.3.3", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "shallow-equal-object": "^1.1.1", "ts-node": "^10.9.1", "uuid": "^11.0.5", diff --git a/apps/web/package.json b/apps/web/package.json index 3ab16ce7..60520f86 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -40,11 +40,11 @@ "axios": "^1.9.0", "dinero.js": "^1.9.1", "react-error-boundary": "^6.0.0", - "react-hook-form": "^7.56.4", + "react-hook-form": "^7.72.1", "react-i18next": "^15.0.1", "react-router-dom": "^6.26.0", "react-secure-storage": "^1.3.2", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "tailwindcss": "^4.1.10", "tw-animate-css": "^1.2.9", "vite-plugin-html": "^3.2.2" diff --git a/modules/auth/package.json b/modules/auth/package.json index 228301e9..ecc441aa 100644 --- a/modules/auth/package.json +++ b/modules/auth/package.json @@ -32,7 +32,7 @@ "@repo/rdx-ui": "workspace:*", "@repo/shadcn-ui": "workspace:*", "@tanstack/react-query": "^5.90.6", - "react-hook-form": "^7.56.2", + "react-hook-form": "^7.72.1", "react-router-dom": "^6.26.0", "react-secure-storage": "^1.3.2" } diff --git a/modules/core/package.json b/modules/core/package.json index e4ef1f9e..fab9150a 100644 --- a/modules/core/package.json +++ b/modules/core/package.json @@ -47,10 +47,10 @@ "http-status": "^2.1.0", "lucide-react": "^0.577.0", "mime-types": "^3.0.1", - "react-hook-form": "^7.58.1", + "react-hook-form": "^7.72.1", "react-i18next": "^15.5.1", "react-router-dom": "^6.26.0", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "zod": "^4.1.11" } } \ No newline at end of file diff --git a/modules/customer-invoices/package.json b/modules/customer-invoices/package.json index ad247af8..74077ccf 100644 --- a/modules/customer-invoices/package.json +++ b/modules/customer-invoices/package.json @@ -55,11 +55,11 @@ "libphonenumber-js": "^1.12.7", "lucide-react": "^0.577.0", "pg-hstore": "^2.3.4", - "react-hook-form": "^7.58.1", + "react-hook-form": "^7.72.1", "react-i18next": "^15.5.1", "react-qr-code": "^2.0.18", "react-router-dom": "^6.26.0", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "zod": "^4.1.11" } } \ No newline at end of file diff --git a/modules/customers/package.json b/modules/customers/package.json index 110b7423..989ea915 100644 --- a/modules/customers/package.json +++ b/modules/customers/package.json @@ -45,10 +45,10 @@ "express": "^4.18.2", "lucide-react": "^0.577.0", "react-data-table-component": "^7.7.0", - "react-hook-form": "^7.58.1", + "react-hook-form": "^7.72.1", "react-i18next": "^16.2.4", "react-router-dom": "^6.26.0", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "use-debounce": "^10.0.5", "zod": "^4.1.11" } diff --git a/modules/customers/src/api/domain/aggregates/customer.aggregate.ts b/modules/customers/src/api/domain/aggregates/customer.aggregate.ts index 8ac18328..bbb89c1c 100644 --- a/modules/customers/src/api/domain/aggregates/customer.aggregate.ts +++ b/modules/customers/src/api/domain/aggregates/customer.aggregate.ts @@ -58,7 +58,7 @@ export type CustomerPatchProps = Partial< // Customer export interface ICustomer { // comportamiento - update(partialCustomer: CustomerPatchProps): Result; + update(partialCustomer: CustomerPatchProps): Result; // propiedades (getters) readonly isIndividual: boolean; @@ -148,7 +148,7 @@ export class Customer extends AggregateRoot implements IC return new Customer(props, id); } - public update(partialCustomer: CustomerPatchProps): Result { + public update(partialCustomer: CustomerPatchProps): Result { const { address: partialAddress, ...rest } = partialCustomer; Object.assign(this.props, rest); diff --git a/modules/customers/src/api/infrastructure/persistence/sequelize/repositories/customer.repository.ts b/modules/customers/src/api/infrastructure/persistence/sequelize/repositories/customer.repository.ts index a5427728..75eb6d84 100644 --- a/modules/customers/src/api/infrastructure/persistence/sequelize/repositories/customer.repository.ts +++ b/modules/customers/src/api/infrastructure/persistence/sequelize/repositories/customer.repository.ts @@ -11,7 +11,7 @@ import type { FindOptions, InferAttributes, OrderItem, Sequelize, Transaction } import type { CustomerSummary, ICustomerRepository } from "../../../../application"; import type { Customer } from "../../../../domain"; -import type { SequelizeCustomerDomainMapper, SequelizeCustomerSummaryMapper } from "../../mappers"; +import type { SequelizeCustomerDomainMapper, SequelizeCustomerSummaryMapper } from "../mappers"; import { CustomerModel } from "../models/sequelize-customer.model"; export class CustomerRepository diff --git a/modules/customers/src/web/shared/constants/customer.constants.ts b/modules/customers/src/web/shared/constants/customer.constants.ts new file mode 100644 index 00000000..180eaed4 --- /dev/null +++ b/modules/customers/src/web/shared/constants/customer.constants.ts @@ -0,0 +1,28 @@ +export const COUNTRY_OPTIONS = [ + { value: "es", label: "España" }, + { value: "fr", label: "Francia" }, + { value: "de", label: "Alemania" }, + { value: "it", label: "Italia" }, + { value: "pt", label: "Portugal" }, + { value: "us", label: "Estados Unidos" }, + { value: "mx", label: "México" }, + { value: "ar", label: "Argentina" }, +] as const; + +export const LANGUAGE_OPTIONS = [ + { value: "es", label: "Español" }, + { value: "en", label: "Inglés" }, + { value: "fr", label: "Francés" }, + { value: "de", label: "Alemán" }, + { value: "it", label: "Italiano" }, + { value: "pt", label: "Portugués" }, +] as const; + +export const CURRENCY_OPTIONS = [ + { value: "EUR", label: "Euro" }, + { value: "USD", label: "Dólar estadounidense" }, + { value: "GBP", label: "Libra esterlina" }, + { value: "ARS", label: "Peso argentino" }, + { value: "MXN", label: "Peso mexicano" }, + { value: "JPY", label: "Yen japonés" }, +] as const; diff --git a/modules/customers/src/web/shared/constants/index.ts b/modules/customers/src/web/shared/constants/index.ts new file mode 100644 index 00000000..1186e595 --- /dev/null +++ b/modules/customers/src/web/shared/constants/index.ts @@ -0,0 +1 @@ +export * from "./customer.constants"; diff --git a/modules/customers/src/web/shared/index.ts b/modules/customers/src/web/shared/index.ts index da2a3add..1eaf2d7a 100644 --- a/modules/customers/src/web/shared/index.ts +++ b/modules/customers/src/web/shared/index.ts @@ -1,4 +1,5 @@ export * from "./api"; +export * from "./constants"; export * from "./entities"; export * from "./hooks"; export * from "./ui"; diff --git a/modules/customers/src/web/update/ui/editor/customer-additional-config-fields.tsx b/modules/customers/src/web/update/ui/editor/customer-additional-config-fields.tsx index 454b92a3..2d16ba23 100644 --- a/modules/customers/src/web/update/ui/editor/customer-additional-config-fields.tsx +++ b/modules/customers/src/web/update/ui/editor/customer-additional-config-fields.tsx @@ -9,8 +9,8 @@ import { import { useFormContext } from "react-hook-form"; import { useTranslation } from "../../../i18n"; -import { CURRENCY_OPTIONS, LANGUAGE_OPTIONS } from "../../constants"; -import type { CustomerFormData } from "../../schemas"; +import { CURRENCY_OPTIONS, LANGUAGE_OPTIONS } from "../../../shared"; +import type { CustomerFormData } from "../../types"; interface CustomerAdditionalConfigFieldsProps { className?: string; diff --git a/modules/customers/src/web/update/ui/editor/customer-address-fields.tsx b/modules/customers/src/web/update/ui/editor/customer-address-fields.tsx index 816cfb69..a870d724 100644 --- a/modules/customers/src/web/update/ui/editor/customer-address-fields.tsx +++ b/modules/customers/src/web/update/ui/editor/customer-address-fields.tsx @@ -9,8 +9,8 @@ import { import { useFormContext } from "react-hook-form"; import { useTranslation } from "../../../i18n"; -import { COUNTRY_OPTIONS } from "../../constants"; -import type { CustomerFormData } from "../../schemas"; +import { COUNTRY_OPTIONS } from "../../../shared"; +import type { CustomerFormData } from "../../types"; interface CustomerAddressFieldsProps { className?: string; diff --git a/modules/customers/src/web/update/ui/editor/customer-basic-info-fields.tsx b/modules/customers/src/web/update/ui/editor/customer-basic-info-fields.tsx index 62dcfb88..5450817e 100644 --- a/modules/customers/src/web/update/ui/editor/customer-basic-info-fields.tsx +++ b/modules/customers/src/web/update/ui/editor/customer-basic-info-fields.tsx @@ -1,30 +1,23 @@ -import { TextAreaField, TextField } from "@repo/rdx-ui/components"; +import { RadioGroupField, TextAreaField, TextField } from "@repo/rdx-ui/components"; import { Field, FieldDescription, + FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSet, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, - RadioGroup, - RadioGroupItem, } from "@repo/shadcn-ui/components"; import { useEffect } from "react"; import { Controller, useFormContext } from "react-hook-form"; import { useTranslation } from "../../../i18n"; -import type { CustomerFormData } from "../../schemas"; +import type { CustomerFormData } from "../../types"; import { CustomerTaxesMultiSelect } from "./customer-taxes-multi-select"; -interface CustomerBasicInfoFieldsProps { - focusRef?: React.RefObject; - className?: string; +interface CustomerBasicInfoFieldsProps extends React.ComponentProps { + focusRef?: React.RefObject; } export const CustomerBasicInfoFields = ({ @@ -33,82 +26,55 @@ export const CustomerBasicInfoFields = ({ ...props }: CustomerBasicInfoFieldsProps) => { const { t } = useTranslation(); - const { control } = useFormContext(); + const { control, setFocus } = useFormContext(); // Enfoca el primer campo recibido useEffect(() => { - focusRef?.current?.focus?.(); - }, [focusRef]); + setFocus("name"); + }, [setFocus]); return (
{t("form_groups.basic_info.title")} {t("form_groups.basic_info.description")} - - - + - - ( - - {t("form_fields.customer_type.label")} - - { - field.onChange(value === "false" ? "false" : "true"); - }} - > - - - - - - {t("form_fields.customer_type.company")} - - - - - - - - {t("form_fields.customer_type.individual")} - - - - - - - )} - /> - + - - - + ( - - + + {t("form_fields.default_taxes.label")} + + {t("form_fields.default_taxes.description")} + )} /> } - label={t("form_fields.email_primary.label")} name="email_primary" placeholder={t("form_fields.email_primary.placeholder")} required @@ -48,13 +48,13 @@ export const CustomerContactFields = ({ className, ...props }: CustomerContactFi className="lg:col-span-2" control={control} description={t("form_fields.mobile_primary.description")} - icon={ + label={t("form_fields.mobile_primary.label")} + leftIcon={ } - label={t("form_fields.mobile_primary.label")} name="mobile_primary" placeholder={t("form_fields.mobile_primary.placeholder")} typePreset="phone" @@ -64,10 +64,10 @@ export const CustomerContactFields = ({ className, ...props }: CustomerContactFi className="lg:col-span-2" control={control} description={t("form_fields.phone_primary.description")} - icon={ + label={t("form_fields.phone_primary.label")} + leftIcon={ } - label={t("form_fields.phone_primary.label")} name="phone_primary" placeholder={t("form_fields.phone_primary.placeholder")} typePreset="phone" @@ -79,10 +79,10 @@ export const CustomerContactFields = ({ className, ...props }: CustomerContactFi className="lg:col-span-2 lg:col-start-1" control={control} description={t("form_fields.email_secondary.description")} - icon={ + label={t("form_fields.email_secondary.label")} + leftIcon={ } - label={t("form_fields.email_secondary.label")} name="email_secondary" placeholder={t("form_fields.email_secondary.placeholder")} typePreset="email" @@ -92,13 +92,13 @@ export const CustomerContactFields = ({ className, ...props }: CustomerContactFi className="lg:col-span-2" control={control} description={t("form_fields.mobile_secondary.description")} - icon={ + label={t("form_fields.mobile_secondary.label")} + leftIcon={ } - label={t("form_fields.mobile_secondary.label")} name="mobile_secondary" placeholder={t("form_fields.mobile_secondary.placeholder")} typePreset="phone" @@ -107,10 +107,10 @@ export const CustomerContactFields = ({ className, ...props }: CustomerContactFi className="lg:col-span-2" control={control} description={t("form_fields.phone_secondary.description")} - icon={ + label={t("form_fields.phone_secondary.label")} + leftIcon={ } - label={t("form_fields.phone_secondary.label")} name="phone_secondary" placeholder={t("form_fields.phone_secondary.placeholder")} typePreset="phone" @@ -134,13 +134,13 @@ export const CustomerContactFields = ({ className, ...props }: CustomerContactFi className="lg:col-span-2" control={control} description={t("form_fields.website.description")} - icon={ + label={t("form_fields.website.label")} + leftIcon={ } - label={t("form_fields.website.label")} name="website" placeholder={t("form_fields.website.placeholder")} typePreset="text" diff --git a/modules/customers/src/web/update/ui/editor/customer-edit-form.tsx b/modules/customers/src/web/update/ui/editor/customer-edit-form.tsx index 0cb8baac..8a87def9 100644 --- a/modules/customers/src/web/update/ui/editor/customer-edit-form.tsx +++ b/modules/customers/src/web/update/ui/editor/customer-edit-form.tsx @@ -17,7 +17,7 @@ export const CustomerEditForm = ({ formId, onSubmit, className, focusRef }: Cust return (
-
+
diff --git a/modules/factuges/package.json b/modules/factuges/package.json index 9ce01968..8a8d7e2c 100644 --- a/modules/factuges/package.json +++ b/modules/factuges/package.json @@ -28,7 +28,7 @@ "@repo/rdx-logger": "workspace:*", "@repo/rdx-utils": "workspace:*", "express": "^4.18.2", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "zod": "^4.1.11" } } \ No newline at end of file diff --git a/modules/supplier-invoices/package.json b/modules/supplier-invoices/package.json index ce8d7eb5..3347d16e 100644 --- a/modules/supplier-invoices/package.json +++ b/modules/supplier-invoices/package.json @@ -27,7 +27,7 @@ "@repo/rdx-logger": "workspace:*", "@repo/rdx-utils": "workspace:*", "express": "^4.18.2", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "zod": "^4.1.11" } } \ No newline at end of file diff --git a/modules/supplier/package.json b/modules/supplier/package.json index ec254afb..6e67e2a8 100644 --- a/modules/supplier/package.json +++ b/modules/supplier/package.json @@ -27,7 +27,7 @@ "@repo/rdx-logger": "workspace:*", "@repo/rdx-utils": "workspace:*", "express": "^4.18.2", - "sequelize": "^6.37.5", + "sequelize": "^6.37.8", "zod": "^4.1.11" } } \ No newline at end of file diff --git a/package.json b/package.json index e9793694..4527531c 100644 --- a/package.json +++ b/package.json @@ -37,5 +37,5 @@ "engines": { "node": ">=24" }, - "packageManager": "pnpm@10.29.3" + "packageManager": "pnpm@10.33.0" } \ No newline at end of file diff --git a/packages/rdx-criteria/package.json b/packages/rdx-criteria/package.json index fc2e1fb6..0863c405 100644 --- a/packages/rdx-criteria/package.json +++ b/packages/rdx-criteria/package.json @@ -18,6 +18,6 @@ "typescript": "^5.9.3" }, "dependencies": { - "sequelize": "^6.37.5" + "sequelize": "^6.37.8" } } \ No newline at end of file diff --git a/packages/rdx-ui/src/components/form/DatePickerField.tsx b/packages/rdx-ui/src/components/form/DatePickerField.tsx deleted file mode 100644 index e5878826..00000000 --- a/packages/rdx-ui/src/components/form/DatePickerField.tsx +++ /dev/null @@ -1,106 +0,0 @@ -// DatePickerField.tsx - -import { - Button, - Calendar, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, - Popover, - PopoverContent, - PopoverTrigger, -} from "@repo/shadcn-ui/components"; -import { CalendarIcon, LockIcon } from "lucide-react"; - -import { cn } from "@repo/shadcn-ui/lib/utils"; -import { format } from "date-fns"; -import { Control, FieldPath, FieldValues } from "react-hook-form"; -import { useTranslation } from "../../locales/i18n.ts"; - -type DatePickerFieldProps = { - control: Control; - name: FieldPath; - label?: string; - placeholder?: string; - description?: string; - disabled?: boolean; - required?: boolean; - readOnly?: boolean; - className?: string; - formatDateFn?: (iso: string) => string; -}; - -export function DatePickerField({ - control, - name, - label, - placeholder, - description, - disabled = false, - required = false, - readOnly = false, - className, - formatDateFn = (iso) => format(new Date(iso), "dd/MM/yyyy"), -}: DatePickerFieldProps) { - const { t } = useTranslation(); - const isDisabled = disabled || readOnly; - - return ( - ( - - {label && ( -
- {label} - {required && {t("common.required")}} -
- )} - - - - - - - - { - if (!readOnly) { - field.onChange(date?.toISOString()); - } - }} - initialFocus - /> - - - -

- {description || "\u00A0"} -

- -
- )} - /> - ); -} diff --git a/packages/rdx-ui/src/components/form/TextAreaField.tsx b/packages/rdx-ui/src/components/form/TextAreaField.tsx deleted file mode 100644 index 4f992a2c..00000000 --- a/packages/rdx-ui/src/components/form/TextAreaField.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import { - Field, - FieldDescription, - FieldError, - FieldLabel, - Textarea, -} from "@repo/shadcn-ui/components"; -import { cn } from "@repo/shadcn-ui/lib/utils"; -import { - type Control, - Controller, - type FieldPath, - type FieldValues, - useFormState, -} from "react-hook-form"; - -import type { CommonInputProps } from "./types.js"; - -type TextAreaFieldProps = CommonInputProps & { - control: Control; - name: FieldPath; - label?: string; - required?: boolean; - readOnly?: boolean; - description?: string; - - orientation?: "vertical" | "horizontal" | "responsive"; - - inputClassName?: string; -}; - -export function TextAreaField({ - control, - name, - label, - description, - required = false, - readOnly = false, - - orientation = "vertical", - - className, - inputClassName, - - ...inputRest -}: TextAreaFieldProps) { - const { isSubmitting } = useFormState({ control, name }); - const disabled = isSubmitting || inputRest.disabled; - - return ( - { - return ( - - {label && {label}} - -