Education views in member and config

This commit is contained in:
Julian Krauser 2025-06-02 13:57:06 +02:00
parent 3b89262ce9
commit 05ec4afadb
20 changed files with 1139 additions and 4 deletions

View file

@ -106,6 +106,7 @@ export const useMemberStore = defineStore("member", {
nameaffix: member.nameaffix,
birthdate: member.birthdate,
internalId: member.internalId,
note: member.note,
});
this.fetchMembers();
return result;
@ -118,6 +119,7 @@ export const useMemberStore = defineStore("member", {
nameaffix: member.nameaffix,
birthdate: member.birthdate,
internalId: member.internalId,
note: member.note,
});
this.fetchMembers();
return result;

View file

@ -0,0 +1,67 @@
import { defineStore } from "pinia";
import { http } from "@/serverCom";
import type { AxiosResponse } from "axios";
import { useMemberStore } from "./member";
import type {
CreateMemberEducationViewModel,
MemberEducationViewModel,
UpdateMemberEducationViewModel,
} from "@/viewmodels/admin/club/member/memberEducation.models";
export const useMemberEducationStore = defineStore("memberEducation", {
state: () => {
return {
memberEducations: [] as Array<MemberEducationViewModel>,
loading: "loading" as "loading" | "fetched" | "failed",
};
},
actions: {
fetchMemberEducationsForMember() {
const memberId = useMemberStore().activeMember;
this.loading = "loading";
http
.get(`/admin/member/${memberId}/educations`)
.then((result) => {
this.memberEducations = result.data;
this.loading = "fetched";
})
.catch((err) => {
this.loading = "failed";
});
},
fetchMemberEducationById(id: number) {
const memberId = useMemberStore().activeMember;
return http.get(`/admin/member/${memberId}/education/${id}`);
},
async createMemberEducation(memberEducation: CreateMemberEducationViewModel): Promise<AxiosResponse<any, any>> {
const memberId = useMemberStore().activeMember;
const result = await http.post(`/admin/member/${memberId}/education`, {
start: memberEducation.start,
end: memberEducation.end,
place: memberEducation.place,
note: memberEducation.note,
educationId: memberEducation.educationId,
});
this.fetchMemberEducationsForMember();
return result;
},
async updateMemberEducation(memberEducation: UpdateMemberEducationViewModel): Promise<AxiosResponse<any, any>> {
const memberId = useMemberStore().activeMember;
const result = await http.patch(`/admin/member/${memberId}/education/${memberEducation.id}`, {
start: memberEducation.start,
end: memberEducation.end,
place: memberEducation.place,
note: memberEducation.note,
educationId: memberEducation.educationId,
});
this.fetchMemberEducationsForMember();
return result;
},
async deleteMemberEducation(memberEducation: number): Promise<AxiosResponse<any, any>> {
const memberId = useMemberStore().activeMember;
const result = await http.delete(`/admin/member/${memberId}/education/${memberEducation}`);
this.fetchMemberEducationsForMember();
return result;
},
},
});

View file

@ -0,0 +1,55 @@
import { defineStore } from "pinia";
import type {
CreateEducationViewModel,
UpdateEducationViewModel,
EducationViewModel,
} from "@/viewmodels/admin/configuration/education.models";
import { http } from "@/serverCom";
import type { AxiosResponse } from "axios";
export const useEducationStore = defineStore("education", {
state: () => {
return {
educations: [] as Array<EducationViewModel>,
loading: "loading" as "loading" | "fetched" | "failed",
};
},
actions: {
fetchEducations() {
this.loading = "loading";
http
.get("/admin/education")
.then((result) => {
this.educations = result.data;
this.loading = "fetched";
})
.catch((err) => {
this.loading = "failed";
});
},
fetchEducationById(id: number): Promise<AxiosResponse<any, any>> {
return http.get(`/admin/education/${id}`);
},
async createEducation(education: CreateEducationViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/education`, {
education: education.education,
description: education.description,
});
this.fetchEducations();
return result;
},
async updateActiveEducation(education: UpdateEducationViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/education/${education.id}`, {
education: education.education,
description: education.description,
});
this.fetchEducations();
return result;
},
async deleteEducation(education: number): Promise<AxiosResponse<any, any>> {
const result = await http.delete(`/admin/education/${education}`);
this.fetchEducations();
return result;
},
},
});

View file

@ -112,6 +112,9 @@ export const useNavigationStore = defineStore("navigation", {
...(abilityStore.can("read", "configuration", "qualification")
? [{ key: "qualification", title: "Qualifikationen" }]
: []),
...(abilityStore.can("read", "configuration", "education")
? [{ key: "education", title: "Aus-Fortbildungen" }]
: []),
...(abilityStore.can("read", "configuration", "executive_position")
? [{ key: "executive_position", title: "Vereinsämter" }]
: []),