import { Link } from "@remix-run/react"; import { useSettings } from "~/contexts/SettingsContext"; import type { MaintenanceVisitWithRelations } from "~/types/database"; interface MaintenanceVisitDetailsViewProps { visit: MaintenanceVisitWithRelations; } export function MaintenanceVisitDetailsView({ visit }: MaintenanceVisitDetailsViewProps) { const { formatCurrency, formatDate, formatNumber } = useSettings(); const getPaymentStatusColor = (status: string) => { switch (status) { case 'paid': return 'bg-green-100 text-green-800 border-green-200'; case 'pending': return 'bg-yellow-100 text-yellow-800 border-yellow-200'; case 'partial': return 'bg-blue-100 text-blue-800 border-blue-200'; case 'cancelled': return 'bg-red-100 text-red-800 border-red-200'; default: return 'bg-gray-100 text-gray-800 border-gray-200'; } }; const getPaymentStatusLabel = (status: string) => { switch (status) { case 'paid': return 'مدفوع'; case 'pending': return 'معلق'; case 'partial': return 'مدفوع جزئياً'; case 'cancelled': return 'ملغي'; default: return status; } }; const getDelayLabel = (months: number) => { const delayOptions = [ { value: 1, label: 'شهر واحد' }, { value: 2, label: 'شهرين' }, { value: 3, label: '3 أشهر' }, { value: 4, label: '4 أشهر' }, { value: 6, label: '6 أشهر' }, { value: 12, label: 'سنة واحدة' }, ]; const option = delayOptions.find(opt => opt.value === months); return option ? option.label : `${months} أشهر`; }; return (
{formatDate(visit.visitDate)}
{job.job}
{job.notes && ({job.notes}
)}لا توجد تفاصيل أعمال الصيانة
{formatNumber(visit.kilometers)} كم
{getDelayLabel(visit.nextVisitDelay)}
{visit.description}
{visit.vehicle.plateNumber}
{visit.vehicle.year}
{visit.vehicle.manufacturer}
{visit.vehicle.model}
{visit.customer.name}
{visit.customer.address}
تاريخ الدخل
{formatDate(income.incomeDate)}
المبلغ
{formatCurrency(income.amount)}