feat(sp7): MatchedRemitCard — line-count badge
This commit is contained in:
@@ -38,6 +38,12 @@ export function MatchedRemitCard({ matchedRemittance }: MatchedRemitCardProps) {
|
||||
if (matchedRemittance === null) return null;
|
||||
|
||||
const { id, totalPaid, status, receivedAt } = matchedRemittance;
|
||||
// SP7: per-line counts may be missing on pre-SP7 claim-detail responses.
|
||||
const matchedLines = matchedRemittance.matchedLines;
|
||||
const totalLines = matchedRemittance.totalLines;
|
||||
const hasLineCounts =
|
||||
typeof matchedLines === "number" && typeof totalLines === "number";
|
||||
const allMatched = hasLineCounts && matchedLines === totalLines;
|
||||
|
||||
const handleViewRemittance = () => {
|
||||
window.location.href = `/remittances?id=${id}`;
|
||||
@@ -109,6 +115,18 @@ export function MatchedRemitCard({ matchedRemittance }: MatchedRemitCardProps) {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{hasLineCounts ? (
|
||||
<span
|
||||
data-testid="matched-remit-line-counts"
|
||||
data-all-matched={allMatched ? "true" : "false"}
|
||||
className="font-mono text-xs uppercase tracking-wider"
|
||||
style={{ color: allMatched ? "var(--tt-amber)" : "var(--tt-oxblood)" }}
|
||||
>
|
||||
lines: {matchedLines}/{totalLines} matched
|
||||
{!allMatched ? ` (${totalLines! - matchedLines!} unmatched)` : null}
|
||||
</span>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user