Document transaction email template changes..
This commit is contained in:
parent
42d0a96afb
commit
b69cb77153
@ -211,6 +211,9 @@ abstract class Show extends Component
|
||||
/** @var string */
|
||||
public $transactionEmailRoute;
|
||||
|
||||
/** @var string */
|
||||
public $transactionEmailTemplate;
|
||||
|
||||
/** @var bool */
|
||||
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 $hideReceive = false, bool $hideMarkReceived = false, string $markReceivedRoute = '', string $textMarkReceived = '',
|
||||
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 $hideSchedule = false, bool $hideChildren = false,
|
||||
bool $hideAttachment = false, $attachment = [],
|
||||
@ -438,6 +441,7 @@ abstract class Show extends Component
|
||||
$this->hideAcceptPayment = $hideAcceptPayment;
|
||||
|
||||
$this->transactionEmailRoute = $this->getTransactionEmailRoute($type, $transactionEmailRoute);
|
||||
$this->transactionEmailTemplate = $this->getTransactionEmailTemplate($type, $transactionEmailTemplate);
|
||||
|
||||
$this->hideRestore = $this->getHideRestore($hideRestore);
|
||||
|
||||
@ -875,6 +879,15 @@ abstract class Show extends Component
|
||||
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)
|
||||
{
|
||||
if (! empty($hideRestore)) {
|
||||
|
@ -126,6 +126,9 @@ return [
|
||||
'category_type' => 'income',
|
||||
'transaction_type' => 'income',
|
||||
'contact_type' => 'customer', // use contact type
|
||||
'transaction' => [
|
||||
'email_template' => 'invoice_payment_customer', // use email template
|
||||
],
|
||||
'hide' => [], // for document items
|
||||
'class' => [],
|
||||
'notification' => [
|
||||
@ -219,6 +222,9 @@ return [
|
||||
'category_type' => 'expense',
|
||||
'transaction_type' => 'expense',
|
||||
'contact_type' => 'vendor',
|
||||
'transaction' => [
|
||||
'email_template' => 'invoice_payment_customer', // use email template
|
||||
],
|
||||
'hide' => [],
|
||||
'notification' => [
|
||||
'class' => 'App\Notifications\Purchase\Bill',
|
||||
|
18
resources/assets/js/views/common/documents.js
vendored
18
resources/assets/js/views/common/documents.js
vendored
@ -75,6 +75,7 @@ const app = new Vue({
|
||||
',.',
|
||||
',,'
|
||||
],
|
||||
email_template: false,
|
||||
}
|
||||
},
|
||||
|
||||
@ -533,6 +534,7 @@ const app = new Vue({
|
||||
onDeleteDiscount(item_index) {
|
||||
this.items[item_index].add_discount = false;
|
||||
this.items[item_index].discount = 0;
|
||||
|
||||
this.onCalculateTotal();
|
||||
},
|
||||
|
||||
@ -818,11 +820,17 @@ const app = new Vue({
|
||||
buttons:{}
|
||||
};
|
||||
|
||||
let email_promise = Promise.resolve(window.axios.get(email.route, {
|
||||
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: 'invoice_payment_customer'
|
||||
email_template: this.email_template
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
this.email_template = false;
|
||||
|
||||
email_promise.then(response => {
|
||||
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
|
||||
onChangeCurrency(currency_code) {
|
||||
if (this.edit.status && this.edit.currency <= 2) {
|
||||
|
@ -61,7 +61,7 @@
|
||||
</br>
|
||||
|
||||
@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">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
|
@ -45,7 +45,7 @@
|
||||
</br>
|
||||
|
||||
@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">
|
||||
{{ trans('general.title.send', ['type' => trans_choice('general.receipts', 1)]) }}
|
||||
</x-button.hover>
|
||||
|
Loading…
x
Reference in New Issue
Block a user