1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00

Dynamic primary color borders on e-mails

This commit is contained in:
Benjamin Beganović 2020-09-18 14:27:20 +02:00
parent 8d6b9ece92
commit 792f9717f7
3 changed files with 34 additions and 19 deletions

View File

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

View File

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

View File

@ -1,5 +1,5 @@
@php
if(!isset($design)) $design = 'light';
if(!isset($design)) $design = 'light';
@endphp
<!DOCTYPE html>
@ -11,36 +11,46 @@
<title>@yield('title')</title>
</head>
@if($design == 'dark')
<style>
* {
color: #cbd5e0 !important;
}
</style>
@endif
<style>
:root {
--primary-color: {{ $settings->primary_color }};
}
.border-primary {
border-color: var(--primary-color);
}
</style>
@if($design == 'dark')
<style>
* {
color: #cbd5e0 !important;
}
</style>
@endif
<body class="{{ $design == 'light' ? 'bg-gray-200' : 'bg-gray-800' }} my-10 font-sans {{ $design == 'light' ? 'text-gray-700' : 'text-gray-400' }}">
<div class="grid grid-cols-6">
<div class="col-start-2 col-span-4">
<div class="{{ $design == 'light' ? 'bg-white' : 'bg-gray-900' }} shadow border-t-2 {{ $design == 'light' ? 'border-green-500' : 'border-gray-800' }}">
<div class="col-span-4 col-start-2">
<div class="{{ $design == 'light' ? 'bg-white' : 'bg-gray-900' }} shadow border-t-2 {{ $design == 'light' ? 'border-primary' : 'border-gray-800' }}">
<div class="px-10">
{{ $header }}
</div>
<div id="text" class="px-10 py-6 flex flex-col">
<div id="text" class="flex flex-col px-10 py-6">
@isset($greeting)
{{ $greeting }}
{{ $greeting }}
@endisset
{{ $slot }}
{{ $slot }}
@isset($signature)
{{ $signature }}
{{ $signature }}
@endisset
</div>
</div>
@isset($below_card)
<div id="bottomText" class="text-center my-4 px-10">
<div id="bottomText" class="px-10 my-4 text-center">
{{ $below_card }}
</div>
@endisset