{{-- Users of Användare (#2957 slice 6b, card #3020). Included by user/index for user.index and admin.user.index. Expects: $data (collection of User; UserController@index scopes user.index to the company) and $normal_user (true on user.index). Toolbar: the same GET parameters as the old filter box (q, status, and qc on the admin list), sent to the route the page came from; status and qc sit in the "Filter" disclosure, open while one is in use. Rows, as before: user.index links to user.edit, and a main user gets "Ändra" plus "Ta bort användaren" (DELETE user.destroy after a native confirm dialog, disabled on the own row); admin.user.index adds the company column and links to admin.user.edit for admins, without delete. --}} @php $pageRows = \App\Support\TablePagination::rows($data); $normal_user = $normal_user === true; $authUser = Auth::user(); $canManage = $normal_user && $authUser->isMainUser(); $canAdminEdit = ! $normal_user && $authUser->isAdmin(); $action = $normal_user ? route('user.index') : route('admin.user.index'); $status = (string) request('status', ''); $filterOpen = $status !== '' || (! $normal_user && request()->filled('qc')); $filtered = $filterOpen || request()->filled('q'); $statusOptions = ['' => __('user.nh.statusAll'), '1' => __('user.formActive'), '0' => __('user.formInactive')]; if (! $normal_user) { $data->loadMissing('company'); } $mainUserId = $normal_user ? $authUser->company->main_user_id : null; $deletable = collect(); @endphp
@if ($data->isEmpty())| {{ __('userList.name') }} | {{ __('userList.email') }} | {{ __('userList.nh.role') }} | @unless ($normal_user){{ __('userList.companyname') }} | @endunless{{ __('user.nh.columnActions') }} |
|---|---|---|---|---|
| {{ $fullName !== '' ? $fullName : $user->username }} @if ($fullName !== ''){{ $user->username }}@endif | {{ $user->email }} |
@if ($isMain)
|
@unless ($normal_user)
{{ $user->company?->name }} | @endunless
@if ($canManage || $canAdminEdit)
|