diff --git a/front/src/app/components/UserDetail.tsx b/front/src/app/components/UserDetail.tsx index 97257e4703..b8c0e6af21 100644 --- a/front/src/app/components/UserDetail.tsx +++ b/front/src/app/components/UserDetail.tsx @@ -57,12 +57,19 @@ export const UserDetail = ({ agencyRights={[...userWithRights.agencyRights].sort((a, b) => a.agency.name.localeCompare(b.agency.name), )} + isAdmin={userWithRights.isBackofficeAdmin} /> ); }; -const AgenciesTable = ({ agencyRights }: { agencyRights: AgencyRight[] }) => { +const AgenciesTable = ({ + agencyRights, + isAdmin, +}: { + agencyRights: AgencyRight[]; + isAdmin?: boolean; +}) => { if (!agencyRights.length) return

Cet utilisateur n'est lié à aucune agence

; @@ -78,56 +85,65 @@ const AgenciesTable = ({ agencyRights }: { agencyRights: AgencyRight[] }) => { "Carractéristiques de l'agence", "Roles", "Reçoit les notifications", - "Actions", + ...(isAdmin ? ["Actions"] : []), ]} - data={agencyRights.map((agencyRight) => { - const viewAgencyProps = !agencyRight.roles.includes("agency-admin") - ? { - disabled: true, - title: - "Vous n'êtes pas administrateur de cette agence. Seuls les administrateurs de l'agence peuvent voir le détail.", - } - : { - linkProps: routes.adminAgencyDetail({ - agencyId: agencyRight.agency.id, - }).link, - }; + data={agencyRights.map((agencyRight) => [ + <> + {agencyRight.agency.name} + + {addressDtoToString(agencyRight.agency.address)} + - return [ - <> - {agencyRight.agency.name} - - {addressDtoToString(agencyRight.agency.address)} - - , - , + agencyRight.roles + .map((role) => agencyRoleToDisplay[role].label) + .join(", "), + agencyRight.isNotifiedByEmail ? "Oui" : "Non", + ...(isAdmin + ? [ + , + ] + : []), + ])} /> );