Add 'assign-reviewer' action and related functionality for license review process

This commit is contained in:
Nati
2026-08-26 13:34:06 +00:00
parent 207994df69
commit b5f1ffa6b8
6 changed files with 63 additions and 3 deletions

View File

@@ -134,7 +134,10 @@ export function DecisionConfirmModal({
if (!action) return null;
const needsOfficer = action.id === 'assign' || action.id === 'escalate';
const needsOfficer =
action.id === 'assign' ||
action.id === 'assign-reviewer' ||
action.id === 'escalate';
const reasonMissing = action.requiresReason && !reason.trim() && !reasonCode;
const blocked =
reasonMissing ||

View File

@@ -18,6 +18,7 @@ export type ActionTier =
export type ActionId =
| 'claim'
| 'assign'
| 'assign-reviewer'
| 'escalate'
| 'hold'
| 'resume'
@@ -68,6 +69,18 @@ export const ACTIONS: ActionDefinition[] = [
// Claim is deliberately absent here: an officer claims from the queue
// (LicenseQueuePage), not from this detail page. That implementation is
// separate — see LicenseQueuePage/actions.tsx — and is unaffected by this.
{
// Starts the review under the push model: the team leader hands a freshly
// submitted (or eligibility-paid) file to an employee. Without it a CoC/CoP
// sitting in ELIGIBILITY_PAID had no action at all — the server offers only
// `claim` (a permission no seeded role holds) and this.
id: 'assign-reviewer',
tier: 'primary',
labelKey: 'review.actions.assignReviewer',
from: ['SUBMITTED', 'ELIGIBILITY_PAID'],
permissions: ['can:assign:license-application'],
emphasis: 'filled',
},
{
id: 'assign',
tier: 'workflow',
@@ -302,6 +315,7 @@ export interface ResolveContext {
const WORKFLOW_EVENT_IDS = new Set<ActionId>([
'claim',
'assign',
'assign-reviewer',
'escalate',
'hold',
'resume',
@@ -364,9 +378,13 @@ export function resolveActions(ctx: ResolveContext): ResolvedAction[] {
disabledReason: reason,
});
// Decisions belong to whoever holds the application.
// Decisions belong to whoever holds the application. Assigning a
// reviewer is the team leader handing work out, so it is exempt — the
// leader is by definition not the officer who will hold it.
const needsOwnership =
action.tier === 'primary' && action.id !== 'confirm-payment';
action.tier === 'primary' &&
action.id !== 'confirm-payment' &&
action.id !== 'assign-reviewer';
if (
needsOwnership &&
app.assignedOfficerId &&

View File

@@ -39,6 +39,7 @@ import {
useLocalized,
useApproveDocumentsMutation,
useAssignApplicationMutation,
useAssignReviewerMutation,
useClaimApplicationMutation,
useCompleteReviewMutation,
useConfirmPaymentMutation,
@@ -217,6 +218,7 @@ export function LicenseReviewPage() {
const [resumeApplication] = useResumeApplicationMutation();
const [escalateApplication] = useEscalateApplicationMutation();
const [assignApplication] = useAssignApplicationMutation();
const [assignReviewer] = useAssignReviewerMutation();
// Real officer list, so Assign and Escalate name a person instead of
// silently reassigning to whoever already held the application.
const { data: officers = [] } = useGetAssignableOfficersQuery();
@@ -670,6 +672,18 @@ export function LicenseReviewPage() {
t("review.done.escalate", "Escalated"),
);
break;
case "assign-reviewer":
if (!submission.officerId) return;
await run(
() =>
assignReviewer({
id,
officerId: submission.officerId as string,
remark: submission.reason,
}).unwrap(),
t("review.done.assignReviewer", "Review assigned"),
);
break;
case "assign":
if (!submission.officerId) return;
await run(