@php /** @var \App\Models\Branch $branch */ /** @var \Illuminate\Support\Collection|\App\Models\User[] $assignedUsers */ /** @var \Illuminate\Support\Collection|\App\Models\User[] $availableUsers */ /** @var \Illuminate\Support\Collection|\App\Models\Branch[] $otherBranches */ $availableUserAssignOptions = [['value' => '', 'label' => 'Select a user…']]; foreach ($availableUsers as $user) { $line = trim(($user->name ?? '').' '.($user->surname ?? '')).' — '.($user->email ?? ''); if ($user->branch && $user->branch_id !== $branch->id) { $line .= ' (Current branch: '.$user->branch->name.')'; } $availableUserAssignOptions[] = ['value' => (string) $user->id, 'label' => $line]; } $reassignBranchSelectOptions = $otherBranches->map(function ($ob) { return [ 'value' => (string) $ob->id, 'label' => $ob->name.($ob->is_default ? ' (Default)' : ''), ]; })->values()->all(); $reassignBranchDefaultSelected = (string) ($otherBranches->firstWhere('is_default', true)?->id ?? $otherBranches->first()?->id ?? ''); @endphp {{ __('Branch Users') }}

Users for {{ $branch->name }}

Code: {{ $branch->code ?? '—' }} · Status: @if ($branch->is_active) Active @else Inactive @endif @if ($branch->is_default) Default branch @endif

Back to Branches

Add user to this branch

@csrf
@forelse ($assignedUsers as $user) @empty @endforelse
Name Email Department Roles Status Actions
{{ $user->name }} {{ $user->surname }} {{ $user->email }} {{ $user->department->name ?? '—' }} @php $roles = $user->getRoleNames(); @endphp @if ($roles->isEmpty()) No roles @else
@foreach ($roles as $role) {{ $role }} @endforeach
@endif
@if ($user->is_disabled) Disabled @else Active @endif @if ($otherBranches->isEmpty()) No additional branches @else
@csrf @endif
No users are currently assigned to this branch.