Compare commits

..

No commits in common. "363b5bb5412248e40e3d190499a6759899f26d95" and "8a85cc054d273aaddf0bdf30267e365090c7cefa" have entirely different histories.

2 changed files with 21 additions and 34 deletions

View file

@ -1,7 +1,6 @@
export interface ProtocolPresenceViewModel { export interface ProtocolPresenceViewModel {
memberId: number; memberId: number;
absent: boolean; absent: boolean;
excused: boolean;
protocolId: number; protocolId: number;
} }

View file

@ -46,8 +46,7 @@
}" }"
> >
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }"> <span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
{{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.lastname }} {{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.lastname }} {{ getMember(member.memberId)?.nameaffix }}
{{ getMember(member.memberId)?.nameaffix }}
</span> </span>
<span <span
v-if="selected" v-if="selected"
@ -72,20 +71,11 @@
class="flex flex-row h-fit w-full border border-primary rounded-md bg-primary p-2 text-white justify-between items-center" class="flex flex-row h-fit w-full border border-primary rounded-md bg-primary p-2 text-white justify-between items-center"
> >
<div class="flex flex-col items-start"> <div class="flex flex-col items-start">
<p> <p>{{ getMember(member.memberId)?.lastname }}, {{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.nameaffix ? `- ${getMember(member.memberId)?.nameaffix}` : "" }}</p>
{{ getMember(member.memberId)?.lastname }}, {{ getMember(member.memberId)?.firstname }}
{{ getMember(member.memberId)?.nameaffix ? `- ${getMember(member.memberId)?.nameaffix}` : "" }}
</p>
<div class="flex flex-row gap-4">
<label class="flex flex-row gap-2 items-center"> <label class="flex flex-row gap-2 items-center">
<input type="checkbox" v-model="member.absent" /> <input type="checkbox" v-model="member.absent" />
war abwesend war abwesend
</label> </label>
<label v-if="member.absent" class="flex flex-row gap-2 items-center">
<input type="checkbox" v-model="member.excused" />
ist entschuldigt
</label>
</div>
</div> </div>
<TrashIcon <TrashIcon
v-if="can('create', 'club', 'protocol')" v-if="can('create', 'club', 'protocol')"
@ -133,23 +123,21 @@ export default defineComponent({
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]), ...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
...mapState(useMemberStore, ["members"]), ...mapState(useMemberStore, ["members"]),
...mapState(useAbilityStore, ["can"]), ...mapState(useAbilityStore, ["can"]),
filtered(): Array<{ memberId: number; absent: boolean; excused: boolean; protocolId: number }> { filtered(): Array<{memberId:number, absent:boolean; protocolId:number}> {
return ( return (this.query === ""
this.query === ""
? this.members ? this.members
: this.members.filter((member) => : this.members.filter((member) =>
(member.firstname + " " + member.lastname) (member.firstname + " " + member.lastname)
.toLowerCase() .toLowerCase()
.replace(/\s+/g, "") .replace(/\s+/g, "")
.includes(this.query.toLowerCase().replace(/\s+/g, "")) .includes(this.query.toLowerCase().replace(/\s+/g, ""))
) )).map(m =>({memberId: m.id, absent:false, protocolId:parseInt(this.protocolId ?? "")}));
).map((m) => ({ memberId: m.id, absent: false, excused: true, protocolId: parseInt(this.protocolId ?? "") }));
}, },
getMember(){ getMember(){
return (memberId:number) => { return (memberId:number) => {
return this.members.find((m) => memberId == m.id); return this.members.find(m => memberId == m.id)
}; }
}, }
}, },
mounted() { mounted() {
this.fetchMembers(0, 1000, "", true); this.fetchMembers(0, 1000, "", true);