feature/#38-protocol-presence-status #44
2 changed files with 34 additions and 21 deletions
|
@ -1,6 +1,7 @@
|
|||
export interface ProtocolPresenceViewModel {
|
||||
memberId: number;
|
||||
absent: boolean;
|
||||
excused: boolean;
|
||||
protocolId: number;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@
|
|||
}"
|
||||
>
|
||||
<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
|
||||
v-if="selected"
|
||||
|
@ -71,11 +72,20 @@
|
|||
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">
|
||||
<p>{{ getMember(member.memberId)?.lastname }}, {{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.nameaffix ? `- ${getMember(member.memberId)?.nameaffix}` : "" }}</p>
|
||||
<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">
|
||||
<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
|
||||
v-if="can('create', 'club', 'protocol')"
|
||||
|
@ -123,21 +133,23 @@ export default defineComponent({
|
|||
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
|
||||
...mapState(useMemberStore, ["members"]),
|
||||
...mapState(useAbilityStore, ["can"]),
|
||||
filtered(): Array<{memberId:number, absent:boolean; protocolId:number}> {
|
||||
return (this.query === ""
|
||||
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, protocolId:parseInt(this.protocolId ?? "")}));
|
||||
)
|
||||
).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);
|
||||
|
|
Loading…
Reference in a new issue