mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Merge pull request #4088 from beganovich/v2-email-custom-colors
Dynamic primary color borders on e-mails
This commit is contained in:
commit
acd33f7504
@ -87,7 +87,7 @@ class InvoiceController extends Controller
|
||||
$total = $invoices->sum('balance');
|
||||
|
||||
$invoices = $invoices->filter(function ($invoice) {
|
||||
return $invoice->isPayable();
|
||||
return $invoice->isPayable() && $invoice->balance > 0;
|
||||
});
|
||||
|
||||
if ($invoices->count() == 0) {
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
@component('email.template.master', ['design' => 'dark'])
|
||||
@component('email.template.master', ['design' => 'dark', 'settings' => $settigns])
|
||||
|
||||
@slot('header')
|
||||
@component('email.components.header', ['p' => $body, 'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png'])
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -86,7 +86,7 @@
|
||||
{!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
|
||||
</td>
|
||||
<td class="flex items-center justify-end px-6 py-4 text-sm font-medium leading-5 whitespace-no-wrap">
|
||||
@if($invoice->isPayable())
|
||||
@if($invoice->isPayable() && $invoice->balance > 0)
|
||||
<form action="{{ route('client.invoices.bulk') }}" method="post">
|
||||
@csrf
|
||||
<input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">
|
||||
|
Loading…
x
Reference in New Issue
Block a user