Fix extraneous wildcard query in requestable asset search

This commit is contained in:
Brady Wetherington 2022-01-13 16:32:40 -08:00
parent 4e3fd6bfaf
commit 4e8ae8a162
3 changed files with 6 additions and 4 deletions

View file

@ -942,7 +942,9 @@ class AssetsController extends Controller
$offset = request('offset', 0);
$limit = $request->input('limit', 50);
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
if ($request->filled('search')) {
$assets->TextSearch($request->input('search'));
}
switch ($request->input('sort')) {
case 'model':

View file

@ -57,10 +57,10 @@ class ViewAssetsController extends Controller
*/
public function getRequestableIndex()
{
$assets = Asset::with('model', 'defaultLoc', 'location', 'assignedTo', 'requests')->Hardware()->RequestableAssets();
$asset_count = Asset::with('model', 'defaultLoc', 'location', 'assignedTo', 'requests')->Hardware()->RequestableAssets()->count();
$models = AssetModel::with('category', 'requests', 'assets')->RequestableModels()->get();
return view('account/requestable-assets', compact('assets', 'models'));
return view('account/requestable-assets', compact('asset_count', 'models'));
}
public function getRequestItem(Request $request, $itemType, $itemId = null)

View file

@ -20,7 +20,7 @@
<ul class="nav nav-tabs">
<li class="active">
<a href="#assets" data-toggle="tab" title="{{ trans('general.assets') }}">{{ trans('general.assets') }}
<badge class="badge badge-secondary"> {{ $assets->count()}}</badge>
<badge class="badge badge-secondary"> {{ $asset_count }}</badge>
</a>
</li>
<li>