Country not translated in Clients' details view #1828

This commit is contained in:
Hillel Coren 2018-01-21 08:55:40 +02:00
parent 4fb50f75cf
commit 88e4c773c7
7 changed files with 12 additions and 12 deletions

View File

@ -117,10 +117,10 @@ class ClientPortalController extends BaseController
// translate the country names // translate the country names
if ($invoice->client->country) { 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) { if ($invoice->account->country) {
$invoice->account->country->name = trans('texts.country_' . $invoice->account->country->name); $invoice->account->country->name = $invoice->account->country->getName();
} }
$data = []; $data = [];

View File

@ -40,6 +40,6 @@ class Country extends Eloquent
*/ */
public function getName() public function getName()
{ {
return $this->name; return trans('texts.country_' . $this->name);
} }
} }

View File

@ -8,12 +8,12 @@ class ClientPresenter extends EntityPresenter
{ {
public function country() public function country()
{ {
return $this->entity->country ? $this->entity->country->name : ''; return $this->entity->country ? $this->entity->country->getName() : '';
} }
public function shipping_country() 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() public function balance()
@ -72,7 +72,7 @@ class ClientPresenter extends EntityPresenter
$str .= e($cityState) . '<br/>'; $str .= e($cityState) . '<br/>';
} }
if ($country = $client->{$prefix . 'country'}) { if ($country = $client->{$prefix . 'country'}) {
$str .= e($country->name) . '<br/>'; $str .= e($country->getName()) . '<br/>';
} }
if ($str) { if ($str) {

View File

@ -9,6 +9,6 @@ class VendorPresenter extends EntityPresenter
*/ */
public function country() public function country()
{ {
return $this->entity->country ? $this->entity->country->name : ''; return $this->entity->country ? $this->entity->country->getName() : '';
} }
} }

View File

@ -372,7 +372,7 @@
}; };
var map = new google.maps.Map(mapCanvas, mapOptions) 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 = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) { geocoder.geocode( { 'address': address}, function(results, status) {

View File

@ -293,7 +293,7 @@
{{ $client->getCityState() }}<br/> {{ $client->getCityState() }}<br/>
@endif @endif
@if ($client->country) @if ($client->country)
{{ $client->country->name }}<br/> {{ $client->country->getName() }}<br/>
@endif @endif
<br> <br>
@if ($contact->email) @if ($contact->email)
@ -381,7 +381,7 @@
{{ $account->getCityState() }}<br/> {{ $account->getCityState() }}<br/>
@endif @endif
@if ($account->country) @if ($account->country)
{{ $account->country->name }} {{ $account->country->getName() }}
@endif @endif
</div> </div>
<div class="col-md-3 phone-web-details"> <div class="col-md-3 phone-web-details">

View File

@ -98,7 +98,7 @@
{{ $vendor->getCityState() }}<br/> {{ $vendor->getCityState() }}<br/>
@endif @endif
@if ($vendor->country) @if ($vendor->country)
{{ $vendor->country->name }}<br/> {{ $vendor->country->getName() }}<br/>
@endif @endif
@if ($vendor->account->custom_vendor_label1 && $vendor->custom_value1) @if ($vendor->account->custom_vendor_label1 && $vendor->custom_value1)
@ -228,7 +228,7 @@
}; };
var map = new google.maps.Map(mapCanvas, mapOptions) 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 = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) { geocoder.geocode( { 'address': address}, function(results, status) {