Fixed dashboard for components

This commit is contained in:
snipe 2016-05-18 19:16:43 -07:00
parent 47c70141c7
commit fb26188e41
2 changed files with 13 additions and 4 deletions

View file

@ -50,6 +50,13 @@ class Actionlog extends Model implements ICompanyableChild
->withTrashed();
}
public function componentlog()
{
return $this->belongsTo('\App\Models\Component', 'component_id')
->withTrashed();
}
public function accessorylog()
{

View file

@ -88,7 +88,7 @@
<table class="table table-hover table-fixed break-word">
<thead>
<tr>
<th class="col-md-1"><span class="line"></span>{{ trans('general.date') }}</th>
<th class="col-md-2"><span class="line"></span>{{ trans('general.date') }}</th>
<th class="col-md-2"><span class="line"></span>{{ trans('general.admin') }}</th>
<th class="col-md-3"><span class="line"></span>{{ trans('table.item') }}</th>
<th class="col-md-2"><span class="line"></span>{{ trans('table.actions') }}</th>
@ -99,7 +99,7 @@
@if (count($recent_activity) > 0)
@foreach ($recent_activity as $activity)
<tr>
<td>{{ date("M d", strtotime($activity->created_at)) }}</td>
<td>{{ date("M d, Y H:iA", strtotime($activity->created_at)) }}</td>
<td>
@if ($activity->action_type!='requested')
<a href="{{ route('view/user', $activity->user_id) }}">{{ $activity->adminlog->fullName() }}</a>
@ -116,8 +116,10 @@
<a href="{{ route('view/consumable', $activity->consumable_id) }}">{{ $activity->consumablelog->name }}</a>
@elseif (($activity->accessorylog) && ($activity->asset_type=="accessory"))
<a href="{{ route('view/accessory', $activity->accessory_id) }}">{{ $activity->accessorylog->name }}</a>
@else
{{ trans('general.bad_data') }}
@elseif (($activity->componentlog) && ($activity->asset_type=="component"))
<a href="{{ route('view/component', $activity->component_id) }}">{{ $activity->componentlog->name }}</a>
@else
{{ trans('general.bad_data') }}
@endif
</td>