2019-09-18 17:32:37 +02:00
|
|
|
<template>
|
2019-09-26 16:38:58 +02:00
|
|
|
<article class="box">
|
2020-12-01 17:32:07 +01:00
|
|
|
<div class="identity-header">
|
|
|
|
<figure class="image is-24x24" v-if="participation.actor.avatar">
|
|
|
|
<img class="is-rounded" :src="participation.actor.avatar.url" alt="" />
|
|
|
|
</figure>
|
|
|
|
{{ displayNameAndUsername(participation.actor) }}
|
|
|
|
</div>
|
|
|
|
<div class="list-card">
|
2021-06-10 10:05:47 +02:00
|
|
|
<div class="date-component">
|
|
|
|
<date-calendar-icon
|
|
|
|
:date="participation.event.beginsOn"
|
|
|
|
:small="true"
|
|
|
|
/>
|
|
|
|
</div>
|
2020-12-01 17:32:07 +01:00
|
|
|
<div class="content">
|
2019-10-07 16:48:13 +02:00
|
|
|
<div class="title-wrapper">
|
2020-11-30 10:24:11 +01:00
|
|
|
<router-link
|
|
|
|
:to="{
|
|
|
|
name: RouteName.EVENT,
|
|
|
|
params: { uuid: participation.event.uuid },
|
|
|
|
}"
|
|
|
|
>
|
2020-06-15 19:41:11 +02:00
|
|
|
<h3 class="title">{{ participation.event.title }}</h3>
|
2020-02-18 08:57:00 +01:00
|
|
|
</router-link>
|
2019-10-07 16:48:13 +02:00
|
|
|
</div>
|
2021-06-10 10:33:16 +02:00
|
|
|
<div class="participation-actor">
|
2019-10-13 16:24:43 +02:00
|
|
|
<span>
|
2020-11-30 10:24:11 +01:00
|
|
|
<b-icon
|
|
|
|
icon="earth"
|
|
|
|
v-if="participation.event.visibility === EventVisibility.PUBLIC"
|
|
|
|
/>
|
2020-02-18 08:57:00 +01:00
|
|
|
<b-icon
|
2020-06-15 18:12:49 +02:00
|
|
|
icon="link"
|
2020-11-30 10:24:11 +01:00
|
|
|
v-else-if="
|
|
|
|
participation.event.visibility === EventVisibility.UNLISTED
|
|
|
|
"
|
2020-06-15 18:12:49 +02:00
|
|
|
/>
|
|
|
|
<b-icon
|
|
|
|
icon="lock"
|
2020-11-30 10:24:11 +01:00
|
|
|
v-else-if="
|
|
|
|
participation.event.visibility === EventVisibility.PRIVATE
|
|
|
|
"
|
2020-02-18 08:57:00 +01:00
|
|
|
/>
|
2019-09-18 17:32:37 +02:00
|
|
|
</span>
|
2020-06-15 19:41:11 +02:00
|
|
|
<span
|
|
|
|
v-if="
|
2020-11-30 10:24:11 +01:00
|
|
|
participation.event.physicalAddress &&
|
|
|
|
participation.event.physicalAddress.locality
|
2020-06-15 19:41:11 +02:00
|
|
|
"
|
|
|
|
>{{ participation.event.physicalAddress.locality }} -</span
|
|
|
|
>
|
2021-06-10 10:33:16 +02:00
|
|
|
<i18n
|
|
|
|
tag="span"
|
|
|
|
path="Organized by {name}"
|
|
|
|
v-if="organizerActor.id !== currentActor.id"
|
|
|
|
>
|
|
|
|
<popover-actor-card
|
|
|
|
slot="name"
|
|
|
|
:actor="organizerActor"
|
|
|
|
:inline="true"
|
|
|
|
>
|
|
|
|
{{ organizerActor.displayName() }}
|
|
|
|
</popover-actor-card>
|
|
|
|
</i18n>
|
|
|
|
<span v-else>{{ $t("Organized by you") }}</span>
|
2020-06-15 19:41:11 +02:00
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span
|
|
|
|
class="participant-stats"
|
|
|
|
v-if="
|
2020-11-30 10:24:11 +01:00
|
|
|
![
|
|
|
|
ParticipantRole.PARTICIPANT,
|
|
|
|
ParticipantRole.NOT_APPROVED,
|
|
|
|
].includes(participation.role)
|
2020-06-15 19:41:11 +02:00
|
|
|
"
|
|
|
|
>
|
2020-11-30 10:24:11 +01:00
|
|
|
<span
|
|
|
|
v-if="participation.event.options.maximumAttendeeCapacity !== 0"
|
|
|
|
>
|
2020-02-18 08:57:00 +01:00
|
|
|
{{
|
2020-06-18 15:23:05 +02:00
|
|
|
$tc(
|
|
|
|
"{available}/{capacity} available places",
|
|
|
|
participation.event.options.maximumAttendeeCapacity -
|
2020-06-18 16:24:00 +02:00
|
|
|
participation.event.participantStats.participant,
|
2020-06-18 15:23:05 +02:00
|
|
|
{
|
|
|
|
available:
|
|
|
|
participation.event.options.maximumAttendeeCapacity -
|
2020-06-18 16:24:00 +02:00
|
|
|
participation.event.participantStats.participant,
|
2020-11-30 10:24:11 +01:00
|
|
|
capacity:
|
|
|
|
participation.event.options.maximumAttendeeCapacity,
|
2020-06-18 15:23:05 +02:00
|
|
|
}
|
|
|
|
)
|
2020-02-18 08:57:00 +01:00
|
|
|
}}
|
2019-09-26 16:38:58 +02:00
|
|
|
</span>
|
2019-10-15 10:39:26 +02:00
|
|
|
<span v-else>
|
2020-02-18 08:57:00 +01:00
|
|
|
{{
|
2020-11-30 10:24:11 +01:00
|
|
|
$tc(
|
|
|
|
"{count} participants",
|
|
|
|
participation.event.participantStats.participant,
|
|
|
|
{
|
|
|
|
count: participation.event.participantStats.participant,
|
|
|
|
}
|
|
|
|
)
|
2020-02-18 08:57:00 +01:00
|
|
|
}}
|
2019-10-15 10:39:26 +02:00
|
|
|
</span>
|
2020-02-18 08:57:00 +01:00
|
|
|
<span v-if="participation.event.participantStats.notApproved > 0">
|
|
|
|
<b-button
|
|
|
|
type="is-text"
|
|
|
|
@click="
|
|
|
|
gotToWithCheck(participation, {
|
|
|
|
name: RouteName.PARTICIPATIONS,
|
2020-06-18 15:23:05 +02:00
|
|
|
query: { role: ParticipantRole.NOT_APPROVED },
|
2020-02-18 08:57:00 +01:00
|
|
|
params: { eventId: participation.event.uuid },
|
|
|
|
})
|
|
|
|
"
|
|
|
|
>
|
|
|
|
{{
|
|
|
|
$tc(
|
|
|
|
"{count} requests waiting",
|
|
|
|
participation.event.participantStats.notApproved,
|
2021-06-10 10:33:16 +02:00
|
|
|
{
|
|
|
|
count: participation.event.participantStats.notApproved,
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
)
|
|
|
|
}}
|
2019-10-13 16:24:43 +02:00
|
|
|
</b-button>
|
2019-09-26 16:38:58 +02:00
|
|
|
</span>
|
2019-09-18 17:32:37 +02:00
|
|
|
</span>
|
2019-09-26 16:38:58 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-12-01 17:32:07 +01:00
|
|
|
<div class="actions">
|
|
|
|
<b-dropdown aria-role="list" position="is-bottom-left">
|
|
|
|
<b-button slot="trigger" role="button" icon-right="dots-horizontal">
|
|
|
|
{{ $t("Actions") }}
|
|
|
|
</b-button>
|
|
|
|
|
|
|
|
<b-dropdown-item
|
2020-02-18 08:57:00 +01:00
|
|
|
v-if="
|
2020-11-30 10:24:11 +01:00
|
|
|
![
|
|
|
|
ParticipantRole.PARTICIPANT,
|
|
|
|
ParticipantRole.NOT_APPROVED,
|
|
|
|
].includes(participation.role)
|
2020-02-18 08:57:00 +01:00
|
|
|
"
|
2020-12-01 17:32:07 +01:00
|
|
|
aria-role="listitem"
|
|
|
|
@click="
|
|
|
|
gotToWithCheck(participation, {
|
|
|
|
name: RouteName.EDIT_EVENT,
|
|
|
|
params: { eventId: participation.event.uuid },
|
|
|
|
})
|
|
|
|
"
|
2020-02-18 08:57:00 +01:00
|
|
|
>
|
2020-12-01 17:32:07 +01:00
|
|
|
<b-icon icon="pencil" />
|
|
|
|
{{ $t("Edit") }}
|
|
|
|
</b-dropdown-item>
|
|
|
|
|
|
|
|
<b-dropdown-item
|
|
|
|
v-if="participation.role === ParticipantRole.CREATOR"
|
|
|
|
aria-role="listitem"
|
|
|
|
@click="
|
|
|
|
gotToWithCheck(participation, {
|
|
|
|
name: RouteName.DUPLICATE_EVENT,
|
|
|
|
params: { eventId: participation.event.uuid },
|
|
|
|
})
|
|
|
|
"
|
|
|
|
>
|
|
|
|
<b-icon icon="content-duplicate" />
|
|
|
|
{{ $t("Duplicate") }}
|
|
|
|
</b-dropdown-item>
|
|
|
|
|
|
|
|
<b-dropdown-item
|
2020-02-18 08:57:00 +01:00
|
|
|
v-if="
|
2020-11-30 10:24:11 +01:00
|
|
|
![
|
|
|
|
ParticipantRole.PARTICIPANT,
|
|
|
|
ParticipantRole.NOT_APPROVED,
|
|
|
|
].includes(participation.role)
|
2020-02-18 08:57:00 +01:00
|
|
|
"
|
2020-12-01 17:32:07 +01:00
|
|
|
aria-role="listitem"
|
2020-02-18 08:57:00 +01:00
|
|
|
@click="openDeleteEventModalWrapper"
|
|
|
|
>
|
2020-12-01 17:32:07 +01:00
|
|
|
<b-icon icon="delete" />
|
|
|
|
{{ $t("Delete") }}
|
|
|
|
</b-dropdown-item>
|
|
|
|
|
|
|
|
<b-dropdown-item
|
2020-02-18 08:57:00 +01:00
|
|
|
v-if="
|
2020-11-30 10:24:11 +01:00
|
|
|
![
|
|
|
|
ParticipantRole.PARTICIPANT,
|
|
|
|
ParticipantRole.NOT_APPROVED,
|
|
|
|
].includes(participation.role)
|
2020-02-18 08:57:00 +01:00
|
|
|
"
|
2020-12-01 17:32:07 +01:00
|
|
|
aria-role="listitem"
|
|
|
|
@click="
|
|
|
|
gotToWithCheck(participation, {
|
|
|
|
name: RouteName.PARTICIPATIONS,
|
|
|
|
params: { eventId: participation.event.uuid },
|
|
|
|
})
|
|
|
|
"
|
2020-02-18 08:57:00 +01:00
|
|
|
>
|
2020-12-01 17:32:07 +01:00
|
|
|
<b-icon icon="account-multiple-plus" />
|
|
|
|
{{ $t("Manage participations") }}
|
|
|
|
</b-dropdown-item>
|
|
|
|
|
|
|
|
<b-dropdown-item aria-role="listitem" has-link>
|
|
|
|
<router-link
|
2020-11-30 10:24:11 +01:00
|
|
|
:to="{
|
|
|
|
name: RouteName.EVENT,
|
|
|
|
params: { uuid: participation.event.uuid },
|
|
|
|
}"
|
2020-02-18 08:57:00 +01:00
|
|
|
>
|
2020-12-01 17:32:07 +01:00
|
|
|
<b-icon icon="view-compact" />
|
|
|
|
{{ $t("View event page") }}
|
|
|
|
</router-link>
|
|
|
|
</b-dropdown-item>
|
|
|
|
</b-dropdown>
|
2019-09-18 17:32:37 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-02-18 08:57:00 +01:00
|
|
|
</article>
|
2019-09-18 17:32:37 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-02-18 08:57:00 +01:00
|
|
|
import { Component, Prop } from "vue-property-decorator";
|
|
|
|
import DateCalendarIcon from "@/components/Event/DateCalendarIcon.vue";
|
|
|
|
import { mixins } from "vue-class-component";
|
2020-08-31 12:40:30 +02:00
|
|
|
import { RawLocation, Route } from "vue-router";
|
2020-11-27 19:27:44 +01:00
|
|
|
import { EventVisibility, ParticipantRole } from "@/types/enums";
|
|
|
|
import { IParticipant } from "../../types/participant.model";
|
|
|
|
import { IEventCardOptions } from "../../types/event.model";
|
2020-12-01 17:32:07 +01:00
|
|
|
import { displayNameAndUsername, IActor, IPerson } from "../../types/actor";
|
2020-02-18 08:57:00 +01:00
|
|
|
import ActorMixin from "../../mixins/actor";
|
|
|
|
import { CURRENT_ACTOR_CLIENT } from "../../graphql/actor";
|
|
|
|
import EventMixin from "../../mixins/event";
|
|
|
|
import RouteName from "../../router/name";
|
|
|
|
import { changeIdentity } from "../../utils/auth";
|
2020-06-15 19:41:11 +02:00
|
|
|
import PopoverActorCard from "../Account/PopoverActorCard.vue";
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2019-10-05 21:17:18 +02:00
|
|
|
const defaultOptions: IEventCardOptions = {
|
|
|
|
hideDate: true,
|
|
|
|
loggedPerson: false,
|
|
|
|
hideDetails: false,
|
|
|
|
organizerActor: null,
|
2020-10-01 16:13:07 +02:00
|
|
|
memberofGroup: false,
|
2019-10-05 21:17:18 +02:00
|
|
|
};
|
|
|
|
|
2019-09-18 17:32:37 +02:00
|
|
|
@Component({
|
|
|
|
components: {
|
|
|
|
DateCalendarIcon,
|
2020-06-15 19:41:11 +02:00
|
|
|
PopoverActorCard,
|
2019-09-18 17:32:37 +02:00
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
currentActor: {
|
|
|
|
query: CURRENT_ACTOR_CLIENT,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
export default class EventListCard extends mixins(ActorMixin, EventMixin) {
|
2019-10-05 21:17:18 +02:00
|
|
|
/**
|
|
|
|
* The participation associated
|
|
|
|
*/
|
2019-09-18 17:32:37 +02:00
|
|
|
@Prop({ required: true }) participation!: IParticipant;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-10-05 21:17:18 +02:00
|
|
|
/**
|
|
|
|
* Options are merged with default options
|
|
|
|
*/
|
2020-02-18 08:57:00 +01:00
|
|
|
@Prop({ required: false, default: () => defaultOptions })
|
|
|
|
options!: IEventCardOptions;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
|
|
|
currentActor!: IPerson;
|
|
|
|
|
|
|
|
ParticipantRole = ParticipantRole;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2019-09-18 17:32:37 +02:00
|
|
|
EventVisibility = EventVisibility;
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
displayNameAndUsername = displayNameAndUsername;
|
|
|
|
|
2019-10-03 12:32:20 +02:00
|
|
|
RouteName = RouteName;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
|
|
|
get mergedOptions(): IEventCardOptions {
|
2019-10-05 21:17:18 +02:00
|
|
|
return { ...defaultOptions, ...this.options };
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete the event
|
|
|
|
*/
|
2020-08-31 12:40:30 +02:00
|
|
|
async openDeleteEventModalWrapper(): Promise<void> {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
2020-07-09 17:24:28 +02:00
|
|
|
// @ts-ignore
|
2020-11-19 17:06:28 +01:00
|
|
|
await this.openDeleteEventModal(this.participation.event);
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
|
2020-11-30 10:24:11 +01:00
|
|
|
async gotToWithCheck(
|
|
|
|
participation: IParticipant,
|
|
|
|
route: RawLocation
|
|
|
|
): Promise<Route> {
|
|
|
|
if (
|
|
|
|
participation.actor.id !== this.currentActor.id &&
|
|
|
|
participation.event.organizerActor
|
|
|
|
) {
|
2019-10-13 16:24:43 +02:00
|
|
|
const organizer = participation.event.organizerActor as IPerson;
|
|
|
|
await changeIdentity(this.$apollo.provider.defaultClient, organizer);
|
|
|
|
this.$buefy.notification.open({
|
2020-02-18 08:57:00 +01:00
|
|
|
message: this.$t(
|
|
|
|
"Current identity has been changed to {identityName} in order to manage this event.",
|
|
|
|
{
|
|
|
|
identityName: organizer.preferredUsername,
|
|
|
|
}
|
|
|
|
) as string,
|
|
|
|
type: "is-info",
|
|
|
|
position: "is-bottom-right",
|
2019-10-13 16:24:43 +02:00
|
|
|
duration: 5000,
|
|
|
|
});
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
return this.$router.push(route);
|
2019-10-13 16:24:43 +02:00
|
|
|
}
|
2020-12-01 17:32:07 +01:00
|
|
|
|
|
|
|
get organizerActor(): IActor | undefined {
|
|
|
|
if (
|
|
|
|
this.participation.event.attributedTo &&
|
|
|
|
this.participation.event.attributedTo.id
|
|
|
|
) {
|
|
|
|
return this.participation.event.attributedTo;
|
|
|
|
}
|
|
|
|
return this.participation.event.organizerActor;
|
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-10-13 16:24:43 +02:00
|
|
|
<style lang="scss" scoped>
|
2020-02-18 08:57:00 +01:00
|
|
|
article.box {
|
|
|
|
div.tag-container {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 0;
|
|
|
|
margin-right: -5px;
|
|
|
|
z-index: 10;
|
|
|
|
max-width: 40%;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
span.tag {
|
|
|
|
margin: 5px auto;
|
|
|
|
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 1);
|
|
|
|
/*word-break: break-all;*/
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
overflow: hidden;
|
|
|
|
display: block;
|
|
|
|
/*text-align: right;*/
|
|
|
|
font-size: 1em;
|
|
|
|
/*padding: 0 1px;*/
|
|
|
|
line-height: 1.75em;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
.list-card {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2021-06-10 10:33:16 +02:00
|
|
|
padding: 0 6px;
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
.actions {
|
|
|
|
padding-right: 7.5px;
|
|
|
|
cursor: pointer;
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
div.content {
|
|
|
|
flex: 1;
|
|
|
|
padding: 5px;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
.participation-actor span,
|
|
|
|
.participant-stats span {
|
|
|
|
padding: 0 5px;
|
2020-06-17 15:54:24 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
button {
|
|
|
|
height: auto;
|
|
|
|
padding-top: 0;
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
div.title-wrapper {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
div.date-component {
|
|
|
|
flex: 0;
|
|
|
|
margin-right: 16px;
|
2019-10-13 16:24:43 +02:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
a {
|
|
|
|
text-decoration: none;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
2020-06-17 15:54:24 +02:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
.title {
|
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-line-clamp: 2;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
overflow: hidden;
|
|
|
|
font-weight: 400;
|
|
|
|
line-height: 1em;
|
|
|
|
font-size: 1.6em;
|
|
|
|
padding-bottom: 5px;
|
|
|
|
margin: auto 0;
|
2020-06-17 15:54:24 +02:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
2020-12-01 17:32:07 +01:00
|
|
|
}
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
|
2020-12-01 17:32:07 +01:00
|
|
|
.identity-header {
|
|
|
|
background: $yellow-2;
|
|
|
|
display: flex;
|
|
|
|
padding: 5px;
|
|
|
|
|
|
|
|
figure {
|
|
|
|
padding-right: 3px;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-12-01 17:32:07 +01:00
|
|
|
|
|
|
|
& > .columns {
|
|
|
|
padding: 1.25rem;
|
|
|
|
}
|
|
|
|
padding: 0;
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
</style>
|