Skip to content

Commit

Permalink
display warning when add agency for kind is pole-emploi
Browse files Browse the repository at this point in the history
  • Loading branch information
celineung committed Aug 7, 2023
1 parent 7b6420e commit 00c242a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions front/src/app/components/forms/agency/AgencyFormCommonFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
CreateAgencyDto,
emailSchema,
} from "shared";
import { LinkHome } from "react-design-system";
import {
agencyKindToLabel,
AllowedAgencyKindToAdd,
Expand All @@ -26,6 +27,7 @@ import {
useFormContents,
} from "src/app/hooks/formContents.hooks";
import { useFeatureFlags } from "src/app/hooks/useFeatureFlags";
import { routes } from "src/app/routes/routes";

type AgencyFormCommonFieldsProps = {
addressInitialValue?: AddressDto;
Expand Down Expand Up @@ -70,6 +72,15 @@ export const AgencyFormCommonFields = ({
const { getFormFields } = useFormContents(formAgencyFieldsLabels);
const fieldsContent = getFormFields();
const getFieldError = makeFieldError(formState);
const agencyErrorMessage = (
<span>
Attention, toutes les agences Pôle emploi ont déjà été ajoutées par notre
équipe sur Immersion.{" "}
<LinkHome {...routes.agencyDashboard().link}>
Accéder à votre espace prescripteur.
</LinkHome>
</span>
);

return (
<>
Expand All @@ -84,6 +95,10 @@ export const AgencyFormCommonFields = ({
...fieldsContent.kind,
...register("kind"),
}}
state={watch("kind") === "pole-emploi" ? "error" : "default"}
stateRelatedMessage={
watch("kind") === "pole-emploi" ? agencyErrorMessage : undefined
}
/>

<Input
Expand Down
2 changes: 1 addition & 1 deletion front/src/app/components/forms/agency/agencyKindToLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export type AllowedAgencyKindToAdd = Exclude<AgencyKind, "immersion-facile">;

export const agencyKindToLabel: Record<AllowedAgencyKindToAdd, string> = {
"mission-locale": "Mission Locale",
"pole-emploi": "Pole Emploi",
"pole-emploi": "Pôle Emploi",
"cap-emploi": "Cap Emploi",
"conseil-departemental": "Conseil Départemental",
"prepa-apprentissage": "Prépa Apprentissage",
Expand Down

0 comments on commit 00c242a

Please sign in to comment.