Add column to show filenames in Activity Report if the log action is 'uploaded'

This commit is contained in:
Ivan Nieto Vivanco 2022-05-25 18:50:32 -05:00
parent 2b5b3273e2
commit f208869aff
2 changed files with 19 additions and 7 deletions

View file

@ -55,25 +55,35 @@ class ActionlogsTransformer
}
}
$url = '';
if($actionlog->filename!='') {
if ($actionlog->present()->actionType() == 'accepted') {
$url = route('log.storedeula.download', ['filename' => $actionlog->filename]);
} else {
if ($actionlog->itemType() == 'asset') {
$url = route('show/assetfile', ['assetId' => $actionlog->id, 'fileId' => $actionlog->id]);
} elseif ($actionlog->itemType() == 'license') {
$url = route('show.licensefile', ['licenseId' => $actionlog->item->id, 'fileId' => $actionlog->id]);
} elseif ($actionlog->itemType() == 'user') {
$url = route('show/userfile', ['userId' => $actionlog->item->id, 'fileId' => $actionlog->id]);
}
}
}
$array = [
$array = [
'id' => (int) $actionlog->id,
'icon' => $icon,
'file' => ($actionlog->filename!='')
?
[
'url' => ($actionlog->present()->actionType()=='accepted')
?
route('log.storedeula.download', ['filename' => $actionlog->filename])
:
route('show/assetfile', ['assetId' => $actionlog->id, 'fileId' => $actionlog->id]),
'url' => $url,
'filename' => $actionlog->filename,
'inlineable' => (bool) Helper::show_file_inline($actionlog->filename),
] : null,
'item' => ($actionlog->item) ? [
'id' => (int) $actionlog->item->id,
'name' => ($actionlog->itemType()=='user') ? $actionlog->filename : e($actionlog->item->getDisplayNameAttribute()),
'name' => ($actionlog->itemType()=='user') ? e($actionlog->item->getFullNameAttribute()) : e($actionlog->item->getDisplayNameAttribute()),
'type' => e($actionlog->itemType()),
] : null,
'location' => ($actionlog->location) ? [
@ -104,6 +114,7 @@ class ActionlogsTransformer
];
//\Log::info("Clean Meta is: ".print_r($clean_meta,true));
//dd($array);
return $array;
}

View file

@ -47,6 +47,7 @@
<th class="col-sm-3" data-searchable="false" data-sortable="true" data-field="action_date" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th class="col-sm-2" data-searchable="true" data-sortable="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th>
<th class="col-sm-2" data-field="action_type">{{ trans('general.action') }}</th>
<th class="col-sm-2" data-field="file" data-formatter="fileUploadNameFormatter">{{ trans('general.file_name') }}</th>
<th class="col-sm-1" data-field="type" data-formatter="itemTypeFormatter">{{ trans('general.type') }}</th>
<th class="col-sm-3" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th class="col-sm-2" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.to') }}</th>