From 0c39c7a53d981771d59a9c9548450c9f023b3bf6 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 18 Jan 2023 13:25:46 -0800 Subject: [PATCH] =?UTF-8?q?Updated=20blades=20to=20add=20byod=20as=20a=20?= =?UTF-8?q?=E2=80=9Cstatus=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: snipe --- app/Http/Controllers/Api/AssetsController.php | 5 +++++ app/Http/Middleware/AssetCountForSidebar.php | 7 +++++++ resources/views/hardware/index.blade.php | 2 ++ resources/views/layouts/default.blade.php | 6 ++++++ 4 files changed, 20 insertions(+) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index dae0d8c22b..b8675a4131 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -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')) { diff --git a/app/Http/Middleware/AssetCountForSidebar.php b/app/Http/Middleware/AssetCountForSidebar.php index 414c10e8a1..5d9656f5c1 100644 --- a/app/Http/Middleware/AssetCountForSidebar.php +++ b/app/Http/Middleware/AssetCountForSidebar.php @@ -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); } } diff --git a/resources/views/hardware/index.blade.php b/resources/views/hardware/index.blade.php index ef095c1cef..a73b37f2ce 100755 --- a/resources/views/hardware/index.blade.php +++ b/resources/views/hardware/index.blade.php @@ -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') }} diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index f332b6578e..daf4275481 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -454,6 +454,12 @@ ({{ (isset($total_undeployable_sidebar)) ? $total_undeployable_sidebar : '' }}) + + {{ trans('general.all') }} + {{ trans('general.byod') }} + ({{ (isset($total_byod_sidebar)) ? $total_byod_sidebar : '' }}) + + {{ trans('general.all') }} {{ trans('admin/hardware/general.archived') }}