From 3f5feacf16473bb7866724e8ab76d1757457c725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 17:54:19 +0200 Subject: [PATCH 01/42] Make light version for admin side --- .../email/template/admin-light.blade.php | 188 ++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 resources/views/email/template/admin-light.blade.php diff --git a/resources/views/email/template/admin-light.blade.php b/resources/views/email/template/admin-light.blade.php new file mode 100644 index 0000000000..fc362eb8bb --- /dev/null +++ b/resources/views/email/template/admin-light.blade.php @@ -0,0 +1,188 @@ + + + + + + Verify your account + + + + + + + + + + + + +
+ + +
+ +
+ + + + + + + + + + + + + +
+
+ + +
+
+
+ {{ $slot }} +
+
+
+

+ Questions? We're here to help!

+
+ + + + +
+
+

© {{ date('Y') }} Invoice Ninja, All Rights Reserved +

+
+
+
+ + + From 8b568d6147ef4292fda4bd7936d29eafd68ef0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:02:44 +0200 Subject: [PATCH 02/42] Admin: DownloadInvoices / download_files.blade.php --- app/Mail/DownloadInvoices.php | 15 +++---- .../email/admin/download_files.blade.php | 44 ++++--------------- 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/app/Mail/DownloadInvoices.php b/app/Mail/DownloadInvoices.php index 006703f1f3..cb6c6e45cc 100644 --- a/app/Mail/DownloadInvoices.php +++ b/app/Mail/DownloadInvoices.php @@ -28,14 +28,11 @@ class DownloadInvoices extends Mailable public function build() { return $this->from(config('mail.from.address'), config('mail.from.name')) - ->subject(ctrans('texts.download_files')) - ->markdown( - 'email.admin.download_files', - [ - 'url' => $this->file_path, - 'logo' => $this->company->present()->logo, - 'whitelabel' => $this->company->account->isPaid() ? true : false, - ] - ); + ->subject(ctrans('texts.download_files')) + ->view('email.admin.download_files', [ + 'url' => $this->file_path, + 'logo' => $this->company->present()->logo, + 'whitelabel' => (bool)$this->company->account->isPaid(), + ]); } } diff --git a/resources/views/email/admin/download_files.blade.php b/resources/views/email/admin/download_files.blade.php index a73eace603..b0239e5aa9 100644 --- a/resources/views/email/admin/download_files.blade.php +++ b/resources/views/email/admin/download_files.blade.php @@ -1,36 +1,10 @@ -@component('email.template.master', ['design' => 'light', 'settings' =>$settings]) +@component('email.template.admin-light', ['logo' => $logo, 'settings' => $settings]) +
+

{{ ctrans('texts.download') }}

+

{{ ctrans('texts.download_timeframe') }}

-@slot('header') - @component('email.components.header', ['p' => '', 'logo' => $logo]) - @lang('texts.download') - @endcomponent - -@endslot - - -@if(isset($greeting)) -

{{ $greeting }}

-@endif - -

-@lang('texts.download_timeframe') -

- -

- @component('email.components.button', ['url' => $url]) - @lang('texts.download') - @endcomponent -

- -@slot('signature') - InvoiceNinja (contact@invoiceninja.com) -@endslot - -@if(!$whitelabel) - @slot('footer') - @component('email.components.footer', ['url' => 'https://invoiceninja.com', 'url_text' => '© InvoiceNinja']) - For any info, please visit InvoiceNinja. - @endcomponent - @endslot -@endif -@endcomponent \ No newline at end of file + + {{ ctrans('texts.download') }} + +
+@endcomponent From 22f2b2c09528a048836087f11d22ba42a7e415d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:04:29 +0200 Subject: [PATCH 03/42] Admin: notification.blade.php --- .../views/email/admin/notification.blade.php | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/resources/views/email/admin/notification.blade.php b/resources/views/email/admin/notification.blade.php index 7565faf86e..9422a5c613 100644 --- a/resources/views/email/admin/notification.blade.php +++ b/resources/views/email/admin/notification.blade.php @@ -1,18 +1,6 @@ -@component('email.template.master', ['design' => 'light', 'settings' => $settings]) - - @slot('header') - @include('email.components.header', ['logo' => $logo]) - @endslot - -

{!! $title !!}

- -

{!! $body !!}

- - @if(isset($whitelabel) && !$whitelabel) - @slot('footer') - @component('email.components.footer', ['url' => 'https://invoiceninja.com', 'url_text' => '© InvoiceNinja']) - For any info, please visit InvoiceNinja. - @endcomponent - @endslot - @endif +@component('email.template.admin-light', ['logo' => $logo, 'settings' => $settings]) +
+

{!! $title !!}

+

{!! $body !!}

+
@endcomponent From f870cc71edc9348bec1fedccef5668d0b6f0e0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:05:59 +0200 Subject: [PATCH 04/42] Admin: auth / password-reset.blade.php --- .../views/email/auth/password-reset.blade.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/resources/views/email/auth/password-reset.blade.php b/resources/views/email/auth/password-reset.blade.php index de1673f452..239a065218 100644 --- a/resources/views/email/auth/password-reset.blade.php +++ b/resources/views/email/auth/password-reset.blade.php @@ -1,14 +1,9 @@ -@component('email.template.master', ['design' => 'light', 'whitelabel' => false, 'company' => $company]) +@component('email.template.admin-light', ['logo' => $logo, 'settings' => $settings]) +
+

{{ ctrans('texts.reset_password') }}

- @slot('header') - @include('email.components.header', ['logo' => $logo]) - @endslot - -

{{ ctrans('texts.reset_password') }}

- - - {{ ctrans('texts.reset') }} - - - {{ $link }} + + {{ ctrans('texts.reset') }} + +
@endcomponent From 105951321d48e6ee463c9f8644bb223c10f9c883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:06:34 +0200 Subject: [PATCH 05/42] Admin: auth / verify.blade.php --- resources/views/email/auth/verify.blade.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/resources/views/email/auth/verify.blade.php b/resources/views/email/auth/verify.blade.php index 47b119b938..7ef76cd707 100644 --- a/resources/views/email/auth/verify.blade.php +++ b/resources/views/email/auth/verify.blade.php @@ -1,12 +1,9 @@ -@component('email.template.master', ['design' => 'light', 'whitelabel' => false]) +@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png', 'settings' => $settings]) +
+

{{ ctrans('texts.confirmation_message') }}

- @slot('header') - @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) - @endslot - -

{{ ctrans('texts.confirmation_message') }}

