2020-08-31 10:40:30 +00:00
|
|
|
<template>
|
|
|
|
<div class="container section" v-if="group">
|
|
|
|
<nav class="breadcrumb" aria-label="breadcrumbs">
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<router-link
|
|
|
|
:to="{
|
|
|
|
name: RouteName.GROUP,
|
|
|
|
params: { preferredUsername: usernameWithDomain(group) },
|
|
|
|
}"
|
|
|
|
>{{ group.preferredUsername }}</router-link
|
|
|
|
>
|
|
|
|
</li>
|
|
|
|
<li class="is-active">
|
|
|
|
<router-link
|
|
|
|
:to="{
|
|
|
|
name: RouteName.TODO_LISTS,
|
|
|
|
params: { preferredUsername: usernameWithDomain(group) },
|
|
|
|
}"
|
|
|
|
>{{ $t("Events") }}</router-link
|
|
|
|
>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
<section>
|
|
|
|
<h1 class="title" v-if="group">
|
|
|
|
{{ $t("{group}'s events", { group: group.name || group.preferredUsername }) }}
|
|
|
|
</h1>
|
|
|
|
<p>
|
|
|
|
{{
|
|
|
|
$t(
|
|
|
|
"When someone from the group creates an event and attributes it to the group, it will show up here."
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
</p>
|
|
|
|
<b-loading :active.sync="$apollo.loading"></b-loading>
|
2020-09-02 15:42:17 +00:00
|
|
|
<section v-if="group">
|
2020-08-31 10:40:30 +00:00
|
|
|
<subtitle>
|
2020-09-02 15:42:17 +00:00
|
|
|
{{ showPassedEvents ? $t("Past events") : $t("Upcoming events") }}
|
2020-08-31 10:40:30 +00:00
|
|
|
</subtitle>
|
2020-09-02 15:42:17 +00:00
|
|
|
<b-switch v-model="showPassedEvents">{{ $t("Past events") }}</b-switch>
|
2020-08-31 10:40:30 +00:00
|
|
|
<transition-group name="list" tag="p">
|
2020-09-02 15:42:17 +00:00
|
|
|
<EventListViewCard
|
|
|
|
v-for="event in group.organizedEvents.elements"
|
|
|
|
:key="event.id"
|
|
|
|
:event="event"
|
|
|
|
/>
|
2020-08-31 10:40:30 +00:00
|
|
|
</transition-group>
|
2020-09-02 15:42:17 +00:00
|
|
|
<b-message
|
|
|
|
v-if="group.organizedEvents.elements.length === 0 && $apollo.loading === false"
|
|
|
|
type="is-danger"
|
|
|
|
>
|
|
|
|
{{ $t("No events found") }}
|
|
|
|
</b-message>
|
2020-08-31 10:40:30 +00:00
|
|
|
</section>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue } from "vue-property-decorator";
|
|
|
|
import { FETCH_GROUP } from "@/graphql/group";
|
|
|
|
import RouteName from "@/router/name";
|
2020-09-02 15:42:17 +00:00
|
|
|
import Subtitle from "@/components/Utils/Subtitle.vue";
|
|
|
|
import EventListViewCard from "@/components/Event/EventListViewCard.vue";
|
2020-08-31 10:40:30 +00:00
|
|
|
import { IGroup, usernameWithDomain } from "../../types/actor";
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
group: {
|
|
|
|
query: FETCH_GROUP,
|
|
|
|
variables() {
|
|
|
|
return {
|
|
|
|
name: this.$route.params.preferredUsername,
|
2020-09-02 15:42:17 +00:00
|
|
|
beforeDateTime: this.showPassedEvents ? new Date() : null,
|
|
|
|
afterDateTime: this.showPassedEvents ? null : new Date(),
|
2020-08-31 10:40:30 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-09-02 15:42:17 +00:00
|
|
|
components: {
|
|
|
|
Subtitle,
|
|
|
|
EventListViewCard,
|
|
|
|
},
|
2020-08-31 10:40:30 +00:00
|
|
|
})
|
|
|
|
export default class GroupEvents extends Vue {
|
|
|
|
group!: IGroup;
|
|
|
|
|
|
|
|
usernameWithDomain = usernameWithDomain;
|
|
|
|
|
|
|
|
RouteName = RouteName;
|
2020-09-02 15:42:17 +00:00
|
|
|
|
|
|
|
showPassedEvents = false;
|
2020-08-31 10:40:30 +00:00
|
|
|
}
|
|
|
|
</script>
|