diff --git a/app/Http/Controllers/EstimatesController.php b/app/Http/Controllers/EstimatesController.php index 3ba797ba..3312842d 100644 --- a/app/Http/Controllers/EstimatesController.php +++ b/app/Http/Controllers/EstimatesController.php @@ -146,11 +146,9 @@ class EstimatesController extends Controller if ($request->has('estimateSend')) { $data['estimate'] = $estimate->toArray(); - $company = Company::find($data['estimate']['company_id']); $userId = $data['estimate']['user_id']; $data['user'] = User::find($userId)->toArray(); - $data['logo'] = $company->getMedia('logo')->first(); - $data['company_name'] = $company->name; + $data['company'] = Company::find($estimate->company_id); $email = $data['user']['email']; $notificationEmail = CompanySetting::getSetting( 'notification_email', @@ -310,13 +308,11 @@ class EstimatesController extends Controller public function sendEstimate(Request $request) { $estimate = Estimate::findOrFail($request->id); - $company = Company::find($estimate->company_id); $data['estimate'] = $estimate->toArray(); $userId = $data['estimate']['user_id']; $data['user'] = User::find($userId)->toArray(); - $data['logo'] = $company->getMedia('logo')->first(); - $data['company_name'] = $company->name; + $data['company'] = Company::find($estimate->company_id); $email = $data['user']['email']; $notificationEmail = CompanySetting::getSetting( diff --git a/app/Http/Controllers/InvoicesController.php b/app/Http/Controllers/InvoicesController.php index f4edb533..da97751f 100644 --- a/app/Http/Controllers/InvoicesController.php +++ b/app/Http/Controllers/InvoicesController.php @@ -148,10 +148,8 @@ class InvoicesController extends Controller if ($request->has('invoiceSend')) { $data['invoice'] = Invoice::findOrFail($invoice->id)->toArray(); - $company = Company::find($invoice->company_id); $data['user'] = User::find($request->user_id)->toArray(); - $data['logo'] = $company->getMedia('logo')->first(); - $data['company_name'] = $company->name; + $data['company'] = Company::find($invoice->company_id); $notificationEmail = CompanySetting::getSetting( 'notification_email', @@ -374,13 +372,11 @@ class InvoicesController extends Controller public function sendInvoice(Request $request) { $invoice = Invoice::findOrFail($request->id); - $company = Company::find($invoice->company_id); $data['invoice'] = $invoice->toArray(); $userId = $data['invoice']['user_id']; $data['user'] = User::find($userId)->toArray(); - $data['logo'] = $company->getMedia('logo')->first(); - $data['company_name'] = $company->name; + $data['company'] = Company::find($invoice->company_id); $email = $data['user']['email']; $notificationEmail = CompanySetting::getSetting( 'notification_email', diff --git a/resources/views/emails/send/estimate.blade.php b/resources/views/emails/send/estimate.blade.php index b8773e7c..685b5d6f 100644 --- a/resources/views/emails/send/estimate.blade.php +++ b/resources/views/emails/send/estimate.blade.php @@ -1,10 +1,32 @@ -@component('mail::message') -Check your estimate. +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => '']) + @if($data['company']['logo']) + + @else + {{$data['company']['name']}} + @endif + @endcomponent + @endslot -@component('mail::button', ['url' => url('/customer/estimates/pdf/'.$data['estimate']['unique_hash'])]) -Get your estimate + {{-- Body --}} + + + {{-- Subcopy --}} + @slot('subcopy') + @component('mail::subcopy') + You have received a new estimate from {{$data['company']['name']}} + @component('mail::button', ['url' => url('/customer/estimates/pdf/'.$data['estimate']['unique_hash'])]) + View Estimate + @endcomponent + @endcomponent + @endslot + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + Powered by Crater + @endcomponent + @endslot @endcomponent -Thanks,
-{{ config('app.name') }} -@endcomponent diff --git a/resources/views/emails/send/invoice.blade.php b/resources/views/emails/send/invoice.blade.php index d0b9717d..e57c885f 100644 --- a/resources/views/emails/send/invoice.blade.php +++ b/resources/views/emails/send/invoice.blade.php @@ -1,11 +1,31 @@ -@component('mail::message') -@if (! empty($logo)) -# {{ $company }} -@else -@component('mail::button', ['url' => url('/customer/invoices/pdf/'.$data['invoice']['unique_hash'])]) -Get your invoice -@endcomponent +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => '']) + @if($data['company']['logo']) + + @else + {{$data['company']['name']}} + @endif + @endcomponent + @endslot -{{-- Thanks,
-{{ config('app.name') }} --}} + {{-- Body --}} + + + {{-- Subcopy --}} + @slot('subcopy') + @component('mail::subcopy') + You have received a new invoice from {{$data['company']['name']}} + @component('mail::button', ['url' => url('/customer/invoices/pdf/'.$data['invoice']['unique_hash'])]) + View Invoice + @endcomponent + @endcomponent + @endslot + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + Powered by Crater + @endcomponent + @endslot @endcomponent diff --git a/resources/views/vendor/mail/html/button.blade.php b/resources/views/vendor/mail/html/button.blade.php new file mode 100644 index 00000000..512c1d8c --- /dev/null +++ b/resources/views/vendor/mail/html/button.blade.php @@ -0,0 +1,19 @@ + + + + + diff --git a/resources/views/vendor/mail/html/footer.blade.php b/resources/views/vendor/mail/html/footer.blade.php new file mode 100644 index 00000000..33f7dad7 --- /dev/null +++ b/resources/views/vendor/mail/html/footer.blade.php @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/resources/views/vendor/mail/html/header.blade.php b/resources/views/vendor/mail/html/header.blade.php new file mode 100644 index 00000000..a1547a81 --- /dev/null +++ b/resources/views/vendor/mail/html/header.blade.php @@ -0,0 +1,7 @@ + + + {{-- --}} + {{ $slot }} + {{-- --}} + + diff --git a/resources/views/vendor/mail/html/layout.blade.php b/resources/views/vendor/mail/html/layout.blade.php new file mode 100644 index 00000000..eded4957 --- /dev/null +++ b/resources/views/vendor/mail/html/layout.blade.php @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + diff --git a/resources/views/vendor/mail/html/message.blade.php b/resources/views/vendor/mail/html/message.blade.php new file mode 100644 index 00000000..1ae9ed8f --- /dev/null +++ b/resources/views/vendor/mail/html/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') + @endcomponent + @endslot +@endcomponent diff --git a/resources/views/vendor/mail/html/panel.blade.php b/resources/views/vendor/mail/html/panel.blade.php new file mode 100644 index 00000000..783af16c --- /dev/null +++ b/resources/views/vendor/mail/html/panel.blade.php @@ -0,0 +1,13 @@ + + + + + diff --git a/resources/views/vendor/mail/html/promotion.blade.php b/resources/views/vendor/mail/html/promotion.blade.php new file mode 100644 index 00000000..f78b358c --- /dev/null +++ b/resources/views/vendor/mail/html/promotion.blade.php @@ -0,0 +1,7 @@ + + + + + diff --git a/resources/views/vendor/mail/html/promotion/button.blade.php b/resources/views/vendor/mail/html/promotion/button.blade.php new file mode 100644 index 00000000..1dcb2ee4 --- /dev/null +++ b/resources/views/vendor/mail/html/promotion/button.blade.php @@ -0,0 +1,13 @@ + + + + +
+ + + + +
+ {{ $slot }} +
+
diff --git a/resources/views/vendor/mail/html/subcopy.blade.php b/resources/views/vendor/mail/html/subcopy.blade.php new file mode 100644 index 00000000..f559e8f1 --- /dev/null +++ b/resources/views/vendor/mail/html/subcopy.blade.php @@ -0,0 +1,7 @@ + + + + + diff --git a/resources/views/vendor/mail/html/table.blade.php b/resources/views/vendor/mail/html/table.blade.php new file mode 100644 index 00000000..a5f3348b --- /dev/null +++ b/resources/views/vendor/mail/html/table.blade.php @@ -0,0 +1,3 @@ +
+{{ Illuminate\Mail\Markdown::parse($slot) }} +
diff --git a/resources/views/vendor/mail/html/themes/default.css b/resources/views/vendor/mail/html/themes/default.css new file mode 100644 index 00000000..94aa08dd --- /dev/null +++ b/resources/views/vendor/mail/html/themes/default.css @@ -0,0 +1,307 @@ +/* Base */ + +body, +body *:not(html):not(style):not(br):not(tr):not(code) { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, + 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; + box-sizing: border-box; +} + +body { + background-color: #f8fafc; + color: #74787e; + height: 100%; + hyphens: auto; + line-height: 1.4; + margin: 0; + -moz-hyphens: auto; + -ms-word-break: break-all; + width: 100% !important; + -webkit-hyphens: auto; + -webkit-text-size-adjust: none; + word-break: break-all; + word-break: break-word; +} + +p, +ul, +ol, +blockquote { + line-height: 1.4; + text-align: left; +} + +a { + color: #3869d4; +} + +a img { + border: none; +} + +/* Typography */ + +h1 { + color: #3d4852; + font-size: 19px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h2 { + color: #3d4852; + font-size: 16px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +h3 { + color: #3d4852; + font-size: 14px; + font-weight: bold; + margin-top: 0; + text-align: left; +} + +p { + color: #3d4852; + font-size: 16px; + line-height: 1.5em; + margin-top: 0; + text-align: left; +} + +p.sub { + font-size: 12px; +} + +img { + max-width: 100%; +} + +/* Layout */ + +.wrapper { + background-color: #f8fafc; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.content { + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +/* Header */ + +.header { + padding: 25px 0; + text-align: center; +} + +.header { + color: #bbbfc3; + font-size: 25px; + font-weight: 400; + text-transform: capitalize; + text-decoration: none; + text-shadow: 0 1px 0 white; +} + +.header-logo { + height: 50px; +} + +/* Body */ + +.body { + background-color: #ffffff; + border-bottom: 1px solid #edeff2; + border-top: 1px solid #edeff2; + margin: 0; + padding: 0; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} +.company-name { + font-weight: 500; + margin-left: 4px; +} + +.inner-body { + background-color: #ffffff; + margin: 0 auto; + padding: 0; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +/* Subcopy */ + +.subcopy { + margin-top: 25px; + padding-top: 25px; +} + +.subcopy p { + display: flex; + justify-content: center; + text-align: center; + font-size: 20px; +} + +/* Footer */ + +.footer { + margin: 0 auto; + padding: 0; + text-align: center; + width: 570px; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 570px; +} + +.footer p { + color: #aeaeae; + font-size: 12px; + text-align: center; +} + +.footer-link { + text-decoration: none; + color: #5851D8; +} +/* Tables */ + +.table table { + margin: 30px auto; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.table th { + border-bottom: 1px solid #edeff2; + padding-bottom: 8px; + margin: 0; +} + +.table td { + color: #74787e; + font-size: 15px; + line-height: 18px; + padding: 10px 0; + margin: 0; +} + +.content-cell { + padding: 35px; +} + +/* Buttons */ + +.action { + margin: 30px auto; + padding: 0; + text-align: center; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.button { + border-radius: 3px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.16); + color: #fff; + display: inline-block; + text-decoration: none; + -webkit-text-size-adjust: none; +} + +.button-blue, +.button-primary { + background-color: #5851D8; + border-top: 10px solid #5851D8; + border-right: 18px solid #5851D8; + border-bottom: 10px solid #5851D8; + border-left: 18px solid #5851D8; +} + +.button-green, +.button-success { + background-color: #38c172; + border-top: 10px solid #38c172; + border-right: 18px solid #38c172; + border-bottom: 10px solid #38c172; + border-left: 18px solid #38c172; +} + +.button-red, +.button-error { + background-color: #e3342f; + border-top: 10px solid #e3342f; + border-right: 18px solid #e3342f; + border-bottom: 10px solid #e3342f; + border-left: 18px solid #e3342f; +} + +/* Panels */ + +.panel { + margin: 0 0 21px; +} + +.panel-content { + background-color: #f1f5f8; + padding: 16px; +} + +.panel-item { + padding: 0; +} + +.panel-item p:last-of-type { + margin-bottom: 0; + padding-bottom: 0; +} + +/* Promotions */ + +.promotion { + background-color: #ffffff; + border: 2px dashed #9ba2ab; + margin: 0; + margin-bottom: 25px; + margin-top: 25px; + padding: 24px; + width: 100%; + -premailer-cellpadding: 0; + -premailer-cellspacing: 0; + -premailer-width: 100%; +} + +.promotion h1 { + text-align: center; +} + +.promotion p { + font-size: 15px; + text-align: center; +} diff --git a/resources/views/vendor/mail/text/button.blade.php b/resources/views/vendor/mail/text/button.blade.php new file mode 100644 index 00000000..97444ebd --- /dev/null +++ b/resources/views/vendor/mail/text/button.blade.php @@ -0,0 +1 @@ +{{ $slot }}: {{ $url }} diff --git a/resources/views/vendor/mail/text/footer.blade.php b/resources/views/vendor/mail/text/footer.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/footer.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/header.blade.php b/resources/views/vendor/mail/text/header.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/resources/views/vendor/mail/text/header.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/resources/views/vendor/mail/text/layout.blade.php b/resources/views/vendor/mail/text/layout.blade.php new file mode 100644 index 00000000..9378baa0 --- /dev/null +++ b/resources/views/vendor/mail/text/layout.blade.php @@ -0,0 +1,9 @@ +{!! strip_tags($header) !!} + +{!! strip_tags($slot) !!} +@isset($subcopy) + +{!! strip_tags($subcopy) !!} +@endisset + +{!! strip_tags($footer) !!} diff --git a/resources/views/vendor/mail/text/message.blade.php b/resources/views/vendor/mail/text/message.blade.php new file mode 100644 index 00000000..1ae9ed8f --- /dev/null +++ b/resources/views/vendor/mail/text/message.blade.php @@ -0,0 +1,27 @@ +@component('mail::layout') + {{-- Header --}} + @slot('header') + @component('mail::header', ['url' => config('app.url')]) + {{ config('app.name') }} + @endcomponent + @endslot + + {{-- Body --}} + {{ $slot }} + + {{-- Subcopy --}} + @isset($subcopy) + @slot('subcopy') + @component('mail::subcopy') + {{ $subcopy }} + @endcomponent + @endslot + @endisset + + {{-- Footer --}} + @slot('footer') + @component('mail::footer') + © {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.') + @endcomponent + @endslot +@endcomponent diff --git a/resources/views/vendor/mail/text/panel.blade.php b/resources/views/vendor/mail/text/panel.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/panel.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/promotion.blade.php b/resources/views/vendor/mail/text/promotion.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/promotion.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/promotion/button.blade.php b/resources/views/vendor/mail/text/promotion/button.blade.php new file mode 100644 index 00000000..aaa3e575 --- /dev/null +++ b/resources/views/vendor/mail/text/promotion/button.blade.php @@ -0,0 +1 @@ +[{{ $slot }}]({{ $url }}) diff --git a/resources/views/vendor/mail/text/subcopy.blade.php b/resources/views/vendor/mail/text/subcopy.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/subcopy.blade.php @@ -0,0 +1 @@ +{{ $slot }} diff --git a/resources/views/vendor/mail/text/table.blade.php b/resources/views/vendor/mail/text/table.blade.php new file mode 100644 index 00000000..3338f620 --- /dev/null +++ b/resources/views/vendor/mail/text/table.blade.php @@ -0,0 +1 @@ +{{ $slot }}