- - confirmation_code}") }}" target="_blank" class="button"> - {{ ctrans('texts.confirm') }} - + confirmation_code}") }}" target="_blank" class="button"> + {{ ctrans('texts.confirm') }} + +
@endcomponent From 0e3a87a762494314a02999217d6642059ec40e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:08:47 +0200 Subject: [PATCH 06/42] Admin: import / completed.blade.php --- .../views/email/import/completed.blade.php | 164 +++++++++--------- 1 file changed, 81 insertions(+), 83 deletions(-) diff --git a/resources/views/email/import/completed.blade.php b/resources/views/email/import/completed.blade.php index 58038b594a..9824dc60ff 100644 --- a/resources/views/email/import/completed.blade.php +++ b/resources/views/email/import/completed.blade.php @@ -1,106 +1,104 @@ -@component('email.template.master', ['design' => 'light', 'settings' => $company->settings]) - @slot('header') - @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) - @endslot +@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png', 'settings' => $settings]) +
+

Import completed

+

Hello, here is the output of your recent import job.

-

Import completed

-

Hello, here is the output of your recent import job.

+

If your logo imported correctly it will display below. If it didn't import, you'll need to reupload your logo

-

If your logo imported correctly it will display below. If it didn't import, you'll need to reupload your logo

+

-

+ @if(isset($company) && $company->clients->count() >=1) +

{{ ctrans('texts.clients') }}: {{ $company->clients->count() }}

+ @endif - @if(isset($company) && $company->clients->count() >=1) -

{{ ctrans('texts.clients') }}: {{ $company->clients->count() }}

- @endif + @if(isset($company) && count($company->products) >=1) +

{{ ctrans('texts.products') }}: {{ count($company->products) }}

+ @endif - @if(isset($company) && count($company->products) >=1) -

{{ ctrans('texts.products') }}: {{ count($company->products) }}

- @endif + @if(isset($company) && count($company->invoices) >=1) +

{{ ctrans('texts.invoices') }}: {{ count($company->invoices) }}

+ @endif - @if(isset($company) && count($company->invoices) >=1) -

{{ ctrans('texts.invoices') }}: {{ count($company->invoices) }}

- @endif + @if(isset($company) && count($company->payments) >=1) +

{{ ctrans('texts.payments') }}: {{ count($company->payments) }}

+ @endif - @if(isset($company) && count($company->payments) >=1) -

{{ ctrans('texts.payments') }}: {{ count($company->payments) }}

- @endif + @if(isset($company) && count($company->recurring_invoices) >=1) +

{{ ctrans('texts.recurring_invoices') }}: {{ count($company->recurring_invoices) }}

+ @endif - @if(isset($company) && count($company->recurring_invoices) >=1) -

{{ ctrans('texts.recurring_invoices') }}: {{ count($company->recurring_invoices) }}

- @endif + @if(isset($company) && count($company->quotes) >=1) +

{{ ctrans('texts.quotes') }}: {{ count($company->quotes) }}

+ @endif - @if(isset($company) && count($company->quotes) >=1) -

{{ ctrans('texts.quotes') }}: {{ count($company->quotes) }}

- @endif + @if(isset($company) && count($company->credits) >=1) +

{{ ctrans('texts.credits') }}: {{ count($company->credits) }}

+ @endif - @if(isset($company) && count($company->credits) >=1) -

{{ ctrans('texts.credits') }}: {{ count($company->credits) }}

- @endif + @if(isset($company) && count($company->projects) >=1) +

{{ ctrans('texts.projects') }}: {{ count($company->projects) }}

+ @endif - @if(isset($company) && count($company->projects) >=1) -

{{ ctrans('texts.projects') }}: {{ count($company->projects) }}

- @endif + @if(isset($company) && count($company->tasks) >=1) +

{{ ctrans('texts.tasks') }}: {{ count($company->tasks) }}

+ @endif - @if(isset($company) && count($company->tasks) >=1) -

{{ ctrans('texts.tasks') }}: {{ count($company->tasks) }}

- @endif + @if(isset($company) && count($company->vendors) >=1) +

{{ ctrans('texts.vendors') }}: {{ count($company->vendors) }}

+ @endif - @if(isset($company) && count($company->vendors) >=1) -

{{ ctrans('texts.vendors') }}: {{ count($company->vendors) }}

- @endif + @if(isset($company) && count($company->expenses) >=1) +

{{ ctrans('texts.expenses') }}: {{ count($company->expenses) }}

+ @endif - @if(isset($company) && count($company->expenses) >=1) -

{{ ctrans('texts.expenses') }}: {{ count($company->expenses) }}

- @endif + @if(isset($company) && count($company->company_gateways) >=1) +

{{ ctrans('texts.gateways') }}: {{ count($company->company_gateways) }}

+ @endif - @if(isset($company) && count($company->company_gateways) >=1) -

{{ ctrans('texts.gateways') }}: {{ count($company->company_gateways) }}

- @endif + @if(isset($company) && count($company->client_gateway_tokens) >=1) +

{{ ctrans('texts.tokens') }}: {{ count($company->client_gateway_tokens) }}

+ @endif - @if(isset($company) && count($company->client_gateway_tokens) >=1) -

{{ ctrans('texts.tokens') }}: {{ count($company->client_gateway_tokens) }}

- @endif + @if(isset($company) && count($company->tax_rates) >=1) +

{{ ctrans('texts.tax_rates') }}: {{ count($company->tax_rates) }}

+ @endif - @if(isset($company) && count($company->tax_rates) >=1) -

{{ ctrans('texts.tax_rates') }}: {{ count($company->tax_rates) }}

- @endif + @if(isset($company) && count($company->documents) >=1) +

{{ ctrans('texts.documents') }}: {{ count($company->documents) }}

+ @endif - @if(isset($company) && count($company->documents) >=1) -

{{ ctrans('texts.documents') }}: {{ count($company->documents) }}

- @endif + @if($check_data) +

Data Quality:

+

{!! $check_data !!}

+ @endif - @if($check_data) -

Data Quality:

-

{!! $check_data !!}

- @endif - - @if(!empty($errors) ) -

{{ ctrans('texts.errors') }}:

- - - - - - - - - - @foreach($errors as $entityType=>$entityErrors) - @foreach($entityErrors as $error) - - - - - + @if(!empty($errors) ) +

{{ ctrans('texts.errors') }}:

