fixed audit log image not appearing

This commit is contained in:
Godfrey M 2023-06-12 12:10:19 -07:00
parent d1ab139b0f
commit 6dd7181d09
3 changed files with 9 additions and 5 deletions

View file

@ -44,13 +44,13 @@ class AssetAuditPresenter extends Presenter
'visible' => true, 'visible' => true,
'formatter' => 'hardwareLinkFormatter', 'formatter' => 'hardwareLinkFormatter',
], [ ], [
'field' => 'image', 'field' => 'file',
'searchable' => false, 'searchable' => false,
'sortable' => true, 'sortable' => true,
'switchable' => true, 'switchable' => true,
'title' => trans('admin/hardware/table.image'), 'title' => trans('admin/hardware/table.image'),
'visible' => false, 'visible' => false,
'formatter' => 'imageFormatter', 'formatter' => 'auditImageFormatter',
], [ ], [
'field' => 'asset_tag', 'field' => 'asset_tag',
'searchable' => true, 'searchable' => true,

View file

@ -652,11 +652,15 @@
} }
} }
function auditImageFormatter(value){
if (value){
return '<a href="' + value.url + '" data-toggle="lightbox" data-type="image"><img src="' + value.url + '" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;" class="img-responsive"></a>'
}
}
function imageFormatter(value, row) { function imageFormatter(value, row) {
if (value) { if (value) {
// This is a clunky override to handle unusual API responses where we're presenting a link instead of an array // This is a clunky override to handle unusual API responses where we're presenting a link instead of an array

View file

@ -34,7 +34,7 @@
<thead> <thead>
<tr> <tr>
<th class="col-sm-1" data-field="image" data-visible="false" data-formatter="imageFormatter">{{ trans('admin/hardware/table.image') }}</th> <th class="col-sm-1" data-field="file" data-visible="false" data-formatter="auditImageFormatter">{{ trans('admin/hardware/table.image') }}</th>
<th class="col-sm-2" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.audit') }}</th> <th class="col-sm-2" data-field="created_at" data-formatter="dateDisplayFormatter">{{ trans('general.audit') }}</th>
<th class="col-sm-2" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th> <th class="col-sm-2" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th>
<th class="col-sm-2" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th> <th class="col-sm-2" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>