mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:29:03 -05: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');
 | 
					        $total = $invoices->sum('balance');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoices = $invoices->filter(function ($invoice) {
 | 
					        $invoices = $invoices->filter(function ($invoice) {
 | 
				
			||||||
            return $invoice->isPayable();
 | 
					            return $invoice->isPayable() && $invoice->balance > 0;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($invoices->count() == 0) {
 | 
					        if ($invoices->count() == 0) {
 | 
				
			||||||
 | 
				
			|||||||
@ -37,6 +37,8 @@ class TemplateEngine
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private $settings_entity;
 | 
					    private $settings_entity;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private $settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function __construct($body, $subject, $entity, $entity_id, $template)
 | 
					    public function __construct($body, $subject, $entity, $entity_id, $template)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->body = $body;
 | 
					        $this->body = $body;
 | 
				
			||||||
@ -77,8 +79,10 @@ class TemplateEngine
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        if ($this->entity_obj) {
 | 
					        if ($this->entity_obj) {
 | 
				
			||||||
            $this->settings_entity = $this->entity_obj->client;
 | 
					            $this->settings_entity = $this->entity_obj->client;
 | 
				
			||||||
 | 
					            $this->settings = $this->settings_entity->getMergedSettings();
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $this->settings_entity = auth()->user()->company();
 | 
					            $this->settings_entity = auth()->user()->company();
 | 
				
			||||||
 | 
					            $this->settings = $this->settings_entity->settings;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
@ -168,6 +172,7 @@ class TemplateEngine
 | 
				
			|||||||
        $data['body'] = '$body';
 | 
					        $data['body'] = '$body';
 | 
				
			||||||
        $data['footer'] = '';
 | 
					        $data['footer'] = '';
 | 
				
			||||||
        $data['signature'] = $this->settings_entity->getSetting('email_signature');
 | 
					        $data['signature'] = $this->settings_entity->getSetting('email_signature');
 | 
				
			||||||
 | 
					        $data['settings'] = $this->settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($email_style == 'custom') {
 | 
					        if ($email_style == 'custom') {
 | 
				
			||||||
            $wrapper = $this->settings_entity->getSetting('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')
 | 
					@slot('header')
 | 
				
			||||||
    @component('email.components.header', ['p' => $body, 'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png'])
 | 
					    @component('email.components.header', ['p' => $body, 'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png'])
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
@component('email.template.master', ['design' => 'light'])
 | 
					@component('email.template.master', ['design' => 'light', 'settings' => $settings])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@slot('header')
 | 
					@slot('header')
 | 
				
			||||||
    @component('email.components.header', ['p' => $body, 'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png'])
 | 
					    @component('email.components.header', ['p' => $body, 'logo' => 'https://www.invoiceninja.com/wp-content/uploads/2019/01/InvoiceNinja-Logo-Round-300x300.png'])
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
@php
 | 
					@php
 | 
				
			||||||
  if(!isset($design)) $design = 'light';
 | 
					if(!isset($design)) $design = 'light';
 | 
				
			||||||
@endphp
 | 
					@endphp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
@ -11,22 +11,32 @@
 | 
				
			|||||||
  <title>@yield('title')</title>
 | 
					  <title>@yield('title')</title>
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @if($design == 'dark')
 | 
					<style>
 | 
				
			||||||
    <style>
 | 
					  :root {
 | 
				
			||||||
 | 
					    --primary-color: {{ $settings->primary_color }};
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  .border-primary {
 | 
				
			||||||
 | 
					    border-color: var(--primary-color);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@if($design == 'dark')
 | 
				
			||||||
 | 
					<style>
 | 
				
			||||||
  * {
 | 
					  * {
 | 
				
			||||||
    color: #cbd5e0 !important;
 | 
					    color: #cbd5e0 !important;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
    </style>
 | 
					</style>
 | 
				
			||||||
  @endif
 | 
					@endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<body class="{{ $design == 'light' ? 'bg-gray-200' : 'bg-gray-800' }} my-10 font-sans {{ $design == 'light' ? 'text-gray-700' : 'text-gray-400' }}">
 | 
					<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="grid grid-cols-6">
 | 
				
			||||||
    <div class="col-start-2 col-span-4">
 | 
					    <div class="col-span-4 col-start-2">
 | 
				
			||||||
      <div class="{{ $design == 'light' ? 'bg-white' : 'bg-gray-900' }} shadow border-t-2 {{ $design == 'light' ? 'border-green-500' : 'border-gray-800' }}">
 | 
					      <div class="{{ $design == 'light' ? 'bg-white' : 'bg-gray-900' }} shadow border-t-2 {{ $design == 'light' ? 'border-primary' : 'border-gray-800' }}">
 | 
				
			||||||
        <div class="px-10">
 | 
					        <div class="px-10">
 | 
				
			||||||
          {{ $header }}
 | 
					          {{ $header }}
 | 
				
			||||||
        </div>
 | 
					        </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)
 | 
					          @isset($greeting)
 | 
				
			||||||
          {{ $greeting }}
 | 
					          {{ $greeting }}
 | 
				
			||||||
          @endisset
 | 
					          @endisset
 | 
				
			||||||
@ -40,7 +50,7 @@
 | 
				
			|||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      @isset($below_card)
 | 
					      @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 }}
 | 
					        {{ $below_card }}
 | 
				
			||||||
      </div>
 | 
					      </div>
 | 
				
			||||||
      @endisset
 | 
					      @endisset
 | 
				
			||||||
 | 
				
			|||||||
@ -86,7 +86,7 @@
 | 
				
			|||||||
                                {!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
 | 
					                                {!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
 | 
				
			||||||
                            </td>
 | 
					                            </td>
 | 
				
			||||||
                            <td class="flex items-center justify-end px-6 py-4 text-sm font-medium leading-5 whitespace-no-wrap">
 | 
					                            <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">
 | 
					                                    <form action="{{ route('client.invoices.bulk') }}" method="post">
 | 
				
			||||||
                                        @csrf
 | 
					                                        @csrf
 | 
				
			||||||
                                        <input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">
 | 
					                                        <input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user