feature/#38-protocol-presence-status #44
2 changed files with 34 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
||||||
export interface ProtocolPresenceViewModel {
|
export interface ProtocolPresenceViewModel {
|
||||||
memberId: number;
|
memberId: number;
|
||||||
absent: boolean;
|
absent: boolean;
|
||||||
|
excused: boolean;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,8 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<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)?.nameaffix }}
|
{{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.lastname }}
|
||||||
|
{{ getMember(member.memberId)?.nameaffix }}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="selected"
|
v-if="selected"
|
||||||
|
@ -71,12 +72,21 @@
|
||||||
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>{{ getMember(member.memberId)?.lastname }}, {{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.nameaffix ? `- ${getMember(member.memberId)?.nameaffix}` : "" }}</p>
|
<p>
|
||||||
<label class="flex flex-row gap-2 items-center">
|
{{ getMember(member.memberId)?.lastname }}, {{ getMember(member.memberId)?.firstname }}
|
||||||
<input type="checkbox" v-model="member.absent" />
|
{{ getMember(member.memberId)?.nameaffix ? `- ${getMember(member.memberId)?.nameaffix}` : "" }}
|
||||||
war abwesend
|
</p>
|
||||||
</label>
|
<div class="flex flex-row gap-4">
|
||||||
</div>
|
<label class="flex flex-row gap-2 items-center">
|
||||||
|
<input type="checkbox" v-model="member.absent" />
|
||||||
|
war abwesend
|
||||||
|
</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>
|
||||||
<TrashIcon
|
<TrashIcon
|
||||||
v-if="can('create', 'club', 'protocol')"
|
v-if="can('create', 'club', 'protocol')"
|
||||||
class="w-5 h-5 p-1 box-content cursor-pointer"
|
class="w-5 h-5 p-1 box-content cursor-pointer"
|
||||||
|
@ -123,21 +133,23 @@ 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; protocolId:number}> {
|
filtered(): Array<{ memberId: number; absent: boolean; excused: boolean; protocolId: number }> {
|
||||||
return (this.query === ""
|
return (
|
||||||
? this.members
|
this.query === ""
|
||||||
: this.members.filter((member) =>
|
? this.members
|
||||||
(member.firstname + " " + member.lastname)
|
: this.members.filter((member) =>
|
||||||
.toLowerCase()
|
(member.firstname + " " + member.lastname)
|
||||||
.replace(/\s+/g, "")
|
.toLowerCase()
|
||||||
.includes(this.query.toLowerCase().replace(/\s+/g, ""))
|
.replace(/\s+/g, "")
|
||||||
)).map(m =>({memberId: m.id, absent:false, protocolId:parseInt(this.protocolId ?? "")}));
|
.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() {
|
mounted() {
|
||||||
this.fetchMembers(0, 1000, "", true);
|
this.fetchMembers(0, 1000, "", true);
|
||||||
|
|
Loading…
Reference in a new issue