diff --git a/app/Ninja/Presenters/AccountPresenter.php b/app/Ninja/Presenters/AccountPresenter.php index 156aade6237c..64e78bcf897e 100644 --- a/app/Ninja/Presenters/AccountPresenter.php +++ b/app/Ninja/Presenters/AccountPresenter.php @@ -22,6 +22,28 @@ class AccountPresenter extends Presenter return $this->entity->name ?: trans('texts.untitled_account'); } + /** + * @return string + */ + public function address() + { + $account = $this->entity; + + $str = $account->address1 ?: ''; + + if ($account->address2 && $str) { + $str .= ', '; + } + + $str .= $account->address2; + + if ($account->getCityState() && $str) { + $str .= ' - '; + } + + return $str . $account->getCityState(); + } + /** * @return string */ diff --git a/resources/views/emails/design2_html.blade.php b/resources/views/emails/design2_html.blade.php index e707c21a8822..86534cd7d266 100644 --- a/resources/views/emails/design2_html.blade.php +++ b/resources/views/emails/design2_html.blade.php @@ -63,15 +63,8 @@ @section('footer')
- {{ $account->address1 }}
- @if ($account->address1 && $account->getCityState())
- -
- @endif
- {{ $account->getCityState() }}
- @if ($account->address1 || $account->getCityState())
-
- @endif
-
+ {{ $account->present()->address }}
+
@if ($account->website)
{{ $account->website }}
@endif
diff --git a/resources/views/emails/design3_html.blade.php b/resources/views/emails/design3_html.blade.php
index ab1b0f33ca2c..abd344c107bd 100644
--- a/resources/views/emails/design3_html.blade.php
+++ b/resources/views/emails/design3_html.blade.php
@@ -63,15 +63,8 @@
@section('footer')
- {{ $account->address1 }}
- @if ($account->address1 && $account->getCityState())
- -
- @endif
- {{ $account->getCityState() }}
- @if ($account->address1 || $account->getCityState())
-
- @endif
-
+ {{ $account->present()->address }}
+
@if ($account->website)
{{ $account->website }}
@endif