From 539373b99a12ac89f5e5fe4e846818307d749b05 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 31 Jul 2023 12:41:29 +0200 Subject: [PATCH] :bug: Small fixes review --- .../RoleListContainer/index.tsx | 19 ++++++++++++------- .../CollaboratorInformations/index.tsx | 4 +++- .../Offices/OfficeInformations/index.tsx | 16 +++++++++++----- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/index.tsx b/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/index.tsx index ffb79fef..360b58e6 100644 --- a/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultRoleDashboard/RoleListContainer/index.tsx @@ -46,13 +46,18 @@ export default function RoleListContainer(props: IProps) {
{ - return { - name: role.name, - id: role.uid!, - selected: role.uid === roleUid, - }; - })} + blocks={filteredRoles + .filter((role) => { + if (role.name === "admin") return false; + return true; + }) + .map((role) => { + return { + name: role.name, + id: role.uid!, + selected: role.uid === roleUid, + }; + })} onSelectedBlock={onSelectedBlock} />
diff --git a/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx b/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx index f5730d3c..ee40ef15 100644 --- a/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx +++ b/src/front/Components/Layouts/Collaborators/CollaboratorInformations/index.tsx @@ -178,7 +178,9 @@ export default function CollaboratorInformations(props: IProps) { { + return role.label !== "admin"; + })} selectedOption={selectedOption!} onChange={handleRoleChange} disabled={userSelected?.role?.name === "super-admin"} diff --git a/src/front/Components/Layouts/Offices/OfficeInformations/index.tsx b/src/front/Components/Layouts/Offices/OfficeInformations/index.tsx index 56495989..eec32c9d 100644 --- a/src/front/Components/Layouts/Offices/OfficeInformations/index.tsx +++ b/src/front/Components/Layouts/Offices/OfficeInformations/index.tsx @@ -142,6 +142,9 @@ export default function OfficeInformations(props: IProps) { if (!user.office_role && user.role?.name === "admin") { return true; } + if (!user.office_role && user.role?.name === "super-admin") { + return true; + } return false; }) .map((user) => { @@ -173,13 +176,16 @@ export default function OfficeInformations(props: IProps) { {officeSelected?.users ?.filter((user) => { - if (user.office_role && user.office_role.name !== "admin") { - return true; + if (user.office_role && user.office_role.name === "admin") { + return false; } - if (!user.office_role && user.role?.name !== "admin") { - return true; + if (!user.office_role && user.role?.name === "admin") { + return false; } - return false; + if (!user.office_role && user.role?.name === "super-admin") { + return false; + } + return true; }) .map((user) => { return renderUser(user);