From 990e0850f21be5d542623239ac07427f860fa4b2 Mon Sep 17 00:00:00 2001 From: David Arranz Date: Tue, 13 Aug 2024 18:20:02 +0200 Subject: [PATCH] =?UTF-8?q?AL=20hacer=20una=20cotizaci=C3=B3n,=20no=20se?= =?UTF-8?q?=20rellenan=20los=20campos=20por=20defecto=20de=20forma=20de=20?= =?UTF-8?q?pago,=20notas,=20etc...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/app/quotes/create.tsx | 2 +- .../sales/application/Quote/CreateQuote.useCase.ts | 14 ++++++++++---- .../reportQuote/reporter/ReportQuote.reporter.ts | 8 ++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/client/src/app/quotes/create.tsx b/client/src/app/quotes/create.tsx index 63d1764..c75ca6d 100644 --- a/client/src/app/quotes/create.tsx +++ b/client/src/app/quotes/create.tsx @@ -41,7 +41,7 @@ export const QuoteCreate = () => { resolver: joiResolver( Joi.object({ reference: Joi.string().required(), - date: Joi.string().required(), + date: Joi.date().required(), customer_information: Joi.string().required(), }), { diff --git a/server/src/contexts/sales/application/Quote/CreateQuote.useCase.ts b/server/src/contexts/sales/application/Quote/CreateQuote.useCase.ts index 8480962..6d1dfc8 100644 --- a/server/src/contexts/sales/application/Quote/CreateQuote.useCase.ts +++ b/server/src/contexts/sales/application/Quote/CreateQuote.useCase.ts @@ -11,7 +11,6 @@ import { ICreateQuote_Request_DTO, IDomainError, Language, - Note, Percentage, Quantity, Result, @@ -165,17 +164,24 @@ export class CreateQuoteUseCase return Result.fail(currencyOrError.error); } - const paymentOrError = Note.create(quoteDTO.payment_method); + const paymentOrError = TextValueObject.create( + quoteDTO.payment_method ?? + this._dealer?.additionalInfo.get("default_payment_method")?.toString() + ); if (paymentOrError.isFailure) { return Result.fail(paymentOrError.error); } - const notesOrError = TextValueObject.create(quoteDTO.notes); + const notesOrError = TextValueObject.create( + quoteDTO.notes ?? this._dealer?.additionalInfo.get("default_notes")?.toString() + ); if (notesOrError.isFailure) { return Result.fail(notesOrError.error); } - const validityOrError = Note.create(quoteDTO.validity); + const validityOrError = TextValueObject.create( + quoteDTO.validity ?? this._dealer?.additionalInfo.get("default_quote_validity")?.toString() + ); if (validityOrError.isFailure) { return Result.fail(validityOrError.error); } diff --git a/server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQuote/reporter/ReportQuote.reporter.ts b/server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQuote/reporter/ReportQuote.reporter.ts index 06ca685..ab5d091 100644 --- a/server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQuote/reporter/ReportQuote.reporter.ts +++ b/server/src/contexts/sales/infrastructure/express/controllers/quotes/reportQuote/reporter/ReportQuote.reporter.ts @@ -92,10 +92,10 @@ const map = (quote: Quote, context: ISalesContext) => { currency_code: dealer?.currency.code, lang_code: dealer?.language.code, contact_information: dealer?.additionalInfo.get("contact_information"), - default_payment_method: dealer?.additionalInfo.get("contact_information"), - default_notes: dealer?.additionalInfo.get("contact_information"), - default_legal_terms: dealer?.additionalInfo.get("contact_information"), - default_quote_validity: dealer?.additionalInfo.get("contact_information"), + default_payment_method: dealer?.additionalInfo.get("default_payment_method"), + default_notes: dealer?.additionalInfo.get("default_notes"), + default_legal_terms: dealer?.additionalInfo.get("default_legal_terms"), + default_quote_validity: dealer?.additionalInfo.get("default_quote_validity"), }, }; };