import React from 'react'; import { useParams, useNavigate } from 'react-router-dom'; import { useQuery } from '@tanstack/react-query'; import { ArrowRightIcon } from '@heroicons/react/24/outline'; import { api } from '../lib/api'; import type { ApiResponse } from '../lib/api'; import type { Payment } from '../types'; import { formatDate, formatDateTime, formatRial } from '../lib/utils'; import PageHeader from '../components/ui/PageHeader'; import StatusBadge from '../components/ui/StatusBadge'; function InfoRow({ label, value }: { label: string; value: React.ReactNode }) { return (
{label} {value ?? '—'}
); } export default function PaymentDetailPage() { const { uuid } = useParams<{ uuid: string }>(); const navigate = useNavigate(); const { data, isLoading } = useQuery({ queryKey: ['payment', uuid], queryFn: () => api.get>(`/api/v1/payment/${uuid}`), enabled: !!uuid, }); const payment = data?.data; return (
navigate('/admin/payments')} className="flex items-center gap-2 text-sm text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-100 transition-colors"> بازگشت } /> {isLoading ? (
{Array.from({ length: 6 }).map((_, i) => (
))}
) : payment ? (
{payment.uuid}} /> {payment.patient_mobile}} /> } /> {payment.gateway}} /> {payment.ref_id} : null} /> {payment.appointment_uuid && ( مشاهده نوبت } /> )}
) : (
پرداختی یافت نشد
)}
); }