fix(plan): add 'Upravit celý rozsah' button, use class-based action rows

This commit is contained in:
BOHA
2026-06-05 13:58:07 +02:00
parent 9a11a8f001
commit 2f76fe0bc1
3 changed files with 61 additions and 23 deletions

View File

@@ -203,6 +203,23 @@ export default function PlanWork() {
setModalCell(null);
}, [setHookModal]);
// Switch the modal from "day-in-range" to "edit-range" mode, keeping the
// same cell context so the EditForm opens with the range's values.
const switchToEditRange = useCallback(
(entryId: number, userId: number, date: string) => {
const cell = getCell(grid, userId, date);
if (!cell) return;
setModalCell(cell);
setHookModal({
kind: "edit-range",
entryId,
userId,
date,
});
},
[grid, setHookModal],
);
// --- Mutation wrappers -----------------------------------------------------
// The modal calls these with plain objects / ids. We resolve them to the
// hook's mutateAsync calls and surface server errors as alerts.
@@ -468,6 +485,7 @@ export default function PlanWork() {
onUpdateOverride={updateOverrideFn}
onDeleteOverride={deleteOverrideFn}
onCreateOverrideFromRange={createOverrideFromRange}
onSwitchToEditRange={switchToEditRange}
/>
</div>
);