diff --git a/src/components/accessories/admin/users/editGroup/EditGroup.tsx b/src/components/accessories/admin/users/editGroup/EditGroup.tsx index d06654cf1..8563e118e 100644 --- a/src/components/accessories/admin/users/editGroup/EditGroup.tsx +++ b/src/components/accessories/admin/users/editGroup/EditGroup.tsx @@ -6,6 +6,7 @@ import { useParams } from "react-router"; import { useNavigate } from "react-router-dom"; import checkIcon from "../../../../../assets/check-icon.png"; +import warningIcon from "../../../../../assets/warning-icon.png"; import Button from "../../../button/Button"; import ConfirmationDialog from "../../../confirmationDialog/ConfirmationDialog"; import InfoBox from "../../../infoBox/InfoBox"; @@ -42,6 +43,8 @@ export const EditGroup = () => { const { id } = useParams(); const canUpdatePermissions = usePermission("grouppermission.update"); + const [openResetConfirmation, setOpenResetConfirmation] = useState(false); + const update = useAppSelector((state) => state.usergroups.update); const permissions = useAppSelector((state) => state.permissions.getAll); const group = useAppSelector((state) => state.usergroups.currentGroup); @@ -130,9 +133,9 @@ export const EditGroup = () => { }; }, []); - const handleFormReset = () => { - resetForm(); - setGroupPermissions(group.data?.permissions ?? []); + const handleResetConfirmation = () => { + setOpenResetConfirmation(false); + navigate(-1); }; const handleCheckboxChange = useCallback( @@ -262,16 +265,27 @@ export const EditGroup = () => {
+ setOpenResetConfirmation(false)} + /> { const { passwd2, ...userDTO } = values; if (userDTO.passwd === undefined) { @@ -59,7 +62,6 @@ export const EditUserForm = ({ getFieldProps, isValid, dirty, - resetForm, errors, touched, values, @@ -71,6 +73,11 @@ export const EditUserForm = ({ onSubmit: handleFormSubmit, }); + const handleResetConfirmation = () => { + setOpenResetConfirmation(false); + navigate(-1); + }; + const handleCheckboxChange = useCallback( (fieldName: string) => (value: boolean) => { setFieldValue(fieldName, value); @@ -192,18 +199,27 @@ export const EditUserForm = ({
+ setOpenResetConfirmation(false)} + /> { const { t } = useTranslation(); const navigate = useNavigate(); + const [openResetConfirmation, setOpenResetConfirmation] = useState(false); + const create = useAppSelector((state) => state.usergroups.create); const { @@ -40,7 +43,6 @@ export const NewGroup = () => { getFieldProps, isValid, dirty, - resetForm, errors, touched, values, @@ -59,6 +61,11 @@ export const NewGroup = () => { }; }, [dispatch]); + const handleResetConfirmation = () => { + setOpenResetConfirmation(false); + navigate(-1); + }; + const handleCheckboxChange = useCallback( (fieldName: string) => (value: boolean) => { setFieldValue(fieldName, value); @@ -123,18 +130,27 @@ export const NewGroup = () => {
+ setOpenResetConfirmation(false)} + /> { const { t } = useTranslation(); const navigate = useNavigate(); + const [openResetConfirmation, setOpenResetConfirmation] = useState(false); + const create = useAppSelector((state) => state.users.create); const userGroupsTypeState = useAppSelector( @@ -78,6 +80,11 @@ export const NewUser = () => { }; }, [create.hasSucceeded, dispatch, navigate]); + const handleResetConfirmation = () => { + setOpenResetConfirmation(false); + navigate(-1); + }; + const handleCheckboxChange = useCallback( (fieldName: string) => (value: boolean) => { setFieldValue(fieldName, value); @@ -200,12 +207,11 @@ export const NewUser = () => {
@@ -222,6 +228,16 @@ export const NewUser = () => { }} handleSecondaryButtonClick={() => ({})} /> + setOpenResetConfirmation(false)} + />