Adapt templates for dynamic emails

This commit is contained in:
Benjamin Beganović 2021-06-15 15:42:37 +02:00
parent 2bc83aff27
commit 01e7e3271e
3 changed files with 13 additions and 3 deletions

View File

@ -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);

View File

@ -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('<head>', $injection, $wrapper);
}
else {
$wrapper = view($this->getTemplatePath('client'), $data)->render();
$injection = '';
$wrapper = str_replace('<head>', $injection, $wrapper);
}
$data = [
'subject' => $this->subject,

View File

@ -119,7 +119,8 @@
<div style="border: 1px solid #c2c2c2; border-top: none; border-bottom: none; padding: 20px;" id="content">
<div style="padding-top: 10px;"></div>
{{ $slot}}
{{ $slot ?? '' }}
{!! $body ?? '' !!}
<div>
<a href="#"