mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
Padding out client dashboard
This commit is contained in:
parent
073e392751
commit
e9e12f59af
@ -47,6 +47,8 @@ class PortalComposer
|
||||
$data['header'] = [];
|
||||
$data['footer'] = [];
|
||||
$data['countries'] = TranslationHelper::getCountries();
|
||||
$data['company'] = auth()->user()->company;
|
||||
$data['client'] = auth()->user()->client;
|
||||
|
||||
return $data;
|
||||
|
||||
|
@ -49,7 +49,8 @@ class ClientContact extends Authenticatable
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'client'
|
||||
'client',
|
||||
'company'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
|
@ -68,6 +68,8 @@ class Company extends BaseModel
|
||||
'db',
|
||||
'domain',
|
||||
'ip',
|
||||
'industry_id',
|
||||
'size_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
@ -25,4 +25,60 @@ class ClientPresenter extends EntityPresenter
|
||||
{
|
||||
return $this->entity->name ?: $this->entity->primary_contact->first()->first_name . ' '. $this->entity->primary_contact->first()->last_name;
|
||||
}
|
||||
|
||||
public function address()
|
||||
{
|
||||
$str = '';
|
||||
$client = $this->entity;
|
||||
|
||||
if ($address1 = $client->address1) {
|
||||
$str .= e($address1) . '<br/>';
|
||||
}
|
||||
if ($address2 = $client->address2) {
|
||||
$str .= e($address2) . '<br/>';
|
||||
}
|
||||
if ($cityState = $this->getCityState()) {
|
||||
$str .= e($cityState) . '<br/>';
|
||||
}
|
||||
if ($country = $client->country) {
|
||||
$str .= e($country->name) . '<br/>';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,4 +26,9 @@ class CompanyPresenter extends EntityPresenter
|
||||
return $this->entity->name ?: ctrans('texts.untitled_account');
|
||||
}
|
||||
|
||||
public function address()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -40,6 +40,38 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- client and supplier information -->
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ctrans('texts.client_information')}}</div>
|
||||
<div class="card-body">
|
||||
<h2>{{ $client->present()->name() }}</h2>
|
||||
<br>
|
||||
{!! $client->present()->address() !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">{{ctrans('texts.contact_us')}}</div>
|
||||
<div class="card-body">
|
||||
|
||||
@if ($company->logo)
|
||||
{!! HTML::image($company->logo) !!}
|
||||
@else
|
||||
<h2>{{ $company->present()->name() }}</h2>
|
||||
@endif
|
||||
<br>
|
||||
{!! $company->present()->address() !!}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- update payment methods -->
|
||||
<div class="row" style="margin-top: 30px;">
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
@ -55,9 +87,6 @@
|
||||
</div>
|
||||
<div class="w-50 p-0"><img class="card-img embed-responsive-item" src="/images/visa.png" alt="Visa Card"></div>
|
||||
<div>{{ ctrans('texts.expires')}}: 10/20</div>
|
||||
<div class="progress progress-white progress-xs my-2">
|
||||
<div class="progress-bar" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100"></div>
|
||||
</div>
|
||||
<small class="text-value">Mr Joe Citizen - ({{ctrans('texts.default')}})</small>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user