Skip to content

Commit

Permalink
Merge pull request #772 from AI4Bharat/dev2-s
Browse files Browse the repository at this point in the history
user profile edit
  • Loading branch information
aparna-aa authored Aug 2, 2024
2 parents b0f8d87 + 185cd6d commit d4e1e84
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/containers/UserManagement/EditProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,18 @@ const EditProfile = () => {

const getDisabledOption = (name) => {
const { id: userId, role } = loggedInUserData;

if (userId === +id) {
if (
role === "ADMIN" ||
userId === orgOwnerId ||
role === "PROJECT_MANAGER"
) {
return name === "org" || name === "availability";
} else {
return name === "role" || name === "org" || name === "availability";
}

if (userId === +id || loggedInUserData?.role=="ORG_OWNER") {
if ( role === "ORG_OWNER") {
return false;
} else if (role === "ADMIN" || role === "PROJECT_MANAGER") {
return name === "org" || name === "availability";
} else {
return name !== "role";
return name === "role" || name === "org" || name === "availability";
}
} else {
return name !== "role";
}
};

const renderTextField = (name) => {
Expand Down Expand Up @@ -370,7 +368,7 @@ const EditProfile = () => {
const onSubmitClick = () => {
const { id: userId, role } = loggedInUserData;

if (userId === +id) {
if (userId === +id || loggedInUserData?.role ==="ORG_OWNER" ) {
if (
role === "ADMIN" ||
userId === orgOwnerId ||
Expand All @@ -393,6 +391,7 @@ const EditProfile = () => {
setRoleIsEdited(false);

const body = {

user_id: id,
role: userDetails?.role?.value,
};
Expand Down

0 comments on commit d4e1e84

Please sign in to comment.