diff --git a/packages/api/src/api/graphql/resolvers/titres-demarches.ts b/packages/api/src/api/graphql/resolvers/titres-demarches.ts index 9cb0c1b0f881dd194a6fc4f678848057662d3159..291a8d193a24de06b414266667d4fa8dd7c425bb 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 670206c6e971047736dafa6ddcc7ab2305548696..d316cf3abd9a95b37f2c13626bd40aa76bf80ccc 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 9d027c6d2be14ca791a507f9c5c7dfe9cf3d74cf..be8408b0ce0765a93de1210942793e4b6cb8a022 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 1d951c56b331ab7af9ddc62ab8b76c4755c1ceb5..a16792df627700786581dae6b91797ac162ffd81 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 41557e141732a0350df7f136f7d7798985ccccaf..caa79a4e14ca2bb315ab15e509db6c1e4a561b66 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 4e67ff37369e3b3eee92a5a2613d4f1a0dca69cd..6c774b8a635cf65c694e0a6b57e2c209422f5519 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 76da2eef1067a7d2e12c1546d1217869fe312466..1170c757372f92c5b579f0e91793936b190c1eb6 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 307e74151ecec57a008327328adbb9d55072848e..83faa0fb822536d64d9c3191ad5d639cf0a2fd5a 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 d06b3fba7c5177ce32461338a44f274cbfcdcfe8..927598a342ff53baf3bb74a00b4954e049aceb84 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 e3f1c2d84cb84266eafbac5cbecba0d16591ab45..54ac8b8f408ddb030f02bb504df001dda529ff57 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 4e10f37bd64d6732c60fd88a442cb93336e19b10..23e035d69ca8767c2e96aef527ba6ee7fd3fc92b 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 e2a86dd539cc55bd2c3a7a71f5f407fe6d87b791..5b1d8e635e436fcc8c229713ec9ac0a8e9afa1d6 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 25570d0f40c98f4df8938a1a854fd5bf913917f5..dc397ea2a3db0f5d884072c27c96c5da1025f134 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 fc16cec726b5ba0d356eec808dac9eeae17e4554..ba921466e999c6d6079e74573a326642ce71850d 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 62c99db5e637dcc460a3e813ffd406224f7bd006..4378634a512cccf534192d302a8161759aee5020 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 828d88e6406f7256a500ef367bf3a2ebced8eb28..b460050b65ecb9b337ba91c3250712bae460844b 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 174ebf6681a8096ede13b9108ac61ad5e0284788..a38d4528360018f5ce07259df1dd8d97174d6172 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 a9796b223a034f3a1ec4edfcd524fa92ec0661bc..083fce8f10148b3cb4463ab5bf5b325986ff22a3 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 41118497a536b492d68ab5d3c97e2beec9bedd40..740b6978eac5a783e2851d537610ddedc40b469a 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 cf03e2d5c7688edf0182e5164f550d12dea884b5..bb981273365f4399b501307cbc89957cff6ad13b 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 f60692d5929fa46a9a066ca2d83137706bab4925..c3ea11eb6b7b44c6208653aae97688541d09a57a 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'