Skip to content

Commit

Permalink
feat(admin): added remote zones to agencies settings v3 remote agency…
Browse files Browse the repository at this point in the history
… summary card
  • Loading branch information
agarbe committed Aug 30, 2024
1 parent 77cf1cb commit fa8a673
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const AgenciesSettingsInfoQuery = graphql(`
isOnSite
isRemote
isVisibleInCandidateSearchResults
remoteZones
accounts {
id
firstname
Expand All @@ -23,6 +24,7 @@ const AgenciesSettingsInfoQuery = graphql(`
id
isRemote
isVisibleInCandidateSearchResults
remoteZones
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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";
import { RemoteZone } from "@/graphql/generated/graphql";

const AgenciesSettingsPage = () => {
const { maisonMereAAP, organism } = useAgenciesSettings();
Expand All @@ -17,6 +18,27 @@ const AgenciesSettingsPage = () => {
? organism
: maisonMereAAP?.organisms.find((o) => o.isRemote);

const getRemoteZoneLabel = (remoteZone: RemoteZone) => {
switch (remoteZone) {
case "FRANCE_METROPOLITAINE":
return "France métropolitaine (UTC+2)";
case "GUADELOUPE":
return "Guadeloupe (UTC-4)";
case "GUYANE":
return "Guyane (UTC-3)";
case "LA_REUNION":
return "La Réunion (UTC+4)";
case "MARTINIQUE":
return "Martinique (UTC-4)";
case "MAYOTTE":
return "Mayotte (UTC+3)";
case "SAINTE_LUCIE_SAINT_MARTIN":
return "Saint-Pierre-et-Miquelon (UTC-2)";
case "SAINT_PIERRE_ET_MIQUELON":
return "Sainte-Lucie / Saint-Martin (UTC-4)";
}
};

return (
<div className="flex flex-col w-full">
<h1>Paramètres</h1>
Expand All @@ -43,17 +65,25 @@ const AgenciesSettingsPage = () => {
isEditable={true}
titleIconClass="fr-icon-headphone-fill"
>
<Badge
severity={
remoteAgency.isVisibleInCandidateSearchResults
? "success"
: "error"
}
>
{remoteAgency.isVisibleInCandidateSearchResults
? "Visible"
: "Invisible"}
</Badge>
<div className="pl-10 flex flex-col gap-4">
<Badge
small
severity={
remoteAgency.isVisibleInCandidateSearchResults
? "success"
: "error"
}
>
{remoteAgency.isVisibleInCandidateSearchResults
? "Visible"
: "Invisible"}
</Badge>
<ul className="list-none pl-0 flex flex-col gap-2">
{remoteAgency.remoteZones.map((r) => (
<li key={r}>{getRemoteZoneLabel(r)}</li>
))}
</ul>
</div>
</EnhancedSectionCard>
)}

Expand Down

0 comments on commit fa8a673

Please sign in to comment.