A few more small tweaks
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
9555825a67
commit
2bf4ec0ae8
3 changed files with 47 additions and 56 deletions
|
@ -26,11 +26,8 @@ class AssetFilesController extends Controller
|
||||||
*@since [v1.0]
|
*@since [v1.0]
|
||||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
*/
|
*/
|
||||||
public function store(UploadFileRequest $request, $assetId = null) : RedirectResponse
|
public function store(UploadFileRequest $request, Asset $asset) : RedirectResponse
|
||||||
{
|
{
|
||||||
if (! $asset = Asset::find($assetId)) {
|
|
||||||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->authorize('update', $asset);
|
$this->authorize('update', $asset);
|
||||||
|
|
||||||
|
@ -59,9 +56,8 @@ class AssetFilesController extends Controller
|
||||||
* @param int $fileId
|
* @param int $fileId
|
||||||
* @since [v1.0]
|
* @since [v1.0]
|
||||||
*/
|
*/
|
||||||
public function show($assetId = null, $fileId = null) : View | RedirectResponse | Response | StreamedResponse | BinaryFileResponse
|
public function show(Asset $asset, $fileId = null) : View | RedirectResponse | Response | StreamedResponse | BinaryFileResponse
|
||||||
{
|
{
|
||||||
if ($asset = Asset::find($assetId)) {
|
|
||||||
|
|
||||||
$this->authorize('view', $asset);
|
$this->authorize('view', $asset);
|
||||||
|
|
||||||
|
@ -81,9 +77,7 @@ class AssetFilesController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('hardware.show', ['hardware' => $asset])->with('error', trans('general.log_record_not_found'));
|
return redirect()->route('hardware.show', ['hardware' => $asset])->with('error', trans('general.log_record_not_found'));
|
||||||
}
|
|
||||||
|
|
||||||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,9 +89,8 @@ class AssetFilesController extends Controller
|
||||||
* @param int $fileId
|
* @param int $fileId
|
||||||
* @since [v1.0]
|
* @since [v1.0]
|
||||||
*/
|
*/
|
||||||
public function destroy($assetId = null, $fileId = null) : RedirectResponse
|
public function destroy(Asset $asset, $fileId = null) : RedirectResponse
|
||||||
{
|
{
|
||||||
if ($asset = Asset::find($assetId)) {
|
|
||||||
$this->authorize('update', $asset);
|
$this->authorize('update', $asset);
|
||||||
$rel_path = 'private_uploads/assets';
|
$rel_path = 'private_uploads/assets';
|
||||||
|
|
||||||
|
@ -112,6 +105,4 @@ class AssetFilesController extends Controller
|
||||||
return redirect()->route('hardware.show', ['hardware' => $asset])->with('error', trans('general.log_record_not_found'));
|
return redirect()->route('hardware.show', ['hardware' => $asset])->with('error', trans('general.log_record_not_found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,15 @@
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if ($asset->deleted_at!='')
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="callout callout-warning">
|
||||||
|
<x-icon type="warning" />
|
||||||
|
{{ trans('general.asset_deleted_warning') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<div class="nav-tabs-custom">
|
<div class="nav-tabs-custom">
|
||||||
<ul class="nav nav-tabs hidden-print">
|
<ul class="nav nav-tabs hidden-print">
|
||||||
|
@ -169,15 +178,6 @@
|
||||||
<div class="tab-pane fade in active" id="details">
|
<div class="tab-pane fade in active" id="details">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
@if ($asset->deleted_at!='')
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="callout callout-warning">
|
|
||||||
<x-icon type="warning" />
|
|
||||||
{{ trans('general.asset_deleted_warning') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<div class="info-stack-container">
|
<div class="info-stack-container">
|
||||||
<!-- Start button column -->
|
<!-- Start button column -->
|
||||||
<div class="col-md-3 col-xs-12 col-sm-push-9 info-stack">
|
<div class="col-md-3 col-xs-12 col-sm-push-9 info-stack">
|
||||||
|
@ -300,7 +300,7 @@
|
||||||
</button>
|
</button>
|
||||||
<span class="sr-only">{{ trans('general.delete') }}</span>
|
<span class="sr-only">{{ trans('general.delete') }}</span>
|
||||||
@else
|
@else
|
||||||
<form method="POST" action="{{ route('restore/hardware', ['assetId' => $asset->id]) }}">
|
<form method="POST" action="{{ route('restore/hardware', [$asset]) }}">
|
||||||
@csrf
|
@csrf
|
||||||
<button class="btn btn-sm btn-block btn-warning btn-social delete-asset">
|
<button class="btn btn-sm btn-block btn-warning btn-social delete-asset">
|
||||||
<x-icon type="restore" />
|
<x-icon type="restore" />
|
||||||
|
|
|
@ -131,27 +131,27 @@ Route::group(
|
||||||
|
|
||||||
Route::get('{asset}/qr_code',
|
Route::get('{asset}/qr_code',
|
||||||
[AssetsController::class, 'getQrCode']
|
[AssetsController::class, 'getQrCode']
|
||||||
)->name('qr_code/hardware');
|
)->name('qr_code/hardware')->withTrashed();
|
||||||
|
|
||||||
Route::get('{assetId}/barcode',
|
Route::get('{asset}/barcode',
|
||||||
[AssetsController::class, 'getBarCode']
|
[AssetsController::class, 'getBarCode']
|
||||||
)->name('barcode/hardware');
|
)->name('barcode/hardware')->withTrashed();
|
||||||
|
|
||||||
Route::post('{assetId}/restore',
|
Route::post('{asset}/restore',
|
||||||
[AssetsController::class, 'getRestore']
|
[AssetsController::class, 'getRestore']
|
||||||
)->name('restore/hardware');
|
)->name('restore/hardware')->withTrashed();
|
||||||
|
|
||||||
Route::post('{assetId}/upload',
|
Route::post('{asset}/upload',
|
||||||
[AssetFilesController::class, 'store']
|
[AssetFilesController::class, 'store']
|
||||||
)->name('upload/asset');
|
)->name('upload/asset')->withTrashed();
|
||||||
|
|
||||||
Route::get('{assetId}/showfile/{fileId}/{download?}',
|
Route::get('{asset}/showfile/{fileId}/{download?}',
|
||||||
[AssetFilesController::class, 'show']
|
[AssetFilesController::class, 'show']
|
||||||
)->name('show/assetfile');
|
)->name('show/assetfile')->withTrashed();
|
||||||
|
|
||||||
Route::delete('{assetId}/showfile/{fileId}/delete',
|
Route::delete('{asset}/showfile/{fileId}/delete',
|
||||||
[AssetFilesController::class, 'destroy']
|
[AssetFilesController::class, 'destroy']
|
||||||
)->name('delete/assetfile');
|
)->name('delete/assetfile')->withTrashed();
|
||||||
|
|
||||||
Route::post(
|
Route::post(
|
||||||
'bulkedit',
|
'bulkedit',
|
||||||
|
@ -190,7 +190,7 @@ Route::group(
|
||||||
Route::resource('hardware',
|
Route::resource('hardware',
|
||||||
AssetsController::class,
|
AssetsController::class,
|
||||||
['middleware' => ['auth']
|
['middleware' => ['auth']
|
||||||
])->parameters(['hardware' => 'asset']);
|
])->parameters(['hardware' => 'asset'])->withTrashed();
|
||||||
|
|
||||||
|
|
||||||
// Asset Maintenances
|
// Asset Maintenances
|
||||||
|
|
Loading…
Add table
Reference in a new issue