@props([
'user' => null,
'roles' => [],
'accountStatuses' => ['active', 'inactive'],
'mode' => 'create',
'prefill' => ['entity_name' => null, 'entity_city' => null, 'entity_phone' => null],
])
@php
$isEdit = $mode === 'edit';
$roleValue = old('role', $user?->role);
$accountStatusValue = old('account_status', $user?->account_status ?? 'active');
// Keep old values if validation failed, otherwise use prefill.
$entityName = old('entity_name', $prefill['entity_name'] ?? null);
$entityCity = old('entity_city', $prefill['entity_city'] ?? null);
$entityPhone = old('entity_phone', $prefill['entity_phone'] ?? null);
@endphp
@error('name')
{{ $message }}
@enderror
@error('email')
{{ $message }}
@enderror
@error('phone_number')
{{ $message }}
@enderror
@error('role')
{{ $message }}
@enderror
{{ __('Use pharmacy/hospital/medicalCouncil for portal access.') }}
@error('account_status')
{{ $message }}
@enderror
{{ __('Inactive users cannot log in.') }}
@error('password')
{{ $message }}
@enderror
@if ($isEdit)
{{ __('Leave blank to keep current password.') }}
@endif
{{ __('Portal Details (optional)') }}
{{ __('Used for pharmacy/hospital records.') }}
@error('entity_name')
{{ $message }}
@enderror
@error('entity_city')
{{ $message }}
@enderror
@error('entity_phone')
{{ $message }}
@enderror
{{ __('If role is pharmacy/hospital, a linked record will be created/updated using these fields (or user name/phone).') }}