Fixed Bug 68940 - Rooms.FormRoom. When you click the Back button inside a Form room on the Start filling panel, a list of all rooms is displayed, including rooms from the Archive.

This commit is contained in:
Timofey Boyko 2024-07-02 13:43:06 +03:00
parent 254e4d24e3
commit 72d9b4a0df
3 changed files with 12 additions and 2 deletions

View File

@ -135,6 +135,7 @@ export type UseFilesHelpersProps = {
setIsFirstLoad: (value: boolean) => void; setIsFirstLoad: (value: boolean) => void;
withCreate: boolean; withCreate: boolean;
setSelectedItemId: (value: number | string) => void; setSelectedItemId: (value: number | string) => void;
setSelectedItemType: (value?: "rooms" | "files") => void;
}; };
export type TUseInputItemHelper = { export type TUseInputItemHelper = {

View File

@ -82,6 +82,7 @@ const useFilesHelper = ({
setIsFirstLoad, setIsFirstLoad,
withCreate, withCreate,
setSelectedItemId, setSelectedItemId,
setSelectedItemType,
}: UseFilesHelpersProps) => { }: UseFilesHelpersProps) => {
const { t } = useTranslation(["Common"]); const { t } = useTranslation(["Common"]);
@ -341,14 +342,20 @@ const useFilesHelper = ({
hotkey: "f", hotkey: "f",
onCreateClick: () => addInputItem(t("NewFolder"), FolderSvgUrl), onCreateClick: () => addInputItem(t("NewFolder"), FolderSvgUrl),
onBackClick: () => { onBackClick: () => {
setSelectedItemId(current.parentId); let isRooms;
setBreadCrumbs((val) => { setBreadCrumbs((val) => {
const newVal = [...val]; const newVal = [...val];
newVal.pop(); const item = newVal.pop();
isRooms = !!item?.roomType;
return newVal; return newVal;
}); });
if (isRooms) setSelectedItemType("rooms");
setSelectedItemId(current.parentId);
}, },
}); });
} else { } else {
@ -430,6 +437,7 @@ const useFilesHelper = ({
t, t,
setSelectedItemId, setSelectedItemId,
rootThirdPartyId, rootThirdPartyId,
setSelectedItemType,
], ],
); );

View File

@ -240,6 +240,7 @@ const FilesSelector = ({
setIsInit, setIsInit,
withCreate, withCreate,
setSelectedItemId, setSelectedItemId,
setSelectedItemType,
}); });
const onClickBreadCrumb = React.useCallback( const onClickBreadCrumb = React.useCallback(