mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Show company and client details in portal
This commit is contained in:
parent
e9e12f59af
commit
b9605925e3
@ -28,7 +28,29 @@ class CompanyPresenter extends EntityPresenter
|
||||
|
||||
public function address()
|
||||
{
|
||||
|
||||
$str = '';
|
||||
$company = $this->entity;
|
||||
|
||||
if ($address1 = $company->address1) {
|
||||
$str .= e($address1) . '<br/>';
|
||||
}
|
||||
if ($address2 = $company->address2) {
|
||||
$str .= e($address2) . '<br/>';
|
||||
}
|
||||
if ($cityState = $this->getCityState()) {
|
||||
$str .= e($cityState) . '<br/>';
|
||||
}
|
||||
if ($country = $company->country) {
|
||||
$str .= e($country->name) . '<br/>';
|
||||
}
|
||||
if ($company->work_phone) {
|
||||
$str .= ctrans('texts.work_phone') . ": ". e($company->work_phone) .'<br/>';
|
||||
}
|
||||
if ($company->work_email) {
|
||||
$str .= ctrans('texts.work_email') . ": ". e($company->work_email) .'<br/>';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -97,4 +97,37 @@ class EntityPresenter extends Presenter
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,13 @@ $factory->define(App\Models\Company::class, function (Faker $faker) {
|
||||
'ip' => $faker->ipv4,
|
||||
'db' => config('database.default'),
|
||||
'settings' => new CompanySettings(CompanySettings::defaults()),
|
||||
'address1' => $faker->secondaryAddress,
|
||||
'address2' => $faker->address,
|
||||
'city' => $faker->city,
|
||||
'state' => $faker->state,
|
||||
'postal_code' => $faker->postcode,
|
||||
'country_id' => 4,
|
||||
'work_phone' => $faker->phoneNumber,
|
||||
'work_email' => $faker->safeEmail,
|
||||
];
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user