+
TypeDataError
{{$entityType}}{{json_encode($error[$entityType]??null)}}{{json_encode($error['error'])}}
+ + + + + + + + + @foreach($errors as $entityType=>$entityErrors) + @foreach($entityErrors as $error) + + + + + + @endforeach @endforeach - @endforeach - -
TypeDataError
{{$entityType}}{{json_encode($error[$entityType]??null)}}{{json_encode($error['error'])}}
- @endif + + + @endif - {{ ctrans('texts.account_login')}} - -

{{ ctrans('texts.email_signature')}}
{{ ctrans('texts.email_from') }}

+ {{ ctrans('texts.account_login')}} +

{{ ctrans('texts.email_signature')}}
{{ ctrans('texts.email_from') }}

+
@endcomponent + From ba6af55be64c9e902a94ae2fbebb98a21ecdd117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:10:18 +0200 Subject: [PATCH 07/42] Admin: migration / completed.blade.php --- .../views/email/migration/completed.blade.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/resources/views/email/migration/completed.blade.php b/resources/views/email/migration/completed.blade.php index fc36280e43..418ac27fb9 100644 --- a/resources/views/email/migration/completed.blade.php +++ b/resources/views/email/migration/completed.blade.php @@ -1,13 +1,12 @@ -@component('email.template.master', ['design' => 'light', 'settings' => $settings]) +@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png', 'settings' => $settings]) +
+

{{ ctrans('texts.migration_completed')}}

+

{{ ctrans('texts.migration_completed_description')}}

- @slot('header') - @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) - @endslot + + {{ ctrans('texts.account_login')}} + -

{{ ctrans('texts.migration_completed')}}

-

{{ ctrans('texts.migration_completed_description')}}

- - {{ ctrans('texts.account_login')}} - -

{{ ctrans('texts.email_signature')}}
{{ ctrans('texts.email_from') }}

+

{{ ctrans('texts.email_signature')}}
{{ ctrans('texts.email_from') }}

+
@endcomponent From 690acec7f8012e06497e4c8b0673ee4e48790585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:11:23 +0200 Subject: [PATCH 08/42] Admin: migration / existing.blade.php --- .../views/email/migration/existing.blade.php | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/resources/views/email/migration/existing.blade.php b/resources/views/email/migration/existing.blade.php index 3a4c1dbd6c..e82adb7252 100644 --- a/resources/views/email/migration/existing.blade.php +++ b/resources/views/email/migration/existing.blade.php @@ -1,18 +1,6 @@ -@component('email.template.master', ['design' => 'light', 'settings' => $settings]) - - @slot('header') - @include('email.components.header', ['logo' => $logo]) - @endslot - -

{{ctrans('texts.migration_already_completed')}}

- -

{{ctrans('texts.migration_already_completed_desc', ['company_name' => $company_name])}}

- - @if(isset($whitelabel) && !$whitelabel) - @slot('footer') - @component('email.components.footer', ['url' => 'https://invoiceninja.com', 'url_text' => '© InvoiceNinja']) - For any info, please visit InvoiceNinja. - @endcomponent - @endslot - @endif +@component('email.template.admin-light', ['logo' => $logo, 'settings' => $settings]) +
+

{{ ctrans('texts.migration_already_completed') }}

+

{{ ctrans('texts.migration_already_completed_desc', ['company_name' => $company_name]) }}

+
@endcomponent From 456222eda8bdeac0e68b1fbccb2483d2124f7479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:11:58 +0200 Subject: [PATCH 09/42] Admin: migration / failed.blade.php --- .../views/email/migration/failed.blade.php | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/resources/views/email/migration/failed.blade.php b/resources/views/email/migration/failed.blade.php index c304db3f3a..79dca9db09 100644 --- a/resources/views/email/migration/failed.blade.php +++ b/resources/views/email/migration/failed.blade.php @@ -1,18 +1,16 @@ -@component('email.template.master', ['design' => 'light', 'settings' => $settings]) - @slot('header') - @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) - @endslot +@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png', 'settings' => $settings]) +
+

Whoops, migration failed for {{ $company->present()->name() }}.

+

Looks like your migration failed. Here's the error message:

-

Whoops, migration failed for {{ $company->present()->name() }}.

-

Looks like your migration failed. Here's the error message:

