diff --git a/resources/views/filament/pages/choose-workspace.blade.php b/resources/views/filament/pages/choose-workspace.blade.php index 262a0a5..190a61b 100644 --- a/resources/views/filament/pages/choose-workspace.blade.php +++ b/resources/views/filament/pages/choose-workspace.blade.php @@ -1,99 +1,155 @@ - -
-
- Select a workspace to continue. -
+ @php + $workspaces = $this->getWorkspaces(); + $workspaceRoles = $this->workspaceRoles; - @php - $workspaces = $this->getWorkspaces(); - $workspaceRoles = $this->workspaceRoles; + $user = auth()->user(); + $recommendedWorkspaceId = $user instanceof \App\Models\User ? (int) ($user->last_workspace_id ?? 0) : 0; - $user = auth()->user(); - $recommendedWorkspaceId = $user instanceof \App\Models\User ? (int) ($user->last_workspace_id ?? 0) : 0; + if ($recommendedWorkspaceId > 0) { + [$recommended, $other] = $workspaces->partition(fn ($workspace) => (int) $workspace->id === $recommendedWorkspaceId); + $workspaces = $recommended->concat($other)->values(); + } - if ($recommendedWorkspaceId > 0) { - [$recommended, $other] = $workspaces->partition(fn ($workspace) => (int) $workspace->id === $recommendedWorkspaceId); - $workspaces = $recommended->concat($other)->values(); + $roleColorMap = [ + 'owner' => 'primary', + 'manager' => 'info', + 'operator' => 'gray', + 'readonly' => 'gray', + ]; + + $roleIconMap = [ + 'owner' => 'heroicon-m-shield-check', + 'manager' => 'heroicon-m-cog-6-tooth', + 'operator' => 'heroicon-m-wrench-screwdriver', + 'readonly' => 'heroicon-m-eye', + ]; + + $canManageWorkspaces = false; + if ($user instanceof \App\Models\User && $workspaces->count() > 0) { + foreach ($workspaces as $ws) { + if (($workspaceRoles[(int) $ws->id] ?? null) === 'owner') { + $canManageWorkspaces = true; + break; } + } + } + @endphp - $roleColorMap = [ - 'owner' => 'primary', - 'manager' => 'info', - 'operator' => 'gray', - 'readonly' => 'gray', - ]; - @endphp - - @if ($workspaces->isEmpty()) -
- You don't have access to any workspace yet. + @if ($workspaces->isEmpty()) +
+
+
+
- @else -
- @foreach ($workspaces as $workspace) - @php - $isRecommended = $recommendedWorkspaceId > 0 && (int) $workspace->id === $recommendedWorkspaceId; - $role = $workspaceRoles[(int) $workspace->id] ?? null; - $tenantCount = (int) ($workspace->tenants_count ?? 0); - @endphp +

No workspaces available

+

+ You don't have access to any workspace yet. Contact your administrator to get started. +

+
+
+ @else +
+

+ Select a workspace to continue. +

-
-
-
-
- {{ $workspace->name }} +
+ @foreach ($workspaces as $workspace) + @php + $isRecommended = $recommendedWorkspaceId > 0 && (int) $workspace->id === $recommendedWorkspaceId; + $role = $workspaceRoles[(int) $workspace->id] ?? null; + $tenantCount = (int) ($workspace->tenants_count ?? 0); + @endphp + +
- @endforeach + + {{-- Metadata --}} +
+
+ + {{ $tenantCount }} {{ \Illuminate\Support\Str::plural('tenant', $tenantCount) }} +
+ + @if ($isRecommended) + + Last used + + @endif +
+ + {{-- Hover arrow indicator --}} +
+ +
+ + @endforeach +
+ + @if ($canManageWorkspaces) + - - @php - $canManageWorkspaces = false; - - if ($user instanceof \App\Models\User && $workspaces->count() > 0) { - foreach ($workspaces as $ws) { - $wsRole = $workspaceRoles[(int) $ws->id] ?? null; - if ($wsRole === 'owner') { - $canManageWorkspaces = true; - break; - } - } - } - @endphp - - @if ($canManageWorkspaces) - - @endif @endif
- + @endif