1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 00:11:35 +02:00

Show company and client details in portal

This commit is contained in:
David Bomba 2019-08-22 07:46:11 +10:00
parent e9e12f59af
commit b9605925e3
3 changed files with 64 additions and 1 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -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,
];
});