feat(descriptor-menu): handle error empty input
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-11-11 14:46:05 +01:00
parent 509e002e34
commit dd47f209a2
3 changed files with 10 additions and 5 deletions

View File

@ -111,8 +111,7 @@
<span translate>Are you sure you want to send it?</span> <span translate>Are you sure you want to send it?</span>
<vn-textfield vn-one <vn-textfield vn-one
label="Email" label="Email"
ng-model="sendPdfConfirmation.data.email" ng-model="sendPdfConfirmation.data.email">
required>
</vn-textfield> </vn-textfield>
</tpl-body> </tpl-body>
<tpl-buttons> <tpl-buttons>
@ -130,8 +129,7 @@
<span translate>Are you sure you want to send it?</span> <span translate>Are you sure you want to send it?</span>
<vn-textfield vn-one <vn-textfield vn-one
label="Email" label="Email"
ng-model="sendCsvConfirmation.data.email" ng-model="sendCsvConfirmation.data.email">
required>
</vn-textfield> </vn-textfield>
</tpl-body> </tpl-body>
<tpl-buttons> <tpl-buttons>

View File

@ -80,6 +80,9 @@ class Controller extends Section {
} }
sendPdfInvoice($data) { sendPdfInvoice($data) {
if (!$data.email)
return this.vnApp.showError(this.$t(`The email can't be empty`));
return this.vnEmail.send('invoice', { return this.vnEmail.send('invoice', {
recipientId: this.invoiceOut.client.id, recipientId: this.invoiceOut.client.id,
recipient: $data.email, recipient: $data.email,
@ -88,6 +91,9 @@ class Controller extends Section {
} }
sendCsvInvoice($data) { sendCsvInvoice($data) {
if (!$data.email)
return this.vnApp.showError(this.$t(`The email can't be empty`));
return this.vnEmail.sendCsv('invoice', { return this.vnEmail.sendCsv('invoice', {
recipientId: this.invoiceOut.client.id, recipientId: this.invoiceOut.client.id,
recipient: $data.email, recipient: $data.email,

View File

@ -18,3 +18,4 @@ InvoiceOut booked: Factura asentada
Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura? Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura?
Regenerate PDF invoice: Regenerar PDF factura Regenerate PDF invoice: Regenerar PDF factura
The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado 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