mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 21:54:14 -08:00
Present assetlogs (#3112)
* Set user if asset is checked out to user. fixes email problems. * Use sometimes validation to ignore this when no values are present. * Move Actionlog details to a presenter and port the activity table to use it. Still need to port other parts of the application, but this consolidates a lot of logic. * Attempt test fix * Port users,licenses, and assets view to use the presenter to generate table values.
This commit is contained in:
parent
6029bea2de
commit
8a782bf34a
|
@ -526,7 +526,7 @@ class AssetsController extends Controller
|
||||||
$this->authorize('checkin', $asset);
|
$this->authorize('checkin', $asset);
|
||||||
|
|
||||||
$admin = Auth::user();
|
$admin = Auth::user();
|
||||||
|
$user = $asset->assignedUser;
|
||||||
if (is_null($target = $asset->assignedTo)) {
|
if (is_null($target = $asset->assignedTo)) {
|
||||||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkin.already_checked_in'));
|
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.checkin.already_checked_in'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,12 +288,8 @@ class ReportsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function getActivityReport()
|
public function getActivityReport()
|
||||||
{
|
{
|
||||||
$log_actions = Actionlog::orderBy('created_at', 'DESC')
|
|
||||||
->with('item')
|
|
||||||
->orderBy('created_at', 'DESC')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
return View::make('reports/activity', compact('log_actions'));
|
return View::make('reports/activity');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -334,61 +330,7 @@ class ReportsController extends Controller
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($activitylogs as $activity) {
|
foreach ($activitylogs as $activity) {
|
||||||
|
$rows[] = $activity->present()->forDataTable();
|
||||||
if (($activity->item) && ($activity->itemType()=="asset")) {
|
|
||||||
$activity_item = '<a href="'.route('hardware.show', $activity->item_id).'">'.e($activity->item->asset_tag).' - '. e($activity->item->present()->name()).'</a>';
|
|
||||||
$item_type = 'asset';
|
|
||||||
} elseif ($activity->item) {
|
|
||||||
$activity_item = '<a href="' . route($activity->parseItemRoute().'.show', $activity->item_id) . '">' . e($activity->item->name) . '</a>';
|
|
||||||
$item_type = $activity->itemType();
|
|
||||||
} else {
|
|
||||||
$activity_item = "unkonwn";
|
|
||||||
$item_type = "null";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (($activity->user) && ($activity->action_type=="uploaded") && ($activity->itemType()=="user")) {
|
|
||||||
$activity_target = '<a href="'.route('users.show', $activity->target_id).'">'.$activity->user->present()->fullName().'</a>';
|
|
||||||
} elseif ($activity->target_type === "App\Models\Asset") {
|
|
||||||
if ($activity->target) {
|
|
||||||
$activity_target = '<a href="'.route('hardware.show', $activity->target_id).'">'.$activity->target->present()->name().'</a>';
|
|
||||||
} else {
|
|
||||||
$activity_target = "";
|
|
||||||
}
|
|
||||||
} elseif ($activity->target_type === "App\Models\User") {
|
|
||||||
if ($activity->target) {
|
|
||||||
$activity_target = '<a href="'.route('users.show', $activity->target_id).'">'.$activity->target->present()->fullName().'</a>';
|
|
||||||
} else {
|
|
||||||
$activity_target = '';
|
|
||||||
}
|
|
||||||
} elseif (($activity->action_type=='accepted') || ($activity->action_type=='declined')) {
|
|
||||||
$activity_target = $activity->item->assignedTo->nameUrl();
|
|
||||||
} elseif ($activity->action_type=='requested') {
|
|
||||||
if ($activity->user) {
|
|
||||||
$activity_target = '<a href="'.route('users.show', $activity->user_id).'">'.$activity->user->present()->fullName().'</a>';
|
|
||||||
} else {
|
|
||||||
$activity_target = '';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($activity->target) {
|
|
||||||
$activity_target = $activity->target->id;
|
|
||||||
} else {
|
|
||||||
$activity_target = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$rows[] = array(
|
|
||||||
'icon' => '<i class="'.$activity->parseItemIcon().'"></i>',
|
|
||||||
'created_at' => date("M d, Y g:iA", strtotime($activity->created_at)),
|
|
||||||
'action_type' => strtolower(trans('general.'.str_replace(' ', '_', $activity->action_type))),
|
|
||||||
'admin' => $activity->user ? (string) link_to_route('users.show', $activity->user->present()->fullName(), [$activity->user_id]) : '',
|
|
||||||
'target' => $activity_target,
|
|
||||||
'item' => $activity_item,
|
|
||||||
'item_type' => $item_type,
|
|
||||||
'note' => e($activity->note),
|
|
||||||
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = array('total'=>$activityCount, 'rows'=>$rows);
|
$data = array('total'=>$activityCount, 'rows'=>$rows);
|
||||||
|
|
|
@ -38,9 +38,9 @@ class AssetRequest extends Request
|
||||||
'status' => 'integer|nullable',
|
'status' => 'integer|nullable',
|
||||||
'asset_tag' => 'required',
|
'asset_tag' => 'required',
|
||||||
'purchase_cost' => 'numeric|nullable',
|
'purchase_cost' => 'numeric|nullable',
|
||||||
"assigned_user" => 'required_without_all:assigned_asset,assigned_location',
|
"assigned_user" => 'sometimes:required_without_all:assigned_asset,assigned_location',
|
||||||
"assigned_asset" => 'required_without_all:assigned_user,assigned_location',
|
"assigned_asset" => 'sometimes:required_without_all:assigned_user,assigned_location',
|
||||||
"assigned_location" => 'required_without_all:assigned_user,assigned_asset',
|
"assigned_location" => 'sometimes:required_without_all:assigned_user,assigned_asset',
|
||||||
];
|
];
|
||||||
|
|
||||||
$model = AssetModel::find($this->request->get('model_id'));
|
$model = AssetModel::find($this->request->get('model_id'));
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
use App\Presenters\Presentable;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
@ -12,10 +12,11 @@ use Response;
|
||||||
*
|
*
|
||||||
* @version v1.0
|
* @version v1.0
|
||||||
*/
|
*/
|
||||||
class Actionlog extends Model
|
class Actionlog extends SnipeModel
|
||||||
{
|
{
|
||||||
|
protected $presenter = "App\Presenters\ActionlogPresenter";
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
use Presentable;
|
||||||
protected $dates = [ 'deleted_at' ];
|
protected $dates = [ 'deleted_at' ];
|
||||||
|
|
||||||
protected $table = 'action_logs';
|
protected $table = 'action_logs';
|
||||||
|
|
|
@ -237,10 +237,10 @@ class Asset extends Depreciable
|
||||||
} elseif ($this->assignedType() == self::LOCATION) {
|
} elseif ($this->assignedType() == self::LOCATION) {
|
||||||
return $this->assignedTo();
|
return $this->assignedTo();
|
||||||
}
|
}
|
||||||
// Default to User
|
if($this->assignedTo) {
|
||||||
// var_dump($this);
|
|
||||||
return $this->assignedTo->userLoc();
|
return $this->assignedTo->userLoc();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $this->defaultLoc();
|
return $this->defaultLoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
70
app/Presenters/ActionlogPresenter.php
Normal file
70
app/Presenters/ActionlogPresenter.php
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CompanyPresenter
|
||||||
|
* @package App\Presenters
|
||||||
|
*/
|
||||||
|
class ActionlogPresenter extends Presenter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Link to this companies name
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function forDataTable()
|
||||||
|
{
|
||||||
|
|
||||||
|
return [
|
||||||
|
'icon' => '<i class="'.$this->parseItemIcon().'"></i>',
|
||||||
|
'created_at' => date("M d, Y g:iA", strtotime($this->created_at)),
|
||||||
|
'action_type' => strtolower(trans('general.'.str_replace(' ', '_', $this->action_type))),
|
||||||
|
'admin' => $this->model->user ? $this->model->user->present()->nameUrl() : '',
|
||||||
|
'target' => $this->target(),
|
||||||
|
'item' => $this->item(),
|
||||||
|
'item_type' => $this->itemType(),
|
||||||
|
'note' => e($this->note),
|
||||||
|
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function admin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function item()
|
||||||
|
{//
|
||||||
|
// oute('show/userfile', [$user->id, $file->id])
|
||||||
|
if($this->action_type=='uploaded') {
|
||||||
|
return (string) link_to_route('show/userfile', $this->model->filename, [$this->model->item->id, $this->model->id]);
|
||||||
|
}
|
||||||
|
if ($this->model->item) {
|
||||||
|
return $this->model->item->present()->nameUrl();
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function target()
|
||||||
|
{
|
||||||
|
// Target is messy.
|
||||||
|
// On an upload, the target is the item we are uploading to, stored as the "item" in the log.
|
||||||
|
if ($this->action_type=='uploaded') {
|
||||||
|
return $this->model->item->present()->nameUrl();
|
||||||
|
}
|
||||||
|
// If we are logging an accept/reject, the target is not stored directly,
|
||||||
|
// so we access it through who the item is assigned to.
|
||||||
|
// FIXME: On a reject it's not assigned to anyone.
|
||||||
|
if (($this->action_type=='accepted') || ($this->action_type=='declined')) {
|
||||||
|
return $this->model->item->assignedTo->nameUrl();
|
||||||
|
} elseif ($this->action_type=='requested') {
|
||||||
|
if ($this->model->user) {
|
||||||
|
return $this->model->user->present()->nameUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Otherwise, we'll just take the target of the log.
|
||||||
|
if ($this->model->target) {
|
||||||
|
return $this->model->target->present()->nameUrl();
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
|
@ -159,6 +159,7 @@
|
||||||
'supplier' => 'Supplier',
|
'supplier' => 'Supplier',
|
||||||
'suppliers' => 'Suppliers',
|
'suppliers' => 'Suppliers',
|
||||||
'submit' => 'Submit',
|
'submit' => 'Submit',
|
||||||
|
'target' => 'Target',
|
||||||
'total_assets' => 'total assets',
|
'total_assets' => 'total assets',
|
||||||
'total_licenses' => 'total licenses',
|
'total_licenses' => 'total licenses',
|
||||||
'total_accessories' => 'total accessories',
|
'total_accessories' => 'total accessories',
|
||||||
|
|
|
@ -236,47 +236,22 @@ View Assets for {{ $user->present()->fullName() }}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($userlog as $log)
|
@foreach ($userlog as $log)
|
||||||
|
@php $result = $log->present()->forDataTable();
|
||||||
|
@endphp
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
@if ($log->itemType()=="asset")
|
{!! $result['icon'] !!}
|
||||||
<i class="fa fa-barcode"></i>
|
|
||||||
@elseif ($log->itemType()=="accessory")
|
|
||||||
<i class="fa fa-keyboard-o"></i>
|
|
||||||
@elseif ($log->itemType()=="consumable")
|
|
||||||
<i class="fa fa-tint"></i>
|
|
||||||
@elseif ($log->itemType()=="license")
|
|
||||||
<i class="fa fa-floppy-o"></i>
|
|
||||||
@else
|
|
||||||
<i class="fa fa-times"></i>
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ strtolower(trans('general.'.str_replace(' ','_',$log->action_type))) }}
|
{{ $result['action_type'] }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if (($log->item) && ($log->itemType()=="asset"))
|
{!! $result['item'] !!}
|
||||||
@if ($log->item->deleted_at=='')
|
|
||||||
{{ $log->item->present()->name() }}
|
|
||||||
@else
|
|
||||||
<del>{{ $log->item->present()->name() }}</del> (deleted)
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@elseif ($log->item)
|
|
||||||
@if ($log->item->deleted_at=='')
|
|
||||||
{{ $log->item->name }}
|
|
||||||
@else
|
|
||||||
<del>{{ $log->item->name }}</del> (deleted)
|
|
||||||
@endif
|
|
||||||
@else
|
|
||||||
{{ trans('general.bad_data') }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($log->user)
|
{!! $result['admin'] !!}
|
||||||
{{ $log->user->present()->fullName() }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $log->created_at }}</td>
|
<td>{{ $result['created_at'] }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
<th class="col-sm-2" data-field="admin">{{ trans('general.admin') }}</th>
|
<th class="col-sm-2" data-field="admin">{{ trans('general.admin') }}</th>
|
||||||
<th class="col-sm-2" data-field="action_type">{{ trans('general.action') }}</th>
|
<th class="col-sm-2" data-field="action_type">{{ trans('general.action') }}</th>
|
||||||
<th class="col-sm-4" data-field="item">{{ trans('general.item') }}</th>
|
<th class="col-sm-4" data-field="item">{{ trans('general.item') }}</th>
|
||||||
<th class="col-sm-2" data-field="target">To</th>
|
<th class="col-sm-2" data-field="target">{{ trans('general.target') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -271,31 +271,30 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
'icon' => '<i class="'.$this->parseItemIcon().'"></i>',
|
||||||
|
'created_at' => date("M d, Y g:iA", strtotime($this->created_at)),
|
||||||
|
'action_type' => strtolower(trans('general.'.str_replace(' ', '_', $this->action_type))),
|
||||||
|
'admin' => $this->model->user ? $this->model->user->present()->nameUrl() : '',
|
||||||
|
'target' => $this->target(),
|
||||||
|
'item' => $this->item(),
|
||||||
|
'item_type' => $this->itemType(),
|
||||||
|
'note' => e($this->note),
|
||||||
|
|
||||||
@if (count($asset->assetlog) > 0)
|
@if (count($asset->assetlog) > 0)
|
||||||
@foreach ($asset->assetlog as $log)
|
@foreach ($asset->assetlog as $log)
|
||||||
|
@php $result = $log->present()->forDataTable();
|
||||||
|
@endphp
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $log->created_at }}</td>
|
<td>{{ $result['created_at'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if (isset($log->user_id))
|
{!! $result['admin'] !!}
|
||||||
{{ $log->user->present()->fullName() }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $log->action_type }}</td>
|
<td>{{ $result['action_type'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if ((isset($log->target_id)) && ($log->target_id!=0) && ($log->target_id!=''))
|
{!! $result['target'] !!}
|
||||||
@if ($log->target->deleted_at=='')
|
|
||||||
<a href="{{ route('users.show', $log->target_id) }}">
|
|
||||||
{{ $log->user->present()->fullName() }}
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
<del>{{ $log->user->present()->fullName() }}</del>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($log->note)
|
{{ $result['note'] }}
|
||||||
{{ $log->note }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
|
@ -552,53 +552,15 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
@if (count($asset->assetlog) > 0)
|
@if (count($asset->assetlog) > 0)
|
||||||
@foreach ($asset->assetlog as $log)
|
@foreach ($asset->assetlog as $log)
|
||||||
|
@php $result = $log->present()->forDataTable();
|
||||||
|
@endphp
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $log->created_at }}</td>
|
<td>{{ $result['created_at'] }}</td>
|
||||||
|
<td> {!! $result['admin'] !!} </td>
|
||||||
|
<td>{{ $result['action_type'] }}</td>
|
||||||
|
<td>{!! $result['target'] !!} </td>
|
||||||
<td>
|
<td>
|
||||||
@if ($log->action_type != 'requested')
|
{{ $result['note'] }}
|
||||||
@if (isset($log->user))
|
|
||||||
{{ $log->user->present()->fullName() }}
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>{{ $log->action_type }}</td>
|
|
||||||
<td>
|
|
||||||
@if ($log->action_type=='uploaded')
|
|
||||||
{{ $log->filename }}
|
|
||||||
@elseif ((isset($log->target_id)) && ($log->target_id!=0) && ($log->target_id!=''))
|
|
||||||
|
|
||||||
@if ($log->target instanceof \App\Models\User)
|
|
||||||
@if ($log->target->deleted_at=='')
|
|
||||||
<a href="{{ route('users.show', $log->target_id) }}">
|
|
||||||
{{ $log->target->present()->fullName() }}
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
<del>{{ $log->target->present()->fullName() }}</del>
|
|
||||||
@endif
|
|
||||||
@elseif($log->target instanceof \App\Models\Asset)
|
|
||||||
@if ($log->target->deleted_at=='')
|
|
||||||
<a href="{{ route('hardware.show', $log->target_id) }}">
|
|
||||||
{{ $log->target->present()->name() }}
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
<del>{{ $log->target->present()->name() }}</del>
|
|
||||||
@endif
|
|
||||||
@elseif (($log->action_type=='accepted') || ($log->action_type=='declined'))
|
|
||||||
{{-- On a declined log, the asset isn't assigned to anyone when we look this up. --}}
|
|
||||||
@if ($log->item->assignedTo)
|
|
||||||
{{ $log->item->assignedTo->present()->name() }}
|
|
||||||
@else
|
|
||||||
Unknown
|
|
||||||
@endif
|
|
||||||
@else
|
|
||||||
Deleted User
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@if ($log->note)
|
|
||||||
{{ $log->note }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
@if ($snipeSettings->require_accept_signature=='1')
|
@if ($snipeSettings->require_accept_signature=='1')
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -317,46 +317,34 @@
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<table class="table table-hover table-fixed break-word">
|
<table class="table table-hover table-fixed break-word">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-2">{{ trans('general.date') }}</th>
|
<th class="col-md-2">{{ trans('general.date') }}</th>
|
||||||
<th class="col-md-2"><span class="line"></span>{{ trans('general.admin') }}</th>
|
<th class="col-md-2"><span class="line"></span>{{ trans('general.admin') }}</th>
|
||||||
<th class="col-md-2"><span class="line"></span>{{ trans('button.actions') }}</th>
|
<th class="col-md-2"><span class="line"></span>{{ trans('button.actions') }}</th>
|
||||||
<th class="col-md-2"><span class="line"></span>{{ trans('admin/licenses/general.user') }}</th>
|
<th class="col-md-2"><span class="line"></span>{{ trans('general.target') }}</th>
|
||||||
<th class="col-md-4"><span class="line"></span>{{ trans('general.notes') }}</th>
|
<th class="col-md-4"><span class="line"></span>{{ trans('general.notes') }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@if (count($license->assetlog) > 0)
|
@if (count($license->assetlog) > 0)
|
||||||
@foreach ($license->assetlog as $log)
|
@foreach ($license->assetlog as $log)
|
||||||
|
@php $result = $log->present()->forDataTable()
|
||||||
|
@endphp
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ $log->created_at }}</td>
|
<td>{{ $result['created_at'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if (isset($log->user_id))
|
{!! $result['admin'] !!}
|
||||||
<a href="{{ route('users.show', $log->user_id)}}">{{ $log->user->present()->fullName() }}</a>
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $log->action_type }}</td>
|
<td>{{ $result['action_type'] }}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
@if (($log->target) && ($log->target->id!='0'))
|
{!! $result['target'] !!}
|
||||||
@if ($log->target_type == 'App\Models\User')
|
|
||||||
<a href="{{ route('users.show', $log->target_id) }}">
|
|
||||||
{{ $log->userlog->present()->fullName() }}
|
|
||||||
</a>
|
|
||||||
@elseif ($log->target_type == 'App\Models\Asset')
|
|
||||||
<a href="{{ route('hardware.show', $log->target_id) }}">
|
|
||||||
{{ $log->userlog->present()->name() }}
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
@elseif ($log->action_type=='uploaded')
|
|
||||||
{{ $log->filename }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
@if ($log->note)
|
{{ $result['note'] }}
|
||||||
{{ $log->note }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
|
@ -342,7 +342,7 @@
|
||||||
<i class="fa fa-plus icon-white"></i>
|
<i class="fa fa-plus icon-white"></i>
|
||||||
<span>Select File...</span>
|
<span>Select File...</span>
|
||||||
<!-- The file input field used as target for the file upload widget -->
|
<!-- The file input field used as target for the file upload widget -->
|
||||||
<input id="fileupload" type="file" name="file[]" data-url="{{ url('/') }}/api/users/{{ $user->id }}/upload">
|
<input id="fileupload" type="file" name="file[]" data-url="{{ route('upload/user', $user->id) }}">
|
||||||
</span>
|
</span>
|
||||||
@endcan
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
|
@ -396,7 +396,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@can('update', $user)
|
@can('update', $user)
|
||||||
<a class="btn delete-asset btn-danger btn-sm" href="{{ route('users.destroyfile', [$user->id, $file->id]) }}" data-content="Are you sure you wish to delete this file?" data-title="Delete {{ $file->filename }}?"><i class="fa fa-trash icon-white"></i></a>
|
<a class="btn delete-asset btn-danger btn-sm" href="{{ route('delete/userfile', [$user->id, $file->id]) }}" data-content="Are you sure you wish to delete this file?" data-title="Delete {{ $file->filename }}?"><i class="fa fa-trash icon-white"></i></a>
|
||||||
@endcan
|
@endcan
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -422,31 +422,19 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@foreach ($userlog as $log)
|
@foreach ($userlog as $log)
|
||||||
|
@php $result = $log->present()->forDataTable;
|
||||||
|
@endphp
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<i class="{{ ($log->parseItemIcon()) }}"></i>
|
{!!$result['icon']!!}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $log->created_at }}</td>
|
<td>{{ $result['created_at'] }}</td>
|
||||||
<td>{{ $log->action_type }}</td>
|
<td>{{ $result['action_type'] }}</td>
|
||||||
<td>
|
<td>
|
||||||
@if (($log->item) && ($log->itemType()=="asset"))
|
{!! $result['item'] !!}
|
||||||
{!! $log->item->present()->nameUrl() !!}
|
|
||||||
@elseif ($log->item)
|
|
||||||
<a href="{{ route($log->parseItemRoute().'.show', $log->item_id) }}">
|
|
||||||
{{ $log->item->name }}
|
|
||||||
</a>
|
|
||||||
@else
|
|
||||||
{{ trans('general.bad_data') }}
|
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if ($log->action_type != 'requested')
|
{!! $result['admin'] !!}
|
||||||
@if (isset($log->user))
|
|
||||||
{!! $log->user->present()->nameUrl() !!}
|
|
||||||
@else
|
|
||||||
Deleted Admin
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -58,7 +58,7 @@ class AssetsCest
|
||||||
'model_id' => $asset->model_id,
|
'model_id' => $asset->model_id,
|
||||||
'status_id' => $asset->status_id,
|
'status_id' => $asset->status_id,
|
||||||
'assigned_to' => $I->getUserId(),
|
'assigned_to' => $I->getUserId(),
|
||||||
'assigned_type' => 'App\Models\User',
|
'assigned_type' => 'App\\Models\\User',
|
||||||
'serial' => $asset->serial,
|
'serial' => $asset->serial,
|
||||||
'name' => $asset->name,
|
'name' => $asset->name,
|
||||||
'purchase_date' => '2016-01-01',
|
'purchase_date' => '2016-01-01',
|
||||||
|
|
Loading…
Reference in a new issue