Compare commits
No commits in common. "03b35906b2d3c0c5a495cd568c14f472856e684a" and "6e8267555720011db3f235f785b7cb68c127aca8" have entirely different histories.
03b35906b2
...
6e82675557
5 changed files with 3 additions and 76 deletions
|
@ -1,9 +1,5 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import type {
|
import type { CreateMemberViewModel, UpdateMemberViewModel } from "@/viewmodels/admin/club/member/member.models";
|
||||||
CreateMemberViewModel,
|
|
||||||
MemberStatisticsViewModel,
|
|
||||||
UpdateMemberViewModel,
|
|
||||||
} from "@/viewmodels/admin/club/member/member.models";
|
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models";
|
import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models";
|
||||||
|
@ -16,7 +12,6 @@ export const useMemberStore = defineStore("member", {
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
activeMember: null as number | null,
|
activeMember: null as number | null,
|
||||||
activeMemberObj: null as MemberViewModel | null,
|
activeMemberObj: null as MemberViewModel | null,
|
||||||
activeMemberStatistics: null as MemberStatisticsViewModel | null,
|
|
||||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -75,17 +70,6 @@ export const useMemberStore = defineStore("member", {
|
||||||
fetchMemberById(id: number) {
|
fetchMemberById(id: number) {
|
||||||
return http.get(`/admin/member/${id}`);
|
return http.get(`/admin/member/${id}`);
|
||||||
},
|
},
|
||||||
fetchMemberStatisticsByActiveId() {
|
|
||||||
http
|
|
||||||
.get(`/admin/member/${this.activeMember}/statistics`)
|
|
||||||
.then((res) => {
|
|
||||||
this.activeMemberStatistics = res.data;
|
|
||||||
})
|
|
||||||
.catch((err) => {});
|
|
||||||
},
|
|
||||||
fetchMemberStatisticsById(id: number) {
|
|
||||||
return http.get(`/admin/member/${id}/statistics`);
|
|
||||||
},
|
|
||||||
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {
|
async createMember(member: CreateMemberViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/member`, {
|
const result = await http.post(`/admin/member`, {
|
||||||
salutation: member.salutation,
|
salutation: member.salutation,
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.mode
|
||||||
import { useMemberStore } from "./member";
|
import { useMemberStore } from "./member";
|
||||||
import type {
|
import type {
|
||||||
CreateMembershipViewModel,
|
CreateMembershipViewModel,
|
||||||
MembershipStatisticsViewModel,
|
|
||||||
MembershipViewModel,
|
MembershipViewModel,
|
||||||
UpdateMembershipViewModel,
|
UpdateMembershipViewModel,
|
||||||
} from "@/viewmodels/admin/club/member/membership.models";
|
} from "@/viewmodels/admin/club/member/membership.models";
|
||||||
|
@ -15,7 +14,6 @@ export const useMembershipStore = defineStore("membership", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
memberships: [] as Array<MembershipViewModel>,
|
memberships: [] as Array<MembershipViewModel>,
|
||||||
membershipStatistics: [] as Array<MembershipStatisticsViewModel>,
|
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -33,15 +31,6 @@ export const useMembershipStore = defineStore("membership", {
|
||||||
this.loading = "failed";
|
this.loading = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchMembershipStatisticsForMember() {
|
|
||||||
const memberId = useMemberStore().activeMember;
|
|
||||||
http
|
|
||||||
.get(`/admin/member/${memberId}/memberships/statistics`)
|
|
||||||
.then((result) => {
|
|
||||||
this.membershipStatistics = result.data;
|
|
||||||
})
|
|
||||||
.catch((err) => {});
|
|
||||||
},
|
|
||||||
fetchMembershipById(id: number) {
|
fetchMembershipById(id: number) {
|
||||||
const memberId = useMemberStore().activeMember;
|
const memberId = useMemberStore().activeMember;
|
||||||
return http.get(`/admin/member/${memberId}/membership/${id}`);
|
return http.get(`/admin/member/${memberId}/membership/${id}`);
|
||||||
|
|
|
@ -17,18 +17,6 @@ export interface MemberViewModel {
|
||||||
preferredCommunication?: Array<CommunicationViewModel>;
|
preferredCommunication?: Array<CommunicationViewModel>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MemberStatisticsViewModel {
|
|
||||||
id: number;
|
|
||||||
salutation: Salutation;
|
|
||||||
firstname: string;
|
|
||||||
lastname: string;
|
|
||||||
nameaffix: string;
|
|
||||||
birthdate: Date;
|
|
||||||
todayAge: number;
|
|
||||||
ageThisYear: number;
|
|
||||||
exactAge: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateMemberViewModel {
|
export interface CreateMemberViewModel {
|
||||||
salutation: Salutation;
|
salutation: Salutation;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import type { Salutation } from "../../../../enums/salutation";
|
|
||||||
|
|
||||||
export interface MembershipViewModel {
|
export interface MembershipViewModel {
|
||||||
id: number;
|
id: number;
|
||||||
start: Date;
|
start: Date;
|
||||||
|
@ -9,19 +7,6 @@ export interface MembershipViewModel {
|
||||||
statusId: number;
|
statusId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MembershipStatisticsViewModel {
|
|
||||||
durationInDays: number;
|
|
||||||
durationInYears: string;
|
|
||||||
status: string;
|
|
||||||
statusId: number;
|
|
||||||
memberId: number;
|
|
||||||
memberSalutation: Salutation;
|
|
||||||
memberFirstname: string;
|
|
||||||
memberLastname: string;
|
|
||||||
memberNameaffix: string;
|
|
||||||
memberBirthdate: Date;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateMembershipViewModel {
|
export interface CreateMembershipViewModel {
|
||||||
start: Date;
|
start: Date;
|
||||||
statusId: number;
|
statusId: number;
|
||||||
|
|
|
@ -25,20 +25,6 @@
|
||||||
<label for="birthdate">Geburtsdatum</label>
|
<label for="birthdate">Geburtsdatum</label>
|
||||||
<input type="date" id="birthdate" :value="activeMemberObj.birthdate" readonly />
|
<input type="date" id="birthdate" :value="activeMemberObj.birthdate" readonly />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="membershipStatistics.length != 0">
|
|
||||||
<p>Statistiken zur Mitgliedschaft</p>
|
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
|
||||||
<div
|
|
||||||
v-for="stat in membershipStatistics"
|
|
||||||
class="bg-primary p-2 text-white flex flex-row justify-between items-center"
|
|
||||||
>
|
|
||||||
<p>
|
|
||||||
{{ stat.status }} für gesamt {{ stat.durationInDays }} Tage
|
|
||||||
<span class="whitespace-nowrap"> ~> {{ stat.durationInYears.replace("_", "") }} Jahre</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-if="activeMemberObj.firstMembershipEntry">
|
<div v-if="activeMemberObj.firstMembershipEntry">
|
||||||
<p>Erster Eintrag Mitgliedschaft</p>
|
<p>Erster Eintrag Mitgliedschaft</p>
|
||||||
<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">
|
||||||
|
@ -139,7 +125,6 @@ import { defineComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
import Spinner from "@/components/Spinner.vue";
|
import Spinner from "@/components/Spinner.vue";
|
||||||
import { useMemberStore } from "@/stores/admin/club/member/member";
|
import { useMemberStore } from "@/stores/admin/club/member/member";
|
||||||
import { useMembershipStore } from "@/stores/admin/club/member/membership";
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -148,17 +133,13 @@ export default defineComponent({
|
||||||
memberId: String,
|
memberId: String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useMemberStore, ["activeMemberObj", "activeMemberStatistics", "loadingActive"]),
|
...mapState(useMemberStore, ["activeMemberObj", "loadingActive"]),
|
||||||
...mapState(useMembershipStore, ["membershipStatistics"]),
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchMemberByActiveId();
|
this.fetchMemberByActiveId();
|
||||||
this.fetchMemberStatisticsByActiveId();
|
|
||||||
this.fetchMembershipStatisticsForMember();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useMemberStore, ["fetchMemberByActiveId", "fetchMemberStatisticsByActiveId"]),
|
...mapActions(useMemberStore, ["fetchMemberByActiveId"]),
|
||||||
...mapActions(useMembershipStore, ["fetchMembershipStatisticsForMember"]),
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue