2019-09-18 17:32:37 +02:00
|
|
|
<template>
|
2019-09-26 16:38:58 +02:00
|
|
|
<article class="box">
|
|
|
|
<div class="columns">
|
|
|
|
<div class="content column">
|
2019-10-07 16:48:13 +02:00
|
|
|
<div class="title-wrapper">
|
2019-10-15 10:39:26 +02:00
|
|
|
<div class="date-component">
|
2019-10-07 16:48:13 +02:00
|
|
|
<date-calendar-icon :date="participation.event.beginsOn" />
|
|
|
|
</div>
|
2020-02-18 08:57:00 +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>
|
2019-10-13 16:24:43 +02:00
|
|
|
<div class="participation-actor has-text-grey">
|
|
|
|
<span>
|
|
|
|
<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"
|
|
|
|
v-else-if="participation.event.visibility === EventVisibility.UNLISTED"
|
|
|
|
/>
|
|
|
|
<b-icon
|
|
|
|
icon="lock"
|
|
|
|
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="
|
|
|
|
participation.event.physicalAddress && participation.event.physicalAddress.locality
|
|
|
|
"
|
|
|
|
>{{ participation.event.physicalAddress.locality }} -</span
|
|
|
|
>
|
|
|
|
<span>
|
|
|
|
<i18n tag="span" path="Organized by {name}">
|
|
|
|
<popover-actor-card
|
|
|
|
slot="name"
|
|
|
|
:actor="participation.event.organizerActor"
|
|
|
|
:inline="true"
|
|
|
|
>
|
|
|
|
{{ participation.event.organizerActor.displayName() }}
|
|
|
|
</popover-actor-card>
|
|
|
|
</i18n>
|
|
|
|
<i18n
|
|
|
|
v-if="participation.role === ParticipantRole.PARTICIPANT"
|
|
|
|
path="Going as {name}"
|
|
|
|
tag="span"
|
|
|
|
>
|
|
|
|
<popover-actor-card slot="name" :actor="participation.actor" :inline="true">
|
|
|
|
{{ participation.actor.displayName() }}
|
|
|
|
</popover-actor-card>
|
|
|
|
</i18n>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<span
|
|
|
|
class="participant-stats"
|
|
|
|
v-if="
|
|
|
|
![ParticipantRole.PARTICIPANT, ParticipantRole.NOT_APPROVED].includes(
|
|
|
|
participation.role
|
|
|
|
)
|
|
|
|
"
|
|
|
|
>
|
2019-10-13 16:24:43 +02: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-06-18 15:23:05 +02:00
|
|
|
capacity: participation.event.options.maximumAttendeeCapacity,
|
|
|
|
}
|
|
|
|
)
|
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
|
|
|
{{
|
|
|
|
$tc("{count} participants", participation.event.participantStats.participant, {
|
|
|
|
count: participation.event.participantStats.participant,
|
|
|
|
})
|
|
|
|
}}
|
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,
|
|
|
|
{ count: participation.event.participantStats.notApproved }
|
|
|
|
)
|
|
|
|
}}
|
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>
|
|
|
|
<div class="actions column is-narrow">
|
|
|
|
<ul>
|
2020-02-18 08:57:00 +01:00
|
|
|
<li
|
|
|
|
v-if="
|
|
|
|
![ParticipantRole.PARTICIPANT, ParticipantRole.NOT_APPROVED].includes(
|
|
|
|
participation.role
|
|
|
|
)
|
|
|
|
"
|
|
|
|
>
|
2019-10-13 16:24:43 +02:00
|
|
|
<b-button
|
2020-02-18 08:57:00 +01:00
|
|
|
type="is-text"
|
|
|
|
@click="
|
|
|
|
gotToWithCheck(participation, {
|
|
|
|
name: RouteName.EDIT_EVENT,
|
|
|
|
params: { eventId: participation.event.uuid },
|
|
|
|
})
|
|
|
|
"
|
|
|
|
icon-left="pencil"
|
|
|
|
>{{ $t("Edit") }}</b-button
|
2019-10-13 16:24:43 +02:00
|
|
|
>
|
2019-09-26 16:38:58 +02:00
|
|
|
</li>
|
2020-06-11 11:45:52 +02:00
|
|
|
<li v-if="participation.role === ParticipantRole.CREATOR">
|
2020-04-23 00:27:09 +02:00
|
|
|
<b-button
|
|
|
|
type="is-text"
|
|
|
|
@click="
|
|
|
|
gotToWithCheck(participation, {
|
|
|
|
name: RouteName.DUPLICATE_EVENT,
|
|
|
|
params: { eventId: participation.event.uuid },
|
|
|
|
})
|
|
|
|
"
|
|
|
|
icon-left="content-duplicate"
|
|
|
|
>
|
|
|
|
{{ $t("Duplicate") }}
|
|
|
|
</b-button>
|
|
|
|
</li>
|
2020-02-18 08:57:00 +01:00
|
|
|
<li
|
|
|
|
v-if="
|
|
|
|
![ParticipantRole.PARTICIPANT, ParticipantRole.NOT_APPROVED].includes(
|
|
|
|
participation.role
|
|
|
|
)
|
|
|
|
"
|
|
|
|
@click="openDeleteEventModalWrapper"
|
|
|
|
>
|
|
|
|
<b-button type="is-text" icon-left="delete">{{ $t("Delete") }}</b-button>
|
2019-09-26 16:38:58 +02:00
|
|
|
</li>
|
2020-02-18 08:57:00 +01:00
|
|
|
<li
|
|
|
|
v-if="
|
|
|
|
![ParticipantRole.PARTICIPANT, ParticipantRole.NOT_APPROVED].includes(
|
|
|
|
participation.role
|
|
|
|
)
|
|
|
|
"
|
|
|
|
>
|
2019-10-13 16:24:43 +02:00
|
|
|
<b-button
|
2020-02-18 08:57:00 +01:00
|
|
|
type="is-text"
|
|
|
|
@click="
|
|
|
|
gotToWithCheck(participation, {
|
|
|
|
name: RouteName.PARTICIPATIONS,
|
|
|
|
params: { eventId: participation.event.uuid },
|
|
|
|
})
|
|
|
|
"
|
|
|
|
icon-left="account-multiple-plus"
|
|
|
|
>{{ $t("Manage participations") }}</b-button
|
2019-10-13 16:24:43 +02:00
|
|
|
>
|
2019-09-26 16:38:58 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2019-10-13 16:24:43 +02:00
|
|
|
<b-button
|
|
|
|
tag="router-link"
|
|
|
|
icon-left="view-compact"
|
|
|
|
type="is-text"
|
2020-02-18 08:57:00 +01:00
|
|
|
:to="{ name: RouteName.EVENT, params: { uuid: participation.event.uuid } }"
|
|
|
|
>{{ $t("View event page") }}</b-button
|
|
|
|
>
|
2019-09-26 16:38:58 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
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-02-18 08:57:00 +01:00
|
|
|
import {
|
|
|
|
IParticipant,
|
|
|
|
ParticipantRole,
|
|
|
|
EventVisibility,
|
|
|
|
IEventCardOptions,
|
|
|
|
} from "../../types/event.model";
|
|
|
|
import { IPerson } from "../../types/actor";
|
|
|
|
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
|
|
|
|
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
|
2019-09-18 17:32:37 +02:00
|
|
|
await this.openDeleteEventModal(this.participation.event, this.currentActor);
|
|
|
|
}
|
|
|
|
|
2020-08-31 12:40:30 +02:00
|
|
|
async gotToWithCheck(participation: IParticipant, route: RawLocation): Promise<Route> {
|
2019-10-13 16:24:43 +02:00
|
|
|
if (participation.actor.id !== this.currentActor.id && participation.event.organizerActor) {
|
|
|
|
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
|
|
|
}
|
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
|
|
|
}
|
|
|
|
div.content {
|
|
|
|
padding: 5px;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.participation-actor span,
|
|
|
|
.participant-stats span {
|
|
|
|
padding: 0 5px;
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
button {
|
|
|
|
height: auto;
|
|
|
|
padding-top: 0;
|
2019-10-13 16:24:43 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
div.title-wrapper {
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
div.date-component {
|
|
|
|
flex: 0;
|
|
|
|
margin-right: 16px;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
|
2020-06-17 15:54:24 +02:00
|
|
|
a {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.title {
|
|
|
|
display: -webkit-box;
|
2020-06-17 16:45:52 +02:00
|
|
|
-webkit-line-clamp: 2;
|
2020-02-18 08:57:00 +01:00
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
overflow: hidden;
|
|
|
|
font-weight: 400;
|
|
|
|
line-height: 1em;
|
|
|
|
font-size: 1.6em;
|
|
|
|
padding-bottom: 5px;
|
|
|
|
margin: auto 0;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.actions {
|
|
|
|
ul li {
|
|
|
|
margin: 0 auto;
|
|
|
|
.is-link {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
.button.is-text {
|
|
|
|
text-decoration: none;
|
2019-10-13 16:24:43 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
/deep/ span:first-child i.mdi::before {
|
|
|
|
font-size: 24px !important;
|
2019-10-13 16:24:43 +02:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
|
2020-02-18 08:57:00 +01:00
|
|
|
/deep/ span:last-child {
|
|
|
|
padding-left: 4px;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
2020-06-17 15:54:24 +02:00
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background: #f5f5f5;
|
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
|
|
|
|
* {
|
|
|
|
font-size: 0.8rem;
|
2020-06-17 15:54:24 +02:00
|
|
|
color: $background-color;
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
}
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
</style>
|