From 4d0469b4f05f9d6681d122980d526d234c7bc31f Mon Sep 17 00:00:00 2001 From: Arthur Molinos Date: Thu, 28 Nov 2024 15:57:11 +0100 Subject: [PATCH] =?UTF-8?q?Ajoute=20la=20possibilit=C3=A9=20de=20donner=20?= =?UTF-8?q?des=20valeurs=20custom=20aux=20badges=20des=20listes=20Indicate?= =?UTF-8?q?ur=20et=20FicheAction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Indicateurs/lists/indicateurs-list/badge-list.tsx | 8 +++++++- .../lists/indicateurs-list/indicateurs-list.tsx | 4 ++++ .../ToutesLesFichesAction/FichesActionListe.tsx | 10 ++++++++-- .../ModuleFichesActions/ModuleFichesActionsPage.tsx | 7 +++++++ .../ModuleIndicateurs/ModuleIndicateursPage.tsx | 7 +++++++ 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/badge-list.tsx b/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/badge-list.tsx index 8e15987987..f67ed1af08 100644 --- a/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/badge-list.tsx +++ b/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/badge-list.tsx @@ -8,6 +8,7 @@ import { useExportIndicateurs, } from '@tet/app/pages/collectivite/Indicateurs/Indicateur/useExportIndicateurs'; import FilterBadges, { + CustomFilterBadges, useFiltersToBadges, } from 'ui/shared/filters/filter-badges'; @@ -15,6 +16,7 @@ type Props = { pageName: ExportIndicateursPageName; // tracking definitions?: Indicateurs.domain.IndicateurListItem[]; filters: Indicateurs.FetchFiltre; + customFilterBadges?: CustomFilterBadges; resetFilters?: () => void; isLoading: boolean; isEmpty: boolean; @@ -24,6 +26,7 @@ const BadgeList = ({ pageName, definitions, filters, + customFilterBadges, resetFilters, isEmpty, isLoading, @@ -32,7 +35,10 @@ const BadgeList = ({ const { mutate: exportIndicateurs, isLoading: isDownloadingExport } = useExportIndicateurs(pageName, definitions); - const { data: filterBadges } = useFiltersToBadges({ filters }); + const { data: filterBadges } = useFiltersToBadges({ + filters, + customValues: customFilterBadges, + }); return (
diff --git a/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/indicateurs-list.tsx b/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/indicateurs-list.tsx index c29bcc539d..376e7485e2 100644 --- a/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/indicateurs-list.tsx +++ b/app.territoiresentransitions.react/src/app/pages/collectivite/Indicateurs/lists/indicateurs-list/indicateurs-list.tsx @@ -21,6 +21,7 @@ import { makeCollectiviteIndicateursUrl } from 'app/paths'; import { useCurrentCollectivite } from 'core-logic/hooks/useCurrentCollectivite'; import BadgeList from '@tet/app/pages/collectivite/Indicateurs/lists/indicateurs-list/badge-list'; import { ExportIndicateursPageName } from '@tet/app/pages/collectivite/Indicateurs/Indicateur/useExportIndicateurs'; +import { CustomFilterBadges } from 'ui/shared/filters/filter-badges'; type sortByOptionsType = { label: string; @@ -51,6 +52,7 @@ const sortByOptions: sortByOptionsType[] = [ type Props = { settings: (openState: OpenState) => React.ReactNode; filtres?: Indicateurs.FetchFiltre; + customFilterBadges?: CustomFilterBadges; resetFilters?: () => void; maxNbOfCards?: number; sortSettings?: SortIndicateurSettings; @@ -67,6 +69,7 @@ const IndicateursListe = ({ defaultSort: 'text', }, filtres = {}, + customFilterBadges, resetFilters, settings, isEditable, @@ -205,6 +208,7 @@ const IndicateursListe = ({ pageName={pageName} definitions={definitions} filters={filtres} + customFilterBadges={customFilterBadges} resetFilters={resetFilters} isLoading={isLoading} isEmpty={currentDefs?.length === 0} diff --git a/app.territoiresentransitions.react/src/app/pages/collectivite/PlansActions/ToutesLesFichesAction/FichesActionListe.tsx b/app.territoiresentransitions.react/src/app/pages/collectivite/PlansActions/ToutesLesFichesAction/FichesActionListe.tsx index a34b4b8784..a214092f03 100644 --- a/app.territoiresentransitions.react/src/app/pages/collectivite/PlansActions/ToutesLesFichesAction/FichesActionListe.tsx +++ b/app.territoiresentransitions.react/src/app/pages/collectivite/PlansActions/ToutesLesFichesAction/FichesActionListe.tsx @@ -19,6 +19,7 @@ import { makeCollectivitePlanActionFicheUrl, } from 'app/paths'; import FilterBadges, { + CustomFilterBadges, useFiltersToBadges, } from 'ui/shared/filters/filter-badges'; @@ -52,8 +53,9 @@ const sortByOptions: sortByOptionsType[] = [ ]; type Props = { - filtres: Filtre; settings: (openState: OpenState) => React.ReactNode; + filtres: Filtre; + customFilterBadges?: CustomFilterBadges; resetFilters?: () => void; maxNbOfCards?: number; sortSettings?: SortFicheActionSettings; @@ -65,6 +67,7 @@ const FichesActionListe = ({ defaultSort: 'modified_at', }, filtres, + customFilterBadges, resetFilters, settings, maxNbOfCards = 15, @@ -133,7 +136,10 @@ const FichesActionListe = ({ const countTotal = data?.count || 0; - const { data: filterBadges } = useFiltersToBadges({ filters: filtres }); + const { data: filterBadges } = useFiltersToBadges({ + filters: filtres, + customValues: customFilterBadges, + }); return ( <> diff --git a/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleFichesActions/ModuleFichesActionsPage.tsx b/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleFichesActions/ModuleFichesActionsPage.tsx index eee4b64748..bde890e100 100644 --- a/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleFichesActions/ModuleFichesActionsPage.tsx +++ b/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleFichesActions/ModuleFichesActionsPage.tsx @@ -16,6 +16,7 @@ import FichesActionListe, { import ModulePage from '@tet/app/pages/collectivite/TableauDeBord/components/ModulePage'; import ModalActionsDontJeSuisLePilote from '@tet/app/pages/collectivite/TableauDeBord/Personnel/ModuleFichesActions/ModalActionsDontJeSuisLePilote'; import ModalActionsRecemmentModifiees from '@tet/app/pages/collectivite/TableauDeBord/Personnel/ModuleFichesActions/ModalActionsRecemmentModifiees'; +import { usePlanActionsCount } from '@tet/app/pages/collectivite/PlansActions/PlanAction/data/usePlanActionsCount'; type Props = { view: TDBViewParam; @@ -30,6 +31,7 @@ const ModuleFichesActionsPage = ({ view, slug, sortSettings }: Props) => { const { data: dataModule, isLoading: isModuleLoading } = usePersonalModuleFetch(slug); const module = dataModule as ModuleFicheActionsSelect; + const { count } = usePlanActionsCount(); const trackEvent = useEventTracker(`app/tdb/personnel/${slug}`); @@ -45,6 +47,11 @@ const ModuleFichesActionsPage = ({ view, slug, sortSettings }: Props) => { /> ( <> diff --git a/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleIndicateurs/ModuleIndicateursPage.tsx b/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleIndicateurs/ModuleIndicateursPage.tsx index 7a81052f73..2952c75d36 100644 --- a/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleIndicateurs/ModuleIndicateursPage.tsx +++ b/app.territoiresentransitions.react/src/app/pages/collectivite/TableauDeBord/Personnel/ModuleIndicateurs/ModuleIndicateursPage.tsx @@ -13,6 +13,7 @@ import { } from '@tet/app/pages/collectivite/TableauDeBord/Personnel/usePersonalModuleFetch'; import { TDBViewParam } from 'app/paths'; import { useCollectiviteId } from 'core-logic/hooks/params'; +import { usePlanActionsCount } from '@tet/app/pages/collectivite/PlansActions/PlanAction/data/usePlanActionsCount'; type Props = { view: TDBViewParam; @@ -27,6 +28,8 @@ const ModuleIndicateursPage = ({ view, slug }: Props) => { const filtre = module?.options.filtre; + const { count } = usePlanActionsCount(); + const pageName = 'app/tdb/personnel/indicateurs-de-suivi-de-mes-plans'; const trackEvent = useEventTracker(pageName); @@ -43,6 +46,10 @@ const ModuleIndicateursPage = ({ view, slug }: Props) => { ( <>