Fixes for address presentation for clients

This commit is contained in:
David Bomba 2021-06-20 07:55:47 +10:00
parent 3982fcc2b0
commit 0772c05e66

View File

@ -136,21 +136,40 @@ class ClientPresenter extends EntityPresenter
return $str;
}
// public function getCityState()
// {
// $settings = $this->entity->getMergedSettings();
// $country = false;
// if ($settings->country_id) {
// $country = Country::find($settings->country_id);
// }
// $swap = $country && $country->swap_postal_code;
// $city = e($settings->city ?: '');
// $state = e($settings->state ?: '');
// $postalCode = e($settings->postal_code ?: '');
// if ($city || $state || $postalCode) {
// return $this->cityStateZip($city, $state, $postalCode, $swap);
// } else {
// return false;
// }
// }
public function getCityState()
{
$settings = $this->entity->getMergedSettings();
$country = false;
if ($settings->country_id) {
$country = Country::find($settings->country_id);
}
$client = $this->entity;
$country = $client->country ?: false;
$swap = $country && $country->swap_postal_code;
$city = e($settings->city ?: '');
$state = e($settings->state ?: '');
$postalCode = e($settings->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);