fix: approval window

This commit is contained in:
Nathnael
2026-08-18 12:44:02 +00:00
parent f3e64681c2
commit cbcc9a02e6
4 changed files with 390 additions and 14 deletions

View File

@@ -338,9 +338,11 @@ export function InvoiceStatusBadge({
/**
* Inline approval action buttons for a profile row.
* Transitions: pending → approve / reject-with-note | rejected → approve (override) |
* Transitions: pending → approve / reject-with-note | rejected → undo-rejection (→ pending) |
* active → suspend | suspended → reactivate/blacklist | blacklisted → reinstate.
* Rejecting captures a note the customer sees so they can fix and reapply.
* Rejecting captures a note the customer sees so they can fix and reapply — a
* rejected role is theirs to resubmit, so it cannot be approved from here until
* they do (the API refuses it); undoing the rejection is the only way back.
*
* `locked` (customer hasn't submitted onboarding) withholds the review decision
* only — there's no application to judge yet, and the API rejects the call
@@ -526,18 +528,33 @@ export function ProfileApprovalActions({
}
if (status === "rejected") {
if (!canSet("active")) return null;
// No Approve here: the role is waiting on the customer to fix what was
// flagged and resubmit it, and the API refuses rejected → active outright.
// All that's left is undoing a rejection that shouldn't have happened,
// which puts the role back in the queue rather than into service.
if (!canSet("pending")) return null;
return (
<Button
size="xs"
variant="light"
color="edr-green"
radius="md"
loading={isPending}
onClick={() => act("active")}
>
Approve
</Button>
<Group gap={8} wrap="nowrap">
<Text size="xs" c="dimmed" fs="italic">
Awaiting customer resubmission
</Text>
<Tooltip
multiline
w={260}
label="Puts the role back in the pending queue and clears the rejection note. Use only if the rejection itself was a mistake — it does not approve the role."
>
<Button
size="xs"
variant="subtle"
color="gray"
radius="md"
loading={isPending}
onClick={() => act("pending")}
>
Undo rejection
</Button>
</Tooltip>
</Group>
);
}