2015-11-12 21:36:28 +01:00
|
|
|
<?php namespace App\Ninja\Presenters;
|
|
|
|
|
|
|
|
|
2016-05-23 11:26:08 +02:00
|
|
|
class ClientPresenter extends EntityPresenter {
|
2015-11-12 21:36:28 +01:00
|
|
|
|
|
|
|
public function country()
|
|
|
|
{
|
|
|
|
return $this->entity->country ? $this->entity->country->name : '';
|
|
|
|
}
|
2016-02-04 19:36:39 +01:00
|
|
|
|
2016-08-07 21:42:32 +02:00
|
|
|
public function balance()
|
|
|
|
{
|
|
|
|
$client = $this->entity;
|
|
|
|
$account = $client->account;
|
|
|
|
|
|
|
|
return $account->formatMoney($client->balance, $client);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function paid_to_date()
|
|
|
|
{
|
|
|
|
$client = $this->entity;
|
|
|
|
$account = $client->account;
|
|
|
|
|
|
|
|
return $account->formatMoney($client->paid_to_date, $client);
|
|
|
|
}
|
|
|
|
|
2016-02-04 19:36:39 +01:00
|
|
|
public function status()
|
|
|
|
{
|
|
|
|
$class = $text = '';
|
|
|
|
|
|
|
|
if ($this->entity->is_deleted) {
|
|
|
|
$class = 'danger';
|
|
|
|
$text = trans('texts.deleted');
|
|
|
|
} elseif ($this->entity->trashed()) {
|
|
|
|
$class = 'warning';
|
|
|
|
$text = trans('texts.archived');
|
|
|
|
} else {
|
|
|
|
$class = 'success';
|
|
|
|
$text = trans('texts.active');
|
|
|
|
}
|
|
|
|
|
|
|
|
return "<span class=\"label label-{$class}\">{$text}</span>";
|
2016-02-23 22:32:39 +01:00
|
|
|
}
|
2016-05-23 11:26:08 +02:00
|
|
|
}
|