From dd47f209a2c40176848e3707688c58b2e6945a0e Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 11 Nov 2021 14:46:05 +0100 Subject: [PATCH] feat(descriptor-menu): handle error empty input --- modules/invoiceOut/front/descriptor-menu/index.html | 6 ++---- modules/invoiceOut/front/descriptor-menu/index.js | 6 ++++++ modules/invoiceOut/front/descriptor-menu/locale/es.yml | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/invoiceOut/front/descriptor-menu/index.html b/modules/invoiceOut/front/descriptor-menu/index.html index be1fa7b21..dbfd5fe82 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.html +++ b/modules/invoiceOut/front/descriptor-menu/index.html @@ -111,8 +111,7 @@ Are you sure you want to send it? + ng-model="sendPdfConfirmation.data.email"> @@ -130,8 +129,7 @@ Are you sure you want to send it? + ng-model="sendCsvConfirmation.data.email"> diff --git a/modules/invoiceOut/front/descriptor-menu/index.js b/modules/invoiceOut/front/descriptor-menu/index.js index 6f764a3d0..b6e7e0261 100644 --- a/modules/invoiceOut/front/descriptor-menu/index.js +++ b/modules/invoiceOut/front/descriptor-menu/index.js @@ -80,6 +80,9 @@ class Controller extends Section { } sendPdfInvoice($data) { + if (!$data.email) + return this.vnApp.showError(this.$t(`The email can't be empty`)); + return this.vnEmail.send('invoice', { recipientId: this.invoiceOut.client.id, recipient: $data.email, @@ -88,6 +91,9 @@ class Controller extends Section { } sendCsvInvoice($data) { + if (!$data.email) + return this.vnApp.showError(this.$t(`The email can't be empty`)); + return this.vnEmail.sendCsv('invoice', { recipientId: this.invoiceOut.client.id, recipient: $data.email, diff --git a/modules/invoiceOut/front/descriptor-menu/locale/es.yml b/modules/invoiceOut/front/descriptor-menu/locale/es.yml index 8a4a09db1..616fb2fa0 100644 --- a/modules/invoiceOut/front/descriptor-menu/locale/es.yml +++ b/modules/invoiceOut/front/descriptor-menu/locale/es.yml @@ -17,4 +17,5 @@ Are you sure you want to clone this invoice?: Estas seguro de clonar esta factur InvoiceOut booked: Factura asentada Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura? Regenerate PDF invoice: Regenerar PDF factura -The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado \ No newline at end of file +The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado +The email can't be empty: El correo no puede estar vacĂ­o \ No newline at end of file