diff --git a/modules/customer-invoices/src/common/locales/en.json b/modules/customer-invoices/src/common/locales/en.json index cce92015..019a6157 100644 --- a/modules/customer-invoices/src/common/locales/en.json +++ b/modules/customer-invoices/src/common/locales/en.json @@ -176,9 +176,15 @@ "description": "Create a new customer proforma", "back_to_list": "Back to the list" }, - "edit": { + "update": { "title": "Edit customer proforma", - "description": "Edit the selected customer proforma" + "description": "Edit the selected customer proforma", + "load_error.message": "Please try again later", + "load_error.title": "Unable to load the proforma", + "not_found_msg": "Check the identifier or go back to the list", + "not_found_title": "Proforma not found", + "error_msg": "Check the data and try again.", + "error_title": "Unable to save the changes" }, "delete": { "title": "Delete customer proforma", @@ -222,137 +228,141 @@ } }, "form_groups": { - "customer": { - "title": "Customer", - "description": "Select the customer for this proforma." - }, - "items": { - "title": "Proforma details", - "description": "" - }, - "basic_info": { - "title": "Proforma information", - "description": "Basic proforma information" - }, - "totals": { - "title": "Proforma totals", - "description": "Breakdown of proforma amounts with discounts and taxes." - }, - "tax_resume": { - "title": "Resumen de impuestos", - "description": "" - }, - "preferences": { - "title": "Preferences", - "description": "Additional proforma settings" + "proformas": { + "customer": { + "title": "Customer", + "description": "Select the customer for this proforma." + }, + "items": { + "title": "Proforma details", + "description": "" + }, + "basic_info": { + "title": "Proforma information", + "description": "Basic proforma information" + }, + "totals": { + "title": "Proforma totals", + "description": "Breakdown of proforma amounts with discounts and taxes." + }, + "tax_resume": { + "title": "Resumen de impuestos", + "description": "" + }, + "preferences": { + "title": "Preferences", + "description": "Additional proforma settings" + } } }, "form_fields": { - "status": { - "label": "Estado", - "placeholder": "", - "description": "" - }, - "invoice_number": { - "label": "Proforma number", - "placeholder": "", - "description": "" - }, - "invoice_date": { - "label": "Proforma date", - "placeholder": "Select a date", - "description": "Proforma date" - }, - "series": { - "label": "Serie", - "placeholder": "", - "description": "Proforma serie" - }, - "operation_date": { - "label": "Operation date", - "placeholder": "Select a date", - "description": "Proforma operation date" - }, - "reference": { - "label": "Reference", - "placeholder": "Reference of the proforma", - "description": "Reference of the proforma" - }, - "description": { - "label": "Description", - "placeholder": "Description of the proforma", - "description": "General description of the proforma" - }, - "subtotal_amount": { - "label": "Subtotal", - "placeholder": "", - "desc": "Proforma subtotal" - }, - "discount": { - "label": "Discount (%)", - "placeholder": "", - "desc": "Percentage discount" - }, - "discount_amount": { - "label": "Discount price", - "placeholder": "", - "desc": "Percentage discount price" - }, - "total_amount": { - "label": "Total price", - "placeholder": "", - "desc": "Proforma total price" - }, - "notes": { - "label": "Notes", - "placeholder": "Additional notes about the proforma", - "description": "Additional notes that can be included in the proforma" - }, - "item": { - "quantity": { - "label": "Quantity", + "proformas": { + "status": { + "label": "Estado", "placeholder": "", "description": "" }, + "invoice_number": { + "label": "Proforma number", + "placeholder": "", + "description": "" + }, + "invoice_date": { + "label": "Proforma date", + "placeholder": "Select a date", + "description": "Proforma date" + }, + "series": { + "label": "Serie", + "placeholder": "", + "description": "Proforma serie" + }, + "operation_date": { + "label": "Operation date", + "placeholder": "Select a date", + "description": "Proforma operation date" + }, + "reference": { + "label": "Reference", + "placeholder": "Reference of the proforma", + "description": "Reference of the proforma" + }, "description": { "label": "Description", - "placeholder": "", - "description": "" + "placeholder": "Description of the proforma", + "description": "General description of the proforma" }, - "unit_amount": { - "label": "Unit price", + "subtotal_amount": { + "label": "Subtotal", "placeholder": "", - "description": "Item unit price" + "desc": "Proforma subtotal" }, - "discount_percentage": { - "label": "Dto (%)", + "discount": { + "label": "Discount (%)", "placeholder": "", - "description": "Percentage discount" + "desc": "Percentage discount" }, "discount_amount": { - "label": "Discount amount", + "label": "Discount price", "placeholder": "", - "description": "Percentage discount amount" - }, - "taxable_amount": { - "label": "Taxable amount", - "placeholder": "", - "description": "" - }, - "tax_codes": { - "label": "Taxes", - "placeholder": "", - "description": "Taxes" - }, - "taxes_amount": { - "label": "Taxes amount", - "placeholder": "", - "description": "Percentage taxes amount" + "desc": "Percentage discount price" }, "total_amount": { - "label": "Total amount", + "label": "Total price", "placeholder": "", - "description": "Proforma line total" + "desc": "Proforma total price" + }, + "notes": { + "label": "Notes", + "placeholder": "Additional notes about the proforma", + "description": "Additional notes that can be included in the proforma" + }, + "item": { + "quantity": { + "label": "Quantity", + "placeholder": "", + "description": "" + }, + "description": { + "label": "Description", + "placeholder": "", + "description": "" + }, + "unit_amount": { + "label": "Unit price", + "placeholder": "", + "description": "Item unit price" + }, + "discount_percentage": { + "label": "Dto (%)", + "placeholder": "", + "description": "Percentage discount" + }, + "discount_amount": { + "label": "Discount amount", + "placeholder": "", + "description": "Percentage discount amount" + }, + "taxable_amount": { + "label": "Taxable amount", + "placeholder": "", + "description": "" + }, + "tax_codes": { + "label": "Taxes", + "placeholder": "", + "description": "Taxes" + }, + "taxes_amount": { + "label": "Taxes amount", + "placeholder": "", + "description": "Percentage taxes amount" + }, + "total_amount": { + "label": "Total amount", + "placeholder": "", + "description": "Proforma line total" + } } } }, diff --git a/modules/customer-invoices/src/common/locales/es.json b/modules/customer-invoices/src/common/locales/es.json index ab8fcddf..5f1d2c43 100644 --- a/modules/customer-invoices/src/common/locales/es.json +++ b/modules/customer-invoices/src/common/locales/es.json @@ -177,9 +177,15 @@ "description": "Crear una nueva proforma", "back_to_list": "Volver al listado" }, - "edit": { + "update": { "title": "Editar proforma", - "description": "Editar la proforma seleccionada" + "description": "Editar la proforma seleccionada", + "load_error.message": "Inténtalo de nuevo más tarde", + "load_error.title": "No se pudo cargar la proforma", + "not_found_msg": "Revisa el identificador o vuelve al listado", + "not_found_title": "Proforma no encontrada", + "error_msg": "Revisa los datos e inténtalo de nuevo.", + "error_title": "No se pudo guardar los cambios" }, "delete": { "title": "Eliminar proforma", @@ -223,128 +229,132 @@ } }, "form_groups": { - "customer": { - "title": "Cliente", - "description": "Selecciona el cliente para esta proforma" - }, - "items": { - "title": "Detalles de la proforma", - "description": "" - }, - "basic_info": { - "title": "Información de la proforma", - "description": "Información básica de la proforma" - }, - "totals": { - "title": "Totales de la proforma", - "description": "Desglose de los importes de la proforma con descuentos e impuestos." - }, - "preferences": { - "title": "Preferencias", - "description": "Configuraciones adicionales de la proforma" + "proformas": { + "customer": { + "title": "Cliente", + "description": "Selecciona el cliente para esta proforma" + }, + "items": { + "title": "Detalles de la proforma", + "description": "" + }, + "basic_info": { + "title": "Información de la proforma", + "description": "Información básica de la proforma" + }, + "totals": { + "title": "Totales de la proforma", + "description": "Desglose de los importes de la proforma con descuentos e impuestos." + }, + "preferences": { + "title": "Preferencias", + "description": "Configuraciones adicionales de la proforma" + } } }, "form_fields": { - "invoice_number": { - "label": "Número de proforma", - "placeholder": "", - "description": "" - }, - "invoice_date": { - "label": "Fecha", - "placeholder": "Selecciona una fecha", - "description": "Fecha de emisión de la proforma" - }, - "series": { - "label": "Serie", - "placeholder": "", - "description": "" - }, - "operation_date": { - "label": "Fecha de operación", - "placeholder": "Selecciona una fecha", - "description": "Fecha de la operación de la proforma" - }, - "reference": { - "label": "Referencia", - "placeholder": "Referencia de la proforma", - "description": "Referencia de la proforma" - }, - "description": { - "label": "Descripción", - "placeholder": "Descripción de la proforma", - "description": "Descripción general de la proforma" - }, - "subtotal_amount": { - "label": "Subtotal", - "placeholder": "", - "desc": "Subtotal de la proforma" - }, - "discount": { - "label": "Descuento (%)", - "placeholder": "", - "desc": "Porcentaje de descuento" - }, - "discount_amount": { - "label": "Importe del descuento", - "placeholder": "", - "desc": "Importe del descuento porcentual" - }, - "total_amount": { - "label": "Precio total", - "placeholder": "", - "desc": "Precio total de la proforma" - }, - "notes": { - "label": "Notas", - "placeholder": "Notas adicionales sobre la proforma", - "description": "Notas adicionales que se pueden incluir en la proforma" - }, - "item": { - "quantity": { - "label": "Cantidad", + "proformas": { + "invoice_number": { + "label": "Número de proforma", "placeholder": "", "description": "" }, + "invoice_date": { + "label": "Fecha", + "placeholder": "Selecciona una fecha", + "description": "Fecha de emisión de la proforma" + }, + "series": { + "label": "Serie", + "placeholder": "", + "description": "" + }, + "operation_date": { + "label": "Fecha de operación", + "placeholder": "Selecciona una fecha", + "description": "Fecha de la operación de la proforma" + }, + "reference": { + "label": "Referencia", + "placeholder": "Referencia de la proforma", + "description": "Referencia de la proforma" + }, "description": { "label": "Descripción", - "placeholder": "", - "description": "" + "placeholder": "Descripción de la proforma", + "description": "Descripción general de la proforma" }, - "unit_amount": { - "label": "Precio unitario", + "subtotal_amount": { + "label": "Subtotal", "placeholder": "", - "description": "Precio unitario del producto" + "desc": "Subtotal de la proforma" }, - "discount_percentage": { - "label": "Dto (%)", + "discount": { + "label": "Descuento (%)", "placeholder": "", - "description": "Porcentaje de descuento" + "desc": "Porcentaje de descuento" }, "discount_amount": { "label": "Importe del descuento", "placeholder": "", - "description": "Importe del descuento porcentual" - }, - "taxable_amount": { - "label": "Subtotal", - "placeholder": "", - "description": "" - }, - "tax_codes": { - "label": "Impuestos", - "placeholder": "", - "description": "Impuestos" - }, - "taxes_amount": { - "label": "Importe impuestos", - "placeholder": "", - "description": "Importe porcentual de los impuestos" + "desc": "Importe del descuento porcentual" }, "total_amount": { "label": "Precio total", "placeholder": "", - "description": "Precio total con descuento porcentual" + "desc": "Precio total de la proforma" + }, + "notes": { + "label": "Notas", + "placeholder": "Notas adicionales sobre la proforma", + "description": "Notas adicionales que se pueden incluir en la proforma" + }, + "item": { + "quantity": { + "label": "Cantidad", + "placeholder": "", + "description": "" + }, + "description": { + "label": "Descripción", + "placeholder": "", + "description": "" + }, + "unit_amount": { + "label": "Precio unitario", + "placeholder": "", + "description": "Precio unitario del producto" + }, + "discount_percentage": { + "label": "Dto (%)", + "placeholder": "", + "description": "Porcentaje de descuento" + }, + "discount_amount": { + "label": "Importe del descuento", + "placeholder": "", + "description": "Importe del descuento porcentual" + }, + "taxable_amount": { + "label": "Subtotal", + "placeholder": "", + "description": "" + }, + "tax_codes": { + "label": "Impuestos", + "placeholder": "", + "description": "Impuestos" + }, + "taxes_amount": { + "label": "Importe impuestos", + "placeholder": "", + "description": "Importe porcentual de los impuestos" + }, + "total_amount": { + "label": "Precio total", + "placeholder": "", + "description": "Precio total con descuento porcentual" + } } } }, diff --git a/modules/customer-invoices/src/web/proformas/update/ui/blocks/index.ts b/modules/customer-invoices/src/web/proformas/update/ui/blocks/index.ts index 28cbd977..bded24a4 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/blocks/index.ts +++ b/modules/customer-invoices/src/web/proformas/update/ui/blocks/index.ts @@ -2,4 +2,3 @@ export * from "./proforma-form-field-shell"; export * from "./proforma-header-fields-card"; export * from "./proforma-header-form-grid"; export * from "./proforma-section-card"; -export * from "./proforma-update-editor-form"; diff --git a/modules/customer-invoices/src/web/proformas/update/ui/editors/index.ts b/modules/customer-invoices/src/web/proformas/update/ui/editors/index.ts index 2c24e86e..8f371dbf 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/editors/index.ts +++ b/modules/customer-invoices/src/web/proformas/update/ui/editors/index.ts @@ -1 +1,2 @@ +export * from "./proforma-update-editor-form"; export * from "./proforma-update-header-editor"; diff --git a/modules/customer-invoices/src/web/proformas/update/ui/blocks/proforma-update-editor-form.tsx b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-editor-form.tsx similarity index 93% rename from modules/customer-invoices/src/web/proformas/update/ui/blocks/proforma-update-editor-form.tsx rename to modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-editor-form.tsx index a76747d9..d4dd9cdf 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/blocks/proforma-update-editor-form.tsx +++ b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-editor-form.tsx @@ -3,11 +3,11 @@ import { Button } from "@repo/shadcn-ui/components"; import { cn } from "@repo/shadcn-ui/lib/utils"; +import { ProformaUpdateHeaderEditor } from "."; + import { useTranslation } from "../../../../i18n"; import type { Proforma } from "../../../shared/entities"; -import { ProformaUpdateHeaderEditor } from "../editors"; - -import { ProformaHeaderFieldsCard } from "./proforma-header-fields-card"; +import { ProformaHeaderFieldsCard } from "../blocks/proforma-header-fields-card"; type ProformaUpdateEditorProps = { formId: string; @@ -37,6 +37,7 @@ export const ProformaUpdateEditorForm = ({ paymentMethodOptions={[]} priceListOptions={[]} salesPersonOptions={[]} + serieOptions={[]} statusOptions={[]} warehouseOptions={[]} /> diff --git a/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-header-editor.tsx b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-header-editor.tsx index fe1d2ed2..0369e115 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-header-editor.tsx +++ b/modules/customer-invoices/src/web/proformas/update/ui/editors/proforma-update-header-editor.tsx @@ -1,4 +1,4 @@ -import { DatePickerField, TextField } from "@repo/rdx-ui/components"; +import { DatePickerField, SelectField, TextField } from "@repo/rdx-ui/components"; import { Input, Select, @@ -21,6 +21,7 @@ interface SelectOption { interface ProformaUpdateHeaderEditorProps { statusOptions: SelectOption[]; + serieOptions: SelectOption[]; customerOptions: SelectOption[]; currencyOptions: SelectOption[]; paymentMethodOptions: SelectOption[]; @@ -33,6 +34,7 @@ interface ProformaUpdateHeaderEditorProps { export const ProformaUpdateHeaderEditor = ({ statusOptions, + serieOptions, customerOptions, currencyOptions, paymentMethodOptions, @@ -55,46 +57,46 @@ export const ProformaUpdateHeaderEditor = ({ return (
- diff --git a/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.tsx b/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.tsx index 656b76c8..7442cafa 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.tsx +++ b/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.tsx @@ -8,8 +8,8 @@ import { FormProvider } from "react-hook-form"; import { useTranslation } from "../../../../i18n"; import { useUpdateProformaPageController } from "../../controllers/use-update-proforma-page-controller"; -import { ProformaUpdateEditorForm } from "../blocks"; import { ProformaUpdateSkeleton } from "../components"; +import { ProformaUpdateEditorForm } from "../editors"; export const ProformaUpdatePage = () => { const { t } = useTranslation(); @@ -28,9 +28,9 @@ export const ProformaUpdatePage = () => { message={ updateCtrl.loadError instanceof Error ? updateCtrl.loadError.message - : t("proformas.update.load_error.message", "Inténtalo de nuevo más tarde") + : t("pages.proformas.update.load_error.message", "Inténtalo de nuevo más tarde") } - title={t("proformas.update.load_error.title", "No se pudo cargar la proforma")} + title={t("pages.proformas.update.load_error.title", "No se pudo cargar la proforma")} />
@@ -45,8 +45,11 @@ export const ProformaUpdatePage = () => { <> @@ -57,7 +60,7 @@ export const ProformaUpdatePage = () => { { }} /> } - title={t("pages.update.title")} + title={t("pages.proformas.update.title")} /> @@ -83,9 +86,9 @@ export const ProformaUpdatePage = () => { )} diff --git a/packages/rdx-ui/src/components/form/select-field.tsx b/packages/rdx-ui/src/components/form/select-field.tsx index 9bf0d740..4b9bf1f4 100644 --- a/packages/rdx-ui/src/components/form/select-field.tsx +++ b/packages/rdx-ui/src/components/form/select-field.tsx @@ -31,7 +31,7 @@ type SelectFieldProps = { readOnly?: boolean; placeholder?: string; - items: SelectFieldItem[]; + items?: SelectFieldItem[]; orientation?: "vertical" | "horizontal" | "responsive"; @@ -50,7 +50,7 @@ export function SelectField({ readOnly = false, placeholder, - items, + items = [], orientation = "vertical", @@ -66,6 +66,13 @@ export function SelectField({ control={control} name={name} render={({ field, fieldState }) => { + const fieldValue = typeof field.value === "string" ? field.value.trim() : ""; + + const normalizedItems = + fieldValue && !items.some((item) => item.value === fieldValue) + ? [{ value: fieldValue, label: fieldValue }, ...items] + : items; + return ( ({ - {items.map((item) => ( + {normalizedItems.map((item) => ( {item.label} diff --git a/packages/rdx-ui/src/components/layout/site-header.tsx b/packages/rdx-ui/src/components/layout/site-header.tsx index b5b80559..3a0706ce 100644 --- a/packages/rdx-ui/src/components/layout/site-header.tsx +++ b/packages/rdx-ui/src/components/layout/site-header.tsx @@ -15,9 +15,9 @@ export function SiteHeader() { fill="none" height="24" stroke="currentColor" - stroke-linecap="round" - stroke-linejoin="round" - stroke-width="2" + strokeLinecap="round" + strokeLinejoin="round" + strokeWidth="2" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" @@ -39,9 +39,9 @@ export function SiteHeader() { fill="none" height="24" stroke="currentColor" - stroke-linecap="round" - stroke-linejoin="round" - stroke-width="2" + strokeLinecap="round" + strokeLinejoin="round" + strokeWidth="2" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" @@ -57,6 +57,7 @@ export function SiteHeader() { data-size="icon" data-slot="button" data-variant="ghost" + type="button" > +