Fixes for email designs and cross client compatibility

This commit is contained in:
David Bomba 2023-02-16 09:20:24 +11:00
parent eefd2eb5d4
commit b76e78e9ed
13 changed files with 75 additions and 16 deletions

View File

@ -147,9 +147,9 @@ class EmailController extends BaseController
if (! $invitation->contact->trashed() && $invitation->contact->email) {
$entity_obj->service()->markSent()->save();
// EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data);
EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data);
MailEntity::dispatch($invitation, $invitation->company->db, $mo);
// MailEntity::dispatch($invitation, $invitation->company->db, $mo);
}
});

View File

@ -244,12 +244,12 @@ class PaymentEmailEngine extends BaseEmailEngine
$data['$company3'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company3', $this->settings->custom_value3, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company3')];
$data['$company4'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company4', $this->settings->custom_value4, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company4')];
$data['$view_link'] = ['value' => '<a class="button" href="'.$this->payment->getLink().'">'.ctrans('texts.view_payment').'</a>', 'label' => ctrans('texts.view_payment')];
$data['$view_link'] = ['value' => $this->buildViewButton($this->payment->getLink(), ctrans('texts.view_payment')), 'label' => ctrans('texts.view_payment')];
$data['$view_button'] = &$data['$view_link'];
$data['$viewButton'] = &$data['$view_link'];
$data['$viewLink'] = &$data['$view_link'];
$data['$paymentLink'] = &$data['$view_link'];
$data['$portalButton'] = ['value' => "<a href='{$this->payment->getPortalLink()}'>".ctrans('texts.login').'</a>', 'label' =>''];
$data['$portalButton'] = ['value' => $this->buildViewButton($this->payment->getPortalLink(), ctrans('texts.login')), 'label' =>''];
$data['$portal_url'] = &$data['$portalButton'];
$data['$view_url'] = ['value' => $this->payment->getLink(), 'label' => ctrans('texts.view_payment')];
@ -367,7 +367,12 @@ class PaymentEmailEngine extends BaseEmailEngine
return $data;
}
/**
* generateLabelsAndValues
*
* @return void
*/
public function generateLabelsAndValues()
{
$data = [];
@ -381,4 +386,25 @@ class PaymentEmailEngine extends BaseEmailEngine
return $data;
}
/**
* buildViewButton
*
* @param string $link
* @param string $text
* @return string
*/
private function buildViewButton(string $link, string $text): string
{
return '
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="'. $link .'" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">'. $text .'</a>
</td>
</tr>
</table>
';
}
}

View File

@ -156,7 +156,7 @@ class VendorHtmlEngine
$data['$number_short'] = ['value' => $this->entity->number ?: '&nbsp;', 'label' => ctrans('texts.purchase_order_number_short')];
$data['$entity.terms'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->terms), $this->company) ?: '', 'label' => ctrans('texts.invoice_terms')];
$data['$terms'] = &$data['$entity.terms'];
$data['$view_link'] = ['value' => '<a class="button" href="'.$this->invitation->getLink().'">'.ctrans('texts.view_purchase_order').'</a>', 'label' => ctrans('texts.view_purchase_order')];
$data['$view_link'] = ['value' => $this->buildViewButton($this->invitation->getLink(), ctrans('texts.view_purchase_order')), 'label' => ctrans('texts.view_purchase_order')];
$data['$viewLink'] = &$data['$view_link'];
$data['$viewButton'] = &$data['$view_link'];
$data['$view_button'] = &$data['$view_link'];
@ -813,4 +813,25 @@ html {
return $dom->saveHTML();
}
/**
* buildViewButton
*
* @param string $link
* @param string $text
* @return string
*/
private function buildViewButton(string $link, string $text): string
{
return '
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="'. $link .'" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">'. $text .'</a>
</td>
</tr>
</table>
';
}
}

View File

@ -7,12 +7,11 @@
{{ ctrans('texts.download') }}
</a> -->
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;"> {{ ctrans('texts.download') }}</a>
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; "> {{ ctrans('texts.download') }}</a>
</td>
</tr>

View File

@ -12,7 +12,7 @@
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;"> {{ ctrans('texts.download') }}</a>
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; "> {{ ctrans('texts.download') }}</a>
</td>
</tr>

View File

@ -7,7 +7,7 @@
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">{{ ctrans('texts.download') }}</a>
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; ">{{ ctrans('texts.download') }}</a>
</td>
</tr>

View File

@ -12,7 +12,7 @@
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;"> {{ ctrans('texts.download') }}</a>
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; "> {{ ctrans('texts.download') }}</a>
</td>
</tr>

View File

@ -12,7 +12,7 @@
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;"> {{ ctrans('texts.download') }}</a>
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; "> {{ ctrans('texts.download') }}</a>
</td>
</tr>

View File

@ -11,7 +11,7 @@
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;"> {{ ctrans('texts.download') }}</a>
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; "> {{ ctrans('texts.download') }}</a>
</td>
</tr>

View File

@ -33,7 +33,7 @@
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;"> {{ ctrans($button) }}</a>
<a href="{{ $url }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; ">{{ ctrans($button) }}</a>
</td>
</tr>

View File

@ -9,7 +9,7 @@
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr style="border: 0 !important; ">
<td class="new_button" style="padding: 12px 18px 12px 18px; border-radius:5px;" align="center">
<a href="{{ $view_link }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block;">{{ $view_text }}</a>
<a href="{{ $view_link }}" target="_blank" style="border: 0 !important;font-size: 18px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; display: inline-block; ">{{ $view_text }}</a>
</td>
</tr>
</table>

View File

@ -149,10 +149,13 @@
position: fixed;
}
.new_button {
.new_button, a {
background-color: {{ $primary_color }};
}
a:visited {
color:#ffffff !important;
}
</style>
</head>

View File

@ -119,6 +119,16 @@
.new_button {
background-color: {{ $primary_color }};
}
}
.new_button, {
background-color: {{ $primary_color }};
}
a:visited {
color:#ffffff !important;
}
</style>