fix: show all permitting deadline categories for cerere/aviz regardless of direction

Previously DIRECTION_CATEGORIES limited intrat to only completari+contestatie,
so cerere/aviz on intrat direction lost certificat/avize/urbanism/autorizare.
Now cerere/aviz doc types unlock all 6 categories on both directions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-10 23:24:02 +02:00
parent 4467e70973
commit 8bcb0bcc81
@@ -710,12 +710,22 @@ export const CATEGORY_LABELS: Record<DeadlineCategory, string> = {
contestatie: "Contestatie", contestatie: "Contestatie",
}; };
/** Full categories available per direction (before doc type filtering) */ /** All permitting categories — shown for cerere/aviz doc types regardless of direction */
const ALL_PERMITTING_CATEGORIES: DeadlineCategory[] = [
"certificat",
"avize",
"urbanism",
"autorizare",
"completari",
"contestatie",
];
/** Restricted categories per direction (for non-permitting doc types) */
export const DIRECTION_CATEGORIES: Record< export const DIRECTION_CATEGORIES: Record<
RegistryDirection, RegistryDirection,
DeadlineCategory[] DeadlineCategory[]
> = { > = {
iesit: ["certificat", "avize", "urbanism", "autorizare", "completari"], iesit: ["completari"],
intrat: ["completari", "contestatie"], intrat: ["completari", "contestatie"],
}; };
@@ -727,20 +737,19 @@ const FULL_DEADLINE_DOC_TYPES = new Set(["cerere", "aviz"]);
/** /**
* Get the ordered list of deadline categories for a given direction + document type. * Get the ordered list of deadline categories for a given direction + document type.
* - "cerere" / "aviz" doc types → full set (CU, avize, urbanism, autorizare, completari, contestatie) * - "cerere" / "aviz" doc types → full permitting set (certificat, avize, urbanism, autorizare, completari, contestatie)
* - All other doc types (scrisoare, notificare, etc.) → only completari + contestatie * - All other doc types (scrisoare, notificare, etc.) → direction-dependent limited set
*/ */
export function getCategoriesForDirection( export function getCategoriesForDirection(
direction: RegistryDirection, direction: RegistryDirection,
documentType?: string, documentType?: string,
): DeadlineCategory[] { ): DeadlineCategory[] {
const all = DIRECTION_CATEGORIES[direction]; // cerere / aviz unlock ALL permitting categories regardless of direction
// If doc type triggers full permitting flow, show all categories for this direction
if (!documentType || FULL_DEADLINE_DOC_TYPES.has(documentType)) { if (!documentType || FULL_DEADLINE_DOC_TYPES.has(documentType)) {
return all; return ALL_PERMITTING_CATEGORIES;
} }
// Otherwise, only completari + contestatie // Other doc types get direction-specific limited categories
return all.filter((c) => c === "completari" || c === "contestatie"); return DIRECTION_CATEGORIES[direction];
} }
/** /**