diff --git a/app/Http/ViewComposers/PortalComposer.php b/app/Http/ViewComposers/PortalComposer.php index 97010d17d5f8..7b7cb9daaa6f 100644 --- a/app/Http/ViewComposers/PortalComposer.php +++ b/app/Http/ViewComposers/PortalComposer.php @@ -47,7 +47,9 @@ class PortalComposer $data['header'] = []; $data['footer'] = []; $data['countries'] = TranslationHelper::getCountries(); - + $data['company'] = auth()->user()->company; + $data['client'] = auth()->user()->client; + return $data; } diff --git a/app/Models/ClientContact.php b/app/Models/ClientContact.php index 85f9cc223f89..7f9f46d7a172 100644 --- a/app/Models/ClientContact.php +++ b/app/Models/ClientContact.php @@ -49,7 +49,8 @@ class ClientContact extends Authenticatable ]; protected $with = [ - 'client' + 'client', + 'company' ]; protected $hidden = [ diff --git a/app/Models/Company.php b/app/Models/Company.php index af3571bf9675..113c2dc23aba 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -68,6 +68,8 @@ class Company extends BaseModel 'db', 'domain', 'ip', + 'industry_id', + 'size_id', ]; protected $casts = [ diff --git a/app/Models/Presenters/ClientPresenter.php b/app/Models/Presenters/ClientPresenter.php index c451886f54e3..78e6b7d9c19c 100644 --- a/app/Models/Presenters/ClientPresenter.php +++ b/app/Models/Presenters/ClientPresenter.php @@ -25,4 +25,60 @@ class ClientPresenter extends EntityPresenter { return $this->entity->name ?: $this->entity->primary_contact->first()->first_name . ' '. $this->entity->primary_contact->first()->last_name; } + + public function address() + { + $str = ''; + $client = $this->entity; + + if ($address1 = $client->address1) { + $str .= e($address1) . '
'; + } + if ($address2 = $client->address2) { + $str .= e($address2) . '
'; + } + if ($cityState = $this->getCityState()) { + $str .= e($cityState) . '
'; + } + if ($country = $client->country) { + $str .= e($country->name) . '
'; + } + + return $str; + } + + public function getCityState() + { + $client = $this->entity; + $swap = $client->country && $client->country->swap_postal_code; + + $city = e($client->city); + $state = e($client->state); + $postalCode = e($client->postal_code); + + if ($city || $state || $postalCode) { + return $this->cityStateZip($city, $state, $postalCode, $swap); + } else { + return false; + } + } + + public function cityStateZip($city, $state, $postalCode, $swap) + { + $str = $city; + + if ($state) { + if ($str) { + $str .= ', '; + } + $str .= $state; + } + + if ($swap) { + return $postalCode . ' ' . $str; + } else { + return $str . ' ' . $postalCode; + } + } + } diff --git a/app/Models/Presenters/CompanyPresenter.php b/app/Models/Presenters/CompanyPresenter.php index 59808191144b..7c3be7c066a2 100644 --- a/app/Models/Presenters/CompanyPresenter.php +++ b/app/Models/Presenters/CompanyPresenter.php @@ -26,4 +26,9 @@ class CompanyPresenter extends EntityPresenter return $this->entity->name ?: ctrans('texts.untitled_account'); } + public function address() + { + + } + } diff --git a/resources/views/portal/default/dashboard/index.blade.php b/resources/views/portal/default/dashboard/index.blade.php index f6962d390403..9fc2cfa922e2 100644 --- a/resources/views/portal/default/dashboard/index.blade.php +++ b/resources/views/portal/default/dashboard/index.blade.php @@ -40,6 +40,38 @@ + +
+
+
+
{{ctrans('texts.client_information')}}
+
+

{{ $client->present()->name() }}

+
+ {!! $client->present()->address() !!} +
+
+
+ +
+
+
{{ctrans('texts.contact_us')}}
+
+ + @if ($company->logo) + {!! HTML::image($company->logo) !!} + @else +

{{ $company->present()->name() }}

+ @endif +
+ {!! $company->present()->address() !!} + +
+
+
+ +
+
@@ -55,9 +87,6 @@
Visa Card
{{ ctrans('texts.expires')}}: 10/20
-
-
-
Mr Joe Citizen - ({{ctrans('texts.default')}})