diff --git a/src/routes/CreateNewTeam/components/SearchAndSubmit/index.jsx b/src/routes/CreateNewTeam/components/SearchAndSubmit/index.jsx
index cd55604d..4a1063fb 100644
--- a/src/routes/CreateNewTeam/components/SearchAndSubmit/index.jsx
+++ b/src/routes/CreateNewTeam/components/SearchAndSubmit/index.jsx
@@ -107,6 +107,7 @@ function SearchAndSubmit(props) {
diff --git a/src/routes/CreateNewTeam/components/SubmitContainer/index.jsx b/src/routes/CreateNewTeam/components/SubmitContainer/index.jsx
index f00a6bc6..32247548 100644
--- a/src/routes/CreateNewTeam/components/SubmitContainer/index.jsx
+++ b/src/routes/CreateNewTeam/components/SubmitContainer/index.jsx
@@ -7,6 +7,7 @@
import React, {
useCallback,
useEffect,
+ useMemo,
useLayoutEffect,
useState,
} from "react";
@@ -24,7 +25,7 @@ import ConfirmationModal from "../ConfirmationModal";
import { withBusinessAuthentication } from "../../../../hoc/withAuthentication";
import "./styles.module.scss";
import { isCustomRole, isUuid, setCurrentStage } from "utils/helpers";
-import { clearSearchedRoles } from "../../actions";
+import { clearSearchedRoles, editRoleAction } from "../../actions";
import { postTeamRequest } from "services/teams";
import NoMatchingProfilesResultCard from "../NoMatchingProfilesResultCard";
@@ -33,15 +34,30 @@ function SubmitContainer({
setStages,
progressStyle,
matchingRole,
+ previousSearchId,
addedRoles,
}) {
const [addAnotherOpen, setAddAnotherOpen] = useState(false);
const [teamDetailsOpen, setTeamDetailsOpen] = useState(true);
const [teamObject, setTeamObject] = useState(null);
const [requestLoading, setRequestLoading] = useState(false);
+ const [buttonClickable, setButtonClickable] = useState(true);
const dispatch = useDispatch();
+ const currentRole = useMemo(() => {
+ return _.find(addedRoles, { searchId: previousSearchId });
+ }, [addedRoles, previousSearchId]);
+
+ const onSaveEditRole = useCallback(
+ (isValid, role) => {
+ setButtonClickable(isValid);
+ if (isValid) {
+ dispatch(editRoleAction({ ...role, searchId: previousSearchId }));
+ }
+ },
+ [dispatch, previousSearchId]
+ );
useEffect(() => {
setCurrentStage(2, stages, setStages);
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -114,7 +130,11 @@ function SubmitContainer({
return (
{!isCustomRole(matchingRole) ? (
-
+
) : (
)}
@@ -123,6 +143,7 @@ function SubmitContainer({