feat: unify doctor title handling and enhance specialty selection

- Implemented a helper function `displayDoctorName` to prepend "دکتر" to doctor names for consistent display across the application.
- Updated various components (InviteDoctorModal, DashboardPage, DoctorDetailPage, DoctorsPage, etc.) to utilize the new helper for rendering doctor names.
- Modified the DoctorFormPage to automatically add the "دکتر" title in the UI without requiring user input.
- Fixed the EditSpecialtyPicker component to allow multiple specialty selections, resolving a UI bug where only one specialty could be selected at a time.
- Ensured that the backend strips the "دکتر" title from the name during pre-registration and doctor creation processes.
- Added tests for the new functionality, including checks for title handling and specialty selection logic.
- Updated API documentation to reflect changes in name handling and display logic.
This commit is contained in:
hamed
2026-07-19 19:57:03 +03:30
parent 801c6f96db
commit 74577c2ff6
17 changed files with 482 additions and 40 deletions
+13 -3
View File
@@ -327,9 +327,19 @@ export default function DoctorFormPage() {
<Field label="شماره موبایل" required error={errors.mobile?.message} hint="اگر کاربر با این شماره وجود دارد پروفایل به او متصل می‌شود">
<MobileInput hasError={!!errors.mobile} {...register('mobile')} />
</Field>
<Field label="نام کامل" required error={errors.name?.message}>
<input type="text" className="cp-input" placeholder="دکتر ..." {...register('name')}
style={errors.name ? { borderColor: 'var(--danger)' } : {}} />
<Field label="نام کامل" required error={errors.name?.message} hint="عنوان «دکتر» خودکار اضافه می‌شود؛ لازم نیست تایپ کنید">
<div className="cp-input" style={{
display: 'flex', alignItems: 'center', gap: 6, padding: 0, overflow: 'hidden',
...(errors.name ? { borderColor: 'var(--danger)' } : {}),
}}>
<span style={{
flexShrink: 0, alignSelf: 'stretch', display: 'flex', alignItems: 'center',
padding: '0 12px', background: 'var(--surface-2)', color: 'var(--text-2)',
fontWeight: 600, fontSize: 14, borderInlineEnd: '1px solid var(--border)',
}}>دکتر</span>
<input type="text" placeholder="مثلاً: حامد حسینی" {...register('name')}
style={{ flex: 1, minWidth: 0, border: 'none', outline: 'none', background: 'transparent', padding: '0 12px', height: '100%', color: 'inherit', font: 'inherit' }} />
</div>
</Field>
</div>
</div>