Skip to content

Commit

Permalink
feat(admin): show visible / not visible badge on remote agency summar…
Browse files Browse the repository at this point in the history
…y card
  • Loading branch information
agarbe committed Aug 30, 2024
1 parent ef0f07d commit 77cf1cb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ const AgenciesSettingsInfoQuery = graphql(`
query getAgenciesSettingsInfo {
account_getAccountForConnectedUser {
organism {
id
isOnSite
isRemote
isVisibleInCandidateSearchResults
accounts {
id
firstname
Expand All @@ -17,6 +19,11 @@ const AgenciesSettingsInfoQuery = graphql(`
}
maisonMereAAP {
statutValidationInformationsJuridiquesMaisonMereAAP
organisms {
id
isRemote
isVisibleInCandidateSearchResults
}
}
}
}
Expand All @@ -38,6 +45,7 @@ export const useAgenciesSettings = () => {

const organism =
agenciesSettingsResponse?.account_getAccountForConnectedUser?.organism;

return {
agenciesSettingsResponse,
agenciesSettingsStatus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { EnhancedSectionCard } from "@/components/card/enhanced-section-card/Enh
import { SmallNotice } from "@/components/small-notice/SmallNotice";
import { useAgenciesSettings } from "./_components/agenciesSettings.hook";
import { useAuth } from "@/components/auth/auth";
import Badge from "@codegouvfr/react-dsfr/Badge";

const AgenciesSettingsPage = () => {
const { maisonMereAAP, organism } = useAgenciesSettings();
Expand All @@ -11,6 +12,11 @@ const AgenciesSettingsPage = () => {
maisonMereAAP?.statutValidationInformationsJuridiquesMaisonMereAAP ===
"A_JOUR";
const isCollaboratorsEditable = isGeneralInformationCompleted;

const remoteAgency = organism?.isRemote
? organism
: maisonMereAAP?.organisms.find((o) => o.isRemote);

return (
<div className="flex flex-col w-full">
<h1>Paramètres</h1>
Expand All @@ -29,14 +35,28 @@ const AgenciesSettingsPage = () => {
titleIconClass="fr-icon-information-fill"
/>
)}
{(isGestionnaireMaisonMereAAP || organism?.isRemote === true) && (
<EnhancedSectionCard
title="Accompagnement à distance"
buttonOnClickHref="/agencies-settings-v3/remote"
isEditable={isGestionnaireMaisonMereAAP}
titleIconClass="fr-icon-headphone-fill"
/>
)}
{remoteAgency &&
(isGestionnaireMaisonMereAAP || organism?.isRemote) && (
<EnhancedSectionCard
title="Accompagnement à distance"
buttonOnClickHref={`/agencies-settings-v3/organisms/${remoteAgency.id}/remote`}
isEditable={true}
titleIconClass="fr-icon-headphone-fill"
>
<Badge
severity={
remoteAgency.isVisibleInCandidateSearchResults
? "success"
: "error"
}
>
{remoteAgency.isVisibleInCandidateSearchResults
? "Visible"
: "Invisible"}
</Badge>
</EnhancedSectionCard>
)}

{isGestionnaireMaisonMereAAP && (
<EnhancedSectionCard
title="Accompagnement en présentiel"
Expand Down

0 comments on commit 77cf1cb

Please sign in to comment.