From be1d34e2794285ba147625b97687a61a7cc38aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Bitard?= <bitard.michael@gmail.com> Date: Mon, 25 Sep 2023 11:49:04 +0200 Subject: [PATCH] =?UTF-8?q?fix(ui):=20corrige=20les=20libell=C3=A9s=20de?= =?UTF-8?q?=20filters=20pour=20la=20page=20des=20d=C3=A9marches=20et=20des?= =?UTF-8?q?=20travaux=20(#660)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/graphql/resolvers/titres-demarches.ts | 6 +++-- .../api/src/api/graphql/schemas/index.graphql | 1 + packages/common/src/filters.ts | 18 +++++++++---- .../components/_ui/filters/camino-filtres.ts | 2 ++ ...eckboxes.stories_snapshots_AllFilters.html | 19 +++++++++++--- ..._snapshots_AllFiltersClosedWithValues.html | 14 ++++++++--- ..._snapshots_AllFiltersOpenedWithValues.html | 14 ++++++++--- .../filters.stories_snapshots_Opened.html | 14 ++++++++--- .../ui/src/components/_ui/filters/filters.tsx | 1 + .../activites.stories_snapshots_Full.html | 2 +- .../activites.stories_snapshots_Loading.html | 2 +- ...nistrations.stories_snapshots_Default.html | 2 +- packages/ui/src/components/demarches.tsx | 18 ++++++++++++- .../src/components/demarches/page.stories.tsx | 15 ++++++++--- .../page.stories_snapshots_Demarches.html | 7 ++---- .../page.stories_snapshots_Loading.html | 7 ++---- .../page.stories_snapshots_Travaux.html | 24 ++---------------- .../page.stories_snapshots_WithError.html | 7 ++---- packages/ui/src/components/demarches/page.tsx | 25 +++++-------------- .../components/titre/demarche-api-client.ts | 2 ++ packages/ui/src/components/travaux.tsx | 18 ++++++++++++- 21 files changed, 131 insertions(+), 87 deletions(-) diff --git a/packages/api/src/api/graphql/resolvers/titres-demarches.ts b/packages/api/src/api/graphql/resolvers/titres-demarches.ts index 9cb0c1b0f..291a8d193 100644 --- a/packages/api/src/api/graphql/resolvers/titres-demarches.ts +++ b/packages/api/src/api/graphql/resolvers/titres-demarches.ts @@ -42,6 +42,7 @@ const demarches = async ( ordre, colonne, typesIds, + travauxTypesIds, statutsIds, etapesInclues, etapesExclues, @@ -60,6 +61,7 @@ const demarches = async ( ordre?: 'asc' | 'desc' | null colonne?: ITitreDemarcheColonneId | null typesIds?: string[] | null + travauxTypesIds?: string[] | null statutsIds?: string[] | null etapesInclues?: ITitreEtapeFiltre[] | null etapesExclues?: ITitreEtapeFiltre[] | null @@ -94,7 +96,7 @@ const demarches = async ( page, ordre, colonne, - typesIds, + typesIds: [...(typesIds ?? []), ...(travauxTypesIds ?? [])], statutsIds, etapesInclues, etapesExclues, @@ -113,7 +115,7 @@ const demarches = async ( ), titresDemarchesCount( { - typesIds, + typesIds: [...(typesIds ?? []), ...(travauxTypesIds ?? [])], statutsIds, etapesInclues, etapesExclues, diff --git a/packages/api/src/api/graphql/schemas/index.graphql b/packages/api/src/api/graphql/schemas/index.graphql index 670206c6e..d316cf3ab 100644 --- a/packages/api/src/api/graphql/schemas/index.graphql +++ b/packages/api/src/api/graphql/schemas/index.graphql @@ -69,6 +69,7 @@ type Query { colonne: String ordre: String typesIds: [ID] + travauxTypesIds: [ID] statutsIds: [ID] etapesInclues: [InputEtapeFiltre] etapesExclues: [InputEtapeFiltre] diff --git a/packages/common/src/filters.ts b/packages/common/src/filters.ts index 9d027c6d2..be8408b0c 100644 --- a/packages/common/src/filters.ts +++ b/packages/common/src/filters.ts @@ -27,7 +27,7 @@ export const caminoFiltres = { }, administrationTypesIds: { id: 'administrationTypesIds', - name: 'Types', + name: "Type d'administration", type: 'checkboxes', elements: Object.values(ADMINISTRATION_TYPES), component: 'FiltresLabel', @@ -159,7 +159,7 @@ export const caminoFiltres = { }, activiteStatutsIds: { id: 'activiteStatutsIds', - name: 'Statuts', + name: "Statuts d'activité", type: 'checkboxes', elements: activitesStatuts, component: 'FiltresStatuts', @@ -183,15 +183,23 @@ export const caminoFiltres = { }, demarchesTypesIds: { id: 'demarchesTypesIds', - name: 'Types', + name: 'Types de démarche', type: 'checkboxes', - elements: sortedDemarchesTypes, + elements: sortedDemarchesTypes.filter(({ travaux }) => !travaux), + component: 'FiltresLabel', + validator: z.array(demarcheTypeIdValidator), + }, + travauxTypesIds: { + id: 'travauxTypesIds', + name: 'Types de travaux', + type: 'checkboxes', + elements: sortedDemarchesTypes.filter(({ travaux }) => travaux), component: 'FiltresLabel', validator: z.array(demarcheTypeIdValidator), }, demarchesStatutsIds: { id: 'demarchesStatutsIds', - name: 'Types', + name: 'Statuts de démarche', type: 'checkboxes', elements: sortedDemarchesStatuts, component: 'FiltresStatuts', diff --git a/packages/ui/src/components/_ui/filters/camino-filtres.ts b/packages/ui/src/components/_ui/filters/camino-filtres.ts index 1d951c56b..a16792df6 100644 --- a/packages/ui/src/components/_ui/filters/camino-filtres.ts +++ b/packages/ui/src/components/_ui/filters/camino-filtres.ts @@ -43,6 +43,7 @@ const caminoCheckboxesFiltresArrayIds = [ 'activiteTypesIds', 'activiteStatutsIds', 'demarchesTypesIds', + 'travauxTypesIds', 'demarchesStatutsIds', ] as const export const caminoCheckboxesFiltres = [ @@ -54,6 +55,7 @@ export const caminoCheckboxesFiltres = [ caminoFiltres.activiteTypesIds, caminoFiltres.activiteStatutsIds, caminoFiltres.demarchesTypesIds, + caminoFiltres.travauxTypesIds, caminoFiltres.demarchesStatutsIds, ] as const satisfies readonly { type: 'checkboxes' }[] export type CheckboxesCaminoFiltres = (typeof caminoCheckboxesFiltres)[number]['id'] diff --git a/packages/ui/src/components/_ui/filters/filters-checkboxes.stories_snapshots_AllFilters.html b/packages/ui/src/components/_ui/filters/filters-checkboxes.stories_snapshots_AllFilters.html index 41557e141..caa79a4e1 100644 --- a/packages/ui/src/components/_ui/filters/filters-checkboxes.stories_snapshots_AllFilters.html +++ b/packages/ui/src/components/_ui/filters/filters-checkboxes.stories_snapshots_AllFilters.html @@ -304,7 +304,7 @@ <td>administrationTypesIds</td> <td> <div class="mb"> - <h5>Types</h5> + <h5>Type d'administration</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aut"><span class="cap-first h6 bold">Autorité</span></label></li> @@ -477,7 +477,7 @@ <td>activiteStatutsIds</td> <td> <div class="mb"> - <h5>Statuts</h5> + <h5>Statuts d'activité</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="abs"> @@ -500,7 +500,7 @@ <td>demarchesTypesIds</td> <td> <div class="mb"> - <h5>Types</h5> + <h5>Types de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> @@ -523,6 +523,17 @@ <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> + </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> + </div> + </td> + </tr> + <tr> + <td>travauxTypesIds</td> + <td> + <div class="mb"> + <h5>Types de travaux</h5> + <hr class="mb-s"> + <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> @@ -534,7 +545,7 @@ <td>demarchesStatutsIds</td> <td> <div class="mb"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersClosedWithValues.html b/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersClosedWithValues.html index 4e67ff373..6c774b8a6 100644 --- a/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersClosedWithValues.html +++ b/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersClosedWithValues.html @@ -144,7 +144,7 @@ </div><button class="btn-border small px-s p-xs rnd-xs mb">Tout effacer</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Type d'administration</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aut"><span class="cap-first h6 bold">Autorité</span></label></li> @@ -287,7 +287,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Statuts</h5> + <h5>Statuts d'activité</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="abs"> @@ -305,7 +305,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Types de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> @@ -328,13 +328,19 @@ <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> + </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> + </div> + <div class="mb tablet-blob-1-2 large-blob-1-3"> + <h5>Types de travaux</h5> + <hr class="mb-s"> + <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersOpenedWithValues.html b/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersOpenedWithValues.html index 76da2eef1..1170c7573 100644 --- a/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersOpenedWithValues.html +++ b/packages/ui/src/components/_ui/filters/filters.stories_snapshots_AllFiltersOpenedWithValues.html @@ -144,7 +144,7 @@ </div><button class="btn-border small px-s p-xs rnd-xs mb">Tout effacer</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Type d'administration</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aut"><span class="cap-first h6 bold">Autorité</span></label></li> @@ -287,7 +287,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Statuts</h5> + <h5>Statuts d'activité</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="abs"> @@ -305,7 +305,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Types de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> @@ -328,13 +328,19 @@ <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> + </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> + </div> + <div class="mb tablet-blob-1-2 large-blob-1-3"> + <h5>Types de travaux</h5> + <hr class="mb-s"> + <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/_ui/filters/filters.stories_snapshots_Opened.html b/packages/ui/src/components/_ui/filters/filters.stories_snapshots_Opened.html index 307e74151..83faa0fb8 100644 --- a/packages/ui/src/components/_ui/filters/filters.stories_snapshots_Opened.html +++ b/packages/ui/src/components/_ui/filters/filters.stories_snapshots_Opened.html @@ -140,7 +140,7 @@ </div><button class="btn-border small px-s p-xs rnd-xs mb">Tout effacer</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Type d'administration</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aut"><span class="cap-first h6 bold">Autorité</span></label></li> @@ -283,7 +283,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Statuts</h5> + <h5>Statuts d'activité</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="abs"> @@ -301,7 +301,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Types de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> @@ -324,13 +324,19 @@ <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> + </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> + </div> + <div class="mb tablet-blob-1-2 large-blob-1-3"> + <h5>Types de travaux</h5> + <hr class="mb-s"> + <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/_ui/filters/filters.tsx b/packages/ui/src/components/_ui/filters/filters.tsx index d06b3fba7..927598a34 100644 --- a/packages/ui/src/components/_ui/filters/filters.tsx +++ b/packages/ui/src/components/_ui/filters/filters.tsx @@ -88,6 +88,7 @@ export const getInitialFiltres = (route: Pick<RouteLocationNormalizedLoaded, 'qu activiteTypesIds: caminoFiltres.activiteTypesIds.validator.parse(routerQueryToStringArray(route.query.activiteTypesIds)), activiteStatutsIds: caminoFiltres.activiteStatutsIds.validator.parse(routerQueryToStringArray(route.query.activiteStatutsIds)), demarchesTypesIds: caminoFiltres.demarchesTypesIds.validator.parse(routerQueryToStringArray(route.query.demarchesTypesIds)), + travauxTypesIds: caminoFiltres.travauxTypesIds.validator.parse(routerQueryToStringArray(route.query.travauxTypesIds)), demarchesStatutsIds: caminoFiltres.demarchesStatutsIds.validator.parse(routerQueryToStringArray(route.query.demarchesStatutsIds)), etapesInclues: caminoFiltres.etapesInclues.validator.parse(JSON.parse(routerQueryToString(route.query.etapesInclues, '[]'))), etapesExclues: caminoFiltres.etapesExclues.validator.parse(JSON.parse(routerQueryToString(route.query.etapesExclues, '[]'))), diff --git a/packages/ui/src/components/activites.stories_snapshots_Full.html b/packages/ui/src/components/activites.stories_snapshots_Full.html index e3f1c2d84..54ac8b8f4 100644 --- a/packages/ui/src/components/activites.stories_snapshots_Full.html +++ b/packages/ui/src/components/activites.stories_snapshots_Full.html @@ -212,7 +212,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Statuts</h5> + <h5>Statuts d'activité</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="abs"> diff --git a/packages/ui/src/components/activites.stories_snapshots_Loading.html b/packages/ui/src/components/activites.stories_snapshots_Loading.html index 4e10f37bd..23e035d69 100644 --- a/packages/ui/src/components/activites.stories_snapshots_Loading.html +++ b/packages/ui/src/components/activites.stories_snapshots_Loading.html @@ -215,7 +215,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Statuts</h5> + <h5>Statuts d'activité</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="abs"> diff --git a/packages/ui/src/components/administrations.stories_snapshots_Default.html b/packages/ui/src/components/administrations.stories_snapshots_Default.html index e2a86dd53..5b1d8e635 100644 --- a/packages/ui/src/components/administrations.stories_snapshots_Default.html +++ b/packages/ui/src/components/administrations.stories_snapshots_Default.html @@ -36,7 +36,7 @@ </div><button class="btn-border small px-s p-xs rnd-xs mb">Tout effacer</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Type d'administration</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aut"><span class="cap-first h6 bold">Autorité</span></label></li> diff --git a/packages/ui/src/components/demarches.tsx b/packages/ui/src/components/demarches.tsx index 25570d0f4..dc397ea2a 100644 --- a/packages/ui/src/components/demarches.tsx +++ b/packages/ui/src/components/demarches.tsx @@ -1,8 +1,24 @@ import { FunctionalComponent } from 'vue' import { Page } from './demarches/page' +import { CaminoFiltre } from 'camino-common/src/filters' + +export const filtres = [ + 'titresIds', + 'domainesIds', + 'typesIds', + 'statutsIds', + 'entreprisesIds', + 'substancesIds', + 'references', + 'titresTerritoires', + 'demarchesTypesIds', + 'demarchesStatutsIds', + 'etapesInclues', + 'etapesExclues', +] as const satisfies readonly CaminoFiltre[] export const Demarches: FunctionalComponent = () => { - return <Page travaux={false} /> + return <Page travaux={false} filtres={filtres} /> } // Demandé par le router car utilisé dans un import asynchrone /shrug Demarches.displayName = 'Demarches' diff --git a/packages/ui/src/components/demarches/page.stories.tsx b/packages/ui/src/components/demarches/page.stories.tsx index fc16cec72..ba921466e 100644 --- a/packages/ui/src/components/demarches/page.stories.tsx +++ b/packages/ui/src/components/demarches/page.stories.tsx @@ -4,6 +4,8 @@ import { action } from '@storybook/addon-actions' import { RouteLocationRaw } from 'vue-router' import { ApiClient } from '@/api/api-client' import { vueRouter } from 'storybook-vue3-router' +import { filtres as demarchesFiltres } from '../demarches' +import { filtres as travauxFiltres } from '../travaux' const meta: Meta = { title: 'Components/Demarches/Page', @@ -56,12 +58,18 @@ const apiClient: Pick<ApiClient, 'getDemarches' | 'titresRechercherByNom' | 'get } export const Loading: StoryFn = () => ( - <PurePage travaux updateUrlQuery={updateUrlQuery} currentRoute={{ name: 'demarches', query: {} }} apiClient={{ ...apiClient, getUtilisateurEntreprises: () => new Promise(() => ({})) }} /> + <PurePage + travaux + updateUrlQuery={updateUrlQuery} + currentRoute={{ name: 'demarches', query: {} }} + apiClient={{ ...apiClient, getUtilisateurEntreprises: () => new Promise(() => ({})) }} + filtres={demarchesFiltres} + /> ) -export const Travaux: StoryFn = () => <PurePage travaux updateUrlQuery={updateUrlQuery} currentRoute={{ name: 'demarches', query: {} }} apiClient={apiClient} /> +export const Travaux: StoryFn = () => <PurePage travaux updateUrlQuery={updateUrlQuery} currentRoute={{ name: 'demarches', query: {} }} apiClient={apiClient} filtres={travauxFiltres} /> -export const Demarches: StoryFn = () => <PurePage travaux={false} updateUrlQuery={updateUrlQuery} currentRoute={{ name: 'demarches', query: {} }} apiClient={apiClient} /> +export const Demarches: StoryFn = () => <PurePage travaux={false} updateUrlQuery={updateUrlQuery} currentRoute={{ name: 'demarches', query: {} }} apiClient={apiClient} filtres={demarchesFiltres} /> export const WithError: StoryFn = () => ( <PurePage @@ -69,5 +77,6 @@ export const WithError: StoryFn = () => ( updateUrlQuery={updateUrlQuery} currentRoute={{ name: 'demarches', query: {} }} apiClient={{ ...apiClient, getUtilisateurEntreprises: () => Promise.reject(new Error('Cassé')), getDemarches: () => Promise.reject(new Error('Cassé')) }} + filtres={demarchesFiltres} /> ) diff --git a/packages/ui/src/components/demarches/page.stories_snapshots_Demarches.html b/packages/ui/src/components/demarches/page.stories_snapshots_Demarches.html index 62c99db5e..4378634a5 100644 --- a/packages/ui/src/components/demarches/page.stories_snapshots_Demarches.html +++ b/packages/ui/src/components/demarches/page.stories_snapshots_Demarches.html @@ -188,7 +188,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Types de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> @@ -211,13 +211,10 @@ <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/demarches/page.stories_snapshots_Loading.html b/packages/ui/src/components/demarches/page.stories_snapshots_Loading.html index 828d88e64..b460050b6 100644 --- a/packages/ui/src/components/demarches/page.stories_snapshots_Loading.html +++ b/packages/ui/src/components/demarches/page.stories_snapshots_Loading.html @@ -191,7 +191,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Types de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> @@ -214,13 +214,10 @@ <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/demarches/page.stories_snapshots_Travaux.html b/packages/ui/src/components/demarches/page.stories_snapshots_Travaux.html index 174ebf668..a38d45283 100644 --- a/packages/ui/src/components/demarches/page.stories_snapshots_Travaux.html +++ b/packages/ui/src/components/demarches/page.stories_snapshots_Travaux.html @@ -188,36 +188,16 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Types de travaux</h5> <hr class="mb-s"> <ul class="list-sans"> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="pro"><span class="cap-first h6 bold">prolongation</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="pr1"><span class="cap-first h6 bold">prolongation 1</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="pr2"><span class="cap-first h6 bold">prolongation 2</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="pre"><span class="cap-first h6 bold">prolongation exceptionnelle</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="exp"><span class="cap-first h6 bold">extension de périmètre</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dep"><span class="cap-first h6 bold">déplacement de périmètre</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="fus"><span class="cap-first h6 bold">fusion</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="exs"><span class="cap-first h6 bold">extension de substance</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="con"><span class="cap-first h6 bold">conversion</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="amo"><span class="cap-first h6 bold">amodiation</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="res"><span class="cap-first h6 bold">résiliation anticipée d'amodiation</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="mut"><span class="cap-first h6 bold">mutation</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="vut"><span class="cap-first h6 bold">mutation partielle</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ces"><span class="cap-first h6 bold">cession</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="prr"><span class="cap-first h6 bold">prorogation</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="vct"><span class="cap-first h6 bold">demande de titre d'exploitation</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/demarches/page.stories_snapshots_WithError.html b/packages/ui/src/components/demarches/page.stories_snapshots_WithError.html index a9796b223..083fce8f1 100644 --- a/packages/ui/src/components/demarches/page.stories_snapshots_WithError.html +++ b/packages/ui/src/components/demarches/page.stories_snapshots_WithError.html @@ -203,7 +203,7 @@ </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Types de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="oct"><span class="cap-first h6 bold">octroi</span></label></li> @@ -226,13 +226,10 @@ <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ren"><span class="cap-first h6 bold">renonciation</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="ret"><span class="cap-first h6 bold">retrait</span></label></li> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dec"><span class="cap-first h6 bold">déchéance</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="aom"><span class="cap-first h6 bold">Autorisation d'ouverture de travaux</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dot"><span class="cap-first h6 bold">Déclaration d'ouverture de travaux</span></label></li> - <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="dam"><span class="cap-first h6 bold">Déclaration d'arrêt définitif des travaux</span></label></li> </ul><button class="btn-border small px-s p-xs rnd-xs mr-xs">Aucun</button><button class="btn-border small px-s p-xs rnd-xs mr-xs">Tous</button> </div> <div class="mb tablet-blob-1-2 large-blob-1-3"> - <h5>Types</h5> + <h5>Statuts de démarche</h5> <hr class="mb-s"> <ul class="list-sans"> <li><label style="display: flex; flex-direction: row;"><input type="checkbox" class="mr-s" value="eco"> diff --git a/packages/ui/src/components/demarches/page.tsx b/packages/ui/src/components/demarches/page.tsx index 41118497a..740b6978e 100644 --- a/packages/ui/src/components/demarches/page.tsx +++ b/packages/ui/src/components/demarches/page.tsx @@ -26,24 +26,11 @@ const demarchesColonnes = [ { id: 'references', name: 'Références', noSort: true }, ] as const satisfies readonly Column[] -const filtres = [ - 'titresIds', - 'domainesIds', - 'typesIds', - 'statutsIds', - 'entreprisesIds', - 'substancesIds', - 'references', - 'titresTerritoires', - 'demarchesTypesIds', - 'demarchesStatutsIds', - 'etapesInclues', - 'etapesExclues', -] as const satisfies readonly CaminoFiltre[] -type Props = Pick<PureProps, 'travaux'> +type Props = Pick<PureProps, 'travaux' | 'filtres'> interface PureProps { travaux: boolean + filtres: readonly CaminoFiltre[] currentRoute: Pick<RouteLocationNormalizedLoaded, 'query' | 'name'> updateUrlQuery: Pick<Router, 'push'> apiClient: Pick<ApiClient, 'getDemarches' | 'getUtilisateurEntreprises' | 'titresRechercherByNom' | 'getTitresByIds'> @@ -127,7 +114,7 @@ export const PurePage = defineComponent<PureProps>(props => { }} renderButton={null} listeFiltre={{ - filtres, + filtres: props.filtres, apiClient: props.apiClient, updateUrlQuery: props.updateUrlQuery, }} @@ -138,12 +125,12 @@ export const PurePage = defineComponent<PureProps>(props => { }) // @ts-ignore waiting for https://github.com/vuejs/core/issues/7833 -PurePage.props = ['currentRoute', 'updateUrlQuery', 'apiClient', 'travaux'] +PurePage.props = ['currentRoute', 'updateUrlQuery', 'apiClient', 'travaux', 'filtres'] export const Page = defineComponent<Props>(props => { const router = useRouter() - return () => <PurePage travaux={props.travaux} apiClient={apiClient} currentRoute={router.currentRoute.value} updateUrlQuery={router} /> + return () => <PurePage filtres={props.filtres} travaux={props.travaux} apiClient={apiClient} currentRoute={router.currentRoute.value} updateUrlQuery={router} /> }) // @ts-ignore waiting for https://github.com/vuejs/core/issues/7833 -Page.props = ['travaux'] +Page.props = ['travaux', 'filtres'] diff --git a/packages/ui/src/components/titre/demarche-api-client.ts b/packages/ui/src/components/titre/demarche-api-client.ts index cf03e2d5c..bb9812733 100644 --- a/packages/ui/src/components/titre/demarche-api-client.ts +++ b/packages/ui/src/components/titre/demarche-api-client.ts @@ -109,6 +109,7 @@ export const demarcheApiClient: DemarcheApiClient = { $etapesExclues: [InputEtapeFiltre!] $domainesIds: [ID!] $demarchesTypesIds: [ID!] + $travauxTypesIds: [ID!] $demarchesStatutsIds: [ID!] $titresIds: [String] $entreprisesIds: [String] @@ -123,6 +124,7 @@ export const demarcheApiClient: DemarcheApiClient = { colonne: $colonne ordre: $ordre typesIds: $demarchesTypesIds + travauxTypesIds: $travauxTypesIds statutsIds: $demarchesStatutsIds etapesInclues: $etapesInclues etapesExclues: $etapesExclues diff --git a/packages/ui/src/components/travaux.tsx b/packages/ui/src/components/travaux.tsx index f60692d59..c3ea11eb6 100644 --- a/packages/ui/src/components/travaux.tsx +++ b/packages/ui/src/components/travaux.tsx @@ -1,8 +1,24 @@ import { FunctionalComponent } from 'vue' import { Page } from './demarches/page' +import { CaminoFiltre } from 'camino-common/src/filters' + +export const filtres = [ + 'titresIds', + 'domainesIds', + 'typesIds', + 'statutsIds', + 'entreprisesIds', + 'substancesIds', + 'references', + 'titresTerritoires', + 'travauxTypesIds', + 'demarchesStatutsIds', + 'etapesInclues', + 'etapesExclues', +] as const satisfies readonly CaminoFiltre[] export const Travaux: FunctionalComponent = () => { - return <Page travaux={true} /> + return <Page travaux={true} filtres={filtres} /> } // Demandé par le router car utilisé dans un import asynchrone /shrug Travaux.displayName = 'Travaux' -- GitLab