- -
-    	@if(\App\Utils\Ninja::isHosted())
-	        {!! $exception->getMessage() !!}
-            {!! $content !!}
-    	@else
-        {!! $exception->getMessage() !!}
-        {!! $content !!}
-        @endif
-    
+
+    	    @if(\App\Utils\Ninja::isHosted())
+                {!! $exception->getMessage() !!}
+                {!! $content !!}
+            @else
+                {!! $exception->getMessage() !!}
+                {!! $content !!}
+            @endif
+        
+
@endcomponent From 3aa18916bd24b966bdf10ab491717a18889d8e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:12:11 +0200 Subject: [PATCH 10/42] Admin: migration / max_companies.blade.php --- app/Console/Commands/SendTestEmails.php | 45 +++++++++++++++++-- .../email/migration/max_companies.blade.php | 22 +++------ 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/app/Console/Commands/SendTestEmails.php b/app/Console/Commands/SendTestEmails.php index be96efc1a3..cce65f40d6 100644 --- a/app/Console/Commands/SendTestEmails.php +++ b/app/Console/Commands/SendTestEmails.php @@ -17,6 +17,10 @@ use App\Factory\ClientFactory; use App\Factory\InvoiceFactory; use App\Factory\InvoiceInvitationFactory; use App\Jobs\Invoice\CreateEntityPdf; +use App\Jobs\Mail\NinjaMailerJob; +use App\Jobs\Mail\NinjaMailerObject; +use App\Mail\DownloadInvoices; +use App\Mail\Migration\MaxCompanies; use App\Mail\TemplateEmail; use App\Models\Account; use App\Models\Client; @@ -60,9 +64,44 @@ class SendTestEmails extends Command */ public function handle() { - $this->sendTemplateEmails('plain'); - $this->sendTemplateEmails('light'); - $this->sendTemplateEmails('dark'); + $faker = Factory::create(); + + $account = Account::factory()->create(); + + $user = User::factory()->create([ + 'account_id' => $account->id, + 'confirmation_code' => '123', + 'email' => $faker->safeEmail, + 'first_name' => 'John', + 'last_name' => 'Doe', + ]); + + $company = Company::factory()->create([ + 'account_id' => $account->id, + ]); + + $user->companies()->attach($company->id, [ + 'account_id' => $account->id, + 'is_owner' => 1, + 'is_admin' => 1, + 'is_locked' => 0, + 'permissions' => '', + 'notifications' => CompanySettings::notificationDefaults(), + //'settings' => DefaultSettings::userSettings(), + 'settings' => null, + ]); + + $nmo = new NinjaMailerObject; + $nmo->mailable = new DownloadInvoices('https://google.com', $user->account->companies()->first()); + $nmo->company = $user->account->companies()->first(); + $nmo->settings = $user->account->companies()->first()->settings; + $nmo->to_user = $user; + + NinjaMailerJob::dispatch($nmo); + + // $this->sendTemplateEmails('plain'); + // $this->sendTemplateEmails('light'); + // $this->sendTemplateEmails('dark'); } private function sendTemplateEmails($template) diff --git a/resources/views/email/migration/max_companies.blade.php b/resources/views/email/migration/max_companies.blade.php index 4d76f055b9..a9cfad1d73 100644 --- a/resources/views/email/migration/max_companies.blade.php +++ b/resources/views/email/migration/max_companies.blade.php @@ -1,18 +1,6 @@ -@component('email.template.master', ['design' => 'light', 'settings' => $settings]) - - @slot('header') - @include('email.components.header', ['logo' => $logo]) - @endslot - -

{{ctrans('texts.max_companies')}}

- -

{{ctrans('texts.max_companies_desc')}}

- - @if(isset($whitelabel) && !$whitelabel) - @slot('footer') - @component('email.components.footer', ['url' => 'https://invoiceninja.com', 'url_text' => '© InvoiceNinja']) - For any info, please visit InvoiceNinja. - @endcomponent - @endslot - @endif +@component('email.template.admin-light', ['logo' => $logo, 'settings' => $settings]) +
+

{{ ctrans('texts.max_companies') }}

+

{{ ctrans('texts.max_companies_desc') }}

+
@endcomponent From e6d19b77f639df86bddf63bce32f4ba579031374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:13:29 +0200 Subject: [PATCH 11/42] Admin: support / cancellation.blade.php --- resources/views/email/support/cancellation.blade.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/resources/views/email/support/cancellation.blade.php b/resources/views/email/support/cancellation.blade.php index 7cb9dd6d79..77ba26fb42 100644 --- a/resources/views/email/support/cancellation.blade.php +++ b/resources/views/email/support/cancellation.blade.php @@ -1,7 +1,3 @@ -@component('email.template.master', ['design' => 'light']) - @slot('header') - @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) - @endslot - - {{ $message }} +@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) + {!! $message !!} @endcomponent From eb1616387f33a17315d006061ff95ba6c68f26d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 7 Jun 2021 18:14:06 +0200 Subject: [PATCH 12/42] Admin: support / message.blade.php --- resources/views/email/support/message.blade.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/resources/views/email/support/message.blade.php b/resources/views/email/support/message.blade.php index acf8ae9e8f..858a9b8236 100644 --- a/resources/views/email/support/message.blade.php +++ b/resources/views/email/support/message.blade.php @@ -1,8 +1,4 @@ -@component('email.template.master', ['design' => 'light']) - @slot('header') - @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) - @endslot - +@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) {{-- Body --}} {{ $message }} From a7a4bcc19dbfa7e6a6cda258baa0bb4da61f5bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 9 Jun 2021 12:25:48 +0200 Subject: [PATCH 13/42] Merge admin light/dark master template into one file --- .../template/{admin-light.blade.php => admin.blade.php} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename resources/views/email/template/{admin-light.blade.php => admin.blade.php} (98%) diff --git a/resources/views/email/template/admin-light.blade.php b/resources/views/email/template/admin.blade.php similarity index 98% rename from resources/views/email/template/admin-light.blade.php rename to resources/views/email/template/admin.blade.php index fc362eb8bb..a7769219b8 100644 --- a/resources/views/email/template/admin-light.blade.php +++ b/resources/views/email/template/admin.blade.php @@ -4,20 +4,20 @@ - Verify your account + + + + + + + + + + +
+ + +
+ + + + + + + + + @if(isset($company) & $company instanceof \App\Models\Company) + + + + @endif + + + + +
+
+ + +
+
+
+
+ + {{ $slot }} +
+
+
+

+ {{ ctrans('texts.client_email_company_contact_label') }} +

+

+ {{ $company->present()->name() }}

+

+ {{ $company->settings->phone }} + {{ $company->settings->website }} +

+
+
+
+ @if(isset($company) && !$company->account->isPaid()) +

© {{ date('Y') }} Invoice Ninja, All + Rights Reserved +

+ @endif +
+
+
+ + + From 4cba96d97376a8f61096763c023dad17e49c8c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Fri, 11 Jun 2021 15:52:28 +0200 Subject: [PATCH 30/42] ACHVerificationNotification: - Pass $company into view - Update view to use client layout - Fixes for client layout / whitelabel handling --- .../Gateways/ACHVerificationNotification.php | 1 + .../ach-verification-notification.blade.php | 2 +- .../views/email/template/client.blade.php | 20 ++++++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/app/Mail/Gateways/ACHVerificationNotification.php b/app/Mail/Gateways/ACHVerificationNotification.php index b15709d638..346181a54e 100644 --- a/app/Mail/Gateways/ACHVerificationNotification.php +++ b/app/Mail/Gateways/ACHVerificationNotification.php @@ -47,6 +47,7 @@ class ACHVerificationNotification extends Mailable ->view('email.gateways.ach-verification-notification', [ 'logo' => $this->company->present()->logo(), 'settings' => $this->company->settings, + 'company' => $this->company, ]); } } diff --git a/resources/views/email/gateways/ach-verification-notification.blade.php b/resources/views/email/gateways/ach-verification-notification.blade.php index d03b3e64f5..1c49dddc0e 100644 --- a/resources/views/email/gateways/ach-verification-notification.blade.php +++ b/resources/views/email/gateways/ach-verification-notification.blade.php @@ -1,4 +1,4 @@ -@component('email.template.admin', ['logo' => $logo, 'settings' => $settings]) +@component('email.template.client', ['logo' => $logo, 'settings' => $settings, 'company' => $company])

{{ ctrans('texts.ach_verification_notification_label') }}

{{ ctrans('texts.ach_verification_notification') }}

diff --git a/resources/views/email/template/client.blade.php b/resources/views/email/template/client.blade.php index 34882974eb..f3ae10b440 100644 --- a/resources/views/email/template/client.blade.php +++ b/resources/views/email/template/client.blade.php @@ -111,15 +111,21 @@ -
-
+
+
- {{ $slot }} -
+ {{ $slot}} + +
+ + +
+
- @if(isset($company) & $company instanceof \App\Models\Company) + @if(isset($company) && $company instanceof \App\Models\Company)
© {{ date('Y') }} Invoice Ninja, All Rights Reserved

