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:
hamed
2026-06-12 20:43:47 +03:30
parent 9e8064e101
commit 960ff1ab29
10 changed files with 480 additions and 344 deletions
@@ -11,6 +11,7 @@ import PageHeader from '../components/ui/PageHeader';
import { ActiveBadge } from '../components/ui/StatusBadge';
import ConfirmDialog from '../components/ui/ConfirmDialog';
import Modal from '../components/ui/Modal';
import SearchableSelect from '../components/ui/SearchableSelect';
function DetailRow({ label, value }: { label: string; value: React.ReactNode }) {
return (
@@ -244,16 +245,13 @@ export default function RepresentationDetailPage() {
</div>
<div>
<label className="">شهر</label>
<select
value={formData.city_id}
onChange={(e) => setFormData((p) => ({ ...p, city_id: e.target.value }))}
className="cp-input h-11"
>
<option value="">انتخاب شهر</option>
{cities.map((c) => (
<option key={c.id} value={String(c.id)}>{c.name}</option>
))}
</select>
<SearchableSelect
options={cities.map(c => ({ value: String(c.id), label: c.name }))}
value={formData.city_id || null}
onChange={(v) => setFormData(p => ({ ...p, city_id: v ? String(v) : '' }))}
placeholder="انتخاب شهر"
isClearable
/>
</div>
<div>
<label className="">موبایل</label>