A free open source IT asset/license management system
Moved code closer to actions
snipeabe58117fe29
diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.phpindex 6759aedbc7..4bec77e2f8 100644--- a/resources/views/partials/bootstrap-table.blade.php+++ b/resources/views/partials/bootstrap-table.blade.php@@ -370,49 +370,6 @@return '<a href="{{ config('app.url') }}/hardware/' + row.id + '/audit" class="actions btn btn-sm btn-primary" data-tooltip="true" title="{{ trans('general.audit') }}"><x-icon type="audit" /><span class="sr-only">{{ trans('general.audit') }}</span></a> ';}- // This handles the custom view for the filestable blade component- window.customViewFormatter = data => {- const template = $('#fileGalleryTemplate').html()- let view = ''-- $.each(data, function (i, row) {--- if (row.exists_on_disk === true)- {- if (row.mediatype === 'image') {- embed_code = '<a href="' + row.url + '" data-toggle="lightbox" data-type="image" data-title="' + row.filename + row.filename + '" data-footer="' + row.note + '" class="embed-responsive-item"><img src="' + row.url + '?inline=true" alt="" style="max-width: 100%"></a>';- } else if (row.mediatype === 'video') {- embed_code = '<a href="' + row.url + '" data-toggle="lightbox" data-type="video" data-title="' + row.filename + row.filename + '" data-footer="' + row.note + '" class="embed-responsive-item"><video controls><source src="' + row.url + '?inline=true" type="video/mp4">Your browser does not support the video tag.</video></a>';- } else if (row.mediatype === 'audio') {- embed_code = '<audio style="width: 100%" controls><source src="' + row.url + '?inline=true" type="audio/mpeg">Your browser does not support the audio element.</audio>';- } else if (row.mediatype === 'pdf') {- embed_code = '<object height="200" style="width: 100%" type="application/pdf" data="' + row.url + '?inline=true">File cannot be displayed</object>';- } else {- embed_code = '<div class="text-center"><a href="' + row.url + '?inline=true"><i class="' + row.icon + '" style="font-size: 50px" /></i></a></div>';- }- } else {- embed_code = '<div class="text-center text-danger" style="padding-top: 20px;"><i class="fa-solid fa-heart-crack" style="font-size: 80px" /></i> <br><br>{{ trans('general.file_upload_status.file_not_found') }}</div>';- }-- view += template.replace('%ID%', row.id)- .replace('%ICON%', row.icon)- .replace('%FILETYPE%', row.filetype)- .replace('%FILE_URL%', row.url)- .replace('%LINK_URL%', row.url)- .replace('%FILENAME%', (row.exists_on_disk === true) ? row.filename : '<x-icon type="x" /> <del>' + row.filename + '</del>')- .replace('%CREATED_AT%', row.created_at.formatted)- .replace('%CREATED_BY%', (row.created_by) ? row.created_by.name : '')- .replace('%NOTE%', row.note)- .replace('%PANEL_CLASS%', (row.exists_on_disk === true) ? 'default' : 'danger')- .replace('%FILE_EMBED%', embed_code)- .replace('%DOWNLOAD_BUTTON%', (row.exists_on_disk === true) ? '<a href="'+ row.url +'" class="btn btn-sm btn-default"><x-icon type="download" /></a> ' : '<span class="btn btn-sm btn-default disabled" data-tooltip="true" title="{{ trans('general.file_upload_status.file_not_found') }}"><x-icon type="download" /></span>')- .replace('%NEW_WINDOW_BUTTON%', (row.exists_on_disk === true) ? '<a href="'+ row.url +'?inline=true" class="btn btn-sm btn-default" target="_blank"><x-icon type="external-link" /></a> ' : '<span class="btn btn-sm btn-default disabled" data-tooltip="true" title="{{ trans('general.file_upload_status.file_not_found') }}" ><x-icon type="external-link"/></span>')- .replace('%DELETE_BUTTON%', ((row.exists_on_disk === true) && row.available_actions.delete === true) ? '<a href="{{ config('app.url') }}/' + row.item.type + '/' + row.item.id + '/showfile/' + row.id + '/delete" class="actions btn btn-danger btn-sm delete-asset" data-tooltip="true" data-toggle="modal" data-content="{{ trans('general.sure_to_delete') }} '+ row.filename + '"?" data-title="{{ trans('general.delete') }}" data-target="#dataConfirmModal" onClick="return false;"><x-icon type="delete" /></a> ' : '<a class="btn btn-sm btn-danger disabled" data-tooltip="true" title="{{ trans('general.file_upload_status.file_not_found') }}" ><x-icon type="delete"/></a>');- })-- return `<div class="row">${view}</div>`- }@@ -1012,12 +969,61 @@return '<a href="{{ config('app.url') }}/' + destination + '/' + row.item.id + '/showfile/' + row.id + '/delete" '+ ' class="actions btn btn-danger btn-sm delete-asset" data-tooltip="true" '+ ' data-toggle="modal" '- + ' data-content="{{ trans('general.file_upload_status.confirm_delete') }} ' + row.filename + '?" '+ + ' data-content="{{ trans('general.file_upload_status.confirm_delete') }}: ' + row.filename + '?" '+ ' data-title="{{ trans('general.delete') }}" onClick="return false;">'+ '<x-icon type="delete" /><span class="sr-only">{{ trans('general.delete') }}</span></a> ';}}+ // This handles the custom view for the filestable blade component+ window.customViewFormatter = data => {+ const template = $('#fileGalleryTemplate').html()+ let view = ''++ $.each(data, function (i, row) {++ delete_url = row.url +'/delete';++ if (row.exists_on_disk === true)+ {+ if (row.mediatype === 'image') {+ embed_code = '<a href="' + row.url + '" data-toggle="lightbox" data-type="image" data-title="' + row.filename + row.filename + '" data-footer="' + row.note + '" class="embed-responsive-item"><img src="' + row.url + '?inline=true" alt="" style="max-width: 100%"></a>';+ } else if (row.mediatype === 'video') {+ embed_code = '<a href="' + row.url + '" data-toggle="lightbox" data-type="video" data-title="' + row.filename + row.filename + '" data-footer="' + row.note + '" class="embed-responsive-item"><video controls><source src="' + row.url + '?inline=true" type="video/mp4">Your browser does not support the video tag.</video></a>';+ } else if (row.mediatype === 'audio') {+ embed_code = '<audio style="width: 100%" controls><source src="' + row.url + '?inline=true" type="audio/mpeg">Your browser does not support the audio element.</audio>';+ } else if (row.mediatype === 'pdf') {+ embed_code = '<object height="200" style="width: 100%" type="application/pdf" data="' + row.url + '?inline=true">File cannot be displayed</object>';+ } else {+ embed_code = '<div class="text-center"><a href="' + row.url + '?inline=true"><i class="' + row.icon + '" style="font-size: 50px" /></i></a></div>';+ }+ } else {+ embed_code = '<div class="text-center text-danger" style="padding-top: 20px;"><i class="fa-solid fa-heart-crack" style="font-size: 80px" /></i> <br><br>{{ trans('general.file_upload_status.file_not_found') }}</div>';+ }++ view += template.replace('%ID%', row.id)+ .replace('%ICON%', row.icon)+ .replace('%FILETYPE%', row.filetype)+ .replace('%FILE_URL%', row.url)+ .replace('%LINK_URL%', row.url)+ .replace('%FILENAME%', (row.exists_on_disk === true) ? row.filename : '<x-icon type="x" /> <del>' + row.filename + '</del>')+ .replace('%CREATED_AT%', row.created_at.formatted)+ .replace('%CREATED_BY%', (row.created_by) ? row.created_by.name : '')+ .replace('%NOTE%', row.note)+ .replace('%PANEL_CLASS%', (row.exists_on_disk === true) ? 'default' : 'danger')+ .replace('%FILE_EMBED%', embed_code)+ .replace('%DOWNLOAD_BUTTON%', (row.exists_on_disk === true) ? '<a href="'+ row.url +'" class="btn btn-sm btn-default"><x-icon type="download" /></a> ' : '<span class="btn btn-sm btn-default disabled" data-tooltip="true" title="{{ trans('general.file_upload_status.file_not_found') }}"><x-icon type="download" /></span>')+ .replace('%NEW_WINDOW_BUTTON%', (row.exists_on_disk === true) ? '<a href="'+ row.url +'?inline=true" class="btn btn-sm btn-default" target="_blank"><x-icon type="external-link" /></a> ' : '<span class="btn btn-sm btn-default disabled" data-tooltip="true" title="{{ trans('general.file_upload_status.file_not_found') }}"><x-icon type="external-link"/></span>')+ .replace('%DELETE_BUTTON%', (row.available_actions.delete === true) ?+ '<a href="'+delete_url+'" class="btn btn-danger btn-sm delete-asset" data-toggle="modal" data-content="{{ trans('general.file_upload_status.confirm_delete') }} '+ row.filename +'?" data-title="{{ trans('general.delete') }}" onClick="return false;" data-target="#deleteForm"><x-icon type="delete" /><span class="sr-only">{{ trans('general.delete') }}</span></a>' :+ '<a class="btn btn-sm btn-danger disabled" data-tooltip="true" title="{{ trans('general.file_upload_status.file_not_found') }}"><x-icon type="delete" /><span class="sr-only">{{ trans('general.delete') }}</span></a>'+ );+ })++ return `<div class="row">${view}</div>`+ }++