feat(freight-backoffice): show fayda and dars status on customer detail

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Nathnael
2026-07-28 13:44:56 +00:00
parent f1431a8353
commit 1081b813bb

View File

@@ -607,8 +607,19 @@ export default function CustomerDetailPage() {
{ label: "PoA address", value: company?.poaAddress },
];
const hasPoaDetails = poaFields.some((f) => f.value?.trim());
// Fayda verification is written into the company attributes by the portal's
// verification flow.
const attrs = (company?.attributes ?? {}) as Record<string, unknown>;
const faydaVerified = (prefix: "owner" | "poa") => ({
verified: Boolean(attrs[`${prefix}FaydaSub`]),
at: (attrs[`${prefix}FaydaVerifiedAt`] as string | undefined) ?? null,
});
const ownerIdentity = faydaVerified("owner");
const ownerPassportNumber =
(attrs.ownerPassportNumber as string | undefined) ?? null;
const poaIdentity = faydaVerified("poa");
// A freight forwarder acts on other companies' behalf, so its PoA — details
// and delegation letter both — is mandatory rather than optional.
// and DARS delegation paper both — is mandatory rather than optional.
const poaMandatory = (company?.companyProfiles ?? []).some(
(p) => p.type === "freight_forwarder",
);
@@ -752,6 +763,16 @@ export default function CustomerDetailPage() {
<InfoField label="TIN" value={company.tin} />
<InfoField label="VAT number" value={company.vatNumber} />
<InfoField label="FAN number" value={company.fanNumber} />
<InfoField
label="Owner identity"
value={
ownerIdentity.verified
? "Fayda verified"
: ownerPassportNumber
? `Passport ${ownerPassportNumber}`
: "Not verified"
}
/>
<InfoField label="Country" value={company.country} />
<InfoField label="Address" value={company.address} />
<InfoField label="Website" value={company.website} />
@@ -798,11 +819,11 @@ export default function CustomerDetailPage() {
</Group>
{delegationMissing ? (
<Badge size="sm" color="red" variant="light">
Delegation letter missing
DARS delegation paper missing
</Badge>
) : poaLive.length > 0 ? (
<Badge size="sm" color="edr-green" variant="light">
Delegation letter on file
DARS delegation paper on file
</Badge>
) : (
<Badge size="sm" color="gray" variant="light">
@@ -820,6 +841,12 @@ export default function CustomerDetailPage() {
value={f.value}
/>
))}
<InfoField
label="PoA Fayda"
value={
poaIdentity.verified ? "Verified" : "Not verified"
}
/>
</SimpleGrid>
) : (
<Text size="sm" c="dimmed">
@@ -838,7 +865,7 @@ export default function CustomerDetailPage() {
tt="uppercase"
style={{ letterSpacing: "0.04em" }}
>
Delegation letter
DARS delegation paper
</Text>
{documentsQuery.isLoading ? (
@@ -864,7 +891,7 @@ export default function CustomerDetailPage() {
</Group>
) : poaDocuments.length === 0 ? (
<Text size="sm" c="dimmed">
No delegation letter uploaded.
No DARS delegation paper uploaded.
</Text>
) : (
poaDocuments.map((doc) => (