Skip to content

Commit

Permalink
checkBox conditional working fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
adityadeshlahre committed Jul 5, 2024
1 parent 757b184 commit 5aa69e4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions frontend/src/components/admin/userManagement/UserAddModify.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,16 @@ function UserAddModify() {
}

function handleCheckboxChange(roleId) {
const numberToUpdate = ["71", "72", "73", "11", "2"];
const numberToUpdate = userDataShow.globalRoles
.filter((role) => role.roleName !== "Global Administrator")
.map((role) => role.roleId);
let updatedRoles = [...selectedGlobalLabUnitRoles];

if (roleId === "1") {
const globalAdminRoleId = userDataShow.globalRoles.find(
(role) => role.roleName === "Global Administrator",
)?.roleId;

if (globalAdminRoleId && roleId === globalAdminRoleId) {
if (selectedGlobalLabUnitRoles.includes(roleId)) {
updatedRoles = updatedRoles.filter((role) => role !== roleId);
} else {
Expand Down

0 comments on commit 5aa69e4

Please sign in to comment.