JEI_Import_Documents-App/app/components/DocCell.tsx
Mavis 5f73d2ea71 feat: Fedex import flow, orders + invoice APIs, payment bundles
- /fedex: batch create, document upload/replace/delete, save shipment, imported list
- /api/orders, /api/invoices, /api/pb-file, /api/pb/refresh-token, /api/stock-codes
- /api/payments/bundle: generate + download-all remittance bundles
- shared app/components/DocCell.tsx and app/lib/{invoice-docs,pb-fetch,pb-token}.ts
- recon: invoice reconciliation reports and PowerShell fix-plan scripts
- .gitignore: exclude one-off scripts/_* debugging artefacts, recon/pdfs+txts, data backups
2026-10-18 17:27:40 +02:00

48 lines
No EOL
1.3 KiB
TypeScript

// app/components/DocCell.tsx
// One cell in a document column.
//
// Two states only, so a row can be scanned at a glance:
// OPEN (blue link) - the file exists in PocketBase, click to view it
// NONE (red text) - nothing is stored for that document type
//
// A column can hold more than one file (one consignment, two waybills), so the
// extra files get a numbered label rather than a hidden "+1" that needs a click
// to discover.
import type { DocLink } from "../lib/invoice-docs";
export default function DocCell({
docs,
label,
}: {
docs?: DocLink[];
label: string;
}) {
if (!docs || docs.length === 0) {
return (
<span
className="text-xs font-semibold text-red-600"
title={`No ${label} is stored for this invoice`}
>
NONE
</span>
);
}
return (
<span className="inline-flex flex-wrap gap-1 justify-end">
{docs.map((d, i) => (
<a
key={`${d.id}-${i}`}
href={d.url}
target="_blank"
rel="noopener noreferrer"
className="text-xs border rounded px-2 py-1 text-brand hover:bg-purple-50 hover:border-purple-300 whitespace-nowrap"
title={`Open ${label}: ${d.name}`}
>
OPEN{docs.length > 1 ? ` ${i + 1}` : ""}
</a>
))}
</span>
);
}