feat: Add option to link an external registration provider for events
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
committed by
Thomas Citharel
parent
4fb1282e76
commit
2de6937407
@@ -1,7 +1,13 @@
|
||||
<template>
|
||||
<div class="">
|
||||
<external-participation-button
|
||||
v-if="event && event.joinOptions === EventJoinOptions.EXTERNAL"
|
||||
:event="event"
|
||||
:current-actor="currentActor"
|
||||
/>
|
||||
|
||||
<participation-section
|
||||
v-if="event && anonymousParticipationConfig"
|
||||
v-else-if="event && anonymousParticipationConfig"
|
||||
:participation="participations[0]"
|
||||
:event="event"
|
||||
:anonymousParticipation="anonymousParticipation"
|
||||
@@ -15,7 +21,10 @@
|
||||
@cancel-anonymous-participation="cancelAnonymousParticipation"
|
||||
/>
|
||||
<div class="flex flex-col gap-1 mt-1">
|
||||
<p class="inline-flex gap-2 ml-auto">
|
||||
<p
|
||||
class="inline-flex gap-2 ml-auto"
|
||||
v-if="event.joinOptions !== EventJoinOptions.EXTERNAL"
|
||||
>
|
||||
<TicketConfirmationOutline />
|
||||
<router-link
|
||||
class="participations-link"
|
||||
@@ -349,6 +358,7 @@ import { useMutation } from "@vue/apollo-composable";
|
||||
import { useCreateReport } from "@/composition/apollo/report";
|
||||
import { useDeleteEvent } from "@/composition/apollo/event";
|
||||
import { useProgrammatic } from "@oruga-ui/oruga-next";
|
||||
import ExternalParticipationButton from "./ExternalParticipationButton.vue";
|
||||
|
||||
const ShareEventModal = defineAsyncComponent(
|
||||
() => import("@/components/Event/ShareEventModal.vue")
|
||||
|
||||
30
js/src/components/Event/ExternalParticipationButton.vue
Normal file
30
js/src/components/Event/ExternalParticipationButton.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<o-button
|
||||
tag="a"
|
||||
:href="
|
||||
event.externalParticipationUrl
|
||||
? encodeURI(`${event.externalParticipationUrl}?uuid=${event.uuid}`)
|
||||
: '#'
|
||||
"
|
||||
rel="noopener ugc"
|
||||
target="_blank"
|
||||
:disabled="!event.externalParticipationUrl"
|
||||
icon-right="OpenInNew"
|
||||
>
|
||||
{{ t("Go to booking") }}
|
||||
</o-button>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
import { IEvent } from "../../types/event.model";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n({ useScope: "global" });
|
||||
|
||||
const props = defineProps<{
|
||||
event: IEvent;
|
||||
}>();
|
||||
|
||||
const event = computed(() => props.event);
|
||||
</script>
|
||||
@@ -21,6 +21,7 @@ const FULL_EVENT_FRAGMENT = gql`
|
||||
status
|
||||
visibility
|
||||
joinOptions
|
||||
externalParticipationUrl
|
||||
draft
|
||||
language
|
||||
category
|
||||
@@ -121,6 +122,7 @@ export const FETCH_EVENT_BASIC = gql`
|
||||
id
|
||||
uuid
|
||||
joinOptions
|
||||
externalParticipationUrl
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
@@ -199,6 +201,7 @@ export const CREATE_EVENT = gql`
|
||||
$status: EventStatus
|
||||
$visibility: EventVisibility
|
||||
$joinOptions: EventJoinOptions
|
||||
$externalParticipationUrl: String
|
||||
$draft: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
@@ -220,6 +223,7 @@ export const CREATE_EVENT = gql`
|
||||
status: $status
|
||||
visibility: $visibility
|
||||
joinOptions: $joinOptions
|
||||
externalParticipationUrl: $externalParticipationUrl
|
||||
draft: $draft
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
@@ -247,6 +251,7 @@ export const EDIT_EVENT = gql`
|
||||
$status: EventStatus
|
||||
$visibility: EventVisibility
|
||||
$joinOptions: EventJoinOptions
|
||||
$externalParticipationUrl: String
|
||||
$draft: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
@@ -269,6 +274,7 @@ export const EDIT_EVENT = gql`
|
||||
status: $status
|
||||
visibility: $visibility
|
||||
joinOptions: $joinOptions
|
||||
externalParticipationUrl: $externalParticipationUrl
|
||||
draft: $draft
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
|
||||
@@ -1605,5 +1605,9 @@
|
||||
"Reported by an unknown actor": "Reported by an unknown actor",
|
||||
"Reported at": "Reported at",
|
||||
"Updated at": "Updated at",
|
||||
"Suspend the profile?": "Suspend the profile?"
|
||||
"Suspend the profile?": "Suspend the profile?",
|
||||
"Go to booking": "Go to booking",
|
||||
"External registration": "External registration",
|
||||
"I want to manage the registration with an external provider": "I want to manage the registration with an external provider",
|
||||
"External provider URL": "External provider URL"
|
||||
}
|
||||
@@ -1601,5 +1601,9 @@
|
||||
"{username} was invited to {group}": "{username} a été invité à {group}",
|
||||
"{user}'s follow request was accepted": "La demande de suivi de {user} a été acceptée",
|
||||
"{user}'s follow request was rejected": "La demande de suivi de {user} a été rejetée",
|
||||
"© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap"
|
||||
"© The OpenStreetMap Contributors": "© Les Contributeur⋅ices OpenStreetMap",
|
||||
"Go to booking": "Aller à la réservation",
|
||||
"External registration": "Inscription externe",
|
||||
"I want to manage the registration with an external provider": "Je souhaite gérer l'enregistrement auprès d'un fournisseur externe",
|
||||
"External provider URL": "URL du fournisseur externe"
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ export enum EventJoinOptions {
|
||||
FREE = "FREE",
|
||||
RESTRICTED = "RESTRICTED",
|
||||
INVITE = "INVITE",
|
||||
EXTERNAL = "EXTERNAL",
|
||||
}
|
||||
|
||||
export enum EventVisibilityJoinOptions {
|
||||
|
||||
@@ -43,6 +43,7 @@ interface IEventEditJSON {
|
||||
status: EventStatus;
|
||||
visibility: EventVisibility;
|
||||
joinOptions: EventJoinOptions;
|
||||
externalParticipationUrl: string | null;
|
||||
draft: boolean;
|
||||
picture?: IMedia | { mediaId: string } | null;
|
||||
attributedToId: string | null;
|
||||
@@ -72,6 +73,7 @@ export interface IEvent {
|
||||
status: EventStatus;
|
||||
visibility: EventVisibility;
|
||||
joinOptions: EventJoinOptions;
|
||||
externalParticipationUrl: string | null;
|
||||
draft: boolean;
|
||||
|
||||
picture: IMedia | null;
|
||||
@@ -132,6 +134,8 @@ export class EventModel implements IEvent {
|
||||
|
||||
joinOptions = EventJoinOptions.FREE;
|
||||
|
||||
externalParticipationUrl: string | null = null;
|
||||
|
||||
status = EventStatus.CONFIRMED;
|
||||
|
||||
draft = true;
|
||||
@@ -197,6 +201,7 @@ export class EventModel implements IEvent {
|
||||
this.status = hash.status;
|
||||
this.visibility = hash.visibility;
|
||||
this.joinOptions = hash.joinOptions;
|
||||
this.externalParticipationUrl = hash.externalParticipationUrl;
|
||||
this.draft = hash.draft;
|
||||
|
||||
this.picture = hash.picture;
|
||||
@@ -248,6 +253,7 @@ export function toEditJSON(event: IEditableEvent): IEventEditJSON {
|
||||
category: event.category,
|
||||
visibility: event.visibility,
|
||||
joinOptions: event.joinOptions,
|
||||
externalParticipationUrl: event.externalParticipationUrl,
|
||||
draft: event.draft,
|
||||
tags: event.tags.map((t) => t.title),
|
||||
onlineAddress: event.onlineAddress,
|
||||
|
||||
@@ -246,8 +246,25 @@
|
||||
</o-radio>
|
||||
</div>-->
|
||||
|
||||
<o-field :label="t('External registration')">
|
||||
<o-switch v-model="externalParticipation">
|
||||
{{
|
||||
t("I want to manage the registration with an external provider")
|
||||
}}
|
||||
</o-switch>
|
||||
</o-field>
|
||||
|
||||
<o-field v-if="externalParticipation" :label="t('URL')">
|
||||
<o-input
|
||||
icon="link"
|
||||
type="url"
|
||||
v-model="event.externalParticipationUrl"
|
||||
:placeholder="t('External provider URL')"
|
||||
/>
|
||||
</o-field>
|
||||
|
||||
<o-field
|
||||
v-if="anonymousParticipationConfig?.allowed"
|
||||
v-if="anonymousParticipationConfig?.allowed && !externalParticipation"
|
||||
:label="t('Anonymous participations')"
|
||||
>
|
||||
<o-switch v-model="eventOptions.anonymousParticipation">
|
||||
@@ -268,19 +285,22 @@
|
||||
</o-switch>
|
||||
</o-field>
|
||||
|
||||
<o-field :label="t('Participation approval')">
|
||||
<o-field
|
||||
:label="t('Participation approval')"
|
||||
v-show="!externalParticipation"
|
||||
>
|
||||
<o-switch v-model="needsApproval">{{
|
||||
t("I want to approve every participation request")
|
||||
}}</o-switch>
|
||||
</o-field>
|
||||
|
||||
<o-field :label="t('Number of places')">
|
||||
<o-field :label="t('Number of places')" v-show="!externalParticipation">
|
||||
<o-switch v-model="limitedPlaces">{{
|
||||
t("Limited number of places")
|
||||
}}</o-switch>
|
||||
</o-field>
|
||||
|
||||
<div class="" v-if="limitedPlaces">
|
||||
<div class="" v-if="limitedPlaces && !externalParticipation">
|
||||
<o-field :label="t('Number of places')" label-for="number-of-places">
|
||||
<o-input
|
||||
type="number"
|
||||
@@ -1308,6 +1328,19 @@ const orderedCategories = computed(() => {
|
||||
if (!eventCategories.value) return undefined;
|
||||
return sortBy(eventCategories.value, ["label"]);
|
||||
});
|
||||
|
||||
const externalParticipation = computed({
|
||||
get() {
|
||||
return event.value?.joinOptions === EventJoinOptions.EXTERNAL;
|
||||
},
|
||||
set(newValue) {
|
||||
if (newValue === true) {
|
||||
event.value.joinOptions = EventJoinOptions.EXTERNAL;
|
||||
} else {
|
||||
event.value.joinOptions = EventJoinOptions.FREE;
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
Reference in New Issue
Block a user