app/Mail/Import/ImportCompleted.php

This commit is contained in:
Benjamin Beganović 2021-06-09 16:47:11 +02:00
parent ae66496711
commit 973bdfcb35
3 changed files with 21 additions and 7 deletions

View File

@ -133,7 +133,7 @@ class CSVImport implements ShouldQueue {
];
$nmo = new NinjaMailerObject;
$nmo->mailable = new ImportCompleted( $data );
$nmo->mailable = new ImportCompleted($this->company, $data);
$nmo->company = $this->company;
$nmo->settings = $this->company->settings;
$nmo->to_user = $this->company->owner();

View File

@ -1,4 +1,5 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
@ -11,6 +12,7 @@
namespace App\Mail\Import;
use App\Models\Company;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
@ -19,6 +21,9 @@ class ImportCompleted extends Mailable
{
// use Queueable, SerializesModels;
/** @var Company */
public $company;
/**
* Create a new message instance.
*
@ -26,8 +31,10 @@ class ImportCompleted extends Mailable
*/
public $data;
public function __construct($data)
public function __construct(Company $company, $data)
{
$this->company = $company;
$this->data = $data;
}
@ -38,7 +45,13 @@ class ImportCompleted extends Mailable
*/
public function build()
{
return $this->from(config('mail.from.address'), config('mail.from.name'))
->view('email.import.completed', $this->data);
$data = array_merge($this->data, [
'logo' => $this->company->present()->logo(),
'settings' => $this->company->settings,
]);
return $this
->from(config('mail.from.address'), config('mail.from.name'))
->view('email.import.completed', $data);
}
}

View File

@ -1,6 +1,6 @@
@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png', 'settings' => $settings])
@component('email.template.admin', ['logo' => $logo, 'settings' => $settings])
<div class="center">
<h1>Import completed</h1>
<h1>{{ ctrans('texts.import_complete') }}</h1>
<p>Hello, here is the output of your recent import job.</p>
<p><b>If your logo imported correctly it will display below. If it didn't import, you'll need to reupload your logo</b></p>
@ -98,7 +98,8 @@
<a href="{{ url('/') }}" target="_blank" class="button">{{ ctrans('texts.account_login')}}</a>
<p>{{ ctrans('texts.email_signature')}}<br/> {{ ctrans('texts.email_from') }}</p>
<p>{{ ctrans('texts.email_signature')}}</p>
<p>{{ ctrans('texts.email_from') }}</p>
</div>
@endcomponent