Document transaction email template changes..

This commit is contained in:
Cüneyt Şentürk 2022-07-14 11:22:39 +03:00
parent 42d0a96afb
commit b69cb77153
5 changed files with 41 additions and 8 deletions

View File

@ -211,6 +211,9 @@ abstract class Show extends Component
/** @var string */ /** @var string */
public $transactionEmailRoute; public $transactionEmailRoute;
/** @var string */
public $transactionEmailTemplate;
/** @var bool */ /** @var bool */
public $hideRestore; public $hideRestore;
@ -337,7 +340,7 @@ abstract class Show extends Component
bool $hideCreated = false, bool $hideSend = false, bool $hideMarkSent = false, string $markSentRoute = '', string $textMarkSent = '', bool $hideCreated = false, bool $hideSend = false, bool $hideMarkSent = false, string $markSentRoute = '', string $textMarkSent = '',
bool $hideReceive = false, bool $hideMarkReceived = false, string $markReceivedRoute = '', string $textMarkReceived = '', bool $hideReceive = false, bool $hideMarkReceived = false, string $markReceivedRoute = '', string $textMarkReceived = '',
bool $hideGetPaid = false, bool $hideGetPaid = false,
bool $hideRestore = false, bool $hideAddPayment = false, bool $hideAcceptPayment = false, string $transactionEmailRoute = '', bool $hideRestore = false, bool $hideAddPayment = false, bool $hideAcceptPayment = false, string $transactionEmailRoute = '', string $transactionEmailTemplate = '',
bool $hideMakePayment = false, bool $hideMakePayment = false,
bool $hideSchedule = false, bool $hideChildren = false, bool $hideSchedule = false, bool $hideChildren = false,
bool $hideAttachment = false, $attachment = [], bool $hideAttachment = false, $attachment = [],
@ -438,6 +441,7 @@ abstract class Show extends Component
$this->hideAcceptPayment = $hideAcceptPayment; $this->hideAcceptPayment = $hideAcceptPayment;
$this->transactionEmailRoute = $this->getTransactionEmailRoute($type, $transactionEmailRoute); $this->transactionEmailRoute = $this->getTransactionEmailRoute($type, $transactionEmailRoute);
$this->transactionEmailTemplate = $this->getTransactionEmailTemplate($type, $transactionEmailTemplate);
$this->hideRestore = $this->getHideRestore($hideRestore); $this->hideRestore = $this->getHideRestore($hideRestore);
@ -875,6 +879,15 @@ abstract class Show extends Component
return 'modals.transactions.emails.create'; return 'modals.transactions.emails.create';
} }
protected function getTransactionEmailTemplate($type, $transactionEmailTemplate)
{
if (! empty($transactionEmailTemplate)) {
return $transactionEmailTemplate;
}
return config('type.' . static::OBJECT_TYPE . '.' . $type . '.transaction.email_template', false);
}
protected function getHideRestore($hideRestore) protected function getHideRestore($hideRestore)
{ {
if (! empty($hideRestore)) { if (! empty($hideRestore)) {

View File

@ -126,6 +126,9 @@ return [
'category_type' => 'income', 'category_type' => 'income',
'transaction_type' => 'income', 'transaction_type' => 'income',
'contact_type' => 'customer', // use contact type 'contact_type' => 'customer', // use contact type
'transaction' => [
'email_template' => 'invoice_payment_customer', // use email template
],
'hide' => [], // for document items 'hide' => [], // for document items
'class' => [], 'class' => [],
'notification' => [ 'notification' => [
@ -219,6 +222,9 @@ return [
'category_type' => 'expense', 'category_type' => 'expense',
'transaction_type' => 'expense', 'transaction_type' => 'expense',
'contact_type' => 'vendor', 'contact_type' => 'vendor',
'transaction' => [
'email_template' => 'invoice_payment_customer', // use email template
],
'hide' => [], 'hide' => [],
'notification' => [ 'notification' => [
'class' => 'App\Notifications\Purchase\Bill', 'class' => 'App\Notifications\Purchase\Bill',

View File

@ -75,6 +75,7 @@ const app = new Vue({
',.', ',.',
',,' ',,'
], ],
email_template: false,
} }
}, },
@ -533,6 +534,7 @@ const app = new Vue({
onDeleteDiscount(item_index) { onDeleteDiscount(item_index) {
this.items[item_index].add_discount = false; this.items[item_index].add_discount = false;
this.items[item_index].discount = 0; this.items[item_index].discount = 0;
this.onCalculateTotal(); this.onCalculateTotal();
}, },
@ -818,11 +820,17 @@ const app = new Vue({
buttons:{} buttons:{}
}; };
let email_promise = Promise.resolve(window.axios.get(email.route, { let email_promise = Promise.resolve(window.axios.get(email.route));
params: {
email_template: 'invoice_payment_customer' 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_promise.then(response => {
email.modal = true; email.modal = true;
@ -870,6 +878,12 @@ const app = new Vue({
}); });
}, },
onEmailViaTemplate(route, template) {
this.email_template = template;
this.onEmail(route);
},
// Change currency get money // Change currency get money
onChangeCurrency(currency_code) { onChangeCurrency(currency_code) {
if (this.edit.status && this.edit.currency <= 2) { if (this.edit.status && this.edit.currency <= 2) {

View File

@ -61,7 +61,7 @@
</br> </br>
@if (! empty($transaction->contact) && $transaction->contact->email) @if (! empty($transaction->contact) && $transaction->contact->email)
<x-button id="button-email-send" class="text-purple mt-1" override="class" @click="onEmail('{{ route($transactionEmailRoute, $transaction->id) }}')"> <x-button id="button-email-send" class="text-purple mt-1" override="class" @click="onEmailViaTemplate('{{ route($transactionEmailRoute, $transaction->id) }}', '{{ $transactionEmailTemplate }}')">
<x-button.hover color="to-purple"> <x-button.hover color="to-purple">
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }} {{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
</x-button.hover> </x-button.hover>

View File

@ -45,7 +45,7 @@
</br> </br>
@if (! empty($transaction->contact) && $transaction->contact->email) @if (! empty($transaction->contact) && $transaction->contact->email)
<x-button id="button-email-send" class="text-purple mt-1" override="class" @click="onEmail('{{ route($transactionEmailRoute, $transaction->id) }}')"> <x-button id="button-email-send" class="text-purple mt-1" override="class" @click="onEmailViaTemplate('{{ route($transactionEmailRoute, $transaction->id) }}', '{{ $transactionEmailTemplate }}')">
<x-button.hover color="to-purple"> <x-button.hover color="to-purple">
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }} {{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
</x-button.hover> </x-button.hover>