1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Improvements to migration email

This commit is contained in:
David Bomba 2021-01-31 16:07:45 +11:00
parent dc231bc8b5
commit d48756ea79
4 changed files with 70 additions and 37 deletions

View File

@ -206,7 +206,7 @@ class Import implements ShouldQueue
$this->setInitialCompanyLedgerBalances();
Mail::to($this->user)
->send(new MigrationCompleted());
->send(new MigrationCompleted($this->company));
/*After a migration first some basic jobs to ensure the system is up to date*/
VersionCheck::dispatch();

View File

@ -2,6 +2,7 @@
namespace App\Mail;
use App\Models\Company;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
@ -10,14 +11,16 @@ class MigrationCompleted extends Mailable
{
use Queueable, SerializesModels;
public $company;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct()
public function __construct(Company $company)
{
//
$this->company = $company;
}
/**
@ -27,9 +30,11 @@ class MigrationCompleted extends Mailable
*/
public function build()
{
$data['settings'] = auth()->user()->company()->settings;
$data['settings'] = $this->company->settings;
$data['company'] = $this->company;
return $this->from(config('mail.from.address'), config('mail.from.name'))
->view('email.migration.completed', $data);
->view('email.import.completed', $data)
->attach($this->company->invoices->first()->pdf_file_path());
}
}

View File

@ -373,6 +373,11 @@ class Company extends BaseModel
return $this->hasMany(CompanyToken::class);
}
public function client_gateway_tokens()
{
return $this->hasMany(ClientGatewayToken::class);
}
public function system_logs()
{
return $this->hasMany(SystemLog::class)->orderBy('id', 'DESC')->take(50);

View File

@ -6,51 +6,74 @@
<h1>Import completed</h1>
<p>Hello, here is the output of your recent import job.</p>
@if(isset($clients) && count($clients) >=1)
<h3>Clients Imported: {{ count($clients) }} </h3>
<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>
<p><img src="{{ $company->present()->logo() }}"></p>
@if(isset($company) && count($company->clients) >=1)
<p><b>Clients Imported:</b> {{ count($company->clients) }} </p>
@endif
@if(isset($errors['clients']) && count($errors['clients']) >=1)
<h3>Client Errors</h3>
<ul>
@foreach($errors['clients'] as $error)
<li>{{ $error['client'] }} - {{ $error['error'] }}</li>
@endforeach
</ul>
@if(isset($company) && count($company->products) >=1)
<p><b>Products Imported:</b> {{ count($company->products) }} </p>
@endif
@if(isset($invoices) && count($invoices) >=1)
@if(isset($company) && count($company->invoices) >=1)
<p><b>Invoices Imported:</b> {{ count($company->invoices) }} </p>
<h3>Invoices Imported: {{ count($invoices) }} </h3>
<p>To test your PDF generation is working correctly, click <a href="{{$company->invoices->first()->invitations->first()->getLink() }}">here</a>. We've also attempted to attach the PDF to this email.
@endif
@if(isset($errors['invoices']) && count($errors['invoices']) >=1)
<h3>Invoices Errors</h3>
<ul>
@foreach($errors['invoices'] as $error)
<li>{{ $error['invoice'] }} - {{ $error['error'] }}</li>
@endforeach
</ul>
@if(isset($company) && count($company->payments) >=1)
<p><b>Payments Imported:</b> {{ count($company->payments) }} </p>
@endif
@if(isset($products) && count($products) >=1)
<h3>Products Imported: {{ count($products) }} </h3>
@if(isset($company) && count($company->recurring_invoices) >=1)
<p><b>Recurring Invoices Imported:</b> {{ count($company->recurring_invoices) }} </p>
@endif
@if(isset($errors['products']) && count($errors['products']) >=1)
<h3>Client Errors</h3>
<ul>
@foreach($errors['products'] as $error)
<li>{{ $error['product'] }} - {{ $error['error'] }}</li>
@endforeach
</ul>
@if(isset($company) && count($company->quotes) >=1)
<p><b>Quotes Imported:</b> {{ count($company->quotes) }} </p>
@endif
<a href="{{ url('/') }}" target="_blank" class="button">Visit portal</a>
@if(isset($company) && count($company->credits) >=1)
<p><b>Credits Imported:</b> {{ count($company->credits) }} </p>
@endif
<p>Thank you, <br/> Invoice Ninja.</p>
@if(isset($company) && count($company->projects) >=1)
<p><b>Projects Imported:</b> {{ count($company->projects) }} </p>
@endif
@if(isset($company) && count($company->tasks) >=1)
<p><b>Tasks Imported:</b> {{ count($company->tasks) }} </p>
@endif
@if(isset($company) && count($company->vendors) >=1)
<p><b>Vendors Imported:</b> {{ count($company->vendors) }} </p>
@endif
@if(isset($company) && count($company->expenses) >=1)
<p><b>Expenses Imported:</b> {{ count($company->expenses) }} </p>
@endif
@if(isset($company) && count($company->company_gateways) >=1)
<p><b>Gateways Imported:</b> {{ count($company->company_gateways) }} </p>
@endif
@if(isset($company) && count($company->client_gateway_tokens) >=1)
<p><b>Client Gateway Tokens Imported:</b> {{ count($company->client_gateway_tokens) }} </p>
@endif
@if(isset($company) && count($company->tax_rates) >=1)
<p><b>Tax Rates Imported:</b> {{ count($company->tax_rates) }} </p>
@endif
@if(isset($company) && count($company->documents) >=1)
<p><b>Documents Imported:</b> {{ count($company->documents) }} </p>
@endif
<a href="{{ url('/') }}" target="_blank" class="button">{{ ctrans('texts.account_login')}}</a>
<p>{{ ctrans('texts.email_signature')}}<br/> {{ ctrans('texts.email_from') }}</p>
@endcomponent