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:
@@ -30,6 +30,8 @@ interface DeadlineAddDialogProps {
|
||||
onOpenChange: (open: boolean) => void;
|
||||
entryDate: string;
|
||||
direction: RegistryDirection;
|
||||
/** Document type — filters which deadline categories are available */
|
||||
documentType?: string;
|
||||
/** Callback: typeId, startDate, options (CJ toggle etc.) */
|
||||
onAdd: (
|
||||
typeId: string,
|
||||
@@ -45,6 +47,7 @@ export function DeadlineAddDialog({
|
||||
onOpenChange,
|
||||
entryDate,
|
||||
direction,
|
||||
documentType,
|
||||
onAdd,
|
||||
}: DeadlineAddDialogProps) {
|
||||
const [step, setStep] = useState<Step>("category");
|
||||
@@ -61,8 +64,8 @@ export function DeadlineAddDialog({
|
||||
const [cuDurationMonths, setCuDurationMonths] = useState<number | null>(null);
|
||||
|
||||
const categories = useMemo(
|
||||
() => getCategoriesForDirection(direction),
|
||||
[direction],
|
||||
() => getCategoriesForDirection(direction, documentType),
|
||||
[direction, documentType],
|
||||
);
|
||||
|
||||
const typesForCategory = useMemo(() => {
|
||||
|
||||
Reference in New Issue
Block a user