diff --git a/app/Http/Controllers/Frontdesk/WatchlistController.php b/app/Http/Controllers/Frontdesk/WatchlistController.php index ac46de8..d681320 100644 --- a/app/Http/Controllers/Frontdesk/WatchlistController.php +++ b/app/Http/Controllers/Frontdesk/WatchlistController.php @@ -35,10 +35,20 @@ class WatchlistController extends Controller ->paginate(25) ->withQueryString(); + $statsQuery = WatchlistEntry::owned($this->ownerRef($request)) + ->where('organization_id', $organization->id); + + $heroStats = [ + 'total' => (clone $statsQuery)->count(), + 'requires_approval' => (clone $statsQuery)->where('status', Visitor::WATCHLIST_REQUIRES_APPROVAL)->count(), + 'blacklisted' => (clone $statsQuery)->where('status', Visitor::WATCHLIST_BLACKLISTED)->count(), + ]; + return view('frontdesk.watchlist.index', [ 'entries' => $entries, 'organization' => $organization, 'statuses' => config('frontdesk.watchlist_statuses'), + 'heroStats' => $heroStats, 'canManage' => app(\App\Services\Frontdesk\FrontdeskPermissions::class) ->can($this->member($request), 'watchlist.manage'), ]); diff --git a/resources/views/frontdesk/watchlist/index.blade.php b/resources/views/frontdesk/watchlist/index.blade.php index 4731869..ab0dfc4 100644 --- a/resources/views/frontdesk/watchlist/index.blade.php +++ b/resources/views/frontdesk/watchlist/index.blade.php @@ -1,66 +1,82 @@ -
-
-

Watchlist

-

Flagged and blocked visitors

-
- @if ($canManage) - Add entry - @endif -
- -
- - - -
+ + -
- - - - - - - - - - - - @forelse ($entries as $entry) + + + + + + +
+
+

Watchlist entries

+
+
NameCompanyStatusReason
+ - - - - - + + + + + - @empty - - @endforelse - -
- @if ($entry->visitor) - {{ $entry->full_name }} - @else - {{ $entry->full_name }} - @endif - {{ $entry->company ?? '—' }}{{ str_replace('_', ' ', $entry->status) }}{{ Str::limit($entry->reason, 60) ?: '—' }} - @if ($canManage) -
- @csrf @method('DELETE') - -
- @endif -
NameCompanyStatusReason
No watchlist entries.
+ + + @forelse ($entries as $entry) + + + @if ($entry->visitor) + {{ $entry->full_name }} + @else + {{ $entry->full_name }} + @endif + + {{ $entry->company ?? '—' }} + {{ str_replace('_', ' ', $entry->status) }} + {{ Str::limit($entry->reason, 60) ?: '—' }} + + @if ($canManage) +
+ @csrf @method('DELETE') + +
+ @endif + + + @empty + No watchlist entries. + @endforelse + + + @if ($entries->hasPages()) +
{{ $entries->links() }}
+ @endif +
- -
{{ $entries->links() }}