+ @else +

+ © {{ date('Y') }} Invoice Ninja, All Rights Reserved +

@endif
From 3977b4e662f7dcfbcb037e5110018784081cc71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:02:12 +0200 Subject: [PATCH 31/42] Refactor generic_email --- .../views/email/admin/generic_email.blade.php | 35 ++++++------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/resources/views/email/admin/generic_email.blade.php b/resources/views/email/admin/generic_email.blade.php index 47e58035e3..d439347a71 100644 --- a/resources/views/email/admin/generic_email.blade.php +++ b/resources/views/email/admin/generic_email.blade.php @@ -1,28 +1,15 @@ -@component('email.template.master', ['design' => 'light', 'settings' =>$settings]) +@component('email.template.admin', ['settings' => $settings, 'logo' => $logo]) +
+

{{ $title }}

-@slot('header') - @component('email.components.header', ['p' => $title, 'logo' => $logo]) - @endcomponent -@endslot + {{ ctrans("texts.{$body}") }} -@slot('greeting') - @lang($body) -@endslot - - @if(isset($view_link)) - @component('email.components.button', ['url' => $view_link]) - {{ $view_text }} - @endcomponent - @endif - - @if(isset($signature)) - {{ $signature }} - @endif - -@slot('footer') - @component('email.components.footer', ['url' => 'https://invoiceninja.com', 'url_text' => '© InvoiceNinja']) - For any info, please visit InvoiceNinja. - @endcomponent -@endslot + @isset($view_link) + {{{ $view_text }}} + @endisset + @isset($signature) +

{{ $signature }}

+ @endisset +
@endcomponent \ No newline at end of file From f35d1b7e7dc43874a415c324a83e4e885d9ea2cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:09:01 +0200 Subject: [PATCH 32/42] Update generic to accept $content and $slot --- resources/views/email/admin/generic.blade.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/views/email/admin/generic.blade.php b/resources/views/email/admin/generic.blade.php index ea26cb1ed0..e7c331f10c 100644 --- a/resources/views/email/admin/generic.blade.php +++ b/resources/views/email/admin/generic.blade.php @@ -13,7 +13,13 @@ @endisset
- {{ $content }} + @isset($content) + {{ $content }} + @endisset + + @isset($slot) + {{ $slot }} + @endisset
@isset($additional_info) From 5a458a858863c698915e85e1fb326965191b95f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:09:12 +0200 Subject: [PATCH 33/42] Update password-reset --- resources/views/email/auth/password-reset.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/email/auth/password-reset.blade.php b/resources/views/email/auth/password-reset.blade.php index 239a065218..f50bda5a9c 100644 --- a/resources/views/email/auth/password-reset.blade.php +++ b/resources/views/email/auth/password-reset.blade.php @@ -1,4 +1,4 @@ -@component('email.template.admin-light', ['logo' => $logo, 'settings' => $settings]) +@component('email.template.admin', ['logo' => $logo, 'settings' => $settings])

{{ ctrans('texts.reset_password') }}

From 5af9cc828ff999db860641c3f3e0c6b0ce5a9752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:12:06 +0200 Subject: [PATCH 34/42] Passwordless login --- app/Mail/ContactPasswordlessLogin.php | 1 + resources/views/email/auth/verify.blade.php | 2 +- resources/views/email/billing/passwordless-login.blade.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Mail/ContactPasswordlessLogin.php b/app/Mail/ContactPasswordlessLogin.php index aa4a03554c..065648fb63 100644 --- a/app/Mail/ContactPasswordlessLogin.php +++ b/app/Mail/ContactPasswordlessLogin.php @@ -57,6 +57,7 @@ class ContactPasswordlessLogin extends Mailable ->view('email.billing.passwordless-login', [ 'logo' => $this->company->present()->logo(), 'settings' => $this->company->settings, + 'company' => $this->company->settings, ]); } } diff --git a/resources/views/email/auth/verify.blade.php b/resources/views/email/auth/verify.blade.php index 7ef76cd707..d975af40e3 100644 --- a/resources/views/email/auth/verify.blade.php +++ b/resources/views/email/auth/verify.blade.php @@ -1,4 +1,4 @@ -@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' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png', 'settings' => $settings])

{{ ctrans('texts.confirmation_message') }}

diff --git a/resources/views/email/billing/passwordless-login.blade.php b/resources/views/email/billing/passwordless-login.blade.php index 43695a043d..0db522d193 100644 --- a/resources/views/email/billing/passwordless-login.blade.php +++ b/resources/views/email/billing/passwordless-login.blade.php @@ -1,4 +1,4 @@ -@component('email.template.admin', ['logo' => $logo, 'settings' => $settings]) +@component('email.template.client', ['logo' => $logo, 'settings' => $settings, 'company' => $company])

{{ ctrans('texts.login_link_requested_label') }}

{{ ctrans('texts.login_link_requested') }}

From 8493b2e4d680ac9478ae012fa1f80e78a2163d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:14:28 +0200 Subject: [PATCH 35/42] ImportCompleted email --- app/Mail/Import/ImportCompleted.php | 1 + resources/views/email/import/completed.blade.php | 2 +- resources/views/email/migration/completed.blade.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Mail/Import/ImportCompleted.php b/app/Mail/Import/ImportCompleted.php index 1d3220ef0e..36fd9f03f1 100644 --- a/app/Mail/Import/ImportCompleted.php +++ b/app/Mail/Import/ImportCompleted.php @@ -48,6 +48,7 @@ class ImportCompleted extends Mailable $data = array_merge($this->data, [ 'logo' => $this->company->present()->logo(), 'settings' => $this->company->settings, + 'company' => $this->company, ]); return $this diff --git a/resources/views/email/import/completed.blade.php b/resources/views/email/import/completed.blade.php index 4de8fa9dd2..e7b910cf48 100644 --- a/resources/views/email/import/completed.blade.php +++ b/resources/views/email/import/completed.blade.php @@ -1,4 +1,4 @@ -@component('email.template.admin', ['logo' => $logo, 'settings' => $settings]) +@component('email.template.admin', ['logo' => $logo, 'settings' => $settings, 'company' => $company ?? ''])

{{ ctrans('texts.import_complete') }}

Hello, here is the output of your recent import job.

