From a57dfe2a02ec08ac3d7a24f0c27e6344d333d145 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 19 Sep 2025 19:25:41 +0200 Subject: [PATCH] Clientes y facturas de cliente --- .../customer-invoice/template copy.hbs | 254 ------------------ .../templates/customer-invoice/template.hbs | 1 - .../api/domain/aggregates/customer-invoice.ts | 7 +- .../express/customer-invoices.routes.ts | 2 +- .../mappers/domain/customer-invoice.mapper.ts | 4 +- .../src/components/layout/app-sidebar.tsx | 8 +- 6 files changed, 9 insertions(+), 267 deletions(-) delete mode 100644 modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template copy.hbs diff --git a/modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template copy.hbs b/modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template copy.hbs deleted file mode 100644 index a5f683cf..00000000 --- a/modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template copy.hbs +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - Factura #{{id}} - - - - - - -
- -
- - - - - - - {{#if any_item_has_discount}} - - {{/if}} - - - - - {{#each items}} - - - - - {{#if ../any_item_has_discount}} - - {{/if}} - - - {{/each}} - - - - - - -
ConceptoCantidadPrecio unidadDto (%)Importe total
-
{{description}}
- {{#if note}}
{{note}}
{{/if}} -
{{quantity}}{{unit_price}}{{discount}}{{total_price}}
* Precios en {{currency}}.
-
- - -
- - - - - -
- - - -
- - - - {{!-- Helpers opcionales esperados por la plantilla --}} - {{!-- - any_item_has_discount: boolean precomputado en tu código - payment_is_direct_debit: boolean si forma de pago es domiciliación - direct_debit_text: texto para el bloque de domiciliación bancaria - currency: ISO o símbolo (EUR, €, etc.) - --}} - - - \ No newline at end of file diff --git a/modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template.hbs b/modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template.hbs index 1d992e01..b7dd4308 100644 --- a/modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template.hbs +++ b/modules/customer-invoices/src/api/application/use-cases/report/reporter/templates/customer-invoice/template.hbs @@ -119,7 +119,6 @@

Factura nº: {{invoice_number}}

Fecha: {{invoice_date}}

-

Página: /

{{recipient.name}}

diff --git a/modules/customer-invoices/src/api/domain/aggregates/customer-invoice.ts b/modules/customer-invoices/src/api/domain/aggregates/customer-invoice.ts index 006fc90f..79581b7b 100644 --- a/modules/customer-invoices/src/api/domain/aggregates/customer-invoice.ts +++ b/modules/customer-invoices/src/api/domain/aggregates/customer-invoice.ts @@ -38,7 +38,7 @@ export interface CustomerInvoiceProps { languageCode: LanguageCode; currencyCode: CurrencyCode; - taxes: Maybe; + taxes: InvoiceTaxes; items: CustomerInvoiceItems; discountPercentage: Percentage; @@ -71,10 +71,7 @@ export class CustomerInvoice currencyCode: props.currencyCode, }); - this._taxes = props.taxes.match( - (taxes) => taxes, - () => InvoiceTaxes.create({}) - ); + this._taxes = props.taxes; } static create(props: CustomerInvoiceProps, id?: UniqueID): Result { diff --git a/modules/customer-invoices/src/api/infrastructure/express/customer-invoices.routes.ts b/modules/customer-invoices/src/api/infrastructure/express/customer-invoices.routes.ts index 242feab0..455965af 100644 --- a/modules/customer-invoices/src/api/infrastructure/express/customer-invoices.routes.ts +++ b/modules/customer-invoices/src/api/infrastructure/express/customer-invoices.routes.ts @@ -115,5 +115,5 @@ export const customerInvoicesRouter = (params: ModuleParams) => { } ); - app.use(`${baseRoutePath}/customer-invoices`, router); + app.use(`${baseRoutePath}/proforma-invoices`, router); }; diff --git a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts index 5e7b619a..30f1a93f 100644 --- a/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts +++ b/modules/customer-invoices/src/api/infrastructure/mappers/domain/customer-invoice.mapper.ts @@ -11,7 +11,7 @@ import { extractOrPushError, maybeFromNullableVO, } from "@repo/rdx-ddd"; -import { Maybe, Result } from "@repo/rdx-utils"; +import { Result } from "@repo/rdx-utils"; import { CustomerInvoice, CustomerInvoiceItems, @@ -243,7 +243,7 @@ export class CustomerInvoiceDomainMapper discountPercentage: attributes.discountPercentage!, - taxes: Maybe.some(taxes), + taxes: taxes, items, }; diff --git a/packages/rdx-ui/src/components/layout/app-sidebar.tsx b/packages/rdx-ui/src/components/layout/app-sidebar.tsx index e08125ae..ec5fb667 100644 --- a/packages/rdx-ui/src/components/layout/app-sidebar.tsx +++ b/packages/rdx-ui/src/components/layout/app-sidebar.tsx @@ -200,8 +200,8 @@ const data2 = { ], }, { - title: "Facturas de cliente", - url: "/customer-invoices", + title: "Proformas de cliente", + url: "/customer-proforma", icon: Bot, items: [ { @@ -219,8 +219,8 @@ const data2 = { ], }, { - title: "Documentation", - url: "#", + title: "Facturas de cliente", + url: "/customer-invoices", icon: BookOpen, items: [ {