From 9a9f777fe6a408f70df3e45b7d31bb7669956eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= Date: Thu, 14 Jul 2022 01:11:04 +0300 Subject: [PATCH] invoice send receipt email template issue fixed #2505 --- .../Controllers/Modals/TransactionEmails.php | 19 ++++++++++++++++--- resources/assets/js/views/common/documents.js | 6 +++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Modals/TransactionEmails.php b/app/Http/Controllers/Modals/TransactionEmails.php index fc202039a..b40eb6e3c 100644 --- a/app/Http/Controllers/Modals/TransactionEmails.php +++ b/app/Http/Controllers/Modals/TransactionEmails.php @@ -4,7 +4,8 @@ namespace App\Http\Controllers\Modals; use App\Abstracts\Http\Controller; use App\Models\Banking\Transaction; -use App\Notifications\Banking\Transaction as Notification; +use App\Notifications\Portal\PaymentReceived as PaymentReceivedNotification; +use App\Notifications\Banking\Transaction as TransactionNotification; use App\Jobs\Banking\SendTransactionAsCustomMail; use App\Http\Requests\Common\CustomMail as Request; @@ -30,10 +31,22 @@ class TransactionEmails extends Controller * @return Response */ public function create(Transaction $transaction) - { + { $email_template = config('type.transaction.' . $transaction->type . '.email_template'); + + if (request()->get('email_template')) { + $email_template = request()->get('email_template'); + } - $notification = new Notification($transaction, $email_template, true); + switch ($email_template) { + case 'invoice_payment_customer': + $notification = new PaymentReceivedNotification($transaction->document, $transaction, $email_template, true); + break; + + default: + $notification = new TransactionNotification($transaction, $email_template, true); + break; + } $store_route = 'modals.transactions.emails.store'; diff --git a/resources/assets/js/views/common/documents.js b/resources/assets/js/views/common/documents.js index 356dc19a5..784e7a52b 100644 --- a/resources/assets/js/views/common/documents.js +++ b/resources/assets/js/views/common/documents.js @@ -818,7 +818,11 @@ 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, { + params: { + email_template: 'invoice_payment_customer' + } + })); email_promise.then(response => { email.modal = true;