feat: update appointment management API and frontend components

- Added new endpoint to get today's appointment statistics with optional date filter.
- Enhanced appointment listing API to support filtering by date and doctor UUID.
- Updated Appointment model to include new fields and modified status values.
- Implemented AppointmentStatusDropdown component for status management with visual feedback.
- Created PersianCalendar component for date selection in Jalali format.
- Updated API documentation to reflect changes in appointment management.
This commit is contained in:
hamed
2026-06-11 14:13:42 +03:30
parent 92a258832b
commit 45ee725820
9 changed files with 1241 additions and 636 deletions
+10 -13
View File
@@ -6,21 +6,19 @@ import { toast } from 'sonner';
import { api } from '../lib/api';
import type { ApiResponse } from '../lib/api';
import type { Appointment, AppointmentStatus } from '../types';
import { formatDate, formatDateTime, formatRial } from '../lib/utils';
import { formatDate, formatDateTime } from '../lib/utils';
import PageHeader from '../components/ui/PageHeader';
import StatusBadge from '../components/ui/StatusBadge';
import ConfirmDialog from '../components/ui/ConfirmDialog';
const ALL_STATUSES: { value: AppointmentStatus; label: string }[] = [
{ value: 'waiting_for_payment', label: 'در انتظار پرداخت' },
{ value: 'reserved', label: 'رزرو شده' },
{ value: 'checked_in', label: 'ورود به مطب' },
{ value: 'waiting', label: 'در صف انتظار' },
{ value: 'in_progress', label: 'در حال ویزیت' },
{ value: 'visited', label: 'ویزیت شده' },
{ value: 'completed', label: 'تکمیل شده' },
{ value: 'cancelled_by_admin', label: 'لغو توسط ادمین' },
{ value: 'no_show', label: 'غیبت' },
{ value: 'pending', label: 'رزرو شده' },
{ value: 'confirmed', label: 'تأیید شده' },
{ value: 'completed', label: 'تکمیل شده' },
{ value: 'cancelled_by_doctor', label: 'لغو پزشک' },
{ value: 'cancelled_by_user', label: 'لغو بیمار' },
{ value: 'no_show', label: 'غیبت' },
{ value: 'expired', label: 'منقضی' },
];
function InfoRow({ label, value }: { label: string; value: React.ReactNode }) {
@@ -98,10 +96,9 @@ export default function AppointmentDetailPage() {
<InfoRow label="نام بیمار" value={appt.patient_name} />
<InfoRow label="موبایل" value={<span dir="ltr">{appt.patient_mobile}</span>} />
<InfoRow label="پزشک" value={`دکتر ${appt.doctor_name}`} />
<InfoRow label="کلینیک" value={appt.clinic_name} />
<InfoRow label="تاریخ نوبت" value={formatDate(appt.appointment_date)} />
<InfoRow label="ساعت" value={appt.appointment_time} />
<InfoRow label="مبلغ" value={formatRial(appt.amount)} />
<InfoRow label="ساعت شروع" value={appt.appointment_time} />
<InfoRow label="ساعت پایان" value={appt.end_time} />
<InfoRow label="تاریخ ثبت" value={formatDateTime(appt.created_at)} />
</div>
File diff suppressed because it is too large Load Diff