diff --git a/back/src/domains/convention/adapters/PgConventionQueries.integration.test.ts b/back/src/domains/convention/adapters/PgConventionQueries.integration.test.ts index 14f934b4c4..3cb04ac2a8 100644 --- a/back/src/domains/convention/adapters/PgConventionQueries.integration.test.ts +++ b/back/src/domains/convention/adapters/PgConventionQueries.integration.test.ts @@ -336,7 +336,12 @@ describe("Pg implementation of ConventionQueries", () => { describe("PG implementation of method getConventionsByFilters", () => { const agencyId = "bbbbbc15-9c0a-1aaa-aa6d-6aa9ad38aaff"; const agency = AgencyDtoBuilder.create().withId(agencyId).build(); + const siret1 = "11110000111100"; + const siret2 = "22220000222200"; + const siret3 = "33330000333300"; + const conventionCancelledAndDateStart20230327 = new ConventionDtoBuilder() + .withSiret(siret1) .withId("bbbbbc15-9c0a-1aaa-aa6d-6aa9ad38aa01") .withDateStart(new Date("2023-03-27").toISOString()) .withDateEnd(new Date("2023-03-28").toISOString()) @@ -346,6 +351,7 @@ describe("Pg implementation of ConventionQueries", () => { .build(); const conventionDraftAndDateStart20230330 = new ConventionDtoBuilder() + .withSiret(siret3) .withId("bbbbbc15-9c0a-1aaa-aa6d-6aa9ad38aa02") .withDateSubmission(new Date("2023-03-05").toISOString()) .withDateStart(new Date("2023-03-30").toISOString()) @@ -356,6 +362,7 @@ describe("Pg implementation of ConventionQueries", () => { .build(); const firstValidatedConvention = new ConventionDtoBuilder() + .withSiret(siret1) .withId("bbbbbc15-9c0a-1aaa-aa6d-6aa9ad38aa03") .withDateSubmission(new Date("2024-06-20").toISOString()) .withDateStart(new Date("2024-07-01").toISOString()) @@ -368,6 +375,7 @@ describe("Pg implementation of ConventionQueries", () => { .build(); const secondValidatedConvention = new ConventionDtoBuilder() + .withSiret(siret2) .withId("bbbbbc15-9c0a-1aaa-aa6d-6aa9ad38aa04") .withDateSubmission(new Date("2024-06-21").toISOString()) .withDateStart(new Date("2024-07-02").toISOString()) @@ -523,6 +531,21 @@ describe("Pg implementation of ConventionQueries", () => { firstValidatedConvention, ]); }); + + it("getConventionsByFilters with some sirets", async () => { + const resultAll = await conventionQueries.getConventions({ + filters: { + withSirets: [siret1, siret2], + }, + sortBy: "dateStart", + }); + + expectToEqual(resultAll, [ + secondValidatedConvention, + firstValidatedConvention, + conventionCancelledAndDateStart20230327, + ]); + }); }); describe("findSimilarConventions", () => { diff --git a/back/src/domains/convention/adapters/PgConventionQueries.ts b/back/src/domains/convention/adapters/PgConventionQueries.ts index 4666400ced..d7c20d9cf0 100644 --- a/back/src/domains/convention/adapters/PgConventionQueries.ts +++ b/back/src/domains/convention/adapters/PgConventionQueries.ts @@ -9,6 +9,7 @@ import { ConventionStatus, DateRange, FindSimilarConventionsParams, + SiretDto, conventionReadSchema, conventionSchema, pipeWithValue, @@ -279,7 +280,7 @@ const addFiltersToBuilder = const addWithSiretsIfNeeded: AddToBuilder = (b) => withSirets && withSirets.length > 0 - ? b.where("conventions.siret", "in", withSirets) + ? b.where("conventions.siret", "=", sql`ANY(${withSirets})`) : b; return pipeWithValue( diff --git a/front/src/app/components/layout/LayoutFooter.tsx b/front/src/app/components/layout/LayoutFooter.tsx index 0fb01d40c4..2a1a914c4e 100644 --- a/front/src/app/components/layout/LayoutFooter.tsx +++ b/front/src/app/components/layout/LayoutFooter.tsx @@ -1,4 +1,8 @@ import { fr } from "@codegouvfr/react-dsfr"; +import { + Display, + headerFooterDisplayItem, +} from "@codegouvfr/react-dsfr/Display"; import { useIsDark } from "@codegouvfr/react-dsfr/useIsDark"; import React from "react"; import { @@ -139,7 +143,7 @@ const links: NavLink[] = [ target: "_blank", }, ]; -const bottomsLinks: NavLink[] = [ +const bottomsLinks: (NavLink | typeof headerFooterDisplayItem)[] = [ { label: "Accessibilité : partiellement conforme", ...routes.standard({ pagePath: "accessibilite" }).link, @@ -207,6 +211,7 @@ const bottomsLinks: NavLink[] = [ id: bottomsLinksIds.communicationKit, target: "_blank", }, + headerFooterDisplayItem, ]; const navTopGroupLinks: NavTopGroupLinks[] = [ @@ -282,6 +287,7 @@ export const LayoutFooter = () => ( bottomLinks={bottomsLinks} plateformeInclusionLogo={} /> + ); diff --git a/front/src/app/components/layout/LayoutHeader.tsx b/front/src/app/components/layout/LayoutHeader.tsx index ef98744aae..f0418aa689 100644 --- a/front/src/app/components/layout/LayoutHeader.tsx +++ b/front/src/app/components/layout/LayoutHeader.tsx @@ -1,8 +1,4 @@ import { fr } from "@codegouvfr/react-dsfr"; -import { - Display, - headerFooterDisplayItem, -} from "@codegouvfr/react-dsfr/Display"; import { Header, HeaderProps } from "@codegouvfr/react-dsfr/Header"; import { MainNavigationProps } from "@codegouvfr/react-dsfr/MainNavigation"; import { useIsDark } from "@codegouvfr/react-dsfr/useIsDark"; @@ -54,7 +50,6 @@ export const LayoutHeader = () => { const isAdminConnected = useAppSelector(authSelectors.isAdminConnected); const isPeConnected = useAppSelector(authSelectors.isPeConnected); const tools: HeaderProps["quickAccessItems"] = [ - headerFooterDisplayItem, { text: "Remplir la demande de convention", iconId: "fr-icon-draft-line", @@ -318,7 +313,6 @@ export const LayoutHeader = () => { navigation={links} quickAccessItems={tools} /> - ); }; diff --git a/libs/react-design-system/src/immersionFacile/components/footer/Footer.tsx b/libs/react-design-system/src/immersionFacile/components/footer/Footer.tsx index 49d1a6d34f..4e8ef6603f 100644 --- a/libs/react-design-system/src/immersionFacile/components/footer/Footer.tsx +++ b/libs/react-design-system/src/immersionFacile/components/footer/Footer.tsx @@ -1,4 +1,5 @@ import { fr } from "@codegouvfr/react-dsfr"; +import { FooterProps as FooterPropsDsfr } from "@codegouvfr/react-dsfr/Footer"; import React from "react"; import { useStyles } from "tss-react/dsfr"; import FooterStyles from "./Footer.styles"; @@ -24,7 +25,7 @@ export type NavTopGroupLinks = { export type FooterProps = { links?: NavLink[]; navTopGroupLinks?: NavTopGroupLinks[]; - bottomLinks?: NavLink[]; + bottomLinks?: (NavLink | FooterPropsDsfr.BottomItem.Button)[]; partnersLogos?: React.ReactNode; plateformeInclusionLogo?: React.ReactNode; }; @@ -47,13 +48,36 @@ const TopLink = ({ link }: { link: NavLink }) => { ); }; -const BottomLink = ({ link }: { link: NavLink }) => ( -
  • - - {link.label} - -
  • -); +const BottomLink = ({ + link, +}: { link: NavLink | FooterPropsDsfr.BottomItem }) => { + const { cx } = useStyles(); + return ( +
  • + {"label" in link ? ( + + {link.label} + + ) : ( + + )} +
  • + ); +}; export const Footer = ({ links,