@php use App\Models\User; $isEditing = $staffId !== null; @endphp
{{-- Messages --}} @if (session()->has('message')) @endif @if (session()->has('error')) @endif
Staff Information
{{-- Profile Image --}}
@if ($profileImage) Preview @elseif($currentProfileImage) Current Profile @else @endif @unless ($staffId)
@endunless
@unless ($staffId) @if ($profileImage || $currentProfileImage) @endif @endunless
@error('profileImage')
{{ $message }}
@enderror @unless ($staffId)
Uploading image...
@endunless
{{-- Supervising Doctor --}}
@error('selectedDoctor') {{ $message }} @enderror
{{-- Staff Mode --}} @if (!$staffId)
@endif {{-- Existing Staff Selection --}} @if ($staffMode === 'select')
@if ($dropdownVisible && count($existingStaff) > 0) @endif
@if ($selectedExistingStaff) @php $selectedStaff = \App\Models\User::find($selectedExistingStaff); @endphp
Selected: {{ $selectedStaff->name }}
{{ $selectedStaff->email }}
@endif @error('selectedExistingStaff') {{ $message }} @enderror
@endif {{-- Name, Email, Phone (for create or edit) --}} @if ($staffMode === 'create' || $staffId) @if (!$staffId)
@error('name') {{ $message }} @enderror
@error('email') {{ $message }} @enderror
@error('phone_number') {{ $message }} @enderror
{{-- Password fields only for create mode --}}
@error('password') {{ $message }} @enderror
@error('password_confirmation') {{ $message }} @enderror
@endif @if ($staffId)
@error('name') {{ $message }} @enderror
@error('email') {{ $message }} @enderror
@endif @endif {{-- Permissions Section --}}
Staff Permissions
@foreach ($permissionGroups as $groupName => $groupPermissions) @php $allChecked = count( array_intersect($groupPermissions, $permissions), ) === count($groupPermissions) || $groupName === 'Dashboard Access'; $isDisabled = in_array($groupName, [ 'Appointment Management', 'Medical Records', 'Financial', 'Staff Management', ]); @endphp @php $permissionTypes = [ 'list', 'create', 'edit', 'delete', 'view', ]; $permissionColumns = []; foreach ($permissionTypes as $type) { $permissionColumns[$type] = false; foreach ($groupPermissions as $permission) { if (str_contains($permission, $type)) { $permissionColumns[$type] = $permission; break; } } } if ($groupName === 'Dashboard Access') { $permissionColumns['view'] = 'access admin dashboard'; } @endphp @foreach ($permissionTypes as $type) @endforeach @endforeach
Module LIST CREATE EDIT DELETE VIEW TOGGLE ALL

{{ $groupName }}

@if ($permissionColumns[$type])
@if ($permissionColumns[$type] === 'access admin dashboard') (Required) @endif
@endif
{{-- Status --}}
@error('status') {{ $message }} @enderror
{{-- Notes --}}
@error('notes') {{ $message }} @enderror
{{-- Password Note for new staff --}} @if ($staffMode === 'create' && !$staffId)
Note: A password is required for new staff. They can change it later through their profile.
@endif {{-- Assignment Note for existing users --}} @if ($staffMode === 'select' && !$staffId)
Note: This will assign the selected user as staff to the chosen clinic and doctor. They will receive an email notification.
@endif
{{-- Form Actions --}}
@push('scripts') @endpush