feat: enhance DoctorFormPage with searchable specialties and improved UI components
- Refactored DoctorFormPage to use Controller from react-hook-form for better form handling. - Added a new Field component for consistent input styling and error handling. - Implemented a SpecialtyPicker component with improved selection logic for specialties. - Updated the layout and styling of the form sections for better user experience. - Integrated SearchableSelect for selecting specialties and roles in DoctorsPage and UsersPage. - Added createClinic API endpoint to handle clinic creation with validation for mobile and name fields.
This commit is contained in:
@@ -12,6 +12,7 @@ import type { ApiResponse, PaginatedResponse } from '../lib/api';
|
||||
import { formatDate, formatNumber } from '../lib/utils';
|
||||
import ConfirmDialog from '../components/ui/ConfirmDialog';
|
||||
import Pagination from '../components/ui/Pagination';
|
||||
import SearchableSelect from '../components/ui/SearchableSelect';
|
||||
|
||||
// ── Types ─────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -227,13 +228,15 @@ export default function DoctorsPage() {
|
||||
/>
|
||||
</div>
|
||||
{specialties.length > 0 && (
|
||||
<div className="field">
|
||||
<select value={specialtyId} onChange={(e) => setSpecialty(e.target.value)}>
|
||||
<option value="">همه تخصصها</option>
|
||||
{specialties.map((s) => (
|
||||
<option key={s.id} value={String(s.id)}>{s.name}</option>
|
||||
))}
|
||||
</select>
|
||||
<div style={{ minWidth: 180 }}>
|
||||
<SearchableSelect
|
||||
options={specialties.map(s => ({ value: String(s.id), label: s.name }))}
|
||||
value={specialtyId || null}
|
||||
onChange={(v) => setSpecialty(v ? String(v) : '')}
|
||||
placeholder="همه تخصصها"
|
||||
isClearable
|
||||
height={36}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="seg">
|
||||
|
||||
Reference in New Issue
Block a user