From 6154518cbd86c3a1db8ce1f9e8bd091bffd58508 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Tue, 31 Dec 2024 14:52:17 +0100 Subject: [PATCH 1/5] fix query builder requests pagination & pagination loading --- src/components/Pagination.vue | 7 ++++++- src/stores/admin/queryBuilder.ts | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/Pagination.vue b/src/components/Pagination.vue index 8b6ead5..fdedf98 100644 --- a/src/components/Pagination.vue +++ b/src/components/Pagination.vue @@ -96,6 +96,10 @@ watch(searchString, async () => { }, 600); }); +watch(() => props.totalCount, async () => { + currentPage.value = 0; +}); + const emit = defineEmits({ submit(id: number) { return typeof id == "number"; @@ -151,7 +155,8 @@ const loadPage = (newPage: number | ".") => { if (pageEnd > entryCount.value) pageEnd = entryCount.value; let loadedElementCount = filterData(props.items, searchString.value, pageStart, pageEnd).length; - if (loadedElementCount < props.maxEntriesPerPage) + console.log(loadedElementCount, props.maxEntriesPerPage, pageStart, pageEnd) + if (loadedElementCount < props.maxEntriesPerPage && (pageEnd != props.totalCount || loadedElementCount == 0)) emit("loadData", pageStart, props.maxEntriesPerPage, searchString.value); currentPage.value = newPage; diff --git a/src/stores/admin/queryBuilder.ts b/src/stores/admin/queryBuilder.ts index d65e150..292ba38 100644 --- a/src/stores/admin/queryBuilder.ts +++ b/src/stores/admin/queryBuilder.ts @@ -32,8 +32,10 @@ export const useQueryBuilderStore = defineStore("queryBuilder", { }, sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) { this.queryError = ""; - this.data = []; - this.totalLength = 0; + if (offset == 0) { + this.data = []; + this.totalLength = 0; + } let queryToSend = query ?? this.query; if (queryToSend == undefined || queryToSend == "" || (typeof queryToSend != "string" && queryToSend.table == "")) return; @@ -44,7 +46,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", { }) .then((result) => { if (result.data.stats == "success") { - this.data = result.data.rows; + this.data = [...this.data, ...result.data.rows]; this.totalLength = result.data.total; this.loadingData = "fetched"; } else { -- 2.45.2 From bfa6eb2347b1dc5c1825d74bd0d4eaa35cefb3bc Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Wed, 1 Jan 2025 13:21:35 +0100 Subject: [PATCH 2/5] template header & footer margins --- .../templateUsage/TemplateUsageListItem.vue | 40 +++++++++++++------ src/stores/admin/templateUsage.ts | 2 + src/viewmodels/admin/templateUsage.models.ts | 4 ++ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/components/admin/settings/templateUsage/TemplateUsageListItem.vue b/src/components/admin/settings/templateUsage/TemplateUsageListItem.vue index c5562fe..07a35b2 100644 --- a/src/components/admin/settings/templateUsage/TemplateUsageListItem.vue +++ b/src/components/admin/settings/templateUsage/TemplateUsageListItem.vue @@ -18,12 +18,18 @@
-
-

Kopfzeile:

- +
+
+

Kopfzeile:

+ +
+
+

Höhe [mm]:

+ +

Hauptteil:

@@ -32,12 +38,18 @@
-
-

Fußzeile:

- +
+
+

Fußzeile:

+ +
+
+

Höhe [mm]:

+ +
@@ -91,6 +103,8 @@ export default defineComponent({ const headerId = fromData.header.value === "def" ? null : fromData.header.value; const bodyId = fromData.body.value === "def" ? null : fromData.body.value; const footerId = fromData.footer.value === "def" ? null : fromData.footer.value; + const headerHeight = fromData.footer.value === "" ? null : parseInt(fromData.headerHeight.value); + const footerHeight = fromData.footer.value === "" ? null : parseInt(fromData.footerHeight.value); this.status = "loading" this.updateTemplateUsage({ @@ -98,6 +112,8 @@ export default defineComponent({ headerId: headerId, bodyId: bodyId, footerId: footerId, + headerHeight:headerHeight, + footerHeight: footerHeight }) .then(() => { this.status = { status: "success" }; diff --git a/src/stores/admin/templateUsage.ts b/src/stores/admin/templateUsage.ts index 6e3aca9..dde0591 100644 --- a/src/stores/admin/templateUsage.ts +++ b/src/stores/admin/templateUsage.ts @@ -35,6 +35,8 @@ export const useTemplateUsageStore = defineStore("templateUsage", { headerId: templateUsage.headerId, bodyId: templateUsage.bodyId, footerId: templateUsage.footerId, + headerHeight: templateUsage.headerHeight, + footerHeight: templateUsage.footerHeight, }); this.fetchTemplateUsages(); return result; diff --git a/src/viewmodels/admin/templateUsage.models.ts b/src/viewmodels/admin/templateUsage.models.ts index 79459cd..8aa7d1f 100644 --- a/src/viewmodels/admin/templateUsage.models.ts +++ b/src/viewmodels/admin/templateUsage.models.ts @@ -5,6 +5,8 @@ export interface TemplateUsageViewModel { header: { id: number; template: string } | null; body: { id: number; template: string } | null; footer: { id: number; template: string } | null; + headerHeight: number | null; + footerHeight: number | null; } export interface UpdateTemplateUsageViewModel { @@ -12,4 +14,6 @@ export interface UpdateTemplateUsageViewModel { headerId: number | null; bodyId: number | null; footerId: number | null; + headerHeight: number | null; + footerHeight: number | null; } -- 2.45.2 From dfb5547bd24cbf42ce10b0a6ffca31c43ff35237 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Thu, 2 Jan 2025 17:08:43 +0100 Subject: [PATCH 3/5] internal Id to member --- .../admin/club/member/CreateMemberModal.vue | 5 ++ .../admin/club/member/MemberListItem.vue | 49 +++++-------------- .../club/member/MembershipCreateModal.vue | 5 -- .../admin/club/member/MembershipEditModal.vue | 5 -- .../admin/club/member/MembershipListItem.vue | 5 +- src/stores/admin/member.ts | 2 + src/stores/admin/membership.ts | 2 - src/viewmodels/admin/member.models.ts | 3 ++ src/viewmodels/admin/membership.models.ts | 3 -- src/views/admin/club/members/MemberEdit.vue | 7 ++- 10 files changed, 30 insertions(+), 56 deletions(-) diff --git a/src/components/admin/club/member/CreateMemberModal.vue b/src/components/admin/club/member/CreateMemberModal.vue index 0addfc7..0099fc5 100644 --- a/src/components/admin/club/member/CreateMemberModal.vue +++ b/src/components/admin/club/member/CreateMemberModal.vue @@ -66,6 +66,10 @@
+
+ + +
@@ -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(() => { diff --git a/src/components/admin/club/member/MemberListItem.vue b/src/components/admin/club/member/MemberListItem.vue index 24daf11..b9155c5 100644 --- a/src/components/admin/club/member/MemberListItem.vue +++ b/src/components/admin/club/member/MemberListItem.vue @@ -1,41 +1,25 @@ @@ -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 - // ); - }, - }, }); diff --git a/src/components/admin/club/member/MembershipCreateModal.vue b/src/components/admin/club/member/MembershipCreateModal.vue index 433392f..42d3614 100644 --- a/src/components/admin/club/member/MembershipCreateModal.vue +++ b/src/components/admin/club/member/MembershipCreateModal.vue @@ -63,10 +63,6 @@
-
- - -
@@ -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, }; diff --git a/src/components/admin/club/member/MembershipEditModal.vue b/src/components/admin/club/member/MembershipEditModal.vue index 4d621ae..548cfcf 100644 --- a/src/components/admin/club/member/MembershipEditModal.vue +++ b/src/components/admin/club/member/MembershipEditModal.vue @@ -63,10 +63,6 @@
-
- - -
@@ -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, diff --git a/src/components/admin/club/member/MembershipListItem.vue b/src/components/admin/club/member/MembershipListItem.vue index a7dab8c..ce78355 100644 --- a/src/components/admin/club/member/MembershipListItem.vue +++ b/src/components/admin/club/member/MembershipListItem.vue @@ -8,9 +8,8 @@
-
-

Interne ID: {{ membership.internalId }}

-

beendet, weil: {{ membership.terminationReason }}

+
+

Grund: {{ membership.terminationReason }}

diff --git a/src/stores/admin/member.ts b/src/stores/admin/member.ts index b0075de..2a391bb 100644 --- a/src/stores/admin/member.ts +++ b/src/stores/admin/member.ts @@ -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; diff --git a/src/stores/admin/membership.ts b/src/stores/admin/membership.ts index e53734e..56e7bb8 100644 --- a/src/stores/admin/membership.ts +++ b/src/stores/admin/membership.ts @@ -38,7 +38,6 @@ export const useMembershipStore = defineStore("membership", { async createMembership(membership: CreateMembershipViewModel): Promise> { 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> { 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, diff --git a/src/viewmodels/admin/member.models.ts b/src/viewmodels/admin/member.models.ts index 0f95af6..ca5fcc1 100644 --- a/src/viewmodels/admin/member.models.ts +++ b/src/viewmodels/admin/member.models.ts @@ -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; } diff --git a/src/viewmodels/admin/membership.models.ts b/src/viewmodels/admin/membership.models.ts index 76b804e..82ede06 100644 --- a/src/viewmodels/admin/membership.models.ts +++ b/src/viewmodels/admin/membership.models.ts @@ -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; diff --git a/src/views/admin/club/members/MemberEdit.vue b/src/views/admin/club/members/MemberEdit.vue index aa70158..b3c4af8 100644 --- a/src/views/admin/club/members/MemberEdit.vue +++ b/src/views/admin/club/members/MemberEdit.vue @@ -69,6 +69,10 @@ +
+ + +