@@ -1,5 +1,30 @@
|
||||
<template>
|
||||
<form @submit="sendForm">
|
||||
<h2>{{ t("New announcement") }}</h2>
|
||||
<p>
|
||||
{{
|
||||
t(
|
||||
"This announcement will be send to all participants with the statuses selected below. They will not be allowed to reply to your announcement, but they can create a new conversation with you."
|
||||
)
|
||||
}}
|
||||
</p>
|
||||
<o-field class="mt-2 mb-4">
|
||||
<o-checkbox
|
||||
v-model="selectedRoles"
|
||||
:native-value="ParticipantRole.PARTICIPANT"
|
||||
:label="t('Participant')"
|
||||
/>
|
||||
<o-checkbox
|
||||
v-model="selectedRoles"
|
||||
:native-value="ParticipantRole.NOT_APPROVED"
|
||||
:label="t('Not approved')"
|
||||
/>
|
||||
<o-checkbox
|
||||
v-model="selectedRoles"
|
||||
:native-value="ParticipantRole.REJECTED"
|
||||
:label="t('Rejected')"
|
||||
/>
|
||||
</o-field>
|
||||
<Editor
|
||||
v-model="text"
|
||||
mode="basic"
|
||||
@@ -8,6 +33,15 @@
|
||||
:currentActor="currentActor"
|
||||
:placeholder="t('Write a new message')"
|
||||
/>
|
||||
<o-notification
|
||||
class="my-2"
|
||||
variant="danger"
|
||||
:closable="true"
|
||||
v-for="error in errors"
|
||||
:key="error"
|
||||
>
|
||||
{{ error }}
|
||||
</o-notification>
|
||||
<o-button class="mt-3" nativeType="submit">{{ t("Send") }}</o-button>
|
||||
</form>
|
||||
</template>
|
||||
@@ -32,9 +66,15 @@ const props = defineProps<{
|
||||
const event = computed(() => props.event);
|
||||
|
||||
const text = ref("");
|
||||
|
||||
const errors = ref<string[]>([]);
|
||||
|
||||
const selectedRoles = ref<ParticipantRole[]>([ParticipantRole.PARTICIPANT]);
|
||||
|
||||
const {
|
||||
mutate: eventPrivateMessageMutate,
|
||||
onDone: onEventPrivateMessageMutated,
|
||||
onError: onEventPrivateMessageError,
|
||||
} = useMutation<
|
||||
{
|
||||
sendEventPrivateMessage: IConversation;
|
||||
@@ -43,8 +83,7 @@ const {
|
||||
text: string;
|
||||
actorId: string;
|
||||
eventId: string;
|
||||
roles?: string;
|
||||
inReplyToActorId?: ParticipantRole[];
|
||||
roles?: ParticipantRole[];
|
||||
language?: string;
|
||||
}
|
||||
>(SEND_EVENT_PRIVATE_MESSAGE_MUTATION, {
|
||||
@@ -96,6 +135,7 @@ const sendForm = (e: Event) => {
|
||||
event.value.organizerActor?.id ??
|
||||
currentActor.value?.id,
|
||||
eventId: event.value.id,
|
||||
roles: selectedRoles.value,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -103,6 +143,12 @@ onEventPrivateMessageMutated(() => {
|
||||
text.value = "";
|
||||
});
|
||||
|
||||
onEventPrivateMessageError((err) => {
|
||||
err.graphQLErrors.forEach((error) => {
|
||||
errors.value.push(error.message);
|
||||
});
|
||||
});
|
||||
|
||||
const Editor = defineAsyncComponent(
|
||||
() => import("../../components/TextEditor.vue")
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<router-link :to="{ name: RouteName.EVENT_PARTICIPATE_WITH_ACCOUNT }">
|
||||
<figure class="flex justify-center my-2">
|
||||
<img
|
||||
src="../../../public/img/undraw_profile.svg"
|
||||
src="/img/undraw_profile.svg"
|
||||
alt="Profile illustration"
|
||||
width="128"
|
||||
height="128"
|
||||
@@ -55,7 +55,7 @@
|
||||
<img
|
||||
width="128"
|
||||
height="128"
|
||||
src="../../../public/img/undraw_mail_2.svg"
|
||||
src="/img/undraw_mail_2.svg"
|
||||
alt="Privacy illustration"
|
||||
/>
|
||||
</figure>
|
||||
@@ -66,7 +66,7 @@
|
||||
<a :href="`${event.url}/participate/without-account`" v-else>
|
||||
<figure class="flex justify-center my-2">
|
||||
<img
|
||||
src="../../../public/img/undraw_mail_2.svg"
|
||||
src="/img/undraw_mail_2.svg"
|
||||
width="128"
|
||||
height="128"
|
||||
alt="Privacy illustration"
|
||||
|
||||
Reference in New Issue
Block a user