sms alarming flag

This commit is contained in:
Julian Krauser 2024-11-27 10:07:46 +01:00
parent 66026d667d
commit 794de7e3c8
8 changed files with 40 additions and 4 deletions

View file

@ -93,6 +93,10 @@
<input type="checkbox" id="isNewsletterMain" />
<label for="isNewsletterMain">Newsletter hier hin versenden?</label>
</div>
<div v-if="selectedCommunicationType?.fields.includes('mobile')" class="flex flex-row items-center gap-2">
<input type="checkbox" id="isSMSAlarming" />
<label for="isSMSAlarming">SMS-Alarmierung hier hin versenden?</label>
</div>
<div class="flex flex-row gap-2">
<button primary type="submit" :disabled="status == 'loading' || status?.status == 'success'">erstellen</button>
@ -163,6 +167,7 @@ export default defineComponent({
streetNumber: formData.streetNumber?.value,
streetNumberAddition: formData.streetNumberAddition?.value,
isNewsletterMain: formData.isNewsletterMain.checked,
isSMSAlarming: formData.isSMSAlarming?.checked,
typeId: this.selectedCommunicationType.id,
};
this.createCommunication(createCommunication)

View file

@ -6,7 +6,7 @@
<br />
<Spinner v-if="loading == 'loading'" class="mx-auto" />
<p v-else-if="loading == 'failed'" @click="fetchItem" class="cursor-pointer">&#8634; laden fehlgeschlagen</p>
<form v-else-if="communication != null" class="flex flex-col gap-4 py-2" @submit.prevent="triggerCreate">
<form v-else-if="communication != null" class="flex flex-col gap-4 py-2" @submit.prevent="triggerUpdate">
<div>
<p>Type: {{ communication.type.type }}</p>
</div>
@ -42,6 +42,10 @@
<input type="checkbox" id="isNewsletterMain" v-model="communication.isNewsletterMain" />
<label for="isNewsletterMain">Newsletter hier hin versenden?</label>
</div>
<div v-if="communication.type.fields.includes('mobile')" class="flex flex-row items-center gap-2">
<input type="checkbox" id="isSMSAlarming" v-model="communication.isSMSAlarming" />
<label for="isSMSAlarming">SMS-Alarmierung hier hin versenden?</label>
</div>
<div class="flex flex-row gap-2">
<button primary-outline type="reset" :disabled="canSaveOrReset" @click="resetForm">verwerfen</button>
@ -120,7 +124,7 @@ export default defineComponent({
this.loading = "failed";
});
},
triggerCreate(e: any) {
triggerUpdate(e: any) {
if (this.communication == null) return;
let formData = e.target.elements;
let updateCommunication: UpdateCommunicationViewModel = {
@ -133,6 +137,7 @@ export default defineComponent({
streetNumber: formData.streetNumber?.value,
streetNumberAddition: formData.streetNumberAddition?.value,
isNewsletterMain: formData.isNewsletterMain.checked,
isSMSAlarming: formData.isSMSAlarming?.checked,
};
this.updateCommunication(updateCommunication)
.then(() => {

View file

@ -1,6 +1,7 @@
<template>
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
<div class="bg-primary p-2 text-white flex flex-row gap-2 justify-between items-center">
<FireIcon class="h-5 w-5 pr-1 box-content" v-if="communication.isSMSAlarming" />
<EnvelopeIcon class="h-5 w-5 pr-1 box-content" v-if="communication.isNewsletterMain" />
<p class="grow">{{ communication.type.type }} {{ communication.preferred ? "(bevorzugt)" : "" }}</p>
<PencilIcon v-if="can('update', 'club', 'member')" class="w-5 h-5 cursor-pointer" @click="openEditModal" />
@ -16,7 +17,7 @@
import { defineAsyncComponent, defineComponent, markRaw, type PropType } from "vue";
import { mapState, mapActions } from "pinia";
import type { CommunicationViewModel } from "@/viewmodels/admin/communication.models";
import { EnvelopeIcon, PencilIcon, TrashIcon } from "@heroicons/vue/24/outline";
import { EnvelopeIcon, PencilIcon, TrashIcon, FireIcon } from "@heroicons/vue/24/outline";
import { useModalStore } from "@/stores/modal";
import { useAbilityStore } from "@/stores/ability";
</script>