diff --git a/app/DataMapper/EmailTemplateDefaults.php b/app/DataMapper/EmailTemplateDefaults.php index e92fda3da951..9cc5bfa8302a 100644 --- a/app/DataMapper/EmailTemplateDefaults.php +++ b/app/DataMapper/EmailTemplateDefaults.php @@ -119,7 +119,9 @@ class EmailTemplateDefaults 'allow_unsafe_links' => false, ]); - return $converter->convertToHtml(self::transformText('invoice_message')); + $invoice_message = '

' . self::transformText('invoice_message') . '



$view_link

'; + return $invoice_message; + //return $converter->convertToHtml($invoice_message); } diff --git a/app/Http/Controllers/TemplateController.php b/app/Http/Controllers/TemplateController.php index 35aae2320e2e..1f492c3eb488 100644 --- a/app/Http/Controllers/TemplateController.php +++ b/app/Http/Controllers/TemplateController.php @@ -16,6 +16,7 @@ use App\Utils\TemplateEngine; use App\Utils\Traits\MakesHash; use App\Utils\Traits\MakesInvoiceHtml; use App\Utils\Traits\MakesTemplateData; +use Illuminate\Notifications\Messages\MailMessage; use League\CommonMark\CommonMarkConverter; class TemplateController extends BaseController @@ -93,6 +94,8 @@ class TemplateController extends BaseController $data = (new TemplateEngine($body, $subject, $entity, $entity_id, $template))->build(); + return response()->json($data, 200); } + } diff --git a/app/Notifications/BaseNotification.php b/app/Notifications/BaseNotification.php index 293cc145c805..2fb450ba2860 100644 --- a/app/Notifications/BaseNotification.php +++ b/app/Notifications/BaseNotification.php @@ -131,6 +131,12 @@ class BaseNotification extends Notification implements ShouldQueue case 'custom': return 'email.template.custom'; break; + case 'light': + return 'email.template.light'; + break; + case 'dark': + return 'email.template.dark'; + break; default: return 'email.admin.generic_email'; break; diff --git a/app/Notifications/SendGenericNotification.php b/app/Notifications/SendGenericNotification.php index 097047c023cb..d805c995a2ea 100644 --- a/app/Notifications/SendGenericNotification.php +++ b/app/Notifications/SendGenericNotification.php @@ -77,8 +77,8 @@ class SendGenericNotification extends BaseNotification implements ShouldQueue $mail_message = (new MailMessage) ->withSwiftMessage(function ($message) { $message->getHeaders()->addTextHeader('Tag', $this->invitation->company->company_key); - //})->markdown($this->getTemplateView(), $this->buildMailMessageData()); - })->markdown('email.template.plain', $this->buildMailMessageData()); + })->markdown($this->getTemplateView(), $this->buildMailMessageData()); + //})->markdown('email.template.plain', $this->buildMailMessageData()); $mail_message = $this->buildMailMessageSettings($mail_message); diff --git a/app/Utils/TemplateEngine.php b/app/Utils/TemplateEngine.php index ee4f9ffa833c..8bf7a6daf2ff 100644 --- a/app/Utils/TemplateEngine.php +++ b/app/Utils/TemplateEngine.php @@ -126,6 +126,7 @@ class TemplateEngine ]); $this->body = $converter->convertToHtml($this->body); + } private function entityValues($contact) @@ -165,10 +166,12 @@ class TemplateEngine $wrapper = ''; } } else { - $wrapper = $this->getTemplate(); $wrapper = view($this->getTemplatePath($email_style), $data)->render(); + $injection = ''; + $wrapper = str_replace('',$injection ,$wrapper); } +info($this->body); $data = [ 'subject' => $this->subject, 'body' => $this->body, diff --git a/resources/views/email/components/header.blade.php b/resources/views/email/components/header.blade.php index 16eb31e070c5..75ee6c10315f 100644 --- a/resources/views/email/components/header.blade.php +++ b/resources/views/email/components/header.blade.php @@ -9,6 +9,6 @@ {{ $slot }} @isset($p) -

{{ $p }}

+ {!! $p !!} @endisset \ No newline at end of file diff --git a/resources/views/email/template/master.blade.php b/resources/views/email/template/master.blade.php index 9a344f86dd67..903284930cc4 100644 --- a/resources/views/email/template/master.blade.php +++ b/resources/views/email/template/master.blade.php @@ -26,13 +26,13 @@ {{ $header }}
@isset($greeting) -

{{ $greeting }}

+ {{ $greeting }} @endisset -

+ {{ $slot }} -

+ @isset($signature) -

{{ $signature }}

+ {{ $signature }} @endisset
diff --git a/resources/views/email/template/plain.blade.php b/resources/views/email/template/plain.blade.php index a5154f26a0af..fe2dacd8edbc 100644 --- a/resources/views/email/template/plain.blade.php +++ b/resources/views/email/template/plain.blade.php @@ -1,9 +1,9 @@ - + - + {!! $body !!}