Skip to content

A free open source IT asset/license management system

Exclude users-only view from some of the needs attention options

snipe5d5b128b06e6
diff --git a/resources/views/livewire/needs-attention.blade.php b/resources/views/livewire/needs-attention.blade.php
index 62a359a22e..d65933de01 100644
--- a/resources/views/livewire/needs-attention.blade.php
+++ b/resources/views/livewire/needs-attention.blade.php
@@ -33,13 +33,25 @@
</a>
</li>
@endcan
- <li class="list-group-item">
- <a href="{{ route('reports/unaccepted_assets') }}">
- <x-icon type="asset" class="fa-fw"/>
- <span class="dashboard-attention-label">{{ trans('general.dashboard_unaccepted_assets') }}</span>
- <span class="badge dashboard-attention-count">{{ number_format($pendingAcceptancesCount) }}</span>
- </a>
- </li>
+ @if (Gate::allows('view', \App\Models\Asset::class)
+ || Gate::allows('view', \App\Models\Accessory::class)
+ || Gate::allows('view', \App\Models\Consumable::class)
+ || Gate::allows('view', \App\Models\Component::class)
+ || Gate::allows('view', \App\Models\License::class))
+ {{-- Unaccepted acceptances span every checkoutable
+ type. Hide the row entirely when the caller
+ can't view any of them, since NeedsAttention's
+ mount() already zeros the count for them
+ anyway. Prevents an "Unaccepted acceptances 0"
+ line showing to e.g. a users-only viewer. --}}
+ <li class="list-group-item">
+ <a href="{{ route('reports/unaccepted_assets') }}">
+ <x-icon type="asset" class="fa-fw"/>
+ <span class="dashboard-attention-label">{{ trans('general.dashboard_unaccepted_assets') }}</span>
+ <span class="badge dashboard-attention-count">{{ number_format($pendingAcceptancesCount) }}</span>
+ </a>
+ </li>
+ @endif
@can('canCheckoutAtLeastOneItemType')
<li class="list-group-item">
<a href="{{ route('requests.index') }}">