Updated blades to add byod as a “status”

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-01-18 13:25:46 -08:00
parent fce620b54f
commit 0c39c7a53d
4 changed files with 20 additions and 0 deletions

View file

@ -271,6 +271,11 @@ class AssetsController extends Controller
// more sad, horrible workarounds for laravel bugs when doing full text searches
$assets->where('assets.assigned_to', '>', '0');
break;
case 'byod':
// This is kind of redundant, since we already check for byod=1 above, but this keeps the
// sidebar nav links a little less chaotic
$assets->where('assets.byod', '=', '1');
break;
default:
if ((! $request->filled('status_id')) && ($settings->show_archived_in_list != '1')) {

View file

@ -52,6 +52,13 @@ class AssetCountForSidebar
\Log::debug($e);
}
try {
$total_byod_sidebar = Asset::where('byod', '=', '1')->count();
view()->share('total_byod_sidebar', $total_byod_sidebar);
} catch (\Exception $e) {
\Log::debug($e);
}
return $next($request);
}
}

View file

@ -25,6 +25,8 @@
{{ trans('general.archived') }}
@elseif (Request::get('status')=='Deleted')
{{ trans('general.deleted') }}
@elseif (Request::get('status')=='byod')
{{ trans('general.byod') }}
@endif
@else
{{ trans('general.all') }}

View file

@ -454,6 +454,12 @@
({{ (isset($total_undeployable_sidebar)) ? $total_undeployable_sidebar : '' }})
</a>
</li>
<li{!! (Request::query('status') == 'byod' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=byod') }}"><i class="fas fa-times text-red fa-fw"></i>
{{ trans('general.all') }}
{{ trans('general.byod') }}
({{ (isset($total_byod_sidebar)) ? $total_byod_sidebar : '' }})
</a>
</li>
<li{!! (Request::query('status') == 'Archived' ? ' class="active"' : '') !!}><a href="{{ url('hardware?status=Archived') }}"><i class="fas fa-times text-red fa-fw"></i>
{{ trans('general.all') }}
{{ trans('admin/hardware/general.archived') }}