diff --git a/modules/customer-invoices/src/common/locales/en.json b/modules/customer-invoices/src/common/locales/en.json index 0d79d937..9442ac88 100644 --- a/modules/customer-invoices/src/common/locales/en.json +++ b/modules/customer-invoices/src/common/locales/en.json @@ -71,9 +71,9 @@ "title": "Invoice details", "description": "" }, - "basic_into": { + "basic_info": { "title": "Invoice information", - "description": "" + "description": "Basic invoice information" }, "totals": { "title": "Invoice totals", diff --git a/modules/customer-invoices/src/common/locales/es.json b/modules/customer-invoices/src/common/locales/es.json index 772de02b..dbbfef18 100644 --- a/modules/customer-invoices/src/common/locales/es.json +++ b/modules/customer-invoices/src/common/locales/es.json @@ -72,9 +72,9 @@ "title": "Detalles de la factura", "description": "" }, - "basic_into": { + "basic_info": { "title": "Información de la factura", - "description": "" + "description": "Información básica de la factura" }, "totals": { "title": "Totales de la factura", diff --git a/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx b/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx index 5c2c73d1..f2110a34 100644 --- a/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx +++ b/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx @@ -25,28 +25,19 @@ export const CustomerInvoiceEditForm = ({ return (
-
-
- -
-
- -
+
+
-
-
- -
- - -
- -
- +
+ +
+
+ +
diff --git a/modules/customer-invoices/src/web/components/editor/invoice-basic-info-fields.tsx b/modules/customer-invoices/src/web/components/editor/invoice-basic-info-fields.tsx index 967464f6..312890e0 100644 --- a/modules/customer-invoices/src/web/components/editor/invoice-basic-info-fields.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-basic-info-fields.tsx @@ -1,13 +1,8 @@ import { DatePickerInputField, - Description, - Field, - FieldGroup, - Fieldset, - Legend, TextField } from "@repo/rdx-ui/components"; -import { FileTextIcon } from "lucide-react"; +import { FieldDescription, FieldGroup, FieldLegend, FieldSet } from '@repo/shadcn-ui/components'; import { ComponentProps } from 'react'; import { useFormContext } from "react-hook-form"; import { useTranslation } from "../../i18n"; @@ -17,86 +12,64 @@ export const InvoiceBasicInfoFields = (props: ComponentProps<"fieldset">) => { const { t } = useTranslation(); const { control } = useFormContext(); - return ( -
- - {t("form_groups.basic_into.title")} - +
+ + {t("form_groups.basic_info.title")} + + {t("form_groups.basic_info.description")} - {t("form_groups.basic_into.description")} - - - - - - - + + - - - + - - - + + - - - - - - - - + -
+
); -}; +}; \ No newline at end of file diff --git a/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx b/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx index 9d6d186c..f62829e5 100644 --- a/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx @@ -1,25 +1,25 @@ -import { Rows4Icon } from "lucide-react"; -import { Description, FieldGroup, Fieldset, Legend } from '@repo/rdx-ui/components'; +import { FieldDescription, FieldGroup, FieldLegend, FieldSet } from '@repo/shadcn-ui/components'; import { ComponentProps } from 'react'; import { useTranslation } from '../../i18n'; import { ItemsEditor } from "./items"; -export const InvoiceItems = ({ className, ...props }: ComponentProps<"fieldset">) => { +export const InvoiceItems = (props: ComponentProps<"fieldset">) => { const { t } = useTranslation(); return ( -
- - {t('form_groups.items.title')} - +
+ + {t('form_groups.items.title')} + + {t("form_groups.items.description")} - {t("form_groups.items.description")} -
+ +
); }; diff --git a/modules/customer-invoices/src/web/components/editor/invoice-notes.tsx b/modules/customer-invoices/src/web/components/editor/invoice-notes.tsx index 9fd452ad..c4db98b8 100644 --- a/modules/customer-invoices/src/web/components/editor/invoice-notes.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-notes.tsx @@ -1,4 +1,5 @@ -import { Description, FieldGroup, Fieldset, Legend, TextAreaField } from "@repo/rdx-ui/components"; +import { TextAreaField } from "@repo/rdx-ui/components"; +import { FieldDescription, FieldGroup, FieldLegend, FieldSet } from '@repo/shadcn-ui/components'; import { StickyNoteIcon } from "lucide-react"; import { ComponentProps } from 'react'; import { useFormContext } from "react-hook-form"; @@ -10,12 +11,12 @@ export const InvoiceNotes = (props: ComponentProps<"fieldset">) => { const { control } = useFormContext(); return ( -
- - {t("form_groups.basic_into.title")} - +
+ + {t("form_groups.basic_info.title")} + - {t("form_groups.basic_into.description")} + {t("form_groups.basic_info.description")} ) => { description={t("form_fields.notes.description")} /> -
+
); }; diff --git a/modules/customer-invoices/src/web/components/editor/invoice-tax-summary.tsx b/modules/customer-invoices/src/web/components/editor/invoice-tax-summary.tsx index 78e76f25..4064ea3f 100644 --- a/modules/customer-invoices/src/web/components/editor/invoice-tax-summary.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-tax-summary.tsx @@ -1,6 +1,5 @@ import { formatCurrency } from '@erp/core'; -import { Description, FieldGroup, Fieldset, Legend } from "@repo/rdx-ui/components"; -import { Badge } from "@repo/shadcn-ui/components"; +import { Badge, FieldDescription, FieldGroup, FieldLegend, FieldSet } from '@repo/shadcn-ui/components'; import { ReceiptIcon } from "lucide-react"; import { ComponentProps } from 'react'; import { useFormContext, useWatch } from "react-hook-form"; @@ -23,45 +22,47 @@ export const InvoiceTaxSummary = (props: ComponentProps<"fieldset">) => { const displayTaxes = taxes || []; return ( -
- - {t("form_groups.tax_resume.title")} - + +
+ + {t("form_groups.tax_resume.title")} + - {t("form_groups.tax_resume.description")} - -
- {displayTaxes.map((tax, index) => ( + {t("form_groups.tax_resume.description")} + +
+ {displayTaxes.map((tax, index) => ( -
-
- - {tax.tax_label} - -
-
-
- Base para el impuesto: - {formatCurrency(tax.taxable_amount, 2, currency_code, language_code)} +
+
+ + {tax.tax_label} +
-
- Importe de impuesto: - - {formatCurrency(tax.taxes_amount, 2, currency_code, language_code)} - +
+
+ Base para el impuesto: + {formatCurrency(tax.taxable_amount, 2, currency_code, language_code)} +
+
+ Importe de impuesto: + + {formatCurrency(tax.taxes_amount, 2, currency_code, language_code)} + +
-
- ))} + ))} - {displayTaxes.length === 0 && ( -
- -

No hay impuestos aplicados

-
- )} -
- -
+ {displayTaxes.length === 0 && ( +
+ +

No hay impuestos aplicados

+
+ )} + +
+
+ ); }; diff --git a/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx b/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx index 34d8d1de..5c653993 100644 --- a/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-totals.tsx @@ -1,6 +1,5 @@ import { formatCurrency } from "@erp/core"; -import { Description, FieldGroup, Fieldset, Legend } from "@repo/rdx-ui/components"; -import { Separator } from "@repo/shadcn-ui/components"; +import { FieldDescription, FieldGroup, FieldLegend, FieldSet, Separator } from '@repo/shadcn-ui/components'; import { ReceiptIcon } from "lucide-react"; import { ComponentProps } from "react"; import { useFormContext, useWatch } from "react-hook-form"; @@ -22,12 +21,12 @@ export const InvoiceTotals = (props: ComponentProps<"fieldset">) => { return ( -
- +
+ {t("form_groups.totals.title")} - + - {t("form_groups.totals.description")} + {t("form_groups.totals.description")} {/* Sección: Subtotal y Descuentos */}
@@ -145,6 +144,6 @@ export const InvoiceTotals = (props: ComponentProps<"fieldset">) => {
-
+
); }; diff --git a/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx b/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx index 8da6a706..c7fe7a5c 100644 --- a/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx +++ b/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx @@ -1,7 +1,6 @@ -import { Description, FieldGroup, Fieldset, Legend } from "@repo/rdx-ui/components"; +import { FieldDescription, FieldGroup, FieldLegend, FieldSet } from '@repo/shadcn-ui/components'; import { useFormContext } from "react-hook-form"; -import { UserIcon } from "lucide-react"; import { ComponentProps } from 'react'; import { useTranslation } from "../../../i18n"; import { RecipientModalSelectorField } from "./recipient-modal-selector-field"; @@ -14,18 +13,18 @@ export const InvoiceRecipient = (props: ComponentProps<"fieldset">) => { const recipient = getValues('recipient'); return ( -
- - {t("form_groups.customer.title")} - - {t("form_groups.customer.description")} - +
+ + {t('form_groups.recipient.title')} + + {t("form_groups.recipient.description")} + -
+
); }; diff --git a/modules/customer-invoices/src/web/components/page-header.tsx b/modules/customer-invoices/src/web/components/page-header.tsx index d9438ae2..82b9c21b 100644 --- a/modules/customer-invoices/src/web/components/page-header.tsx +++ b/modules/customer-invoices/src/web/components/page-header.tsx @@ -28,7 +28,7 @@ export function PageHeader({ icon, title, description, status, rightSlot, classN {icon &&
{icon}
}
-

{title}

+

{title}

{status && }
{description &&

{description}

} diff --git a/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx b/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx index cedfaec6..e0f185eb 100644 --- a/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx +++ b/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx @@ -3,7 +3,7 @@ import { UnsavedChangesProvider, useHookForm } from "@erp/core/hooks"; -import { AppContent, AppHeader } from "@repo/rdx-ui/components"; +import { AppBreadcrumb, AppContent, AppHeader } from "@repo/rdx-ui/components"; import { showErrorToast, showSuccessToast } from "@repo/rdx-ui/helpers"; import { FilePenIcon } from "lucide-react"; import { useMemo } from 'react'; @@ -86,9 +86,10 @@ export const InvoiceUpdateComp = ({ return ( + } + icon={} rightSlot={ { const { control } = useFormContext(); return ( -
- {t("form_groups.preferences.title")} - {t("form_groups.preferences.description")} +
+ {t("form_groups.preferences.title")} + {t("form_groups.preferences.description")} { /> -
+
); }; diff --git a/modules/customers/src/web/components/editor/customer-address-fields.tsx b/modules/customers/src/web/components/editor/customer-address-fields.tsx index 53d35bfc..4cc9ccf3 100644 --- a/modules/customers/src/web/components/editor/customer-address-fields.tsx +++ b/modules/customers/src/web/components/editor/customer-address-fields.tsx @@ -1,12 +1,8 @@ import { - Description, - Field, - FieldGroup, - Fieldset, - Legend, SelectField, - TextField, + TextField } from "@repo/rdx-ui/components"; +import { Field, FieldDescription, FieldGroup, FieldLegend, FieldSet } from '@repo/shadcn-ui/components'; import { useFormContext } from "react-hook-form"; import { COUNTRY_OPTIONS } from "../../constants"; import { useTranslation } from "../../i18n"; @@ -17,9 +13,9 @@ export const CustomerAddressFields = () => { const { control } = useFormContext(); return ( -
- {t("form_groups.address.title")} - {t("form_groups.address.description")} +
+ {t("form_groups.address.title")} + {t("form_groups.address.description")} { /> -
+
); }; diff --git a/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx b/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx index 11e2bb1c..612692be 100644 --- a/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx +++ b/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx @@ -1,21 +1,16 @@ import { - Description, - Field, - FieldGroup, - Fieldset, - Legend, TextAreaField, - TextField, + TextField } from "@repo/rdx-ui/components"; import { - FormControl, + Field, FieldDescription, FieldGroup, FieldLegend, FieldSet, FormControl, FormField, FormItem, FormLabel, FormMessage, RadioGroup, - RadioGroupItem, -} from "@repo/shadcn-ui/components"; + RadioGroupItem +} from '@repo/shadcn-ui/components'; import { Controller, useFormContext, useWatch } from "react-hook-form"; import { CustomerInvoiceTaxesMultiSelect } from '../../../../../customer-invoices/src/web/components'; import { useTranslation } from "../../i18n"; @@ -32,9 +27,9 @@ export const CustomerBasicInfoFields = () => { }); return ( -
- {t("form_groups.basic_info.title")} - {t("form_groups.basic_info.description")} +
+ {t("form_groups.basic_info.title")} + {t("form_groups.basic_info.description")} { description={t("form_fields.legal_record.description")} /> -
+
); }; diff --git a/modules/customers/src/web/components/editor/customer-contact-fields.tsx b/modules/customers/src/web/components/editor/customer-contact-fields.tsx index 64c8948a..9b43619e 100644 --- a/modules/customers/src/web/components/editor/customer-contact-fields.tsx +++ b/modules/customers/src/web/components/editor/customer-contact-fields.tsx @@ -1,17 +1,11 @@ import { - Description, - Field, - FieldGroup, - Fieldset, - Legend, - TextField, + TextField } from "@repo/rdx-ui/components"; import { Collapsible, CollapsibleContent, - CollapsibleTrigger, - Separator, -} from "@repo/shadcn-ui/components"; + CollapsibleTrigger, Field, FieldDescription, FieldGroup, FieldLegend, FieldSet, Separator +} from '@repo/shadcn-ui/components'; import { AtSignIcon, ChevronDown, GlobeIcon, PhoneIcon, SmartphoneIcon } from "lucide-react"; import { useState } from "react"; @@ -24,9 +18,9 @@ export const CustomerContactFields = () => { const { control } = useFormContext(); return ( -
- {t("form_groups.contact_info.title")} - {t("form_groups.contact_info.description")} +
+ {t("form_groups.contact_info.title")} + {t("form_groups.contact_info.description")} { -
+
); }; diff --git a/packages/rdx-ui/src/components/form/TextAreaField.tsx b/packages/rdx-ui/src/components/form/TextAreaField.tsx index e0e9095b..0b280517 100644 --- a/packages/rdx-ui/src/components/form/TextAreaField.tsx +++ b/packages/rdx-ui/src/components/form/TextAreaField.tsx @@ -1,116 +1,77 @@ // DatePickerField.tsx import { - FormControl, - FormDescription, - FormField, - FormItem, - FormLabel, - FormMessage, + Field, + FieldDescription, + FieldError, + FieldLabel, Textarea, } from "@repo/shadcn-ui/components"; -import { cn } from "@repo/shadcn-ui/lib/utils"; -import { Control, FieldPath, FieldValues, useController } from "react-hook-form"; -import { useTranslation } from "../../locales/i18n.ts"; +import { cn } from '@repo/shadcn-ui/lib/utils'; +import { Control, Controller, FieldPath, FieldValues, useFormState } from "react-hook-form"; import { CommonInputProps } from "./types.js"; type TextAreaFieldProps = CommonInputProps & { control: Control; name: FieldPath; - label?: string; - placeholder?: string; - description?: string; - disabled?: boolean; - required?: boolean; - readOnly?: boolean; - className?: string; - /** Contador de caracteres (si usas maxLength) */ - showCounter?: boolean; - maxLength?: number; - rows?: number; + label?: string; + description?: string; + + orientation?: "vertical" | "horizontal" | "responsive", + + inputClassName?: string; }; export function TextAreaField({ control, name, label, - placeholder, description, - disabled = false, required = false, readOnly = false, + + orientation = 'vertical', + className, - showCounter = false, - maxLength, - rows = 3 + inputClassName, + + ...inputRest }: TextAreaFieldProps) { - const { t } = useTranslation(); - const isDisabled = disabled || readOnly; - const { field, fieldState } = useController({ control, name }); - - const describedById = description ? `${name}-desc` : undefined; - const errorId = fieldState.error ? `${name}-err` : undefined; - - const valueLength = (field.value?.length ?? 0) as number; + const { isSubmitting, isValidating } = useFormState({ control, name }); + const disabled = isSubmitting || inputRest.disabled; return ( - ( - - {label && ( -
-
- - {label} - - {required && ( - {t("common.required")} - )} -
- {/* Punto “unsaved” */} - {fieldState.isDirty && ( - {t("common.modified")} - )} -
- )} - + render={({ field, fieldState }) => { + return ( + + {label && {label}} +