From 922e163ef94f9b22fc1931f447b60216285cf8b1 Mon Sep 17 00:00:00 2001 From: Malek Zemni Date: Thu, 12 Dec 2024 15:04:24 +0100 Subject: [PATCH] feat: ajout archivage dans portefeuille --- .../(with-chat)/pilotage/PilotagePage.tsx | 57 +++++++++++++++++- .../(with-chat)/pilotage/page.tsx | 3 + .../OngletBeneficiairesAArchiverPilotage.tsx | 33 +++++++++++ .../TableauBeneficiairesAArchiver.tsx | 58 +++++++++++++++++++ 4 files changed, 150 insertions(+), 1 deletion(-) create mode 100644 components/pilotage/OngletBeneficiairesAArchiverPilotage.tsx create mode 100644 components/pilotage/TableauBeneficiairesAArchiver.tsx diff --git a/app/(connected)/(with-sidebar)/(with-chat)/pilotage/PilotagePage.tsx b/app/(connected)/(with-sidebar)/(with-chat)/pilotage/PilotagePage.tsx index 3ae40de00..0b79086ac 100644 --- a/app/(connected)/(with-sidebar)/(with-chat)/pilotage/PilotagePage.tsx +++ b/app/(connected)/(with-sidebar)/(with-chat)/pilotage/PilotagePage.tsx @@ -5,6 +5,8 @@ import dynamic from 'next/dynamic' import { useRouter } from 'next/navigation' import React, { useEffect, useState } from 'react' +import { BaseBeneficiaire } from '../../../../../interfaces/beneficiaire' + import IconComponent, { IconName } from 'components/ui/IconComponent' import Tab from 'components/ui/Navigation/Tab' import TabList from 'components/ui/Navigation/TabList' @@ -29,11 +31,18 @@ const OngletAnimationsCollectivesPilotage = dynamic( const OngletSessionsImiloPilotage = dynamic( () => import('components/pilotage/OngletSessionsImiloPilotage') ) +const OngletBeneficiairesAArchiverPilotage = dynamic( + () => import('components/pilotage/OngletBeneficiairesAArchiverPilotage') +) const EncartAgenceRequise = dynamic( () => import('components/EncartAgenceRequise') ) -export type Onglet = 'ACTIONS' | 'ANIMATIONS_COLLECTIVES' | 'SESSIONS_IMILO' +export type Onglet = + | 'ACTIONS' + | 'ANIMATIONS_COLLECTIVES' + | 'SESSIONS_IMILO' + | 'ARCHIVAGE' const ongletProps: { [key in Onglet]: { queryParam: string; trackingLabel: string } @@ -47,6 +56,10 @@ const ongletProps: { queryParam: 'sessionsImilo', trackingLabel: 'Sessions i-milo', }, + ARCHIVAGE: { + queryParam: 'archivage', + trackingLabel: 'Archivage bénéficiaire', + }, } type PilotageProps = { @@ -87,6 +100,12 @@ function PilotagePage({ | undefined >(animationsCollectives) + const beneficiairesAArchiver = portefeuille.filter( + (beneficiaire) => beneficiaire.estAArchiver + ) + const nbBeneficiairesAArchiver = beneficiairesAArchiver.length + const aDesBeneficiairesAArchiver = nbBeneficiairesAArchiver > 0 + const pageTracking = 'Pilotage' const [trackingLabel, setTrackingLabel] = useState( pageTracking + ' - Consultation ' + ongletProps[currentTab].trackingLabel @@ -215,6 +234,17 @@ function PilotagePage({ )} )} + {aDesBeneficiairesAArchiver && ( +
+
Bénéficiaires
+
+
{nbBeneficiairesAArchiver}
+ À archiver +
+
+ )} @@ -246,6 +276,17 @@ function PilotagePage({ iconName={IconName.EventFill} /> )} + {aDesBeneficiairesAArchiver && ( + switchTab('ARCHIVAGE')} + iconName={IconName.EventFill} + /> + )} {currentTab === 'ACTIONS' && ( @@ -308,6 +349,20 @@ function PilotagePage({ {sessions && } )} + + {currentTab === 'ARCHIVAGE' && aDesBeneficiairesAArchiver && ( +
+ +
+ )} ) } diff --git a/app/(connected)/(with-sidebar)/(with-chat)/pilotage/page.tsx b/app/(connected)/(with-sidebar)/(with-chat)/pilotage/page.tsx index 0ddbc451d..bdde32c41 100644 --- a/app/(connected)/(with-sidebar)/(with-chat)/pilotage/page.tsx +++ b/app/(connected)/(with-sidebar)/(with-chat)/pilotage/page.tsx @@ -73,6 +73,9 @@ export default async function Pilotage({ case 'sessionsImilo': onglet = 'SESSIONS_IMILO' break + case 'archivage': + onglet = 'ARCHIVAGE' + break } return ( diff --git a/components/pilotage/OngletBeneficiairesAArchiverPilotage.tsx b/components/pilotage/OngletBeneficiairesAArchiverPilotage.tsx new file mode 100644 index 000000000..f313d3a93 --- /dev/null +++ b/components/pilotage/OngletBeneficiairesAArchiverPilotage.tsx @@ -0,0 +1,33 @@ +import { BeneficiaireWithActivity } from '../../interfaces/beneficiaire' + +import TableauBeneficiairesAArchiver from './TableauBeneficiairesAArchiver' + +import EmptyStateImage from 'assets/images/illustration-event-grey.svg' + +interface OngletBeneficiairesAArchiverPilotageProps { + beneficiaires: BeneficiaireWithActivity[] +} +export default function OngletBeneficiairesAArchiverPilotage({ + beneficiaires, +}: OngletBeneficiairesAArchiverPilotageProps) { + return ( + <> + {Boolean(beneficiaires && beneficiaires.length === 0) && ( +
+ +

+ Vous n’avez pas de bénéficiaires à archiver. +

+
+ )} + + {beneficiaires.length > 0 && ( + + )} + + ) +} diff --git a/components/pilotage/TableauBeneficiairesAArchiver.tsx b/components/pilotage/TableauBeneficiairesAArchiver.tsx new file mode 100644 index 000000000..289c0102a --- /dev/null +++ b/components/pilotage/TableauBeneficiairesAArchiver.tsx @@ -0,0 +1,58 @@ +import { + BaseBeneficiaire, + BeneficiaireFromListe, +} from '../../interfaces/beneficiaire' + +import { Badge } from 'components/ui/Indicateurs/Badge' +import Table from 'components/ui/Table/Table' +import TD from 'components/ui/Table/TD' +import TDLink from 'components/ui/Table/TDLink' +import { TH } from 'components/ui/Table/TH' +import TR from 'components/ui/Table/TR' +import { toLongMonthDate } from 'utils/date' + +interface TableauBeneficiairesAArchiverProps { + beneficiaires: BeneficiaireFromListe[] +} + +export default function TableauBeneficiairesAArchiver({ + beneficiaires, +}: TableauBeneficiairesAArchiverProps) { + return ( + <> + {beneficiaires.length > 0 && ( + + + + + + + + + + + + {beneficiaires.map((benef: BaseBeneficiaire) => ( + + + + + + + ))} + +
DateTitre de l’animation collectiveParticipantsVoir le détail
{toLongMonthDate(benef.date)}{benef.titre} + +
+ )} + + ) +}