diff --git a/packages/applications/ssr/src/app/candidatures/[identifiant]/layout.tsx b/packages/applications/ssr/src/app/candidatures/[identifiant]/layout.tsx
index d0384d9e666..f69cb96b5e9 100644
--- a/packages/applications/ssr/src/app/candidatures/[identifiant]/layout.tsx
+++ b/packages/applications/ssr/src/app/candidatures/[identifiant]/layout.tsx
@@ -10,6 +10,7 @@ import { getCandidature } from '@/app/_helpers';
import { ProjetBannerTemplate } from '@/components/molecules/projet/ProjetBanner.template';
import { StatutCandidatureBadge } from '@/components/molecules/candidature/StatutCandidatureBadge';
import { NotificationBadge } from '@/components/molecules/candidature/NotificationBadge';
+import { PageWithErrorHandling } from '@/utils/PageWithErrorHandling';
type LayoutProps = {
children: React.ReactNode;
@@ -40,29 +41,31 @@ export default async function CandidatureLayout({
children,
params: { identifiant },
}: LayoutProps) {
- const identifiantProjetValue = decodeParameter(identifiant);
- const { identifiantProjet, notification, dépôt, instruction } =
- await getCandidature(identifiantProjetValue);
+ return PageWithErrorHandling(async () => {
+ const identifiantProjetValue = decodeParameter(identifiant);
+ const { identifiantProjet, notification, dépôt, instruction } =
+ await getCandidature(identifiantProjetValue);
- return (
-
-
-
-
- }
- dateDésignation={notification ? notification.notifiéeLe.formatter() : Option.none}
- />
- }
- >
- {children}
-
- );
+ return (
+
+
+
+
+ }
+ dateDésignation={notification ? notification.notifiéeLe.formatter() : Option.none}
+ />
+ }
+ >
+ {children}
+
+ );
+ });
}
diff --git a/packages/applications/ssr/src/app/elimines/[identifiant]/layout.tsx b/packages/applications/ssr/src/app/elimines/[identifiant]/layout.tsx
index 2ec0446d2b1..244e6a60043 100644
--- a/packages/applications/ssr/src/app/elimines/[identifiant]/layout.tsx
+++ b/packages/applications/ssr/src/app/elimines/[identifiant]/layout.tsx
@@ -1,11 +1,17 @@
import { Metadata, ResolvingMetadata } from 'next';
import { notFound } from 'next/navigation';
+import { IdentifiantProjet } from '@potentiel-domain/projet';
+import { mapToPlainObject } from '@potentiel-domain/core';
+
import { ProjetÉliminéBanner } from '@/components/molecules/projet/éliminé/ProjetÉliminéBanner';
import { PageTemplate } from '@/components/templates/Page.template';
import { decodeParameter } from '@/utils/decodeParameter';
import { IdentifiantParameter } from '@/utils/identifiantParameter';
import { getÉliminé } from '@/app/_helpers/getÉliminé';
+import { PageWithErrorHandling } from '@/utils/PageWithErrorHandling';
+import { getLauréatInfos } from '@/app/laureats/[identifiant]/_helpers';
+import { ProjetLauréatBanner } from '@/components/molecules/projet/lauréat/ProjetLauréatBanner';
type LayoutProps = IdentifiantParameter & {
children: React.ReactNode;
@@ -34,11 +40,34 @@ export async function generateMetadata(
}
}
-export default function ÉliminéLayout({ children, params: { identifiant } }: LayoutProps) {
- const identifiantProjet = decodeParameter(identifiant);
- return (
- }>
- {children}
-
- );
+export default async function ÉliminéLayout({ children, params: { identifiant } }: LayoutProps) {
+ return PageWithErrorHandling(async () => {
+ const identifiantProjet = decodeParameter(identifiant);
+ const éliminé = await getÉliminé(identifiantProjet);
+
+ // dans le cas d'un recours accordé, le projet devient lauréat
+ if (!éliminé) {
+ const lauréat = await getLauréatInfos(
+ IdentifiantProjet.convertirEnValueType(identifiantProjet).formatter(),
+ );
+ return (
+
+ );
+ }
+ return (
+
+ }
+ >
+ {children}
+
+ );
+ });
}
diff --git "a/packages/applications/ssr/src/app/laureats/[identifiant]/(d\303\251tails)/(sections)/CahierDesCharges.section.tsx" "b/packages/applications/ssr/src/app/laureats/[identifiant]/(d\303\251tails)/(sections)/CahierDesCharges.section.tsx"
index 7656482af04..fbf2430cb8c 100644
--- "a/packages/applications/ssr/src/app/laureats/[identifiant]/(d\303\251tails)/(sections)/CahierDesCharges.section.tsx"
+++ "b/packages/applications/ssr/src/app/laureats/[identifiant]/(d\303\251tails)/(sections)/CahierDesCharges.section.tsx"
@@ -26,6 +26,7 @@ export const CahierDesChargesSection = ({
const cahierDesCharges = await getCahierDesCharges(identifiantProjet.formatter());
const cahierDesChargesModificatifDisponible =
+ rôle.aLaPermission('cahierDesCharges.choisir') &&
cahierDesCharges.période.cahiersDesChargesModifiésDisponibles.length;
const doitChoisirUnCahierDesChargesModificatif =
diff --git a/packages/applications/ssr/src/app/laureats/[identifiant]/layout.tsx b/packages/applications/ssr/src/app/laureats/[identifiant]/layout.tsx
index 89371442cf4..0a005aef0af 100644
--- a/packages/applications/ssr/src/app/laureats/[identifiant]/layout.tsx
+++ b/packages/applications/ssr/src/app/laureats/[identifiant]/layout.tsx
@@ -1,11 +1,13 @@
import { Metadata, ResolvingMetadata } from 'next';
import { IdentifiantProjet } from '@potentiel-domain/projet';
+import { mapToPlainObject } from '@potentiel-domain/core';
import { ProjetLauréatBanner } from '@/components/molecules/projet/lauréat/ProjetLauréatBanner';
import { PageTemplate } from '@/components/templates/Page.template';
import { decodeParameter } from '@/utils/decodeParameter';
import { IdentifiantParameter } from '@/utils/identifiantParameter';
+import { PageWithErrorHandling } from '@/utils/PageWithErrorHandling';
import { getLauréatInfos } from './_helpers/getLauréat';
@@ -37,10 +39,22 @@ export async function generateMetadata(
}
export default function LauréatLayout({ children, params: { identifiant } }: LayoutProps) {
- const identifiantProjet = decodeParameter(identifiant);
- return (
- }>
- {children}
-
- );
+ return PageWithErrorHandling(async () => {
+ const identifiantProjet = decodeParameter(identifiant);
+ const projet = await getLauréatInfos(
+ IdentifiantProjet.convertirEnValueType(identifiantProjet).formatter(),
+ );
+ return (
+
+ }
+ >
+ {children}
+
+ );
+ });
}
diff --git a/packages/applications/ssr/src/components/molecules/projet/ProjetBanner.template.tsx b/packages/applications/ssr/src/components/molecules/projet/ProjetBanner.template.tsx
index 5d4d6b47f31..3d93858bfb4 100644
--- a/packages/applications/ssr/src/components/molecules/projet/ProjetBanner.template.tsx
+++ b/packages/applications/ssr/src/components/molecules/projet/ProjetBanner.template.tsx
@@ -39,7 +39,7 @@ export const ProjetBannerTemplate: FC = ({
) : (
{nom}
)}
- {badge}
+ {badge}
{process.env.APPLICATION_STAGE !== 'production' && (
;
};
-export const ProjetLauréatBanner: FC = async ({
+export const ProjetLauréatBanner: FC = ({
identifiantProjet,
noLink,
+ projet,
}) =>
withUtilisateur(async ({ rôle }) => {
- const projet = await getLauréatInfos(
- IdentifiantProjet.convertirEnValueType(identifiantProjet).formatter(),
- );
-
const { nomProjet, localité, notifiéLe, statut } = projet;
return (
@@ -34,7 +30,7 @@ export const ProjetLauréatBanner: FC = async ({
badge={}
localité={localité}
dateDésignation={Option.match(notifiéLe)
- .some((date) => date.formatter())
+ .some((date) => date.date)
.none()}
/***
* @todo changer le check du rôle quand la page projet sera matérialisée dans le SSR (utiliser rôle.aLaPermissionDe)
diff --git "a/packages/applications/ssr/src/components/molecules/projet/\303\251limin\303\251/Projet\303\211limin\303\251Banner.tsx" "b/packages/applications/ssr/src/components/molecules/projet/\303\251limin\303\251/Projet\303\211limin\303\251Banner.tsx"
index deccaeea480..f98be81b5f7 100644
--- "a/packages/applications/ssr/src/components/molecules/projet/\303\251limin\303\251/Projet\303\211limin\303\251Banner.tsx"
+++ "b/packages/applications/ssr/src/components/molecules/projet/\303\251limin\303\251/Projet\303\211limin\303\251Banner.tsx"
@@ -1,36 +1,28 @@
-'use server';
-
import { FC } from 'react';
import { Routes } from '@potentiel-applications/routes';
-import { IdentifiantProjet } from '@potentiel-domain/projet';
+import { IdentifiantProjet, Éliminé } from '@potentiel-domain/projet';
import { Option } from '@potentiel-libraries/monads';
+import { PlainType } from '@potentiel-domain/core';
import { withUtilisateur } from '@/utils/withUtilisateur';
-import { getÉliminé } from '@/app/_helpers/getÉliminé';
import { ProjetBannerTemplate } from '../ProjetBanner.template';
-import { ProjetLauréatBanner } from '../lauréat/ProjetLauréatBanner';
import { StatutÉliminéBadge } from './StatutÉliminéBadge';
export type ProjetÉliminéBannerProps = {
identifiantProjet: string;
noLink?: true;
+ projet: PlainType<Éliminé.ConsulterÉliminéReadModel>;
};
-export const ProjetÉliminéBanner: FC = async ({
+export const ProjetÉliminéBanner: FC = ({
identifiantProjet,
noLink,
+ projet,
}) =>
withUtilisateur(async ({ rôle }) => {
- const projet = await getÉliminé(identifiantProjet);
-
- // dans le cas d'un recours accordé, le projet devient lauréat
- if (!projet) {
- return ;
- }
-
const { nomProjet, localité, notifiéLe } = projet;
return (
@@ -38,7 +30,7 @@ export const ProjetÉliminéBanner: FC = async ({
badge={}
localité={localité}
dateDésignation={Option.match(notifiéLe)
- .some((date) => date.formatter())
+ .some((date) => date.date)
.none()}
/***
* @todo changer le check du rôle quand la page projet sera matérialisée dans le SSR (utiliser rôle.aLaPermissionDe)
diff --git "a/packages/applications/ssr/src/components/organisms/acc\303\250s/(inviter)/InviterPorteur.form.tsx" "b/packages/applications/ssr/src/components/organisms/acc\303\250s/(inviter)/InviterPorteur.form.tsx"
index b03aa168e1f..0de52ea5fa4 100644
--- "a/packages/applications/ssr/src/components/organisms/acc\303\250s/(inviter)/InviterPorteur.form.tsx"
+++ "b/packages/applications/ssr/src/components/organisms/acc\303\250s/(inviter)/InviterPorteur.form.tsx"
@@ -31,7 +31,7 @@ export const InviterPorteurForm: FC = ({
return (
<>
{peutInviter && (
-