-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added modal that shows the participants for an event on that day
- Loading branch information
Felix Ruf
committed
Jan 23, 2024
1 parent
19712cb
commit 3c4411a
Showing
9 changed files
with
193 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import useApi from "./api"; | ||
import { IMessage } from "@/interfaces/IMessage"; | ||
|
||
export default async function getEventParticipants(date: string) { | ||
const { error, response, request } = useApi<string[] | IMessage>( | ||
'GET', | ||
`api/participations/event/${date}` | ||
); | ||
|
||
await request(); | ||
|
||
return { error, response }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/Resources/src/components/eventParticipation/EventPopup.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<template> | ||
<InformationCircleIcon | ||
class="h-[24px] w-[24px] text-primary hover:cursor-pointer" | ||
@click="showParticipations = true" | ||
/> | ||
<PopupModal | ||
:isOpen="showParticipations" | ||
> | ||
<div | ||
class="grid max-h-[70vh] min-w-[300px] max-w-[310px] grid-cols-1 grid-rows-[auto_minmax(0,1fr)_auto] md:max-w-lg" | ||
> | ||
<div class="flex h-[48px] flex-row gap-2 rounded-t-lg bg-[#1c5298] p-2"> | ||
<span class="grow self-center justify-self-center truncate font-bold uppercase leading-4 tracking-[3px] text-white"> | ||
{{ t('dashboard.participations').replace('%EventTitle%', eventTitle) }} | ||
</span> | ||
<XCircleIcon | ||
class="h-8 w-8 cursor-pointer self-end text-white transition-transform hover:scale-[120%] hover:text-[#FAFAFA]" | ||
@click="showParticipations = false" | ||
/> | ||
</div> | ||
<RefreshIcon | ||
v-if="isLoading" | ||
class="aspect-[1/1] h-[75px] animate-spin-loading place-self-center p-4 text-primary drop-shadow-[0_0_0.35rem_rgba(0,0,0,0.75)]" | ||
/> | ||
<ul | ||
v-else-if="participations.length > 0" | ||
class="overflow-y-auto p-4" | ||
> | ||
<li | ||
v-for="(participation, index) in participations" | ||
:key="`${participation}_${index}`" | ||
class="border-b-2 p-2 last:border-b-0" | ||
> | ||
{{ participation }} | ||
</li> | ||
</ul> | ||
<span | ||
v-else | ||
class="p-4" | ||
> | ||
{{ t('dashboard.noParticipants') }} | ||
</span> | ||
<span | ||
class="w-full border-t-2 p-2 text-center font-bold" | ||
> | ||
{{ t('dashboard.participationCount').replace('%count%', participations.length.toString()) }} | ||
</span> | ||
</div> | ||
</PopupModal> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ref, watch } from 'vue'; | ||
import PopupModal from '../misc/PopupModal.vue'; | ||
import { InformationCircleIcon, RefreshIcon } from '@heroicons/vue/outline'; | ||
import { XCircleIcon } from '@heroicons/vue/solid'; | ||
import { useI18n } from 'vue-i18n'; | ||
import { useEvents } from '@/stores/eventsStore'; | ||
const { t } = useI18n(); | ||
const { getParticipantsForEvent } = useEvents(); | ||
const props = defineProps<{ | ||
eventTitle: string, | ||
date: string | ||
}>(); | ||
const showParticipations = ref(false); | ||
const participations = ref([]); | ||
const isLoading = ref(false); | ||
watch( | ||
showParticipations, | ||
async () => { | ||
if (showParticipations.value === true) { | ||
isLoading.value = true; | ||
participations.value = await getParticipantsForEvent(props.date); | ||
isLoading.value = false; | ||
} | ||
} | ||
) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<TransitionRoot | ||
as="template" | ||
:show="isOpen" | ||
> | ||
<Dialog | ||
class="relative z-50" | ||
> | ||
<div | ||
class="fixed inset-0 flex items-center justify-center bg-[rgba(0,0,0,0.1)]" | ||
> | ||
<TransitionChild | ||
as="template" | ||
enter="duration-300 ease-out" | ||
enter-from="opacity-0" | ||
enter-to="opacity-100" | ||
leave="duration-200 ease-in" | ||
leave-from="opacity-100" | ||
leave-to="opacity-0" | ||
> | ||
<DialogPanel | ||
class="relative overflow-hidden rounded-lg bg-white text-left shadow-xl" | ||
> | ||
<slot /> | ||
</DialogPanel> | ||
</TransitionChild> | ||
</div> | ||
</Dialog> | ||
</TransitionRoot> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { Dialog, DialogPanel, TransitionChild, TransitionRoot } from '@headlessui/vue'; | ||
defineProps<{ | ||
isOpen: boolean | ||
}>(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters