From f546e3669363dbf34c52393f7b6997ad9a1fe106 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 10 Mar 2023 13:04:48 +0100 Subject: [PATCH] Fixes --- src/components/common/SendEmailDialog.vue | 9 ++++++--- src/components/common/VnSmsDialog.vue | 10 +++++++--- src/components/ui/VnConfirm.vue | 9 +++++++-- src/pages/Ticket/Card/TicketDescriptorMenu.vue | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/components/common/SendEmailDialog.vue b/src/components/common/SendEmailDialog.vue index e22b60329..0ede6c441 100644 --- a/src/components/common/SendEmailDialog.vue +++ b/src/components/common/SendEmailDialog.vue @@ -28,9 +28,12 @@ async function confirm() { if (props.promise) { isLoading.value = true; - Object.assign(response, props.data); - await props.send(response); - isLoading.value = false; + try { + Object.assign(response, props.data); + await props.promise(response); + } finally { + isLoading.value = false; + } } onDialogOK(response); diff --git a/src/components/common/VnSmsDialog.vue b/src/components/common/VnSmsDialog.vue index ff7f075c3..1df30afcf 100644 --- a/src/components/common/VnSmsDialog.vue +++ b/src/components/common/VnSmsDialog.vue @@ -69,9 +69,13 @@ async function send() { }; if (props.promise) { isLoading.value = true; - Object.assign(response, props.data); - await props.promise(response); - isLoading.value = false; + + try { + Object.assign(response, props.data); + await props.promise(response); + } finally { + isLoading.value = false; + } } onDialogOK(response); diff --git a/src/components/ui/VnConfirm.vue b/src/components/ui/VnConfirm.vue index 26ebbdc79..f04e51224 100644 --- a/src/components/ui/VnConfirm.vue +++ b/src/components/ui/VnConfirm.vue @@ -41,9 +41,12 @@ const isLoading = ref(false); async function confirm() { isLoading.value = true; if (props.promise) { - await props.promise(props.data); + try { + await props.promise(props.data); + } finally { + isLoading.value = false; + } } - isLoading.value = false; onDialogOK(props.data); } @@ -78,6 +81,8 @@ async function confirm() { color="primary" :loading="isLoading" @click="confirm()" + unelevated + autofocus /> diff --git a/src/pages/Ticket/Card/TicketDescriptorMenu.vue b/src/pages/Ticket/Card/TicketDescriptorMenu.vue index e816ac5af..cc2bf289a 100644 --- a/src/pages/Ticket/Card/TicketDescriptorMenu.vue +++ b/src/pages/Ticket/Card/TicketDescriptorMenu.vue @@ -43,7 +43,7 @@ function sendDeliveryNoteConfirmation(type = 'deliveryNote', documentType = 'pdf type: type, documentType: documentType, }, - send: sendDeliveryNote, + promise: sendDeliveryNote, }, }); }