mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 12:28:21 +00:00
feat: add poa to the changes approval
This commit is contained in:
@@ -93,6 +93,8 @@ function tableStatus(query: { isLoading: boolean; isError: boolean }) {
|
||||
|
||||
/** Matches the fileKey seeded in the API's file-upload-settings seeder. */
|
||||
const POA_DELEGATION_CODE = "poa_delegation_letter";
|
||||
/** A letter uploaded by an approved customer, awaiting this reviewer's approval. */
|
||||
const POA_DELEGATION_PENDING_CODE = "poa_delegation_letter_pending";
|
||||
|
||||
export default function CustomerDetailPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
@@ -536,9 +538,15 @@ export default function CustomerDetailPage() {
|
||||
);
|
||||
|
||||
const poaDocuments = useMemo(
|
||||
() => documents.filter((d) => d.code === POA_DELEGATION_CODE),
|
||||
() =>
|
||||
documents.filter(
|
||||
(d) =>
|
||||
d.code === POA_DELEGATION_CODE ||
|
||||
d.code === POA_DELEGATION_PENDING_CODE,
|
||||
),
|
||||
[documents],
|
||||
);
|
||||
const poaLive = poaDocuments.filter((d) => d.code === POA_DELEGATION_CODE);
|
||||
const poaFields = [
|
||||
{ label: "PoA name", value: company?.poaName },
|
||||
{ label: "PoA email", value: company?.poaEmail },
|
||||
@@ -553,7 +561,7 @@ export default function CustomerDetailPage() {
|
||||
(p) => p.type === "freight_forwarder",
|
||||
);
|
||||
const delegationMissing =
|
||||
(hasPoaDetails || poaMandatory) && poaDocuments.length === 0;
|
||||
(hasPoaDetails || poaMandatory) && poaLive.length === 0;
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
@@ -713,7 +721,7 @@ export default function CustomerDetailPage() {
|
||||
<Badge size="sm" color="red" variant="light">
|
||||
Delegation letter missing
|
||||
</Badge>
|
||||
) : poaDocuments.length > 0 ? (
|
||||
) : poaLive.length > 0 ? (
|
||||
<Badge size="sm" color="edr-green" variant="light">
|
||||
Delegation letter on file
|
||||
</Badge>
|
||||
@@ -806,6 +814,16 @@ export default function CustomerDetailPage() {
|
||||
{formatBytes(doc.size)} ·{" "}
|
||||
{formatDate(doc.uploadedAt)}
|
||||
</Text>
|
||||
{doc.code === POA_DELEGATION_PENDING_CODE && (
|
||||
<Badge
|
||||
size="xs"
|
||||
color="yellow"
|
||||
variant="light"
|
||||
className="shrink-0"
|
||||
>
|
||||
Pending approval
|
||||
</Badge>
|
||||
)}
|
||||
</Group>
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<ActionIcon
|
||||
|
||||
Reference in New Issue
Block a user