feat(claims): enrich claims with insurance details and item specifics

This commit is contained in:
hamed
2026-06-24 04:48:11 +03:30
parent 27840da78d
commit c189daa860
8 changed files with 188 additions and 11 deletions
+44 -1
View File
@@ -3,7 +3,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { CheckIcon, XMarkIcon, PaperAirplaneIcon, BanknotesIcon } from '@heroicons/react/24/outline';
import { toast } from 'sonner';
import { api } from '../lib/api';
import { formatRial, formatNumber } from '../lib/utils';
import { formatRial, formatNumber, formatDate } from '../lib/utils';
import PageHeader from '../components/ui/PageHeader';
import Modal from '../components/ui/Modal';
import SearchableSelect from '../components/ui/SearchableSelect';
@@ -13,6 +13,11 @@ interface ClaimItem {
invoice_item_id: number;
claimed_rials: number;
approved_rials: number | null;
title: string | null;
is_visit: boolean;
quantity: number;
total_rials: number | null;
visit_date: number | null;
}
interface Claim {
@@ -167,6 +172,44 @@ export default function ClaimsPage() {
)}
</div>
</div>
{c.items.length > 0 && (
<div style={{ marginTop: 12, borderTop: '1px solid var(--border)', paddingTop: 10, overflowX: 'auto' }}>
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: 12.5 }}>
<thead>
<tr style={{ color: 'var(--text-3)', textAlign: 'right' }}>
<th style={{ fontWeight: 600, padding: '4px 8px' }}>شرح</th>
<th style={{ fontWeight: 600, padding: '4px 8px' }}>تاریخ مراجعه</th>
<th style={{ fontWeight: 600, padding: '4px 8px', textAlign: 'center' }}>تعداد</th>
<th style={{ fontWeight: 600, padding: '4px 8px', textAlign: 'left' }}>مبلغ کل</th>
<th style={{ fontWeight: 600, padding: '4px 8px', textAlign: 'left' }}>سهم بیمه (ادعا)</th>
<th style={{ fontWeight: 600, padding: '4px 8px', textAlign: 'left' }}>تأییدشده</th>
</tr>
</thead>
<tbody>
{c.items.map((it, idx) => (
<tr key={idx} style={{ borderTop: '1px solid var(--border)' }}>
<td style={{ padding: '7px 8px' }}>
<span className={`badge ${it.is_visit ? 'blue' : 'gray'}`} style={{ fontSize: 9.5, marginInlineEnd: 6 }}>
{it.is_visit ? 'ویزیت' : 'خدمت'}
</span>
<span style={{ fontWeight: 500 }}>{it.title ?? '—'}</span>
</td>
<td style={{ padding: '7px 8px', color: 'var(--text-3)' }} dir="ltr">
{it.visit_date ? formatDate(it.visit_date) : '—'}
</td>
<td style={{ padding: '7px 8px', textAlign: 'center' }}>{formatNumber(it.quantity)}</td>
<td style={{ padding: '7px 8px', textAlign: 'left' }} dir="ltr">{it.total_rials != null ? formatRial(it.total_rials) : '—'}</td>
<td style={{ padding: '7px 8px', textAlign: 'left', fontWeight: 600 }} dir="ltr">{formatRial(it.claimed_rials)}</td>
<td style={{ padding: '7px 8px', textAlign: 'left', color: 'var(--text-3)' }} dir="ltr">
{it.approved_rials != null ? formatRial(it.approved_rials) : '—'}
</td>
</tr>
))}
</tbody>
</table>
</div>
)}
</div>
);
})}