Import notifications

This commit is contained in:
David Bomba 2020-12-21 12:52:33 +11:00
parent 2347b9db7a
commit ea360cead4
4 changed files with 6 additions and 45 deletions

View File

@ -102,11 +102,12 @@ class CSVImport implements ShouldQueue
$this->{"import".ucfirst($this->entity_type)}();
$data = [
'entity' => $this->entity_type,
'entity' => ucfirst($this->entity_type),
'errors' => $this->error_array,
'clients' => $this->maps['clients'],
'products' => $this->maps['products'],
'invoices' => $this->maps['invoices'],
'settings' => $this->company->settings
];
MailRouter::dispatch(new ImportCompleted($data), $this->company, auth()->user());

View File

@ -97,8 +97,9 @@ class BaseMailerJob implements ShouldQueue
public function failed($exception = null)
{
// info('the job failed');
info('the job failed');
info($exception->getMessage());
$job_failure = new EmailFailure();
$job_failure->string_metric5 = get_parent_class($this);
$job_failure->string_metric6 = $exception->getMessage();

View File

@ -30,6 +30,6 @@ class ImportCompleted extends Mailable
public function build()
{
return $this->from(config('mail.from.address'), config('mail.from.name'))
->view('email.import.completed', compact($this->data));
->view('email.import.completed', $this->data);
}
}

View File

@ -1,41 +0,0 @@
@component('email.template.master', ['design' => 'light', 'settings' =>$settings])
@slot('header')
@component('email.components.header')
Migration already completed
@endcomponent
@endslot
@slot('greeting')
Hello,
@endslot
Here is the output of your recent import job.
Entity Type: {{ $entity_type }}
@if(count($errors['invoices']) >=1)
<ul>
@foreach($errors as $error)
<li>{{ $error['invoice'] }} - {{ $error['error'] }}</li>
@endforeach
</ul>
@endif
@component('email.components.button', ['url' => url('/')])
Visit portal
@endcomponent
@slot('signature')
Thank you, <br>
Invoice Ninja
@endslot
@slot('footer')
@component('email.components.footer', ['url' => 'https://invoiceninja.com', 'url_text' => '&copy; InvoiceNinja'])
For any info, please visit InvoiceNinja.
@endcomponent
@endslot
@endcomponent