diff --git a/ayanova/src/views/cust-customer.vue b/ayanova/src/views/cust-customer.vue index 225e1fa7..4506a856 100644 --- a/ayanova/src/views/cust-customer.vue +++ b/ayanova/src/views/cust-customer.vue @@ -745,6 +745,51 @@ + + + + {{ $ay.t("WorkOrderItemPartRequestList") }} + + + + + + + + + + + + + {{ + $ay.t("Close") + }} + + {{ $ay.t("OK") }} + + + @@ -819,7 +864,10 @@ export default { availableRoles: [], timeZoneName: window.$gz.locale.getResolvedTimeZoneName(), languageName: window.$gz.locale.getResolvedLanguage(), - hour12: window.$gz.locale.getHour12() + hour12: window.$gz.locale.getHour12(), + emailDialog: false, + subject: null, + message: null }; }, watch: { @@ -936,6 +984,37 @@ export default { // }); // } // }, + async sendEmail() { + if ( + this.obj.id == 0 || + this.subject == null || + this.message == null || + window.$gz.util.stringIsNullOrEmpty(this.obj.emailAddress) + ) { + return; + } + window.$gz.form.deleteAllErrorBoxErrors(this); + try { + const res = await window.$gz.api.upsert("notify/direct-smtp", { + ObjectId: this.obj.id, + aType: this.ayaType, + toAddress: this.obj.emailAddress, + subject: this.subject, + textBody: this.message + }); + if (res.error) { + this.formState.serverError = res.error; + window.$gz.form.setErrorBoxErrors(this); + } + } catch (error) { + window.$gz.form.setFormState({ + vm: this, + loading: false + }); + window.$gz.errorHandler.handleFormError(error, this); + } + this.emailDialog = false; + }, canSave: function() { return this.formState.valid && this.formState.dirty; }, @@ -1394,6 +1473,9 @@ async function clickHandler(menuItem) { } }); break; + case "sendemail": + m.vm.emailDialog = true; + break; //v.next // case "Schedule": // m.vm.$router.push({ @@ -1546,6 +1628,19 @@ function generateMenu(vm) { vm: vm }); + if ( + vm.rights.change && + vm.$route.params.recordid != 0 && + !window.$gz.util.stringIsNullOrEmpty(vm.obj.emailAddress) + ) { + menuOptions.menuItems.push({ + title: "SendEmail", + icon: "$ayiAt", + key: FORM_KEY + ":sendemail", + vm: vm + }); + } + menuOptions.menuItems.push({ divider: true, inset: false }); window.$gz.eventBus.$emit("menu-change", menuOptions); } @@ -1626,7 +1721,8 @@ async function fetchTranslatedText() { "CustomerNoteList", "CustomerNoteNotes", "CustomerNoteNoteDate", - "NewWorkOrder" + "NewWorkOrder", + "SendEmail" ]); }