Skip to content

A free open source IT asset/license management system

Updated blades to add byod as a “status”

snipe0c39c7a53d98
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 : '' }})
</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') }}