more cleanup to fit formatting convention
This commit is contained in:
parent
87ef37b0b4
commit
08cb8c354b
3 changed files with 12 additions and 15 deletions
|
@ -856,16 +856,13 @@ class AssetsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bulk Checkin an asset
|
* Checkin an asset by asset tag
|
||||||
* This is the current solution to perform a bulk api checkin based on an asset tag, rather than a regular checkin.
|
|
||||||
* This is due to the need to find the asset first based on the asset tag.
|
|
||||||
*
|
*
|
||||||
* @author [A. Janes] [<ajanes@adagiohealth.org>]
|
* @author [A. Janes] [<ajanes@adagiohealth.org>]
|
||||||
* @param int $assetId
|
* @since [v6.0]
|
||||||
* @since [v4.0]
|
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
*/
|
*/
|
||||||
public function bulkCheckin(Request $request)
|
public function checkinByTag(Request $request)
|
||||||
{
|
{
|
||||||
$this->authorize('checkin', Asset::class);
|
$this->authorize('checkin', Asset::class);
|
||||||
$asset = Asset::with('assetstatus')->where('asset_tag', $request->input('asset_tag'))->first();
|
$asset = Asset::with('assetstatus')->where('asset_tag', $request->input('asset_tag'))->first();
|
||||||
|
@ -875,8 +872,8 @@ class AssetsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(Helper::formatStandardApiResponse('error', [
|
return response()->json(Helper::formatStandardApiResponse('error', [
|
||||||
'asset'=> e($request->input('asset_tag'))
|
'asset'=> e($request->input('asset'))
|
||||||
], 'Asset with tag '.e($request->input('asset_tag')).' not found'));
|
], 'Asset with tag '.e($request->input('asset')).' not found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
var formData = $('#checkin-form').serializeArray();
|
var formData = $('#checkin-form').serializeArray();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{{ route('api.asset.bulkcheckin') }}",
|
url: "{{ route('api.asset.checkinbytag') }}",
|
||||||
type : 'POST',
|
type : 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
"X-Requested-With": 'XMLHttpRequest',
|
"X-Requested-With": 'XMLHttpRequest',
|
||||||
|
|
|
@ -467,12 +467,12 @@ Route::group(['prefix' => 'v1', 'middleware' => 'api'], function () {
|
||||||
]
|
]
|
||||||
)->name('api.asset.checkin');
|
)->name('api.asset.checkin');
|
||||||
|
|
||||||
Route::post('bulkcheckin',
|
Route::post('checkinbytag',
|
||||||
[
|
[
|
||||||
Api\AssetsController::class,
|
Api\AssetsController::class,
|
||||||
'bulkcheckin'
|
'checkinbytag'
|
||||||
]
|
]
|
||||||
)->name('api.asset.bulkcheckin');
|
)->name('api.asset.checkinbytag');
|
||||||
|
|
||||||
Route::post('checkout',
|
Route::post('checkout',
|
||||||
[
|
[
|
||||||
|
|
Loading…
Add table
Reference in a new issue