Fill the three previously-placeholder settings sections so every menu item is now a real page inside the settings shell: - حساب کاربری: new authenticated POST /api/v1/user/change-password (verifies current password, ≥8 chars, must differ) + account page with a profile summary and change-password form. - برچسبها: new per-tenant TenantTag domain (entity/repo/controller + migration) with tenant-scoped CRUD at /api/v1/tenant-tag(s), plus a tags management page (list + color + add/edit/delete). - مدیریت نوبت دهی: export the existing WeeklyScheduleTab from DoctorDetailPage and reuse it in a standalone AppointmentSettingsPage (current doctor's uuid + addresses). Wire all three menu entries to their routes. Backend covered by PHPUnit (change-password, tenant-tag CRUD + ownership); FE covered by Vitest. API docs updated (auth.md, tag.md). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { api } from '../lib/api';
|
|
import type { ApiResponse } from '../lib/api';
|
|
import { useAuthStore } from '../stores/authStore';
|
|
import SettingsLayout from '../components/layout/SettingsLayout';
|
|
import { WeeklyScheduleTab, type AddressData } from './DoctorDetailPage';
|
|
|
|
/**
|
|
* مدیریت نوبت دهی — the doctor's weekly booking schedule as a standalone
|
|
* settings section. Reuses the WeeklyScheduleTab editor (also shown in the
|
|
* doctor profile) with the current doctor's uuid and addresses.
|
|
*/
|
|
export default function AppointmentSettingsPage() {
|
|
const doctorUuid = useAuthStore((s) => s.doctorUuid);
|
|
const dbUuid = useAuthStore((s) => s.dbUuid);
|
|
const uuid = doctorUuid ?? dbUuid ?? undefined;
|
|
|
|
const { data, isLoading } = useQuery({
|
|
queryKey: ['doctor-detail', uuid, 'appointment-settings'],
|
|
queryFn: () => api.get<ApiResponse<any>>(`/api/v1/doctor/${uuid}`),
|
|
enabled: !!uuid,
|
|
});
|
|
|
|
const doctor = (data?.data as any)?.data ?? data?.data;
|
|
const addresses: AddressData[] = doctor?.address ?? [];
|
|
|
|
return (
|
|
<SettingsLayout active="appointment">
|
|
<div className="fade-in">
|
|
<h1 className="section-title" style={{ marginBottom: 16 }}>مدیریت نوبت دهی</h1>
|
|
|
|
{!uuid ? (
|
|
<div className="card" style={{ padding: 32, textAlign: 'center', color: 'var(--text-3)', fontSize: 14 }}>
|
|
این بخش فقط برای پزشک در دسترس است.
|
|
</div>
|
|
) : isLoading ? (
|
|
<div style={{ padding: 16, color: 'var(--text-3)', fontSize: 13 }}>در حال بارگذاری...</div>
|
|
) : (
|
|
<WeeklyScheduleTab doctorUuid={uuid} addresses={addresses} />
|
|
)}
|
|
</div>
|
|
</SettingsLayout>
|
|
);
|
|
}
|