Added statust to client view page

This commit is contained in:
Hillel Coren 2016-02-04 20:36:39 +02:00
parent 8a9eb97134
commit db4ec4fb62
6 changed files with 84 additions and 29 deletions

View File

@ -145,6 +145,7 @@ class TaskController extends BaseController
'actions' => $actions, 'actions' => $actions,
'timezone' => Auth::user()->account->timezone ? Auth::user()->account->timezone->name : DEFAULT_TIMEZONE, 'timezone' => Auth::user()->account->timezone ? Auth::user()->account->timezone->name : DEFAULT_TIMEZONE,
'datetimeFormat' => Auth::user()->account->getMomentDateTimeFormat(), 'datetimeFormat' => Auth::user()->account->getMomentDateTimeFormat(),
//'entityStatus' => $task->present()->status,
]; ];
$data = array_merge($data, self::getViewModel()); $data = array_merge($data, self::getViewModel());

View File

@ -9,4 +9,23 @@ class ClientPresenter extends Presenter {
{ {
return $this->entity->country ? $this->entity->country->name : ''; return $this->entity->country ? $this->entity->country->name : '';
} }
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>";
}
} }

View File

@ -36,4 +36,23 @@ class TaskPresenter extends Presenter {
return implode("\n", $times); return implode("\n", $times);
} }
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>";
}
} }

View File

@ -93,7 +93,7 @@ class AppServiceProvider extends ServiceProvider {
->render(); ->render();
}); });
HTML::macro('breadcrumbs', function() { HTML::macro('breadcrumbs', function($status = false) {
$str = '<ol class="breadcrumb">'; $str = '<ol class="breadcrumb">';
// Get the breadcrumbs by exploding the current path. // Get the breadcrumbs by exploding the current path.
@ -128,6 +128,11 @@ class AppServiceProvider extends ServiceProvider {
$str .= '<li>'.link_to($crumb, $name).'</li>'; $str .= '<li>'.link_to($crumb, $name).'</li>';
} }
} }
if ($status) {
$str .= '&nbsp;&nbsp;&nbsp;&nbsp;' . $status;
}
return $str . '</ol>'; return $str . '</ol>';
}); });

View File

@ -21,6 +21,16 @@
@section('content') @section('content')
<div class="row">
<div class="col-md-8">
<div>
<span style="font-size:28px">{{ $client->getDisplayName() }}</span>
@if ($client->trashed())
&nbsp;&nbsp;{!! $client->present()->status !!}
@endif
</div>
</div>
<div class="col-md-4">
<div class="pull-right"> <div class="pull-right">
{!! Former::open('clients/bulk')->addClass('mainForm') !!} {!! Former::open('clients/bulk')->addClass('mainForm') !!}
<div style="display:none"> <div style="display:none">
@ -50,14 +60,15 @@
{!! Former::close() !!} {!! Former::close() !!}
</div> </div>
</div>
</div>
<h2>{{ $client->getDisplayName() }}</h2>
@if ($client->last_login > 0) @if ($client->last_login > 0)
<h3 style="margin-top:0px"><small> <h3 style="margin-top:0px"><small>
{{ trans('texts.last_logged_in') }} {{ Utils::timestampToDateTimeString(strtotime($client->last_login)) }} {{ trans('texts.last_logged_in') }} {{ Utils::timestampToDateTimeString(strtotime($client->last_login)) }}
</small></h3> </small></h3>
@endif @endif
<br/>
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">

View File

@ -519,7 +519,7 @@
@endif @endif
@if (!isset($showBreadcrumbs) || $showBreadcrumbs) @if (!isset($showBreadcrumbs) || $showBreadcrumbs)
{!! HTML::breadcrumbs() !!} {!! HTML::breadcrumbs(isset($entityStatus) ? $entityStatus : '') !!}
@endif @endif
@yield('content') @yield('content')