2019-10-05 21:17:18 +02:00
|
|
|
<docs>
|
|
|
|
A simple card for a participation (we should rename it)
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<EventListCard
|
|
|
|
:participation="participation"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
participation: {
|
|
|
|
event: {
|
|
|
|
title: 'Vue Styleguidist first meetup: learn the basics!',
|
|
|
|
id: 5,
|
|
|
|
uuid: 'some uuid',
|
|
|
|
beginsOn: new Date(),
|
|
|
|
organizerActor: {
|
|
|
|
preferredUsername: 'tcit',
|
|
|
|
name: 'Some Random Dude',
|
|
|
|
domain: null,
|
|
|
|
id: 4,
|
|
|
|
displayName() { return 'Some random dude' }
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
maximumAttendeeCapacity: 4
|
|
|
|
},
|
|
|
|
participantStats: {
|
|
|
|
approved: 1,
|
|
|
|
unapproved: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
actor: {
|
|
|
|
preferredUsername: 'tcit',
|
|
|
|
name: 'Some Random Dude',
|
|
|
|
domain: null,
|
|
|
|
id: 4,
|
|
|
|
displayName() { return 'Some random dude' }
|
|
|
|
},
|
|
|
|
role: 'CREATOR',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
```
|
|
|
|
</docs>
|
|
|
|
|
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">
|
|
|
|
<div class="date-component" v-if="!mergedOptions.hideDate">
|
|
|
|
<date-calendar-icon :date="participation.event.beginsOn" />
|
|
|
|
</div>
|
2019-10-09 17:54:35 +02:00
|
|
|
<h2 class="title">{{ participation.event.title }}</h2>
|
2019-10-07 16:48:13 +02:00
|
|
|
</div>
|
2019-10-13 16:24:43 +02:00
|
|
|
<div class="participation-actor has-text-grey">
|
2019-09-26 16:38:58 +02:00
|
|
|
<span v-if="participation.event.physicalAddress && participation.event.physicalAddress.locality">{{ participation.event.physicalAddress.locality }} - </span>
|
2019-10-13 16:24:43 +02:00
|
|
|
<span>
|
|
|
|
{{ $t('Organized by {name}', { name: participation.event.organizerActor.displayName() } ) }}</span>
|
|
|
|
<span v-if="participation.role === ParticipantRole.PARTICIPANT">{{ $t('Going as {name}', { name: participation.actor.displayName() }) }}</span>
|
2019-09-26 16:38:58 +02:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div class="columns">
|
|
|
|
<span class="column is-narrow">
|
2019-10-13 16:24:43 +02:00
|
|
|
<b-icon icon="earth" v-if="participation.event.visibility === EventVisibility.PUBLIC" />
|
|
|
|
<b-icon icon="lock-open" v-if="participation.event.visibility === EventVisibility.UNLISTED" />
|
|
|
|
<b-icon icon="lock" v-if="participation.event.visibility === EventVisibility.PRIVATE" />
|
2019-09-18 17:32:37 +02:00
|
|
|
</span>
|
2019-10-13 16:24:43 +02:00
|
|
|
<span class="column is-narrow participant-stats">
|
|
|
|
<!-- <span v-if="participation.event.options.maximumAttendeeCapacity !== 0">-->
|
|
|
|
<!-- {{ $tc('{count} participants', participation.event.participantStats.participants, { count: participation.event.participantStats.participants })}}-->
|
|
|
|
<!-- </span>-->
|
|
|
|
<span v-if="participation.event.options.maximumAttendeeCapacity !== 0">
|
|
|
|
{{ $t('{approved} / {total} seats', {approved: participation.event.participantStats.participants, total: participation.event.options.maximumAttendeeCapacity }) }}
|
|
|
|
<!-- <b-progress-->
|
|
|
|
<!-- v-if="participation.event.options.maximumAttendeeCapacity > 0"-->
|
|
|
|
<!-- size="is-medium"-->
|
|
|
|
<!-- :value="participation.event.participantStats.participants * 100 / participation.event.options.maximumAttendeeCapacity">-->
|
|
|
|
<!-- </b-progress>-->
|
2019-09-26 16:38:58 +02:00
|
|
|
</span>
|
2019-10-13 16:24:43 +02:00
|
|
|
<span v-else>{{ $t('No participants yet') }}</span>
|
2019-09-26 16:38:58 +02:00
|
|
|
<span
|
|
|
|
v-if="participation.event.participantStats.unapproved > 0">
|
2019-10-13 16:24:43 +02:00
|
|
|
<b-button type="is-text" @click="gotToWithCheck(participation, { name: RouteName.PARTICIPATIONS, params: { eventId: participation.event.uuid } })">
|
|
|
|
{{ $tc('{count} requests waiting', participation.event.participantStats.unapproved, { count: participation.event.participantStats.unapproved })}}
|
|
|
|
</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>
|
|
|
|
<li v-if="!([ParticipantRole.PARTICIPANT, ParticipantRole.NOT_APPROVED].includes(participation.role))">
|
2019-10-13 16:24:43 +02:00
|
|
|
<b-button
|
|
|
|
type="is-text"
|
|
|
|
@click="gotToWithCheck(participation, { name: RouteName.EDIT_EVENT, params: { eventId: participation.event.uuid } })"
|
|
|
|
icon-left="pencil"
|
|
|
|
>
|
|
|
|
{{ $t('Edit') }}
|
|
|
|
</b-button>
|
2019-09-26 16:38:58 +02:00
|
|
|
</li>
|
2019-10-13 16:24:43 +02: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>
|
|
|
|
<li v-if="!([ParticipantRole.PARTICIPANT, ParticipantRole.NOT_APPROVED].includes(participation.role))">
|
2019-10-13 16:24:43 +02:00
|
|
|
<b-button
|
|
|
|
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-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"
|
|
|
|
: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>
|
|
|
|
</article>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2019-10-13 16:24:43 +02:00
|
|
|
import { IParticipant, ParticipantRole, EventVisibility, IEventCardOptions } from '@/types/event.model';
|
2019-09-18 17:32:37 +02:00
|
|
|
import { Component, Prop } from 'vue-property-decorator';
|
|
|
|
import DateCalendarIcon from '@/components/Event/DateCalendarIcon.vue';
|
2019-10-13 16:24:43 +02:00
|
|
|
import { IPerson } from '@/types/actor';
|
2019-09-18 17:32:37 +02:00
|
|
|
import { mixins } from 'vue-class-component';
|
|
|
|
import ActorMixin from '@/mixins/actor';
|
2019-10-13 16:24:43 +02:00
|
|
|
import { CURRENT_ACTOR_CLIENT } from '@/graphql/actor';
|
2019-09-18 17:32:37 +02:00
|
|
|
import EventMixin from '@/mixins/event';
|
|
|
|
import { RouteName } from '@/router';
|
2019-10-13 16:24:43 +02:00
|
|
|
import { changeIdentity } from '@/utils/auth';
|
|
|
|
import { Route } from 'vue-router';
|
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,
|
|
|
|
};
|
|
|
|
|
2019-09-18 17:32:37 +02:00
|
|
|
@Component({
|
|
|
|
components: {
|
|
|
|
DateCalendarIcon,
|
|
|
|
},
|
|
|
|
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;
|
2019-10-05 21:17:18 +02:00
|
|
|
/**
|
|
|
|
* Options are merged with default options
|
|
|
|
*/
|
|
|
|
@Prop({ required: false, default: () => defaultOptions }) options!: IEventCardOptions;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
|
|
|
currentActor!: IPerson;
|
|
|
|
|
|
|
|
ParticipantRole = ParticipantRole;
|
|
|
|
EventVisibility = EventVisibility;
|
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
|
|
|
|
*/
|
|
|
|
async openDeleteEventModalWrapper() {
|
|
|
|
await this.openDeleteEventModal(this.participation.event, this.currentActor);
|
|
|
|
}
|
|
|
|
|
2019-10-13 16:24:43 +02:00
|
|
|
async gotToWithCheck(participation: IParticipant, route: Route) {
|
|
|
|
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({
|
|
|
|
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',
|
|
|
|
duration: 5000,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return await this.$router.push(route);
|
|
|
|
}
|
|
|
|
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2019-10-13 16:24:43 +02:00
|
|
|
<style lang="scss" scoped>
|
2019-09-18 17:32:37 +02:00
|
|
|
@import "../../variables";
|
|
|
|
|
|
|
|
article.box {
|
|
|
|
div.tag-container {
|
|
|
|
position: absolute;
|
|
|
|
top: 10px;
|
|
|
|
right: 0;
|
|
|
|
margin-right: -5px;
|
|
|
|
z-index: 10;
|
|
|
|
max-width: 40%;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
div.content {
|
|
|
|
padding: 5px;
|
|
|
|
|
2019-10-13 16:24:43 +02:00
|
|
|
.participation-actor span, .participant-stats span {
|
|
|
|
padding: 0 5px;
|
|
|
|
|
|
|
|
button {
|
|
|
|
height: auto;
|
|
|
|
padding-top: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-18 17:32:37 +02:00
|
|
|
div.title-wrapper {
|
|
|
|
display: flex;
|
2019-10-07 16:48:13 +02:00
|
|
|
align-items: center;
|
2019-09-18 17:32:37 +02:00
|
|
|
|
|
|
|
div.date-component {
|
|
|
|
flex: 0;
|
|
|
|
margin-right: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
2019-10-09 17:54:35 +02:00
|
|
|
display: -webkit-box;
|
|
|
|
-webkit-line-clamp: 1;
|
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
overflow: hidden;
|
2019-09-18 17:32:37 +02:00
|
|
|
font-weight: 400;
|
|
|
|
line-height: 1em;
|
|
|
|
font-size: 1.6em;
|
|
|
|
padding-bottom: 5px;
|
2019-10-07 16:48:13 +02:00
|
|
|
margin: auto 0;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-13 16:24:43 +02:00
|
|
|
/deep/ progress + .progress-value {
|
|
|
|
color: lighten($primary, 20%) !important;
|
2019-09-18 17:32:37 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.actions {
|
|
|
|
ul li {
|
|
|
|
margin: 0 auto;
|
2019-10-13 16:24:43 +02:00
|
|
|
.is-link {
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.button.is-text {
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
|
|
/deep/ span:first-child i.mdi::before {
|
|
|
|
font-size: 24px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
/deep/ span:last-child {
|
|
|
|
padding-left: 4px;
|
|
|
|
}
|
|
|
|
}
|
2019-09-18 17:32:37 +02:00
|
|
|
|
|
|
|
* {
|
|
|
|
font-size: 0.8rem;
|
|
|
|
color: $primary;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</style>
|