From c2b495f8a74754d45a6ba0973489a02475db53b0 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Sun, 19 Jan 2025 13:42:42 +0100 Subject: [PATCH] set excused state to presece members --- .../club/protocol/protocolPresence.models.ts | 1 + .../admin/club/protocol/ProtocolPresence.vue | 54 +++++++++++-------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/viewmodels/admin/club/protocol/protocolPresence.models.ts b/src/viewmodels/admin/club/protocol/protocolPresence.models.ts index 41fb03c..35bdd44 100644 --- a/src/viewmodels/admin/club/protocol/protocolPresence.models.ts +++ b/src/viewmodels/admin/club/protocol/protocolPresence.models.ts @@ -1,6 +1,7 @@ export interface ProtocolPresenceViewModel { memberId: number; absent: boolean; + excused: boolean; protocolId: number; } diff --git a/src/views/admin/club/protocol/ProtocolPresence.vue b/src/views/admin/club/protocol/ProtocolPresence.vue index 1e1c38c..47bf089 100644 --- a/src/views/admin/club/protocol/ProtocolPresence.vue +++ b/src/views/admin/club/protocol/ProtocolPresence.vue @@ -46,7 +46,8 @@ }" > - {{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.lastname }} {{ getMember(member.memberId)?.nameaffix }} + {{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.lastname }} + {{ getMember(member.memberId)?.nameaffix }}
-

{{ getMember(member.memberId)?.lastname }}, {{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.nameaffix ? `- ${getMember(member.memberId)?.nameaffix}` : "" }}

- -
+

+ {{ getMember(member.memberId)?.lastname }}, {{ getMember(member.memberId)?.firstname }} + {{ getMember(member.memberId)?.nameaffix ? `- ${getMember(member.memberId)?.nameaffix}` : "" }} +

+
+ + +
+ { - return (this.query === "" - ? this.members - : this.members.filter((member) => - (member.firstname + " " + member.lastname) - .toLowerCase() - .replace(/\s+/g, "") - .includes(this.query.toLowerCase().replace(/\s+/g, "")) - )).map(m =>({memberId: m.id, absent:false, protocolId:parseInt(this.protocolId ?? "")})); + filtered(): Array<{ memberId: number; absent: boolean; excused: boolean; protocolId: number }> { + return ( + this.query === "" + ? this.members + : this.members.filter((member) => + (member.firstname + " " + member.lastname) + .toLowerCase() + .replace(/\s+/g, "") + .includes(this.query.toLowerCase().replace(/\s+/g, "")) + ) + ).map((m) => ({ memberId: m.id, absent: false, excused: true, protocolId: parseInt(this.protocolId ?? "") })); + }, + getMember() { + return (memberId: number) => { + return this.members.find((m) => memberId == m.id); + }; }, - getMember(){ - return (memberId:number) => { - return this.members.find(m => memberId == m.id) - } - } }, mounted() { this.fetchMembers(0, 1000, "", true);