From 792f9717f77d02e4566dfb6a695d4d0df2deb2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Fri, 18 Sep 2020 14:27:20 +0200 Subject: [PATCH] Dynamic primary color borders on e-mails --- app/Utils/TemplateEngine.php | 5 +++ .../views/email/template/light.blade.php | 4 +- .../views/email/template/master.blade.php | 44 ++++++++++++------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/app/Utils/TemplateEngine.php b/app/Utils/TemplateEngine.php index 14ce8fb1fa..8a90ab4430 100644 --- a/app/Utils/TemplateEngine.php +++ b/app/Utils/TemplateEngine.php @@ -37,6 +37,8 @@ class TemplateEngine private $settings_entity; + private $settings; + public function __construct($body, $subject, $entity, $entity_id, $template) { $this->body = $body; @@ -77,8 +79,10 @@ class TemplateEngine { if ($this->entity_obj) { $this->settings_entity = $this->entity_obj->client; + $this->settings = $this->settings_entity->getMergedSettings(); } else { $this->settings_entity = auth()->user()->company(); + $this->settings = $this->settings_entity->settings; } return $this; @@ -168,6 +172,7 @@ class TemplateEngine $data['body'] = '$body'; $data['footer'] = ''; $data['signature'] = $this->settings_entity->getSetting('email_signature'); + $data['settings'] = $this->settings; if ($email_style == 'custom') { $wrapper = $this->settings_entity->getSetting('email_style_custom'); diff --git a/resources/views/email/template/light.blade.php b/resources/views/email/template/light.blade.php index 704568b2f0..e1f47a5579 100644 --- a/resources/views/email/template/light.blade.php +++ b/resources/views/email/template/light.blade.php @@ -1,10 +1,10 @@ -@component('email.template.master', ['design' => 'light']) +@component('email.template.master', ['design' => 'light', 'settings' => $settings]) @slot('header') @component('email.components.header', ['p' => $body, 'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png']) @if(isset($title)) - {{$title}} + {{$title}} @endif @endcomponent diff --git a/resources/views/email/template/master.blade.php b/resources/views/email/template/master.blade.php index 8e7ae0f9b7..0c3dc3ef54 100644 --- a/resources/views/email/template/master.blade.php +++ b/resources/views/email/template/master.blade.php @@ -1,5 +1,5 @@ @php - if(!isset($design)) $design = 'light'; +if(!isset($design)) $design = 'light'; @endphp @@ -11,36 +11,46 @@ @yield('title') - @if($design == 'dark') - - @endif + + +@if($design == 'dark') + +@endif
-
-
+
+
{{ $header }}
-
+
@isset($greeting) - {{ $greeting }} + {{ $greeting }} @endisset - - {{ $slot }} - + + {{ $slot }} + @isset($signature) - {{ $signature }} + {{ $signature }} @endisset
@isset($below_card) -
+
{{ $below_card }}
@endisset