fix: doc type persistence on edit + filter deadlines by document type
- Fix doc type showing "altele" after edit: preserve initial documentType in allDocTypes map even if not in defaults or Tag Manager - Filter deadline categories by document type: only cerere/aviz unlock full permitting categories (CU, avize, urbanism, autorizare) - Other doc types (scrisoare, notificare, etc.) only get completari + contestatie as deadline categories - Add completari to intrat direction (was missing) - Pass documentType to DeadlineAddDialog for category filtering Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -149,12 +149,20 @@ export function RegistryEntryForm({
|
||||
map.set(key, label);
|
||||
}
|
||||
}
|
||||
// Preserve initial doc type even if not in defaults or Tag Manager
|
||||
// (e.g., custom type whose tag was deleted, or tag not yet loaded)
|
||||
if (initial?.documentType && !map.has(initial.documentType)) {
|
||||
const fallbackLabel =
|
||||
initial.documentType.charAt(0).toUpperCase() +
|
||||
initial.documentType.slice(1).replace(/-/g, " ");
|
||||
map.set(initial.documentType, fallbackLabel);
|
||||
}
|
||||
// Sort alphabetically by label
|
||||
const sorted = new Map(
|
||||
[...map.entries()].sort((a, b) => a[1].localeCompare(b[1], "ro")),
|
||||
);
|
||||
return sorted;
|
||||
}, [docTypeTags, localCustomTypes]);
|
||||
}, [docTypeTags, localCustomTypes, initial?.documentType]);
|
||||
|
||||
// When replyTo is provided, flip direction (intrat→iesit, iesit→intrat)
|
||||
const replyDirection: RegistryDirection | undefined = replyTo
|
||||
@@ -1497,6 +1505,7 @@ export function RegistryEntryForm({
|
||||
onOpenChange={setDeadlineAddOpen}
|
||||
entryDate={date}
|
||||
direction={direction}
|
||||
documentType={documentType}
|
||||
onAdd={handleAddDeadline}
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user