/** * «لیست نوبتهای جدید» table — ported from clinic-pro-tauri * `src/components/dashboard/list/` (CustomTable + DetailT + Status). * * Source data was static mock; here it is fed by the real dashboard API * (`/api/v1/dashboard/{clinic,doctor}` → `today_appointments`). Read-only — * status display/editing lives on the appointments page, not the dashboard. */ import React from 'react'; import { Link } from 'react-router-dom'; export interface ApptRow { uuid: string; patient_name: string | null; patient_mobile?: string | null; doctor_name?: string | null; service_name?: string | null; slot_start: number; slot_end?: number | null; status: string; } /** * روزِ محلیِ نوبت (YYYY-MM-DD) برای دیپلینک «مشاهده» به همان تاریخ در لیست نوبتها. * همان قراردادی که AppointmentDetailPage/AppointmentsPage استفاده میکنند. */ const isoDay = (ts?: number | null): string => { if (!ts) return ''; const d = new Date(ts * 1000); return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`; }; function formatTime(ts?: number | null): string { if (!ts) return '—'; return new Intl.DateTimeFormat('fa-IR', { timeZone: 'Asia/Tehran', hour: '2-digit', minute: '2-digit' }).format(new Date(ts * 1000)); } const HEAD = ['ردیف', 'نام بیمار', 'شماره تماس', 'شروع', 'پایان', 'سرویس', 'پرسنل', 'عملیات']; export function NewAppointmentsTable({ rows, loading }: { rows: ApptRow[]; loading?: boolean }) { if (loading) { return
; } if (!rows.length) { return (نوبتی برای امروز ثبت نشده
); } return (| {h} | ))}
|---|
| مشاهده |