Handled hardware route names

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-08-01 15:59:54 -07:00
parent a51b446a10
commit b035003546
5 changed files with 14 additions and 14 deletions

View file

@ -250,7 +250,7 @@ class BulkAssetsController extends Controller
$target = $this->determineCheckoutTarget();
if (! is_array($request->get('selected_assets'))) {
return redirect()->route('hardware/bulkcheckout')->withInput()->with('error', trans('admin/hardware/message.checkout.no_assets_selected'));
return redirect()->route('hardware.bulkcheckout.show')->withInput()->with('error', trans('admin/hardware/message.checkout.no_assets_selected'));
}
$asset_ids = array_filter($request->get('selected_assets'));
@ -297,9 +297,9 @@ class BulkAssetsController extends Controller
return redirect()->to('hardware')->with('success', trans('admin/hardware/message.checkout.success'));
}
// Redirect to the asset management page with error
return redirect()->to('hardware/bulk-checkout')->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
return redirect()->route('hardware.bulkcheckout.show')->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
} catch (ModelNotFoundException $e) {
return redirect()->to('hardware/bulk-checkout')->with('error', $e->getErrors());
return redirect()->route('hardware.bulkcheckout.show')->with('error', $e->getErrors());
}
}
}

View file

@ -28,11 +28,11 @@
<div class="col-md-12">
@if ($backto=='user')
<form class="form-horizontal" method="post"
action="{{ route('checkin/hardware', array('assetId'=> $asset->id, 'backto'=>'user')) }}"
action="{{ route('hardware.checkin.store', array('assetId'=> $asset->id, 'backto'=>'user')) }}"
autocomplete="off">
@else
<form class="form-horizontal" method="post"
action="{{ route('checkin/hardware', $asset->id) }}" autocomplete="off">
action="{{ route('hardware.checkin.store', array('assetId'=> $asset->id)) }}" autocomplete="off">
@endif
{{csrf_field()}}

View file

@ -22,7 +22,7 @@
@if (($asset->assigned_to != '') && ($asset->deleted_at==''))
@can('checkin', \App\Models\Asset::class)
<li role="menuitem">
<a href="{{ route('checkin/hardware', $asset->id) }}">
<a href="{{ route('hardware.checkin.create', $asset->id) }}">
{{ trans('admin/hardware/general.checkin') }}
</a>
</li>
@ -30,7 +30,7 @@
@elseif (($asset->assigned_to == '') && ($asset->deleted_at==''))
@can('checkout', \App\Models\Asset::class)
<li role="menuitem">
<a href="{{ route('checkout/hardware', $asset->id) }}">
<a href="{{ route('hardware.checkout.create', $asset->id) }}">
{{ trans('admin/hardware/general.checkout') }}
</a>
</li>

View file

@ -486,7 +486,7 @@
@can('checkout', \App\Models\Asset::class)
<li{!! (Request::is('hardware/bulkcheckout') ? ' class="active"' : '') !!}>
<a href="{{ route('hardware/bulkcheckout') }}">
<a href="{{ route('hardware.bulkcheckout.show') }}">
{{ trans('general.bulk_checkout') }}
</a>
</li>

View file

@ -108,19 +108,19 @@ Route::group(
Route::get('{assetId}/checkout',
[AssetCheckoutController::class, 'create']
)->name('checkout/hardware');
)->name('hardware.checkout.create');
Route::post('{assetId}/checkout',
[AssetCheckoutController::class, 'store']
)->name('checkout/hardware');
)->name('hardware.checkout.store');
Route::get('{assetId}/checkin/{backto?}',
[AssetCheckinController::class, 'create']
)->name('checkin/hardware');
)->name('hardware.checkin.create');
Route::post('{assetId}/checkin/{backto?}',
[AssetCheckinController::class, 'store']
)->name('checkin/hardware');
)->name('hardware.checkin.store');
Route::get('{assetId}/view',
[AssetsController::class, 'show']
@ -168,11 +168,11 @@ Route::group(
// Bulk checkout / checkin
Route::get('bulkcheckout',
[BulkAssetsController::class, 'showCheckout']
)->name('hardware/bulkcheckout');
)->name('hardware.bulkcheckout.show');
Route::post('bulkcheckout',
[BulkAssetsController::class, 'storeCheckout']
)->name('hardware/bulkcheckout');
)->name('hardware.bulkcheckout.store');
});
Route::resource('hardware',