From d474de186cc8241c1d4c023dd77a64cc366a7d47 Mon Sep 17 00:00:00 2001 From: estifanos Date: Wed, 5 Aug 2026 07:41:03 +0000 Subject: [PATCH] feat(LicenseReviewPage): refactor staff evidence display to use StaffEvidenceCell component for better maintainability --- .../pages/LicenseReviewPage.tsx | 66 +++++++++++++------ 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage.tsx b/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage.tsx index 789014152..fe5713c3a 100644 --- a/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage.tsx +++ b/apps/backoffice/src/app/features/license-review/pages/LicenseReviewPage.tsx @@ -45,6 +45,7 @@ import { useEscalateApplicationMutation, useFinalApproveMutation, useGetApplicationForReviewQuery, + useGetAttachmentsQuery, useGetInspectionsQuery, useGetAssignableOfficersQuery, useGetLicenseTypeRequirementsQuery, @@ -757,25 +758,7 @@ export function LicenseReviewPage() { {member.fullName} - - {(member.documents ?? []).map((doc) => { - const url = doc.files?.[0]?.url; - return ( - - {doc.documentKey} - - ); - })} - + {/* A person's papers are as returnable as a document or a form section: an ERB certificate for the wrong @@ -1013,6 +996,51 @@ export function LicenseReviewPage() { ); } +/** + * Evidence badges for one staff member. + * + * `application-for-review` nests a `documents` array per staff member, but it + * doesn't always carry the uploaded file (the portal's own upload widget + * hits the attachments endpoint directly for the same reason). Query + * attachments by owner here too, so the officer gets a working link instead + * of a badge with nowhere to go. + */ +function StaffEvidenceCell({ + staffId, + fallback, +}: { + staffId: string; + fallback?: { id: string; documentKey: string; files: { url?: string }[] }[]; +}) { + const { data: attachments } = useGetAttachmentsQuery({ + ownerType: 'APPLICATION_STAFF', + ownerId: staffId, + }); + const docs = attachments?.length ? attachments : (fallback ?? []); + + return ( + + {docs.map((doc) => { + const url = doc.files?.[0]?.url; + return ( + + {doc.documentKey} + + ); + })} + + ); +} + function SummaryRow({ label, value }: { label: string; value?: string | null }) { return (