refs #2680 Changed: Email function . CU-3196abw - ( #3196abw )
This commit is contained in:
parent
32e4bc85a5
commit
a849f5a78c
@ -565,7 +565,7 @@ class Transaction extends Model
|
||||
'permission' => 'read-banking-transactions',
|
||||
'attributes' => [
|
||||
'id' => 'index-line-actions-send-email-' . $this->type . '-' . $this->id,
|
||||
'@click' => 'onEmail("' . route('modals.transactions.emails.create', $this->id) . '")',
|
||||
'@click' => 'onSendEmail("' . route('modals.transactions.emails.create', $this->id) . '")',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
@ -615,7 +615,7 @@ class Document extends Model
|
||||
'permission' => 'read-' . $group . '-' . $permission_prefix,
|
||||
'attributes' => [
|
||||
'id' => 'index-line-actions-send-email-' . $this->type . '-' . $this->id,
|
||||
'@click' => 'onEmail("' . route('modals.'. $prefix . '.emails.create', $this->id) . '")',
|
||||
'@click' => 'onSendEmail("' . route('modals.'. $prefix . '.emails.create', $this->id) . '")',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
98
resources/assets/js/mixins/global.js
vendored
98
resources/assets/js/mixins/global.js
vendored
@ -586,6 +586,104 @@ export default {
|
||||
this.onChangeCurrency(currency_code);
|
||||
},
|
||||
|
||||
async onSendEmail(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>',
|
||||
|
||||
components: {
|
||||
AkauntingDropzoneFileUpload,
|
||||
AkauntingContactCard,
|
||||
AkauntingCompanyEdit,
|
||||
AkauntingEditItemColumns,
|
||||
AkauntingItemButton,
|
||||
AkauntingDocumentButton,
|
||||
AkauntingSearch,
|
||||
AkauntingRadioGroup,
|
||||
AkauntingSelect,
|
||||
AkauntingSelectRemote,
|
||||
AkauntingMoney,
|
||||
AkauntingModal,
|
||||
AkauntingModalAddNew,
|
||||
AkauntingDate,
|
||||
AkauntingRecurring,
|
||||
AkauntingHtmlEditor,
|
||||
AkauntingCountdown,
|
||||
AkauntingCurrencyConversion,
|
||||
AkauntingConnectTransactions,
|
||||
AkauntingSwitch,
|
||||
AkauntingSlider,
|
||||
AkauntingColor,
|
||||
CardForm,
|
||||
[Select.name]: Select,
|
||||
[Option.name]: Option,
|
||||
[Steps.name]: Steps,
|
||||
[Step.name]: Step,
|
||||
[Button.name]: Button,
|
||||
[Link.name]: Link,
|
||||
[Tooltip.name]: Tooltip,
|
||||
[ColorPicker.name]: ColorPicker,
|
||||
},
|
||||
|
||||
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
|
||||
});
|
||||
},
|
||||
|
||||
onShareLink(url) {
|
||||
let share = {
|
||||
modal: false,
|
||||
|
@ -33,62 +33,6 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
methods: {
|
||||
async onEmail(route) {
|
||||
let email = {
|
||||
modal: false,
|
||||
route: route,
|
||||
title: '',
|
||||
html: '',
|
||||
buttons:{}
|
||||
};
|
||||
|
||||
let email_promise = Promise.resolve(window.axios.get(email.route));
|
||||
|
||||
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-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
|
||||
});
|
||||
},
|
||||
//
|
||||
},
|
||||
});
|
||||
|
71
resources/assets/js/views/common/documents.js
vendored
71
resources/assets/js/views/common/documents.js
vendored
@ -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;
|
||||
|
@ -65,7 +65,7 @@
|
||||
|
||||
@if (! $hideEmail)
|
||||
@if ($document->contact_email)
|
||||
<x-dropdown.button id="show-more-actions-send-email-{{ $document->type }}" @click="onEmail('{{ route($emailRoute, $document->id) }}')">
|
||||
<x-dropdown.button id="show-more-actions-send-email-{{ $document->type }}" @click="onSendEmail('{{ route($emailRoute, $document->id) }}')">
|
||||
{{ trans($textEmail) }}
|
||||
</x-dropdown.button>
|
||||
@else
|
||||
|
@ -13,7 +13,7 @@
|
||||
<div class="flex flex-wrap space-x-3 rtl:space-x-reverse">
|
||||
@if (! $hideEmail)
|
||||
@if ($document->contact_email)
|
||||
<x-button id="show-slider-actions-send-email-{{ $document->type }}" kind="secondary" @click="onEmail('{{ route($emailRoute, $document->id) }}')">
|
||||
<x-button id="show-slider-actions-send-email-{{ $document->type }}" kind="secondary" @click="onSendEmail('{{ route($emailRoute, $document->id) }}')">
|
||||
{{ trans($textEmail) }}
|
||||
</x-button>
|
||||
@else
|
||||
|
@ -86,7 +86,7 @@
|
||||
@if ($transaction->isNotTransferTransaction())
|
||||
@if (! $hideButtonEmail)
|
||||
@if (! empty($transaction->contact) && $transaction->contact->email)
|
||||
<x-dropdown.button id="show-more-actions-send-email-{{ $transaction->type }}" @click="onEmail('{{ route($routeButtonEmail, $transaction->id) }}')">
|
||||
<x-dropdown.button id="show-more-actions-send-email-{{ $transaction->type }}" @click="onSendEmail('{{ route($routeButtonEmail, $transaction->id) }}')">
|
||||
{{ trans('invoices.send_mail') }}
|
||||
</x-dropdown.button>
|
||||
@else
|
||||
|
Loading…
x
Reference in New Issue
Block a user