refs #2680 Changed: Email function . CU-3196abw - ( #3196abw )

This commit is contained in:
Cüneyt Şentürk
2022-10-20 14:59:04 +03:00
parent 32e4bc85a5
commit a849f5a78c
8 changed files with 106 additions and 131 deletions

View File

@ -827,77 +827,10 @@ const app = new Vue({
});
},
async onEmail(route) {
let email = {
modal: false,
route: route,
title: '',
html: '',
buttons:{}
};
let email_promise = Promise.resolve(window.axios.get(email.route));
if (this.email_template) {
email_promise = Promise.resolve(window.axios.get(email.route, {
params: {
email_template: this.email_template
}
}));
}
this.email_template = false;
email_promise.then(response => {
email.modal = true;
email.title = response.data.data.title;
email.html = response.data.html;
email.buttons = response.data.data.buttons;
this.component = Vue.component('add-new-component', (resolve, reject) => {
resolve({
template: '<div id="dynamic-email-component"><akaunting-modal-add-new modal-dialog-class="max-w-screen-md" :show="email.modal" @submit="onSubmit" @cancel="onCancel" :buttons="email.buttons" :title="email.title" :is_component=true :message="email.html"></akaunting-modal-add-new></div>',
mixins: [
Global
],
data: function () {
return {
form:{},
email: email,
}
},
methods: {
onSubmit(event) {
this.$emit('submit', event);
event.submit();
},
onCancel() {
this.email.modal = false;
this.email.html = null;
let documentClasses = document.body.classList;
documentClasses.remove('overflow-y-hidden', 'overflow-overlay', '-ml-4');
},
}
})
});
})
.catch(error => {
})
.finally(function () {
// always executed
});
},
onEmailViaTemplate(route, template) {
this.email_template = template;
this.onEmail(route);
this.onSendEmail(route);
},
// Change currency get money
@ -1108,7 +1041,7 @@ const app = new Vue({
let email_route = document.getElementById('senddocument_route').value;
this.onEmail(email_route);
this.onSendEmail(email_route);
}
this.page_loaded = true;