diff --git a/resources/views/email/migration/completed.blade.php b/resources/views/email/migration/completed.blade.php index 418ac27fb9..385b1a6bcb 100644 --- a/resources/views/email/migration/completed.blade.php +++ b/resources/views/email/migration/completed.blade.php @@ -1,4 +1,4 @@ -@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' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png', 'settings' => $settings])

{{ ctrans('texts.migration_completed')}}

{{ ctrans('texts.migration_completed_description')}}

From fef1c604bc4c8c4893e7492ba44e1d8d1137201d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:17:43 +0200 Subject: [PATCH 36/42] QuoteWasApproved --- resources/lang/en/texts.php | 2 ++ resources/views/email/quotes/approved.blade.php | 14 +++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 08366293e5..1ff86933b0 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -4262,6 +4262,8 @@ $LANG = array( 'migration_failed_label' => 'Migration failed', 'migration_failed' => 'Looks like something went wrong with the migration for the following company:', 'client_email_company_contact_label' => 'If you have any questions please contact us, we\'re here to help!', + 'quote_was_approved_label' => 'Quote was approved', + 'quote_was_approved' => 'We would like to inform you that quote was approved.', ); return $LANG; diff --git a/resources/views/email/quotes/approved.blade.php b/resources/views/email/quotes/approved.blade.php index 78815d6be9..bcb4da3c06 100644 --- a/resources/views/email/quotes/approved.blade.php +++ b/resources/views/email/quotes/approved.blade.php @@ -1,10 +1,6 @@ -@component('email.template.master', ['design' => 'light', 'settings' => $settings]) - @slot('header') - @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) - @endslot - -

Quote approved!

-

We want to inform you that quote was approved.

- - Visit Invoice Ninja +@component('email.template.admin', ['settings' => $settings]) +
+

{{ ctrans('texts.quote_was_approved') }}

+

{{ ctrans('texts.quote_was_approved') }}

