From d330ab52a4ebec455f5bc759f85c0e1dbc4bf21c Mon Sep 17 00:00:00 2001 From: Iris Olfermann Date: Mon, 23 Oct 2023 09:04:03 +0200 Subject: [PATCH] first test for the filter, doesn't work yet --- .../src/api/getParticipationsByDate.ts | 11 ++++- .../dashboard/ParticipantsListModal.vue | 41 +++++++++++++------ .../src/views/ParticipantsListByDay.vue | 18 ++++++-- 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/src/Resources/src/api/getParticipationsByDate.ts b/src/Resources/src/api/getParticipationsByDate.ts index 6a2256a0e..bebf9310b 100644 --- a/src/Resources/src/api/getParticipationsByDate.ts +++ b/src/Resources/src/api/getParticipationsByDate.ts @@ -1,8 +1,10 @@ import useApi from '@/api/api'; import type { DateTime } from '@/api/getDashboardData'; -import { onMounted, onUnmounted, reactive, readonly, ref } from 'vue'; +import { onMounted, onUnmounted, reactive, readonly, ref, computed } from 'vue'; import type { Dictionary } from '../../types/types'; +import { useI18n } from 'vue-i18n'; + export type ListData = { data: Dictionary>>> day: DateTime @@ -35,6 +37,13 @@ export function useParticipantsByDayData(date: string){ 'GET', `/api/print/participations/${date}`, ); + if (filter.value !== '') { + const output = []; + output.push(...listData.data.filter(profile => ( + listDataState.participantName.toLowerCase().includes(filter.value.toLowerCase()) || + profile.roles.join(' ').toLowerCase().includes(filter.value.toLowerCase()) + ))); + } if (loaded.value === false) { await request(); diff --git a/src/Resources/src/components/dashboard/ParticipantsListModal.vue b/src/Resources/src/components/dashboard/ParticipantsListModal.vue index d94a1a3ad..a24e9a7e2 100644 --- a/src/Resources/src/components/dashboard/ParticipantsListModal.vue +++ b/src/Resources/src/components/dashboard/ParticipantsListModal.vue @@ -5,7 +5,7 @@ @close="closeParticipantsModal(false)" >
{{ t('dashboard.print') }} +
+ +
import { Dialog, DialogPanel, DialogTitle } from '@headlessui/vue'; -import { ref } from 'vue'; +import { computed, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import CancelButton from '../misc/CancelButton.vue'; @@ -42,7 +53,6 @@ import ParticipantsListByDay from '@/views/ParticipantsListByDay.vue'; import { useComponentHeights } from '@/services/useComponentHeights'; import { onMounted, onUnmounted } from 'vue'; - const { loadShowParticipations, activatePeriodicFetch, disablePeriodicFetch } = getShowParticipations(); const { addWindowHeightListener, removeWindowHeightListener } = useComponentHeights(); const progress = useProgress().start(); @@ -53,19 +63,14 @@ const { t } = useI18n(); const props = defineProps<{ openParticipantsModal: boolean, date: string, + modelValue: string, + text: string, + filter: string }>(); -const emit = defineEmits(['closeDialog']); - -const selectedCombi = ref([-1, -1]); +const filter = ref(''); -function closeParticipantsModal(doSubmit: boolean) { - if (doSubmit === true && selectedCombi.value.includes(-1) === false) { - emit('closeDialog', selectedCombi.value); - } else { - emit('closeDialog', []); - } -} +const emit = defineEmits(['closeDialog', 'update:modelValue', 'change:showHidden']); onMounted(async () => { await loadShowParticipations(); @@ -79,4 +84,14 @@ onUnmounted(() => { removeWindowHeightListener(); }); +const selectedCombi = ref([-1, -1]); + +function closeParticipantsModal(doSubmit: boolean) { + if (doSubmit === true && selectedCombi.value.includes(-1) === false) { + emit('closeDialog', selectedCombi.value); + } else { + emit('closeDialog', []); + } +} + \ No newline at end of file diff --git a/src/Resources/src/views/ParticipantsListByDay.vue b/src/Resources/src/views/ParticipantsListByDay.vue index 903ff4b91..9a62cb202 100644 --- a/src/Resources/src/views/ParticipantsListByDay.vue +++ b/src/Resources/src/views/ParticipantsListByDay.vue @@ -2,15 +2,23 @@