Payment send mail notification..
This commit is contained in:
parent
0fd2288116
commit
3ee49c5bd3
56
app/Listeners/Update/V21/Version2119.php
Normal file
56
app/Listeners/Update/V21/Version2119.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Update\V21;
|
||||
|
||||
use App\Abstracts\Listeners\Update as Listener;
|
||||
use App\Events\Install\UpdateFinished as Event;
|
||||
use App\Models\Common\Company;
|
||||
use App\Models\Common\EmailTemplate;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class Version21199 extends Listener
|
||||
{
|
||||
const ALIAS = 'core';
|
||||
|
||||
const VERSION = '2.1.19';
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
if ($this->skipThisUpdate($event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->updateEmailTemplate();
|
||||
|
||||
Artisan::call('cache:clear');
|
||||
}
|
||||
|
||||
protected function updateEmailTemplate()
|
||||
{
|
||||
$company_id = company_id();
|
||||
|
||||
$companies = Company::cursor();
|
||||
|
||||
foreach ($companies as $company) {
|
||||
$company->makeCurrent();
|
||||
|
||||
EmailTemplate::create([
|
||||
'company_id' => $company->id,
|
||||
'alias' => 'payment_new_vendor',
|
||||
'class' => 'App\Notifications\Purchase\Payment',
|
||||
'name' => 'settings.email.templates.payment_new_vendor',
|
||||
'subject' => trans('email_templates.payment_new_vendor.subject'),
|
||||
'body' => trans('email_templates.payment_new_vendor.body'),
|
||||
]);
|
||||
}
|
||||
|
||||
company($company_id)->makeCurrent();
|
||||
}
|
||||
}
|
@ -79,7 +79,7 @@ class Payment extends Notification
|
||||
return [
|
||||
'template_alias' => $this->template->alias,
|
||||
'payment_id' => $this->payment->id,
|
||||
'customer_name' => $this->payment->contact->name,
|
||||
'vendor_name' => $this->payment->contact->name,
|
||||
'amount' => $this->payment->amount,
|
||||
'payment_date' => company_date($this->payment->paid_at),
|
||||
];
|
||||
@ -91,7 +91,7 @@ class Payment extends Notification
|
||||
'{payment_amount}',
|
||||
'{payment_date}',
|
||||
'{payment_admin_link}',
|
||||
'{customer_name}',
|
||||
'{vendor_name}',
|
||||
'{company_name}',
|
||||
'{company_email}',
|
||||
'{company_tax_number}',
|
||||
|
@ -35,6 +35,7 @@ class Event extends Provider
|
||||
'App\Listeners\Update\V21\Version2116',
|
||||
'App\Listeners\Update\V21\Version2117',
|
||||
'App\Listeners\Update\V21\Version2118',
|
||||
'App\Listeners\Update\V21\Version2119',
|
||||
],
|
||||
'Illuminate\Auth\Events\Login' => [
|
||||
'App\Listeners\Auth\Login',
|
||||
|
@ -77,6 +77,11 @@ class EmailTemplates extends Seeder
|
||||
'class' => 'App\Notifications\Sale\Revenue',
|
||||
'name' => 'settings.email.templates.revenue_new_customer',
|
||||
],
|
||||
[
|
||||
'alias' => 'payment_new_vendor',
|
||||
'class' => 'App\Notifications\Purchase\Payment',
|
||||
'name' => 'settings.email.templates.payment_new_vendor',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($templates as $template) {
|
||||
|
@ -51,4 +51,9 @@ return [
|
||||
'subject' => '{revenue_date} payment created',
|
||||
'body' => 'Dear {customer_name},<br /><br />We have prepared the following payment. <br /><br />You can see the payment details from the following link: <a href="{revenue_guest_link}">{revenue_date}</a>.<br /><br />Feel free to contact us with any questions..<br /><br />Best Regards,<br />{company_name}',
|
||||
],
|
||||
|
||||
'payment_new_vendor' => [
|
||||
'subject' => '{revenue_date} payment created',
|
||||
'body' => 'Dear {vendor_name},<br /><br />We have prepared the following payment. <br /><br />You can see the payment details from the following link: <a href="{payment_admin_link}">{payment_date}</a>.<br /><br />Feel free to contact us with any questions..<br /><br />Best Regards,<br />{company_name}',
|
||||
],
|
||||
];
|
||||
|
@ -3,7 +3,7 @@
|
||||
@section('title', trans('payments.payment_made'))
|
||||
|
||||
@section('new_button')
|
||||
<x-transactions.show.top-buttons type="expense" :transaction="$payment" hide-button-share hide-button-email />
|
||||
<x-transactions.show.top-buttons type="expense" :transaction="$payment" hide-button-share />
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
Loading…
x
Reference in New Issue
Block a user