+
@endcomponent From a2fe0cbb6a9bd220d8e275f2ba476d9cff98e3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:19:56 +0200 Subject: [PATCH 37/42] SupportMessageSent --- app/Mail/SupportMessageSent.php | 3 ++- resources/views/email/support/cancellation.blade.php | 2 +- resources/views/email/support/message.blade.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Mail/SupportMessageSent.php b/app/Mail/SupportMessageSent.php index 197782f96f..e8301dfd1d 100644 --- a/app/Mail/SupportMessageSent.php +++ b/app/Mail/SupportMessageSent.php @@ -62,10 +62,11 @@ class SupportMessageSent extends Mailable return $this->from(config('mail.from.address'), config('mail.from.name')) ->replyTo($user->email, $user->present()->name()) ->subject($subject) - ->markdown('email.support.message', [ + ->view('email.support.message', [ 'message' => $this->message, 'system_info' => $system_info, 'laravel_log' => $log_lines, + 'logo' => $company->present()->logo(), ]); } } diff --git a/resources/views/email/support/cancellation.blade.php b/resources/views/email/support/cancellation.blade.php index 77ba26fb42..4b3e08de3f 100644 --- a/resources/views/email/support/cancellation.blade.php +++ b/resources/views/email/support/cancellation.blade.php @@ -1,3 +1,3 @@ -@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) +@component('email.template.admin', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) {!! $message !!} @endcomponent diff --git a/resources/views/email/support/message.blade.php b/resources/views/email/support/message.blade.php index 858a9b8236..3680ef7778 100644 --- a/resources/views/email/support/message.blade.php +++ b/resources/views/email/support/message.blade.php @@ -1,4 +1,4 @@ -@component('email.template.admin-light', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) +@component('email.template.admin', ['logo' => $logo ?? 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png']) {{-- Body --}} {{ $message }} From a967c3b9bd0fba0264c1263811a882a7e2242f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:40:18 +0200 Subject: [PATCH 38/42] Update icons on admin template --- public/images/emails/email.png | Bin 0 -> 2298 bytes public/images/emails/forum.png | Bin 0 -> 1191 bytes public/images/emails/slack.png | Bin 0 -> 3215 bytes resources/views/email/template/admin.blade.php | 3 +++ 4 files changed, 3 insertions(+) create mode 100644 public/images/emails/email.png create mode 100644 public/images/emails/forum.png create mode 100644 public/images/emails/slack.png diff --git a/public/images/emails/email.png b/public/images/emails/email.png new file mode 100644 index 0000000000000000000000000000000000000000..7ea6bf8c05e7817a4d5a3872e3c59f21e8b1836c GIT binary patch literal 2298 zcmb_e`!^E~A6_Y>h$gafOXw@tkiJtcxf^3>?)SNj=F+rGAz_%@Mw{z5vN36l#uB*{ zqRh*ZV&+o0ET-IELcHET;XUU)=lPuHoacO=b3V`KrzgV^Y9%TH5&-}JqBhp%P5{6m z4YUO;{; zk~B(JN$%!rXC?uk_M6=6M<^nt2}UMt<4@LX6MHG2qfqn$+{MUxX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FuWsQApGsEy%H+}$=sWAAQX*n-QUyXR`oo>}=<-|V|070KEmBu?yPsicGSN=Np7 zLTONs)%CO==vx#WQe240R+v;=i)WhZd7<2|6KetYpqcghGRCMqwbjE5@N9+pQnn4#f-!v})}0vD1WC`<_0aPhO{M+OEKaZeY=kcwMxZX0HWI!YY<*lcxd!n0In zE;BPHCe5IzNdE(xI_c~u^_uPmdviCpCWvxxyefNSu7{7rm&`voEZmQepAo+Qmv7#G zuDb69>AMb|zjW@Ii0$2@pK@(BuB`f*nE7R&@AagF+Xj|uM ziS;+GnDT5l`*|hJxToysviCfTZMVOSPS}#neL*I9ZFEbY!8P9Q3#`Yg(gm|x+6(_! z%!}yYGq^IXHRE@EK>Ln$?N`N=SN@-ICFr-O?$-I_P-`9jCOqF>_IUMnz1o<=E4Ce- z6PVkb>$Y`n(5kgTtE89SN}KY^*z0RkP;Rl;SHY#fnu6|XT;=xKDjTqB`_j0XRemey z0j<8We^OMI{mP}^CexC7b#8_wv@y4t6HwM<8SYdZRIpjY3 z!e2H0fwk-{ufi2V?3w2NI(j$#hx@DZ>@ybZ50ziEIOEm6m5W#YUdFfV-5jeKyNX{$ zyt=nCd1du-zNPQxSxwnh{mSFjzm>`>e=p}-A~(ZoLRG>mi&qm@K3?IzjBl~rEUTWX zj8_`3Hm+Q};`lPYMRIejI;sj@NxZtaGI@pja=wN0YO>;GOJAj4xvxIIO0x9mlit?pDgYc$d*CX^E>-1MePKv99M8 zn_FpWh`GTk?Zvwq17jtx^7fFdbpP@Y=d9&dSKCLe`E_NxPFU@$YO&RJUroD1=l|Mu zbd~?!#Eq|llkYoSU0IjB@KwnA=oM)Re_YcT9_kt~KfZDI)z_TDS7DFW9?fj4E1R>G z{mPE2&)>LC#lFfA^(sBplO;01%Q literal 0 HcmV?d00001 diff --git a/public/images/emails/slack.png b/public/images/emails/slack.png new file mode 100644 index 0000000000000000000000000000000000000000..5a42af5ba7e5048f25b0b48b5ea553fa66d2c38c GIT binary patch literal 3215 zcm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}|H%WHiD|nMMt)uD>%2B4sSg!p{Z8EIC`SpBQf*tz3fE=$w3QO2;QeE3>N(CR@pByq2PZovM?oZLZM=v`y#d#-p0B&6^m18T{$EAe)pp{YGPy5x$*B$e6nTAiP+uAdz)GkH7+A9buwN?j4rHW;QjKfcxLnc z+bH?R|5F;ur;weNgfdY^cMRZi($A4#tHX5;Ud#We;qBd?_Q?uOVy9u_-P@_-NA}|R n+Ol@C8i&W7PIJq|e5-Aw-Q0>W>Nxkm&%zGvc)H%oKjr@bUP&H~ literal 0 HcmV?d00001 diff --git a/resources/views/email/template/admin.blade.php b/resources/views/email/template/admin.blade.php index 3f269ddaa2..3d08cabd75 100644 --- a/resources/views/email/template/admin.blade.php +++ b/resources/views/email/template/admin.blade.php @@ -146,18 +146,21 @@
+ Forums + Slack + E-mail From abad83231bc3379fb5b3ff4bd75b89359caa44c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:42:56 +0200 Subject: [PATCH 39/42] Update admin to follow primary color --- resources/views/email/template/admin.blade.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/resources/views/email/template/admin.blade.php b/resources/views/email/template/admin.blade.php index 3d08cabd75..8f46db95f1 100644 --- a/resources/views/email/template/admin.blade.php +++ b/resources/views/email/template/admin.blade.php @@ -1,3 +1,7 @@ +@php + $primary_color = isset($settings) ? $settings->primary_color : '#4caf50'; +@endphp + @@ -70,7 +74,7 @@ /** Content-specific styles. **/ #content .button { display: inline-block; - background-color: #0091ea; + background-color: {{ $primary_color }}; color: #ffffff; text-transform: uppercase; letter-spacing: 2px; @@ -134,7 +138,7 @@ + style="background-color: {{ $primary_color }}; border: 1px solid #c2c2c2; border-top: none; border-bottom-color: {{ $primary_color }};">

+ style="vertical-align: middle;display: inline-block;background-color: #ffffff; color: {{ $primary_color }}; display: inline-block; text-decoration: none; width: 100px; text-align: center; font-size: 12px; height: 35px; line-height: 35px; margin-left: 10px; margin-right: 10px;"> Forums + style="vertical-align: middle;display: inline-block;background-color: #ffffff; color: {{ $primary_color }}; display: inline-block; text-decoration: none; width: 100px; text-align: center; font-size: 12px; height: 35px; line-height: 35px; margin-left: 10px; margin-right: 10px;"> Slack + style="vertical-align: middle;display: inline-block;background-color: #ffffff; color: {{ $primary_color }}; display: inline-block; text-decoration: none; width: 100px; text-align: center; font-size: 12px; height: 35px; line-height: 35px; margin-left: 10px; margin-right: 10px;"> E-mail + style="vertical-align: middle;display: inline-block;background-color: #ffffff; color: {{ $primary_color }}; display: inline-block; text-decoration: none; width: 100px; text-align: center; font-size: 12px; height: 35px; line-height: 35px; margin-left: 10px; margin-right: 10px;"> Support Docs

From 3dafb34d8f671fbb3f63c711de0272fab0b4a99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Sat, 12 Jun 2021 23:44:02 +0200 Subject: [PATCH 40/42] Update client to follow primary color --- resources/views/email/template/client.blade.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/views/email/template/client.blade.php b/resources/views/email/template/client.blade.php index f3ae10b440..20e1bfd12a 100644 --- a/resources/views/email/template/client.blade.php +++ b/resources/views/email/template/client.blade.php @@ -1,3 +1,8 @@ +@php + $primary_color = isset($settings) ? $settings->primary_color : '#4caf50'; +@endphp + + @@ -57,7 +62,7 @@ /** Content-specific styles. **/ #content .button { display: inline-block; - background-color: #0091ea; + background-color: {{ $primary_color }}; color: #ffffff; text-transform: uppercase; letter-spacing: 2px; @@ -118,7 +123,7 @@
From 2bc83aff276bf2e97666f31c720815f46a4ce3a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 14 Jun 2021 14:50:28 +0200 Subject: [PATCH 41/42] CSS inliner plugin --- .../MailCssInlinerServiceProvider.php | 41 +++++ app/Utils/CssInlinerPlugin.php | 140 ++++++++++++++++++ config/app.php | 2 +- config/css-inliner.php | 18 +++ 4 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 app/Providers/MailCssInlinerServiceProvider.php create mode 100644 app/Utils/CssInlinerPlugin.php create mode 100644 config/css-inliner.php diff --git a/app/Providers/MailCssInlinerServiceProvider.php b/app/Providers/MailCssInlinerServiceProvider.php new file mode 100644 index 0000000000..040bcd76ba --- /dev/null +++ b/app/Providers/MailCssInlinerServiceProvider.php @@ -0,0 +1,41 @@ +publishes([ + __DIR__ . '/../config/css-inliner.php' => base_path('config/css-inliner.php'), + ], 'config'); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton(CssInlinerPlugin::class, function ($app) { + return new CssInlinerPlugin([]); + }); + + $this->app->afterResolving('mail.manager', function (MailManager $mailManager) { + $mailManager->getSwiftMailer()->registerPlugin($this->app->make(CssInlinerPlugin::class)); + return $mailManager; + }); + } +} diff --git a/app/Utils/CssInlinerPlugin.php b/app/Utils/CssInlinerPlugin.php new file mode 100644 index 0000000000..0a6d8d9612 --- /dev/null +++ b/app/Utils/CssInlinerPlugin.php @@ -0,0 +1,140 @@ +converter = new CssToInlineStyles(); + $this->options = $options; + } + + /** + * @param \Swift_Events_SendEvent $evt + */ + public function beforeSendPerformed(\Swift_Events_SendEvent $evt) + { + $message = $evt->getMessage(); + + if ($message->getContentType() === 'text/html' + || ($message->getContentType() === 'multipart/alternative' && $message->getBody()) + || ($message->getContentType() === 'multipart/mixed' && $message->getBody()) + ) { + [$body, $cssResources] = $this->messageSieve($message->getBody()); + $css = $this->concatCss($cssResources); + $message->setBody($this->converter->convert($body, $css)); + } + + foreach ($message->getChildren() as $part) { + if (strpos($part->getContentType(), 'text/html') === 0) { + [$body, $cssResources] = $this->messageSieve($part->getBody()); + $css = $this->concatCss($cssResources); + $part->setBody($this->converter->convert($body, $css)); + } + } + } + + /** + * Do nothing + * + * @param \Swift_Events_SendEvent $evt + */ + public function sendPerformed(\Swift_Events_SendEvent $evt) + { + // Do Nothing + } + + protected function concatCss(array $cssResources): string + { + $output = ''; + foreach ($cssResources as $cssResource) { + $output.= $this->fetchCss($cssResource); + } + + return $output; + } + + protected function fetchCss(string $filename): string + { + if (isset($this->cssCache[$filename])) { + return $this->cssCache[$filename]; + } + + $fixedFilename = $filename; + // Fix relative protocols on hrefs. Assume https. + if (substr($filename, 0, 2) === '//') { + $fixedFilename = 'https:' . $filename; + } + + $content = file_get_contents($fixedFilename); + if (! $content) { + return ''; + } + + $this->cssCache[$filename] = $content; + + return $content; + } + + protected function messageSieve(string $message): array + { + $cssResources = []; + + // Initialize with config defaults, if any + if (isset($this->options['css-files'])) { + $cssResources = $this->options['css-files']; + } + + $dom = new \DOMDocument(); + // set error level + $internalErrors = libxml_use_internal_errors(true); + + $dom->loadHTML($message); + + // Restore error level + libxml_use_internal_errors($internalErrors); + $link_tags = $dom->getElementsByTagName('link'); + + /** @var \DOMElement $link */ + foreach ($link_tags as $link) { + if ($link->getAttribute('rel') === 'stylesheet') { + array_push($cssResources, $link->getAttribute('href')); + } + } + + $link_tags = $dom->getElementsByTagName('link'); + for ($i = $link_tags->length; --$i >= 0;) { + $link = $link_tags->item($i); + if ($link->getAttribute('rel') === 'stylesheet') { + $link->parentNode->removeChild($link); + } + } + + if (count($cssResources)) { + return [$dom->saveHTML(), $cssResources]; + } + + return [$message, []]; + } +} diff --git a/config/app.php b/config/app.php index b5a5b1bbab..79240cf39c 100644 --- a/config/app.php +++ b/config/app.php @@ -181,7 +181,7 @@ return [ App\Providers\MultiDBProvider::class, App\Providers\ClientPortalServiceProvider::class, App\Providers\NinjaTranslationServiceProvider::class, - + App\Providers\MailCssInlinerServiceProvider::class, ], /* diff --git a/config/css-inliner.php b/config/css-inliner.php new file mode 100644 index 0000000000..b45f64c3c8 --- /dev/null +++ b/config/css-inliner.php @@ -0,0 +1,18 @@ + [], + +]; From 01e7e3271e26045c858d97bf87109ea96eeaa456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 15 Jun 2021 15:42:37 +0200 Subject: [PATCH 42/42] Adapt templates for dynamic emails --- app/Mail/TemplateEmail.php | 4 +++- app/Utils/TemplateEngine.php | 9 ++++++++- resources/views/email/template/client.blade.php | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/Mail/TemplateEmail.php b/app/Mail/TemplateEmail.php index 1568c290e9..d5d95dafec 100644 --- a/app/Mail/TemplateEmail.php +++ b/app/Mail/TemplateEmail.php @@ -49,7 +49,8 @@ class TemplateEmail extends Mailable public function build() { - $template_name = 'email.template.'.$this->build_email->getTemplate(); + // $template_name = 'email.template.'.$this->build_email->getTemplate(); + $template_name = 'email.template.client'; if($this->build_email->getTemplate() == 'custom') { $this->build_email->setBody(str_replace('$body', $this->build_email->getBody(), $this->client->getSetting('email_style_custom'))); @@ -100,6 +101,7 @@ class TemplateEmail extends Mailable 'settings' => $settings, 'company' => $company, 'whitelabel' => $this->client->user->account->isPaid() ? true : false, + 'logo' => $this->company->present()->logo(), ]) ->withSwiftMessage(function ($message) use($company){ $message->getHeaders()->addTextHeader('Tag', $company->company_key); diff --git a/app/Utils/TemplateEngine.php b/app/Utils/TemplateEngine.php index 1632c93e17..b602a77e13 100644 --- a/app/Utils/TemplateEngine.php +++ b/app/Utils/TemplateEngine.php @@ -194,6 +194,7 @@ class TemplateEngine $data['title'] = ''; $data['body'] = '$body'; $data['footer'] = ''; + $data['logo'] = auth()->user()->company()->present()->logo(); $data = array_merge($data, Helpers::sharedEmailVariables($this->entity_obj->client)); @@ -211,11 +212,17 @@ class TemplateEngine } else { $wrapper = ''; } - } else { + } + elseif ($email_style == 'plain') { $wrapper = view($this->getTemplatePath($email_style), $data)->render(); $injection = ''; $wrapper = str_replace('', $injection, $wrapper); } + else { + $wrapper = view($this->getTemplatePath('client'), $data)->render(); + $injection = ''; + $wrapper = str_replace('', $injection, $wrapper); + } $data = [ 'subject' => $this->subject, diff --git a/resources/views/email/template/client.blade.php b/resources/views/email/template/client.blade.php index 20e1bfd12a..1701ae3c53 100644 --- a/resources/views/email/template/client.blade.php +++ b/resources/views/email/template/client.blade.php @@ -119,7 +119,8 @@
- {{ $slot}} + {{ $slot ?? '' }} + {!! $body ?? '' !!}