diff --git a/src/main/webapp/src/components/filter/AccountFilter.vue b/src/main/webapp/src/components/filter/AccountFilter.vue index a8c91f09..19a253d2 100644 --- a/src/main/webapp/src/components/filter/AccountFilter.vue +++ b/src/main/webapp/src/components/filter/AccountFilter.vue @@ -3,6 +3,7 @@ import ChipsFilter from '@/components/filter/ChipsFilter.vue'; import { CategoriePersonne } from '@/types/enums/CategoriePersonne'; import { Etat } from '@/types/enums/Etat'; import type { SimplePersonne } from '@/types/personneType'; +import { isArrayOf } from '@/utils/arrayUtils'; import isEmpty from 'lodash.isempty'; import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; @@ -20,6 +21,7 @@ const nbResults = ref(props.searchList ? props.searchList.length : 0); let searchFilter: string | undefined; let categoryFilter: Array; let statusFilter: Array; +let typeFilter: Array; const setSearchFilter = (newValue: string | undefined) => { searchFilter = newValue; @@ -27,15 +29,22 @@ const setSearchFilter = (newValue: string | undefined) => { }; const setCategoryFilter = (newValue: Array) => { - if (typeof newValue == 'string') { - categoryFilter = newValue; + if (isArrayOf(newValue, 'string')) { + categoryFilter = newValue as string[]; filter(); } }; const setStatusFilter = (newValue: Array) => { - if (typeof newValue == 'string') { - statusFilter = newValue; + if (isArrayOf(newValue, 'string')) { + statusFilter = newValue as string[]; + filter(); + } +}; + +const setTypeFilter = (newValue: Array) => { + if (isArrayOf(newValue, 'string')) { + typeFilter = newValue as string[]; filter(); } }; @@ -64,6 +73,12 @@ const filter = () => { result = result?.filter((personne) => statusFilter.includes(personne.etat)); } + if (!isEmpty(typeFilter)) { + result = result.filter((personne) => + typeFilter.includes(personne.source.startsWith('SarapisUi_') ? 'SarapisUi_' : ''), + ); + } + nbResults.value = result.length; emit('update:result', result); }; @@ -93,6 +108,11 @@ const statusTags = [ { id: Etat.Delete, i18n: 'person.status.deleted' }, ]; +const typeTags = [ + { id: '', i18n: 'source.official' }, + { id: 'SarapisUi_', i18n: 'source.SarapisUi_' }, +]; + filter(); @@ -102,6 +122,7 @@ filter(); +
+

{{ t('person.information.profile') }}

+ +
+
+

{{ t('person.information.status') }}

+ +
+
+

{{ t('person.information.source') }}

+ +
+
+ +
{{ nbResults }} {{ t('result', nbResults) }}
+
- -

{{ t('person.information.profile') }}

- -
- -

{{ t('person.information.status') }}

- -
- {{ nbResults }} {{ t('result', nbResults) }} diff --git a/src/main/webapp/src/components/filter/ChipsFilter.vue b/src/main/webapp/src/components/filter/ChipsFilter.vue index 8b297b98..d07b0340 100644 --- a/src/main/webapp/src/components/filter/ChipsFilter.vue +++ b/src/main/webapp/src/components/filter/ChipsFilter.vue @@ -17,6 +17,6 @@ const filter = (payload: Array) => { diff --git a/src/main/webapp/src/locales/en/sources.json b/src/main/webapp/src/locales/en/sources.json index c5ccca44..f93672d5 100644 --- a/src/main/webapp/src/locales/en/sources.json +++ b/src/main/webapp/src/locales/en/sources.json @@ -14,6 +14,8 @@ "SarapisUi_CFA-CENTRE": "", "SarapisUi_EF2S-CENTRE": "", "SarapisUi_GIP-RECIA": "", - "SarapisUi_LA-CENTRE": "" + "SarapisUi_LA-CENTRE": "", + "SarapisUi_": "", + "official": "" } } diff --git a/src/main/webapp/src/locales/fr/sources.json b/src/main/webapp/src/locales/fr/sources.json index 4f36182b..34073bbf 100644 --- a/src/main/webapp/src/locales/fr/sources.json +++ b/src/main/webapp/src/locales/fr/sources.json @@ -14,6 +14,8 @@ "SarapisUi_CFA-CENTRE": "Compte local établissement", "SarapisUi_EF2S-CENTRE": "Compte local établissement", "SarapisUi_GIP-RECIA": "Compte local GIP RECIA", - "SarapisUi_LA-CENTRE": "Compte local enseignement agricole" + "SarapisUi_LA-CENTRE": "Compte local enseignement agricole", + "SarapisUi_": "Compte local", + "official": "Annuaire" } }