import type { CSSProperties, ReactNode } from 'react'; import { formatDate, formatTime } from '../lib/utils'; import { FilesServiceSuccess, FilesServiceMore, CalendarD, ClockP, UserD, StatusGlobe, } from './icons/FilesServiceIcons'; import AppointmentStatusDropdown from './ui/AppointmentStatusDropdown'; export interface AppointmentCardData { uuid: string; starts_at: number; status: string; version: number; doctor_name?: string | null; service_name?: string | null; } /** * label/value row inside the turn card — mirrors tauri ServiceInfoRow * (separatedValues variant): icon+label on one side, value (optionally chip) on * the other. */ function InfoRow({ icon, label, value, chip = false, valueStyle }: { icon: ReactNode; label: string; value: ReactNode; chip?: boolean; valueStyle?: CSSProperties; }) { return (
{icon} {label}:
{value}
); } /** * A patient «نوبت» card — ported pixel-for-pixel from tauri * files/services/TurnsCard. The status uses the admin's live * AppointmentStatusDropdown (backed by PATCH /appointment/{uuid}/status) * instead of the tauri mock. */ export default function AppointmentTurnCard({ appointment, queryKey }: { appointment: AppointmentCardData; queryKey: unknown[]; }) { const title = appointment.service_name || 'نوبت'; return (
{/* Header */}
{title}
{/* Middle: date & time chips */}
} label="تاریخ" chip value={formatDate(appointment.starts_at)} /> } label="ساعت" chip value={formatTime(appointment.starts_at)} />
{/* Bottom: personnel & status */}
} label="پرسنل" value={appointment.doctor_name || '—'} valueStyle={{ fontWeight: 500 }} /> } label="وضعیت" value={} />
); }