Member create, edit and delete
This commit is contained in:
parent
1e3d0771b5
commit
585ff008b9
18 changed files with 392 additions and 126 deletions
142
src/components/admin/club/member/CreateMemberModal.vue
Normal file
142
src/components/admin/club/member/CreateMemberModal.vue
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
<template>
|
||||||
|
<div class="w-full md:max-w-md">
|
||||||
|
<div class="flex flex-col items-center">
|
||||||
|
<p class="text-xl font-medium">Mitglied erstellen</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<form class="flex flex-col gap-4 py-2" @submit.prevent="triggerCreate">
|
||||||
|
<div>
|
||||||
|
<Listbox v-model="selectedSalutation" name="salutation">
|
||||||
|
<ListboxLabel>Anrede</ListboxLabel>
|
||||||
|
<div class="relative mt-1">
|
||||||
|
<ListboxButton
|
||||||
|
class="rounded-md shadow-sm relative block w-full px-3 py-2 border border-gray-300 focus:border-primary placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-0 focus:z-10 sm:text-sm resize-none"
|
||||||
|
>
|
||||||
|
<span class="block truncate w-full text-start"> {{ selectedSalutation }}</span>
|
||||||
|
<span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
|
||||||
|
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||||
|
</span>
|
||||||
|
</ListboxButton>
|
||||||
|
|
||||||
|
<transition
|
||||||
|
leave-active-class="transition duration-100 ease-in"
|
||||||
|
leave-from-class="opacity-100"
|
||||||
|
leave-to-class="opacity-0"
|
||||||
|
>
|
||||||
|
<ListboxOptions
|
||||||
|
class="absolute mt-1 max-h-60 z-20 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm h-32 overflow-y-auto"
|
||||||
|
>
|
||||||
|
<ListboxOption
|
||||||
|
v-slot="{ active, selected }"
|
||||||
|
v-for="salutation in salutations"
|
||||||
|
:key="salutation"
|
||||||
|
:value="salutation"
|
||||||
|
as="template"
|
||||||
|
>
|
||||||
|
<li
|
||||||
|
:class="[
|
||||||
|
active ? 'bg-red-200 text-amber-900' : 'text-gray-900',
|
||||||
|
'relative cursor-default select-none py-2 pl-10 pr-4',
|
||||||
|
]"
|
||||||
|
>
|
||||||
|
<span :class="[selected ? 'font-medium' : 'font-normal', 'block truncate']">{{ salutation }}</span>
|
||||||
|
<span v-if="selected" class="absolute inset-y-0 left-0 flex items-center pl-3 text-primary">
|
||||||
|
<CheckIcon class="h-5 w-5" aria-hidden="true" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ListboxOption>
|
||||||
|
</ListboxOptions>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
</Listbox>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="firstname">Vorname</label>
|
||||||
|
<input type="text" id="firstname" required />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="lastname">Nachname</label>
|
||||||
|
<input type="text" id="lastname" required />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="nameaffix">Nameaffix (optional)</label>
|
||||||
|
<input type="text" id="nameaffix" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="birthdate">Geburtsdatum</label>
|
||||||
|
<input type="date" id="birthdate" required />
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row gap-2">
|
||||||
|
<button primary type="submit" :disabled="status == 'loading' || status?.status == 'success'">erstellen</button>
|
||||||
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="flex flex-row justify-end">
|
||||||
|
<div class="flex flex-row gap-4 py-2">
|
||||||
|
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineComponent } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import Spinner from "@/components/Spinner.vue";
|
||||||
|
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||||
|
import FailureXMark from "@/components/FailureXMark.vue";
|
||||||
|
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
|
||||||
|
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||||
|
import { Salutation } from "@/enums/salutation";
|
||||||
|
import { useMemberStore } from "@/stores/admin/member";
|
||||||
|
import type { CreateMemberViewModel } from "@/viewmodels/admin/member.models";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||||
|
timeout: undefined as any,
|
||||||
|
salutations: [] as Array<string>,
|
||||||
|
selectedSalutation: Salutation.none as Salutation,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.salutations = Object.values(Salutation);
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
try {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useModalStore, ["closeModal"]),
|
||||||
|
...mapActions(useMemberStore, ["createMember"]),
|
||||||
|
triggerCreate(e: any) {
|
||||||
|
let formData = e.target.elements;
|
||||||
|
let createMember: CreateMemberViewModel = {
|
||||||
|
salutation: this.selectedSalutation,
|
||||||
|
firstname: formData.firstname.value,
|
||||||
|
lastname: formData.lastname.value,
|
||||||
|
nameaffix: formData.nameaffix.value,
|
||||||
|
birthdate: formData.birthdate.value,
|
||||||
|
};
|
||||||
|
this.createMember(createMember)
|
||||||
|
.then(() => {
|
||||||
|
this.status = { status: "success" };
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.closeModal();
|
||||||
|
}, 1500);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.status = { status: "failed" };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
87
src/components/admin/club/member/DeleteMemberModal.vue
Normal file
87
src/components/admin/club/member/DeleteMemberModal.vue
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
<template>
|
||||||
|
<div class="w-full md:max-w-md">
|
||||||
|
<div class="flex flex-col items-center">
|
||||||
|
<p class="text-xl font-medium">Mitglied löschen</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<p class="text-center">
|
||||||
|
Mitglied {{ member?.lastname }}, {{ member?.firstname }}
|
||||||
|
{{ member?.nameaffix ? `- ${member.nameaffix}` : "" }} löschen?
|
||||||
|
</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div class="flex flex-row gap-2">
|
||||||
|
<button
|
||||||
|
primary
|
||||||
|
type="submit"
|
||||||
|
:disabled="status == 'loading' || status?.status == 'success'"
|
||||||
|
@click="triggerDelete"
|
||||||
|
>
|
||||||
|
löschen
|
||||||
|
</button>
|
||||||
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-row justify-end">
|
||||||
|
<div class="flex flex-row gap-4 py-2">
|
||||||
|
<button primary-outline @click="closeModal" :disabled="status != null">abbrechen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { defineComponent } from "vue";
|
||||||
|
import { mapState, mapActions } from "pinia";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
|
import Spinner from "@/components/Spinner.vue";
|
||||||
|
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||||
|
import FailureXMark from "@/components/FailureXMark.vue";
|
||||||
|
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
|
||||||
|
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||||
|
import { Salutation } from "@/enums/salutation";
|
||||||
|
import { useMemberStore } from "@/stores/admin/member";
|
||||||
|
import type { CreateMemberViewModel } from "@/viewmodels/admin/member.models";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default defineComponent({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||||
|
timeout: undefined as any,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapState(useModalStore, ["data"]),
|
||||||
|
...mapState(useMemberStore, ["members"]),
|
||||||
|
member() {
|
||||||
|
return this.members.find((m) => m.id == this.data);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
try {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
} catch (error) {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useModalStore, ["closeModal"]),
|
||||||
|
...mapActions(useMemberStore, ["deleteMember"]),
|
||||||
|
triggerDelete() {
|
||||||
|
this.deleteMember(this.data)
|
||||||
|
.then(() => {
|
||||||
|
this.status = { status: "success" };
|
||||||
|
this.timeout = setTimeout(() => {
|
||||||
|
this.$router.push({ name: "admin-club-member" });
|
||||||
|
this.closeModal();
|
||||||
|
}, 1500);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.status = { status: "failed" };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
<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 justify-between items-center">
|
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||||
<p>{{ award.award }}</p>
|
<p>{{ award.award }}</p>
|
||||||
|
<PencilIcon class="w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<p>erhalten am: {{ award.date }}</p>
|
<p>erhalten am: {{ award.date }}</p>
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapState, mapActions } from "pinia";
|
import { mapState, mapActions } from "pinia";
|
||||||
import type { MemberAwardViewModel } from "@/viewmodels/admin/memberAward.models";
|
import type { MemberAwardViewModel } from "@/viewmodels/admin/memberAward.models";
|
||||||
|
import { PencilIcon } from "@heroicons/vue/24/outline";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
<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 justify-between items-center">
|
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||||
<p>{{ communication.type.type }} {{ communication.preferred ? "(bevorzugt)" : "" }}</p>
|
<EnvelopeIcon class="h-5 w-5 pr-1 box-content" v-if="communication.isNewsletterMain" />
|
||||||
<EnvelopeIcon class="h-5 w-5 p-1 box-content" v-if="communication.isNewsletterMain" />
|
<p class="grow">{{ communication.type.type }} {{ communication.preferred ? "(bevorzugt)" : "" }}</p>
|
||||||
|
<PencilIcon class="w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<p v-for="field in communication.type.fields" :key="field">{{ field }}: {{ communication[field] || "--" }}</p>
|
<p v-for="field in communication.type.fields" :key="field">{{ field }}: {{ communication[field] || "--" }}</p>
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapState, mapActions } from "pinia";
|
import { mapState, mapActions } from "pinia";
|
||||||
import type { CommunicationViewModel } from "@/viewmodels/admin/communication.models";
|
import type { CommunicationViewModel } from "@/viewmodels/admin/communication.models";
|
||||||
import { EnvelopeIcon } from "@heroicons/vue/24/outline";
|
import { EnvelopeIcon, PencilIcon } from "@heroicons/vue/24/outline";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
<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 justify-between items-center">
|
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||||
<p>{{ position.executivePosition }} von {{ position.start }} bis {{ position.end ?? "heute" }}</p>
|
<p>{{ position.executivePosition }} von {{ position.start }} bis {{ position.end ?? "heute" }}</p>
|
||||||
|
<PencilIcon class="w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<p v-if="position.note">Notiz: {{ position.note }}</p>
|
<p v-if="position.note">Notiz: {{ position.note }}</p>
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapState, mapActions } from "pinia";
|
import { mapState, mapActions } from "pinia";
|
||||||
import type { MemberExecutivePositionViewModel } from "@/viewmodels/admin/memberExecutivePosition.models";
|
import type { MemberExecutivePositionViewModel } from "@/viewmodels/admin/memberExecutivePosition.models";
|
||||||
|
import { PencilIcon } from "@heroicons/vue/24/outline";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
<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 justify-between items-center">
|
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||||
<p>{{ qualification.qualification }} von {{ qualification.start }} bis {{ qualification.end ?? "heute" }}</p>
|
<p>{{ qualification.qualification }} von {{ qualification.start }} bis {{ qualification.end ?? "heute" }}</p>
|
||||||
|
<PencilIcon class="w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<p v-if="qualification.note">Notiz: {{ qualification.note }}</p>
|
<p v-if="qualification.note">Notiz: {{ qualification.note }}</p>
|
||||||
|
@ -14,6 +15,7 @@
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapState, mapActions } from "pinia";
|
import { mapState, mapActions } from "pinia";
|
||||||
import type { MemberQualificationViewModel } from "@/viewmodels/admin/memberQualification.models";
|
import type { MemberQualificationViewModel } from "@/viewmodels/admin/memberQualification.models";
|
||||||
|
import { PencilIcon } from "@heroicons/vue/24/outline";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
{{ membership.start }} bis {{ membership.end ?? "heute" }}:
|
{{ membership.start }} bis {{ membership.end ?? "heute" }}:
|
||||||
{{ membership.status }}
|
{{ membership.status }}
|
||||||
</p>
|
</p>
|
||||||
|
<PencilIcon class="w-5 h-5" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="membership.terminationReason" class="p-2">
|
<div v-if="membership.terminationReason" class="p-2">
|
||||||
<p>Grund: {{ membership.terminationReason }}</p>
|
<p>Grund: {{ membership.terminationReason }}</p>
|
||||||
|
@ -16,6 +17,7 @@
|
||||||
import { defineComponent, type PropType } from "vue";
|
import { defineComponent, type PropType } from "vue";
|
||||||
import { mapState, mapActions } from "pinia";
|
import { mapState, mapActions } from "pinia";
|
||||||
import type { MembershipViewModel } from "@/viewmodels/admin/membership.models";
|
import type { MembershipViewModel } from "@/viewmodels/admin/membership.models";
|
||||||
|
import { PencilIcon } from "@heroicons/vue/24/outline";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export enum Salutation {
|
export enum Salutation {
|
||||||
Sir = "sir",
|
sir = "sir",
|
||||||
Madam = "madam",
|
madam = "madam",
|
||||||
other = "other",
|
other = "other",
|
||||||
none = "none",
|
none = "none",
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,14 +77,6 @@ const router = createRouter({
|
||||||
component: () => import("@/views/admin/members/Member.vue"),
|
component: () => import("@/views/admin/members/Member.vue"),
|
||||||
beforeEnter: [resetMemberStores],
|
beforeEnter: [resetMemberStores],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: ":id/edit",
|
|
||||||
name: "admin-club-member-edit",
|
|
||||||
component: () => import("@/views/admin/members/MemberEdit.vue"),
|
|
||||||
meta: { type: "update", section: "club", module: "member" },
|
|
||||||
beforeEnter: [abilityAndNavUpdate],
|
|
||||||
props: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: ":memberId",
|
path: ":memberId",
|
||||||
name: "admin-club-member-routing",
|
name: "admin-club-member-routing",
|
||||||
|
@ -128,6 +120,14 @@ const router = createRouter({
|
||||||
component: () => import("@/views/admin/members/MemberExecutivePositions.vue"),
|
component: () => import("@/views/admin/members/MemberExecutivePositions.vue"),
|
||||||
props: true,
|
props: true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "edit",
|
||||||
|
name: "admin-club-member-edit",
|
||||||
|
component: () => import("@/views/admin/members/MemberEdit.vue"),
|
||||||
|
meta: { type: "update", section: "club", module: "member" },
|
||||||
|
beforeEnter: [abilityAndNavUpdate],
|
||||||
|
props: true,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #diffMain>
|
<template #diffMain>
|
||||||
<div class="flex flex-col w-full h-full gap-2 justify-center items-center px-7">
|
<div class="flex flex-col w-full h-full gap-2 justify-center px-7">
|
||||||
<div class="flex flex-col w-full grow gap-2 pr-2 overflow-y-scroll">
|
<div class="flex flex-col w-full grow gap-2 pr-2 overflow-y-scroll">
|
||||||
<MemberListItem v-for="member in members" :key="member.id" :member="member" />
|
<MemberListItem v-for="member in members" :key="member.id" :member="member" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -43,18 +43,23 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button primary class="!w-fit" @click="openCreateModal">Mitglied erstellen</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</MainTemplate>
|
</MainTemplate>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import MainTemplate from "@/templates/Main.vue";
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
import { ChevronRightIcon, ChevronLeftIcon } from "@heroicons/vue/20/solid";
|
import { ChevronRightIcon, ChevronLeftIcon } from "@heroicons/vue/20/solid";
|
||||||
import { useMemberStore } from "@/stores/admin/member";
|
import { useMemberStore } from "@/stores/admin/member";
|
||||||
import MemberListItem from "@/components/admin/club/member/MemberListItem.vue";
|
import MemberListItem from "@/components/admin/club/member/MemberListItem.vue";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -115,10 +120,11 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchMembers(0, this.maxEntriesPerPage);
|
this.fetchMembers(0, this.maxEntriesPerPage, true);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useMemberStore, ["fetchMembers"]),
|
...mapActions(useMemberStore, ["fetchMembers"]),
|
||||||
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
loadPage(newPage: number | ".") {
|
loadPage(newPage: number | ".") {
|
||||||
if (newPage == ".") return;
|
if (newPage == ".") return;
|
||||||
if (newPage < 0 || newPage >= this.countOfPages) return;
|
if (newPage < 0 || newPage >= this.countOfPages) return;
|
||||||
|
@ -135,6 +141,11 @@ export default defineComponent({
|
||||||
filterData(array: Array<any>, start: number, end: number): Array<any> {
|
filterData(array: Array<any>, start: number, end: number): Array<any> {
|
||||||
return array.filter((elem, index) => (elem?.tab_pos ?? index) >= start && (elem?.tab_pos ?? index) < end);
|
return array.filter((elem, index) => (elem?.tab_pos ?? index) >= start && (elem?.tab_pos ?? index) < end);
|
||||||
},
|
},
|
||||||
|
openCreateModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/club/member/CreateMemberModal.vue")))
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||||
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button primary class="!w-fit" @click="">Auszeichnung hinzufügen</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||||
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button primary class="!w-fit" @click="">Kommunikation hinzufügen</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
|
@ -1,98 +1,87 @@
|
||||||
<template>
|
<template>
|
||||||
<MainTemplate>
|
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
|
||||||
<template #topBar>
|
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||||
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
||||||
<h1 class="font-bold text-xl h-8">
|
<form
|
||||||
Mitglied {{ origin?.lastname }}, {{ origin?.firstname }}
|
v-else-if="member != null"
|
||||||
{{ origin?.nameaffix ? `- ${origin?.nameaffix}` : "" }}
|
class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto"
|
||||||
</h1>
|
@submit.prevent="triggerUpdate"
|
||||||
</div>
|
>
|
||||||
</template>
|
<p class="mx-auto">Mitglied bearbeiten</p>
|
||||||
<template #main>
|
<div>
|
||||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
<Listbox v-model="member.salutation" name="salutation">
|
||||||
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
<ListboxLabel>Anrede</ListboxLabel>
|
||||||
<form
|
<div class="relative mt-1">
|
||||||
v-else-if="member != null"
|
<ListboxButton
|
||||||
class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto"
|
class="rounded-md shadow-sm relative block w-full px-3 py-2 border border-gray-300 focus:border-primary placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-0 focus:z-10 sm:text-sm resize-none"
|
||||||
@submit.prevent="triggerUpdate"
|
>
|
||||||
>
|
<span class="block truncate w-full text-start"> {{ member.salutation }}</span>
|
||||||
<div>
|
<span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
|
||||||
<Listbox v-model="member.salutation" name="salutation">
|
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||||
<ListboxLabel>Anrede</ListboxLabel>
|
</span>
|
||||||
<div class="relative mt-1">
|
</ListboxButton>
|
||||||
<ListboxButton
|
|
||||||
class="rounded-md shadow-sm relative block w-full px-3 py-2 border border-gray-300 focus:border-primary placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-0 focus:z-10 sm:text-sm resize-none"
|
|
||||||
>
|
|
||||||
<span class="block truncate w-full text-start"> {{ member.salutation }}</span>
|
|
||||||
<span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
|
|
||||||
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
|
|
||||||
</span>
|
|
||||||
</ListboxButton>
|
|
||||||
|
|
||||||
<transition
|
<transition
|
||||||
leave-active-class="transition duration-100 ease-in"
|
leave-active-class="transition duration-100 ease-in"
|
||||||
leave-from-class="opacity-100"
|
leave-from-class="opacity-100"
|
||||||
leave-to-class="opacity-0"
|
leave-to-class="opacity-0"
|
||||||
|
>
|
||||||
|
<ListboxOptions
|
||||||
|
class="absolute mt-1 max-h-60 z-20 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm h-32 overflow-y-auto"
|
||||||
>
|
>
|
||||||
<ListboxOptions
|
<ListboxOption
|
||||||
class="absolute mt-1 max-h-60 z-20 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm h-32 overflow-y-auto"
|
v-slot="{ active, selected }"
|
||||||
|
v-for="salutation in salutations"
|
||||||
|
:key="salutation"
|
||||||
|
:value="salutation"
|
||||||
|
as="template"
|
||||||
>
|
>
|
||||||
<ListboxOption
|
<li
|
||||||
v-slot="{ active, selected }"
|
:class="[
|
||||||
v-for="salutation in salutations"
|
active ? 'bg-red-200 text-amber-900' : 'text-gray-900',
|
||||||
:key="salutation"
|
'relative cursor-default select-none py-2 pl-10 pr-4',
|
||||||
:value="salutation"
|
]"
|
||||||
as="template"
|
|
||||||
>
|
>
|
||||||
<li
|
<span :class="[selected ? 'font-medium' : 'font-normal', 'block truncate']">{{ salutation }}</span>
|
||||||
:class="[
|
<span v-if="selected" class="absolute inset-y-0 left-0 flex items-center pl-3 text-primary">
|
||||||
active ? 'bg-red-200 text-amber-900' : 'text-gray-900',
|
<CheckIcon class="h-5 w-5" aria-hidden="true" />
|
||||||
'relative cursor-default select-none py-2 pl-10 pr-4',
|
</span>
|
||||||
]"
|
</li>
|
||||||
>
|
</ListboxOption>
|
||||||
<span :class="[selected ? 'font-medium' : 'font-normal', 'block truncate']">{{
|
</ListboxOptions>
|
||||||
salutation
|
</transition>
|
||||||
}}</span>
|
</div>
|
||||||
<span v-if="selected" class="absolute inset-y-0 left-0 flex items-center pl-3 text-primary">
|
</Listbox>
|
||||||
<CheckIcon class="h-5 w-5" aria-hidden="true" />
|
</div>
|
||||||
</span>
|
<div>
|
||||||
</li>
|
<label for="firstname">Vorname</label>
|
||||||
</ListboxOption>
|
<input type="text" id="firstname" required v-model="member.firstname" />
|
||||||
</ListboxOptions>
|
</div>
|
||||||
</transition>
|
<div>
|
||||||
</div>
|
<label for="lastname">Nachname</label>
|
||||||
</Listbox>
|
<input type="text" id="lastname" required v-model="member.lastname" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="firstname">Vorname</label>
|
<label for="nameaffix">Nameaffix (optional)</label>
|
||||||
<input type="text" id="firstname" required v-model="member.firstname" />
|
<input type="text" id="nameaffix" v-model="member.nameaffix" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="lastname">Nachname</label>
|
<label for="birthdate">Geburtsdatum</label>
|
||||||
<input type="text" id="lastname" required v-model="member.lastname" />
|
<input type="date" id="birthdate" required v-model="member.birthdate" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="flex flex-row justify-end gap-2">
|
||||||
<label for="nameaffix">Nameaffix (optional)</label>
|
<button primary-outline type="reset" class="!w-fit" :disabled="canSaveOrReset" @click="resetForm">
|
||||||
<input type="text" id="nameaffix" v-model="member.nameaffix" />
|
verwerfen
|
||||||
</div>
|
</button>
|
||||||
<div>
|
<button primary type="submit" class="!w-fit" :disabled="status == 'loading' || canSaveOrReset">
|
||||||
<label for="birthdate">Geburtsdatum</label>
|
speichern
|
||||||
<input type="date" id="birthdate" required v-model="member.birthdate" />
|
</button>
|
||||||
</div>
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
<div class="flex flex-row justify-end gap-2">
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
<button primary-outline type="reset" class="!w-fit" :disabled="canSaveOrReset" @click="resetForm">
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
verwerfen
|
</div>
|
||||||
</button>
|
</form>
|
||||||
<button primary type="submit" class="!w-fit" :disabled="status == 'loading' || canSaveOrReset">
|
</div>
|
||||||
speichern
|
|
||||||
</button>
|
|
||||||
<Spinner v-if="status == 'loading'" class="my-auto" />
|
|
||||||
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
|
||||||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</template>
|
|
||||||
</MainTemplate>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -114,13 +103,20 @@ import { Salutation } from "@/enums/salutation";
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
id: String,
|
memberId: String,
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
loadingActive() {
|
||||||
|
if (this.loading == "loading") {
|
||||||
|
this.loading = this.loadingActive;
|
||||||
|
}
|
||||||
|
if (this.loadingActive == "fetched") this.member = cloneDeep(this.activeMemberObj);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||||
origin: null as null | MemberViewModel,
|
|
||||||
member: null as null | MemberViewModel,
|
member: null as null | MemberViewModel,
|
||||||
timeout: null as any,
|
timeout: null as any,
|
||||||
salutations: [] as Array<string>,
|
salutations: [] as Array<string>,
|
||||||
|
@ -128,8 +124,9 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
canSaveOrReset(): boolean {
|
canSaveOrReset(): boolean {
|
||||||
return isEqual(this.origin, this.member);
|
return isEqual(this.activeMemberObj, this.member);
|
||||||
},
|
},
|
||||||
|
...mapState(useMemberStore, ["activeMemberObj", "loadingActive"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchItem();
|
this.fetchItem();
|
||||||
|
@ -141,20 +138,12 @@ export default defineComponent({
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useMemberStore, ["fetchMemberById", "updateActiveMember"]),
|
...mapActions(useMemberStore, ["fetchMemberByActiveId", "updateActiveMember"]),
|
||||||
resetForm() {
|
resetForm() {
|
||||||
this.member = cloneDeep(this.origin);
|
this.member = cloneDeep(this.activeMemberObj);
|
||||||
},
|
},
|
||||||
fetchItem() {
|
fetchItem() {
|
||||||
this.fetchMemberById(parseInt(this.id ?? ""))
|
this.fetchMemberByActiveId();
|
||||||
.then((result) => {
|
|
||||||
this.member = result.data;
|
|
||||||
this.origin = cloneDeep(result.data);
|
|
||||||
this.loading = "fetched";
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
this.loading = "failed";
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
triggerUpdate(e: any) {
|
triggerUpdate(e: any) {
|
||||||
if (this.member == null) return;
|
if (this.member == null) return;
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||||
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button primary class="!w-fit" @click="">Vereinsamt hinzufügen</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="activeMemberObj.preferredCommunication">
|
<div v-if="activeMemberObj.preferredCommunication?.length != 0">
|
||||||
<p>bevorzugte Kommunikationswege</p>
|
<p>bevorzugte Kommunikationswege</p>
|
||||||
<div
|
<div
|
||||||
v-for="com in activeMemberObj.preferredCommunication"
|
v-for="com in activeMemberObj.preferredCommunication"
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||||
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button primary class="!w-fit" @click="">Qualifikation hinzufügen</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
|
@ -4,11 +4,15 @@
|
||||||
<RouterLink to="../" class="text-primary">zurück zur Liste</RouterLink>
|
<RouterLink to="../" class="text-primary">zurück zur Liste</RouterLink>
|
||||||
</template>
|
</template>
|
||||||
<template #topBar>
|
<template #topBar>
|
||||||
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
|
||||||
<h1 class="font-bold text-xl h-8">
|
<h1 class="font-bold text-xl h-8 min-h-fit grow">
|
||||||
Mitglied {{ activeMemberObj?.lastname }}, {{ activeMemberObj?.firstname }}
|
{{ activeMemberObj?.lastname }}, {{ activeMemberObj?.firstname }}
|
||||||
{{ activeMemberObj?.nameaffix ? `- ${activeMemberObj?.nameaffix}` : "" }}
|
{{ activeMemberObj?.nameaffix ? `- ${activeMemberObj?.nameaffix}` : "" }}
|
||||||
</h1>
|
</h1>
|
||||||
|
<RouterLink :to="{ name: 'admin-club-member-edit' }">
|
||||||
|
<PencilIcon class="w-5 h-5" />
|
||||||
|
</RouterLink>
|
||||||
|
<TrashIcon class="w-5 h-5 cursor-pointer" @click="openDeleteModal" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #diffMain>
|
<template #diffMain>
|
||||||
|
@ -40,11 +44,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import MainTemplate from "@/templates/Main.vue";
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
import { RouterLink, RouterView } from "vue-router";
|
import { RouterLink, RouterView } from "vue-router";
|
||||||
import { useMemberStore } from "@/stores/admin/member";
|
import { useMemberStore } from "@/stores/admin/member";
|
||||||
|
import { PencilIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { useModalStore } from "@/stores/modal";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -59,7 +65,7 @@ export default defineComponent({
|
||||||
{ route: "admin-club-member-membership", title: "Mitgliedschaft" },
|
{ route: "admin-club-member-membership", title: "Mitgliedschaft" },
|
||||||
{ route: "admin-club-member-communication", title: "Kommunikation" },
|
{ route: "admin-club-member-communication", title: "Kommunikation" },
|
||||||
{ route: "admin-club-member-awards", title: "Auszeichnungen" },
|
{ route: "admin-club-member-awards", title: "Auszeichnungen" },
|
||||||
{ route: "admin-club-member-qualifications", title: "Qualificationen" },
|
{ route: "admin-club-member-qualifications", title: "Qualifikationen" },
|
||||||
{ route: "admin-club-member-positions", title: "Vereinsämter" },
|
{ route: "admin-club-member-positions", title: "Vereinsämter" },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -72,6 +78,13 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useMemberStore, ["fetchMemberByActiveId"]),
|
...mapActions(useMemberStore, ["fetchMemberByActiveId"]),
|
||||||
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
|
openDeleteModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/club/member/DeleteMemberModal.vue"))),
|
||||||
|
parseInt(this.memberId ?? "")
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||||
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex flex-row gap-4">
|
||||||
|
<button primary class="!w-fit" @click="">Mitgliedschaft hinzufügen</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
Loading…
Reference in a new issue