diff --git a/modules/core/src/web/components/page-header.tsx b/modules/core/src/web/components/page-header.tsx index c5f848c3..814bc0b1 100644 --- a/modules/core/src/web/components/page-header.tsx +++ b/modules/core/src/web/components/page-header.tsx @@ -6,43 +6,39 @@ import type { ReactNode } from "react"; interface PageHeaderProps { - /** Icono que aparece a la izquierda del título */ - icon?: ReactNode; - /** Contenido del título (texto plano o nodo complejo) */ + backIcon?: ReactNode; title: ReactNode; - /** Descripción secundaria debajo del título */ description?: ReactNode; - /** Estado opcional (ej. "draft", "paid") */ status?: string; - /** Contenido del lado derecho (botones, menús, etc.) */ rightSlot?: ReactNode; className?: string; } -export function PageHeader({ icon, title, description, status, rightSlot, className }: PageHeaderProps) { +export function PageHeader({ backIcon, title, description, rightSlot, className }: PageHeaderProps) { return ( -
-
- {/* Lado izquierdo */} -
- - {icon &&
{icon}
} + )} -
-
-

{title}

-
- {description &&

{description}

} -
+
+

{title}

+ {description &&

{description}

}
- - {/* Lado derecho parametrizable */} - {rightSlot &&
{rightSlot}
}
+ {/* Lado derecho parametrizable */} + {rightSlot && <>{rightSlot}}
); } diff --git a/modules/customer-invoices/src/common/locales/en.json b/modules/customer-invoices/src/common/locales/en.json index cd1e4a81..67845065 100644 --- a/modules/customer-invoices/src/common/locales/en.json +++ b/modules/customer-invoices/src/common/locales/en.json @@ -34,7 +34,7 @@ "title": "Customer invoices", "description": "Manage your customer invoices", "list": { - "title": "Customer invoice list", + "title": "Customer invoices", "description": "List all customer invoices", "grid_columns": { "invoice_number": "Inv. number", diff --git a/modules/customer-invoices/src/common/locales/es.json b/modules/customer-invoices/src/common/locales/es.json index 6d63d19e..978ebc83 100644 --- a/modules/customer-invoices/src/common/locales/es.json +++ b/modules/customer-invoices/src/common/locales/es.json @@ -33,7 +33,7 @@ "title": "Facturas de clientes", "description": "Gestiona tus facturas de clientes", "list": { - "title": "Listado de facturas de clientes", + "title": "Facturas de clientes", "description": "Lista todas las facturas de clientes", "grid_columns": { "invoice_number": "Nº factura", diff --git a/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx b/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx index 84fef8a2..c84b5c18 100644 --- a/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx +++ b/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx @@ -81,30 +81,24 @@ export const InvoiceListPage = () => { } - - +
+ +
+ } />
-
-
-

{t("pages.list.title")}

-

{t("pages.list.description")}

-
-
- -
-
+
navigate(-1)} /> - - - } /> @@ -106,7 +105,7 @@ export const InvoiceUpdateComp = ({ formId="invoice-update-form" onSubmit={handleSubmit} onError={handleError} - className="max-w-full" + className="bg-white rounded-xl border shadow-xl max-w-full" /> diff --git a/modules/customer-invoices/src/web/pages/update/invoice-update-form.tsx b/modules/customer-invoices/src/web/pages/update/invoice-update-form.tsx index b7fb421d..99e07cc5 100644 --- a/modules/customer-invoices/src/web/pages/update/invoice-update-form.tsx +++ b/modules/customer-invoices/src/web/pages/update/invoice-update-form.tsx @@ -9,7 +9,7 @@ interface InvoiceUpdateFormProps { formId: string; onSubmit: (data: InvoiceFormData) => void; onError: (errors: FieldErrors) => void; - className: string; + className?: string; } export const InvoiceUpdateForm = ({ @@ -22,7 +22,7 @@ export const InvoiceUpdateForm = ({ return (
-
+
diff --git a/modules/customers/src/web/components/editor/customer-edit-form.tsx b/modules/customers/src/web/components/editor/customer-edit-form.tsx index 7e4d5a6c..3f1c9ff3 100644 --- a/modules/customers/src/web/components/editor/customer-edit-form.tsx +++ b/modules/customers/src/web/components/editor/customer-edit-form.tsx @@ -1,6 +1,7 @@ import { FormDebug } from "@erp/core/components"; import { FieldErrors, useFormContext } from "react-hook-form"; +import { cn } from '@repo/shadcn-ui/lib/utils'; import { CustomerFormData } from "../../schemas"; import { CustomerAdditionalConfigFields } from "./customer-additional-config-fields"; import { CustomerAddressFields } from "./customer-address-fields"; @@ -11,24 +12,27 @@ interface CustomerFormProps { formId: string; onSubmit: (data: CustomerFormData) => void; onError: (errors: FieldErrors) => void; + className?: string; } -export const CustomerEditForm = ({ formId, onSubmit, onError }: CustomerFormProps) => { +export const CustomerEditForm = ({ formId, onSubmit, onError, className }: CustomerFormProps) => { const form = useFormContext(); return ( -
-
- +
+
+
+ +
+
+ + + + +
-
- - - - -
-
+
); }; diff --git a/modules/customers/src/web/pages/list/customers-list-page.tsx b/modules/customers/src/web/pages/list/customers-list-page.tsx index b5b47de1..e107221a 100644 --- a/modules/customers/src/web/pages/list/customers-list-page.tsx +++ b/modules/customers/src/web/pages/list/customers-list-page.tsx @@ -1,5 +1,5 @@ import { PageHeader } from '@erp/core/components'; -import { AppBreadcrumb, AppContent, AppHeader, BackHistoryButton, useDebounce } from "@repo/rdx-ui/components"; +import { AppContent, AppHeader, BackHistoryButton, useDebounce } from "@repo/rdx-ui/components"; import { Button } from "@repo/shadcn-ui/components"; import { PlusIcon } from "lucide-react"; import { useMemo, useState } from 'react'; @@ -72,33 +72,25 @@ export const CustomersListPage = () => { return ( <> - } - - +
+ +
+ } />
-
-
-

{t("pages.list.title")}

-

{t("pages.list.description")}

-
-
- -
-
{ if (isLoadError) { return ( <> - + { if (!customerData) return ( <> - + { ); return ( - <> - - - -
-
-

- {t("pages.update.title")} -

-

- {t("pages.update.description")} -

-
+ + + { onBack={() => handleBack()} onReset={() => handleReset()} /> -
- {/* Alerta de error de actualización (si ha fallado el último intento) */} - {isUpdateError && ( - - )} + } + /> + + + {/* Alerta de error de actualización (si ha fallado el último intento) */} + {isUpdateError && ( + + )} + + + + - - - -
- + ); }; diff --git a/modules/customers/src/web/pages/view/customer-view-page.tsx b/modules/customers/src/web/pages/view/customer-view-page.tsx index 45392449..702b3b33 100644 --- a/modules/customers/src/web/pages/view/customer-view-page.tsx +++ b/modules/customers/src/web/pages/view/customer-view-page.tsx @@ -1,8 +1,7 @@ -import { AppContent, BackHistoryButton } from "@repo/rdx-ui/components"; +import { AppContent, AppHeader, BackHistoryButton } from "@repo/rdx-ui/components"; import { Button, Card, CardContent, CardHeader, CardTitle } from "@repo/shadcn-ui/components"; import { Banknote, - Building2, EditIcon, FileText, Globe, @@ -11,11 +10,11 @@ import { MapPin, MoreVertical, Phone, - Smartphone, - User, + Smartphone } from "lucide-react"; import { useNavigate } from "react-router-dom"; +import { PageHeader } from '@erp/core/components'; import { useUrlParamId } from "@erp/core/hooks"; import { Badge } from "@repo/shadcn-ui/components"; import { CustomerEditorSkeleton, ErrorAlert } from "../../components"; @@ -61,28 +60,17 @@ export const CustomerViewPage = () => { return ( <> - -
- {/* Header */} -
-
-
- {customer?.is_company ? ( - - ) : ( - - )} -
-
-

{customer?.name}

-
- - {customer?.reference} - - {customer?.is_company ? "Empresa" : "Persona"} -
-
-
+ + {customer?.name} {customer?.trade_name && ({customer.trade_name})}
)} + description={
+ + {customer?.tin} + + {customer?.is_company ? "Empresa" : "Persona"} +
} + rightSlot={
-
+ } + /> + + + {/* Main Content Grid */} +
+ {/* Información Básica */} + + + + + Información Básica + + + +
+
Nombre
+
{customer?.name}
+
+
+
Referencia
+
+ {customer?.reference} +
+
+
+
Registro Legal
+
{customer?.legal_record}
+
+
+
+ Impuestos por Defecto +
+
+ {customer?.default_taxes.map((tax) => ({tax}))} +
+
+
+
- {/* Main Content Grid */} -
- {/* Información Básica */} - - - - - Información Básica - - - + {/* Dirección */} + + + + + Dirección + + + +
+
Calle
+
+ {customer?.street} + {customer?.street2 && ( + <> +
+ {customer?.street2} + + )} +
+
+
-
Nombre
-
{customer?.name}
+
Ciudad
+
{customer?.city}
-
Referencia
-
- {customer?.reference} -
+
Código Postal
+
{customer?.postal_code}
+
+
+
+
+
Provincia
+
{customer?.province}
-
Registro Legal
-
{customer?.legalRecord}
+
País
+
{customer?.country}
-
-
- Impuestos por Defecto -
-
- {customer?.defaultTax} -
-
- - +
+
+
- {/* Dirección */} - - - - - Dirección - - - -
-
Calle
-
- {customer?.street1} - {customer?.street2 && ( - <> -
- {customer?.street2} - - )} -
-
-
-
-
Ciudad
-
{customer?.city}
-
-
-
Código Postal
-
{customer?.postal_code}
-
-
-
-
-
Provincia
-
{customer?.province}
-
-
-
País
-
{customer?.country}
-
-
-
-
- - {/* Información de Contacto */} - - - - - Información de Contacto - - - -
- {/* Contacto Principal */} -
-

Contacto Principal

- {customer?.email_primary && ( -
- -
-
Email
-
- {customer?.email_primary} -
-
+ {/* Información de Contacto */} + + + + + Información de Contacto + + + +
+ {/* Contacto Principal */} +
+

Contacto Principal

+ {customer?.email_primary && ( +
+ +
+
Email
+
+ {customer?.email_primary} +
- )} - {customer?.mobile_primary && ( -
- -
-
Móvil
-
- {customer?.mobile_primary} -
-
+
+ )} + {customer?.mobile_primary && ( +
+ +
+
Móvil
+
+ {customer?.mobile_primary} +
- )} - {customer?.phone_primary && ( -
- -
-
Teléfono
-
- {customer?.phone_primary} -
-
-
- )} -
- - {/* Contacto Secundario */} -
-

Contacto Secundario

- {customer?.email_secondary && ( -
- -
-
Email
-
- {customer?.email_secondary} -
-
-
- )} - {customer?.mobile_secondary && ( -
- -
-
Móvil
-
- {customer?.mobile_secondary} -
-
-
- )} - {customer?.phone_secondary && ( -
- -
-
Teléfono
-
- {customer?.phone_secondary} -
-
-
- )} -
- - {/* Otros Contactos */} - {(customer?.website || customer?.fax) && ( -
-

Otros

-
- {customer?.website && ( -
- -
-
- Sitio Web -
-
- - {customer?.website} - -
-
-
- )} - {customer?.fax && ( -
- -
-
Fax
-
{customer?.fax}
-
-
- )} +
+ )} + {customer?.phone_primary && ( +
+ +
+
Teléfono
+
+ {customer?.phone_primary} +
)}
- - - {/* Preferencias */} - - - - - Preferencias - - - -
-
- -
-
- Idioma Preferido -
-
{customer?.language_code}
+ {/* Contacto Secundario */} +
+

Contacto Secundario

+ {customer?.email_secondary && ( +
+ +
+
Email
+
+ {customer?.email_secondary} +
+
+
+ )} + {customer?.mobile_secondary && ( +
+ +
+
Móvil
+
+ {customer?.mobile_secondary} +
+
+
+ )} + {customer?.phone_secondary && ( +
+ +
+
Teléfono
+
+ {customer?.phone_secondary} +
+
+
+ )} +
+ + {/* Otros Contactos */} + {(customer?.website || customer?.fax) && ( +
+

Otros

+
+ {customer?.website && ( +
+ +
+
+ Sitio Web +
+
+ + {customer?.website} + +
+
+
+ )} + {customer?.fax && ( +
+ +
+
Fax
+
{customer?.fax}
+
+
+ )}
-
- -
-
- Moneda Preferida -
-
{customer?.currency_code}
-
+ )} +
+ + + + {/* Preferencias */} + + + + + Preferencias + + + +
+
+ +
+
+ Idioma Preferido +
+
{customer?.language_code}
- - -
+
+ +
+
+ Moneda Preferida +
+
{customer?.currency_code}
+
+
+
+ +
- + ); }; diff --git a/packages/rdx-ui/src/components/layout/app-header.tsx b/packages/rdx-ui/src/components/layout/app-header.tsx index 6de4ee09..d7f67f3c 100644 --- a/packages/rdx-ui/src/components/layout/app-header.tsx +++ b/packages/rdx-ui/src/components/layout/app-header.tsx @@ -7,7 +7,7 @@ export const AppHeader = ({ ...props }: PropsWithChildren<{ className?: string }>) => { return ( -
+
{children}
); diff --git a/packages/rdx-ui/src/components/layout/app-layout.tsx b/packages/rdx-ui/src/components/layout/app-layout.tsx index 17efa962..5f36be74 100644 --- a/packages/rdx-ui/src/components/layout/app-layout.tsx +++ b/packages/rdx-ui/src/components/layout/app-layout.tsx @@ -14,7 +14,7 @@ export const AppLayout = () => { > {/* Aquí está el MAIN */} - +