#23-cleanup-&-enhancements #24
10 changed files with 30 additions and 56 deletions
|
@ -66,6 +66,10 @@
|
|||
<label for="birthdate">Geburtsdatum</label>
|
||||
<input type="date" id="birthdate" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="internalId">Interne ID (optional)</label>
|
||||
<input type="text" id="internalId" />
|
||||
</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" />
|
||||
|
@ -127,6 +131,7 @@ export default defineComponent({
|
|||
lastname: formData.lastname.value,
|
||||
nameaffix: formData.nameaffix.value,
|
||||
birthdate: formData.birthdate.value,
|
||||
internalId: formData.internalId.value,
|
||||
};
|
||||
this.createMember(createMember)
|
||||
.then(() => {
|
||||
|
|
|
@ -1,41 +1,25 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-club-member-overview', params: { memberId: member.id } }"
|
||||
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"
|
||||
>
|
||||
<p>{{ member.lastname }}, {{ member.firstname }} {{ member.nameaffix ? `- ${member.nameaffix}` : "" }}</p>
|
||||
<div v-if="false" class="flex flex-row">
|
||||
<RouterLink
|
||||
v-if="can('read', 'club', 'member')"
|
||||
:to="{ name: 'admin-club-member-overview', params: { memberId: member.id } }"
|
||||
>
|
||||
<CircleStackIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||
</RouterLink>
|
||||
<RouterLink
|
||||
v-if="can('update', 'club', 'member')"
|
||||
:to="{ name: 'admin-club-member-edit', params: { id: member.id } }"
|
||||
>
|
||||
<PencilIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||
</RouterLink>
|
||||
<div v-if="can('delete', 'club', 'member')" @click="openDeleteModal">
|
||||
<TrashIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
<div class="p-2">
|
||||
<p v-if="member.internalId">Interne ID: {{ member.internalId }}</p>
|
||||
<p>beigetreten: {{ member.firstMembershipEntry?.start }}</p>
|
||||
<p v-if="member.lastMembershipEntry?.end">ausgetreten: {{ member.lastMembershipEntry?.end }}</p>
|
||||
</div>
|
||||
<p v-if="member.lastMembershipEntry?.end">ausgetreten: {{ member.lastMembershipEntry?.end }}, da {{member.lastMembershipEntry?.terminationReason ?? '- kein Grund angegeben'}}</p>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, defineAsyncComponent, markRaw, type PropType } from "vue";
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { PencilIcon, TrashIcon, CircleStackIcon } from "@heroicons/vue/24/outline";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import type { MemberViewModel } from "@/viewmodels/admin/member.models";
|
||||
</script>
|
||||
|
||||
|
@ -47,14 +31,5 @@ export default defineComponent({
|
|||
computed: {
|
||||
...mapState(useAbilityStore, ["can"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
openDeleteModal() {
|
||||
// this.openModal(
|
||||
// markRaw(defineAsyncComponent(() => import("@/components/admin/.vue"))),
|
||||
// this.member.id
|
||||
// );
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -63,10 +63,6 @@
|
|||
</div>
|
||||
</Listbox>
|
||||
</div>
|
||||
<div>
|
||||
<label for="internalId">Interne ID (optional)</label>
|
||||
<input type="text" id="internalId" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="start">Startdatum</label>
|
||||
<input type="date" id="start" required />
|
||||
|
@ -132,7 +128,6 @@ export default defineComponent({
|
|||
if (this.selectedStatus == undefined) return;
|
||||
let formData = e.target.elements;
|
||||
let createMember: CreateMembershipViewModel = {
|
||||
internalId: formData.internalId.value,
|
||||
start: formData.start.value,
|
||||
statusId: this.selectedStatus.id,
|
||||
};
|
||||
|
|
|
@ -63,10 +63,6 @@
|
|||
</div>
|
||||
</Listbox>
|
||||
</div>
|
||||
<div>
|
||||
<label for="internalId">Interne ID (optional)</label>
|
||||
<input type="text" id="internalId" v-model="membership.internalId" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="start">Startdatum</label>
|
||||
<input type="date" id="start" required v-model="membership.start" />
|
||||
|
@ -169,7 +165,6 @@ export default defineComponent({
|
|||
let formData = e.target.elements;
|
||||
let updateMembership: UpdateMembershipViewModel = {
|
||||
id: this.membership.id,
|
||||
internalId: formData.internalId.value,
|
||||
start: formData.start.value,
|
||||
end: formData.end.value,
|
||||
terminationReason: formData.terminationReason.value,
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
<PencilIcon v-if="can('update', 'club', 'member')" class="w-5 h-5 cursor-pointer" @click="openEditModal" />
|
||||
<TrashIcon v-if="can('delete', 'club', 'member')" class="w-5 h-5 cursor-pointer" @click="openDeleteModal" />
|
||||
</div>
|
||||
<div v-if="membership.terminationReason || membership.internalId" class="p-2">
|
||||
<p v-if="membership.internalId">Interne ID: {{ membership.internalId }}</p>
|
||||
<p v-if="membership.terminationReason">beendet, weil: {{ membership.terminationReason }}</p>
|
||||
<div v-if="membership.terminationReason" class="p-2">
|
||||
<p v-if="membership.terminationReason">Grund: {{ membership.terminationReason }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -62,6 +62,7 @@ export const useMemberStore = defineStore("member", {
|
|||
lastname: member.lastname,
|
||||
nameaffix: member.nameaffix,
|
||||
birthdate: member.birthdate,
|
||||
internalId: member.internalId,
|
||||
});
|
||||
this.fetchMembers();
|
||||
return result;
|
||||
|
@ -73,6 +74,7 @@ export const useMemberStore = defineStore("member", {
|
|||
lastname: member.lastname,
|
||||
nameaffix: member.nameaffix,
|
||||
birthdate: member.birthdate,
|
||||
internalId: member.internalId,
|
||||
});
|
||||
this.fetchMembers();
|
||||
return result;
|
||||
|
|
|
@ -38,7 +38,6 @@ export const useMembershipStore = defineStore("membership", {
|
|||
async createMembership(membership: CreateMembershipViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const memberId = useMemberStore().activeMember;
|
||||
const result = await http.post(`/admin/member/${memberId}/membership`, {
|
||||
internalId: membership.internalId,
|
||||
start: membership.start,
|
||||
statusId: membership.statusId,
|
||||
});
|
||||
|
@ -48,7 +47,6 @@ export const useMembershipStore = defineStore("membership", {
|
|||
async updateMembership(membership: UpdateMembershipViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const memberId = useMemberStore().activeMember;
|
||||
const result = await http.patch(`/admin/member/${memberId}/membership/${membership.id}`, {
|
||||
internalId: membership.internalId,
|
||||
start: membership.start,
|
||||
end: membership.end,
|
||||
terminationReason: membership.terminationReason,
|
||||
|
|
|
@ -9,6 +9,7 @@ export interface MemberViewModel {
|
|||
lastname: string;
|
||||
nameaffix: string;
|
||||
birthdate: Date;
|
||||
internalId?: string;
|
||||
firstMembershipEntry?: MembershipViewModel;
|
||||
lastMembershipEntry?: MembershipViewModel;
|
||||
sendNewsletter?: CommunicationViewModel;
|
||||
|
@ -22,6 +23,7 @@ export interface CreateMemberViewModel {
|
|||
lastname: string;
|
||||
nameaffix: string;
|
||||
birthdate: Date;
|
||||
internalId?: string;
|
||||
}
|
||||
|
||||
export interface UpdateMemberViewModel {
|
||||
|
@ -31,4 +33,5 @@ export interface UpdateMemberViewModel {
|
|||
lastname: string;
|
||||
nameaffix: string;
|
||||
birthdate: Date;
|
||||
internalId?: string;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
export interface MembershipViewModel {
|
||||
id: number;
|
||||
internalId?: string;
|
||||
start: Date;
|
||||
end?: Date;
|
||||
terminationReason?: string;
|
||||
|
@ -9,14 +8,12 @@ export interface MembershipViewModel {
|
|||
}
|
||||
|
||||
export interface CreateMembershipViewModel {
|
||||
internalId?: string;
|
||||
start: Date;
|
||||
statusId: number;
|
||||
}
|
||||
|
||||
export interface UpdateMembershipViewModel {
|
||||
id: number;
|
||||
internalId?: string;
|
||||
start: Date;
|
||||
end?: Date;
|
||||
terminationReason?: string;
|
||||
|
|
|
@ -69,6 +69,10 @@
|
|||
<label for="birthdate">Geburtsdatum</label>
|
||||
<input type="date" id="birthdate" required v-model="member.birthdate" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="internalId">Interne ID (optional)</label>
|
||||
<input type="text" id="internalId" v-model="member.internalId" />
|
||||
</div>
|
||||
<div class="flex flex-row justify-end gap-2">
|
||||
<button primary-outline type="reset" class="!w-fit" :disabled="canSaveOrReset" @click="resetForm">
|
||||
verwerfen
|
||||
|
@ -155,6 +159,7 @@ export default defineComponent({
|
|||
lastname: formData.lastname.value,
|
||||
nameaffix: formData.nameaffix.value,
|
||||
birthdate: formData.birthdate.value,
|
||||
internalId: formData.internalId.value,
|
||||
};
|
||||
this.status = "loading";
|
||||
this.updateActiveMember(updateMember)
|
||||
|
|
Loading…
Reference in a new issue