From 88e4c773c75e01d7bcd7e1a9df44d1a819c52fe9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 21 Jan 2018 08:55:40 +0200 Subject: [PATCH] Country not translated in Clients' details view #1828 --- app/Http/Controllers/ClientPortalController.php | 4 ++-- app/Models/Country.php | 2 +- app/Ninja/Presenters/ClientPresenter.php | 6 +++--- app/Ninja/Presenters/VendorPresenter.php | 2 +- resources/views/clients/show.blade.php | 2 +- resources/views/invited/dashboard.blade.php | 4 ++-- resources/views/vendors/show.blade.php | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index d85068e29189..e69be1794e7e 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -117,10 +117,10 @@ class ClientPortalController extends BaseController // translate the country names if ($invoice->client->country) { - $invoice->client->country->name = trans('texts.country_' . $invoice->client->country->name); + $invoice->client->country->name = $invoice->client->country->getName(); } if ($invoice->account->country) { - $invoice->account->country->name = trans('texts.country_' . $invoice->account->country->name); + $invoice->account->country->name = $invoice->account->country->getName(); } $data = []; diff --git a/app/Models/Country.php b/app/Models/Country.php index 34bd9746e59a..ec74c86364d7 100644 --- a/app/Models/Country.php +++ b/app/Models/Country.php @@ -40,6 +40,6 @@ class Country extends Eloquent */ public function getName() { - return $this->name; + return trans('texts.country_' . $this->name); } } diff --git a/app/Ninja/Presenters/ClientPresenter.php b/app/Ninja/Presenters/ClientPresenter.php index 05a3670b448f..e968cc880793 100644 --- a/app/Ninja/Presenters/ClientPresenter.php +++ b/app/Ninja/Presenters/ClientPresenter.php @@ -8,12 +8,12 @@ class ClientPresenter extends EntityPresenter { public function country() { - return $this->entity->country ? $this->entity->country->name : ''; + return $this->entity->country ? $this->entity->country->getName() : ''; } public function shipping_country() { - return $this->entity->shipping_country ? $this->entity->shipping_country->name : ''; + return $this->entity->shipping_country ? $this->entity->shipping_country->getName() : ''; } public function balance() @@ -72,7 +72,7 @@ class ClientPresenter extends EntityPresenter $str .= e($cityState) . '
'; } if ($country = $client->{$prefix . 'country'}) { - $str .= e($country->name) . '
'; + $str .= e($country->getName()) . '
'; } if ($str) { diff --git a/app/Ninja/Presenters/VendorPresenter.php b/app/Ninja/Presenters/VendorPresenter.php index 228e666bcefb..9766ed807e19 100644 --- a/app/Ninja/Presenters/VendorPresenter.php +++ b/app/Ninja/Presenters/VendorPresenter.php @@ -9,6 +9,6 @@ class VendorPresenter extends EntityPresenter */ public function country() { - return $this->entity->country ? $this->entity->country->name : ''; + return $this->entity->country ? $this->entity->country->getName() : ''; } } diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php index e77978a3e680..0857c38ad80a 100644 --- a/resources/views/clients/show.blade.php +++ b/resources/views/clients/show.blade.php @@ -372,7 +372,7 @@ }; var map = new google.maps.Map(mapCanvas, mapOptions) - var address = {!! json_encode(e("{$client->address1} {$client->address2} {$client->city} {$client->state} {$client->postal_code} " . ($client->country ? $client->country->name : ''))) !!}; + var address = {!! json_encode(e("{$client->address1} {$client->address2} {$client->city} {$client->state} {$client->postal_code} " . ($client->country ? $client->country->getName() : ''))) !!}; geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': address}, function(results, status) { diff --git a/resources/views/invited/dashboard.blade.php b/resources/views/invited/dashboard.blade.php index 28e14ca0b504..02cf0ebe4369 100644 --- a/resources/views/invited/dashboard.blade.php +++ b/resources/views/invited/dashboard.blade.php @@ -293,7 +293,7 @@ {{ $client->getCityState() }}
@endif @if ($client->country) - {{ $client->country->name }}
+ {{ $client->country->getName() }}
@endif
@if ($contact->email) @@ -381,7 +381,7 @@ {{ $account->getCityState() }}
@endif @if ($account->country) - {{ $account->country->name }} + {{ $account->country->getName() }} @endif
diff --git a/resources/views/vendors/show.blade.php b/resources/views/vendors/show.blade.php index 324cbfc6283d..18c9053a0fd9 100644 --- a/resources/views/vendors/show.blade.php +++ b/resources/views/vendors/show.blade.php @@ -98,7 +98,7 @@ {{ $vendor->getCityState() }}
@endif @if ($vendor->country) - {{ $vendor->country->name }}
+ {{ $vendor->country->getName() }}
@endif @if ($vendor->account->custom_vendor_label1 && $vendor->custom_value1) @@ -228,7 +228,7 @@ }; var map = new google.maps.Map(mapCanvas, mapOptions) - var address = {!! json_encode(e("{$vendor->address1} {$vendor->address2} {$vendor->city} {$vendor->state} {$vendor->postal_code} " . ($vendor->country ? $vendor->country->name : ''))) !!}; + var address = {!! json_encode(e("{$vendor->address1} {$vendor->address2} {$vendor->city} {$vendor->state} {$vendor->postal_code} " . ($vendor->country ? $vendor->country->getName() : ''))) !!}; geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': address}, function(results, status) {