enhancement syncing & protocol presence absence
This commit is contained in:
parent
5050011f29
commit
b106ea6396
17 changed files with 95 additions and 47 deletions
|
@ -1,6 +1,9 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { NewsletterDatesViewModel, SyncNewsletterDatesViewModel } from "@/viewmodels/admin/club/newsletter/newsletterDates.models";
|
import type {
|
||||||
|
NewsletterDatesViewModel,
|
||||||
|
SyncNewsletterDatesViewModel,
|
||||||
|
} from "@/viewmodels/admin/club/newsletter/newsletterDates.models";
|
||||||
import { useNewsletterStore } from "./newsletter";
|
import { useNewsletterStore } from "./newsletter";
|
||||||
import cloneDeep from "lodash.clonedeep";
|
import cloneDeep from "lodash.clonedeep";
|
||||||
import isEqual from "lodash.isequal";
|
import isEqual from "lodash.isequal";
|
||||||
|
@ -9,6 +12,7 @@ import differenceWith from "lodash.differencewith";
|
||||||
export const useNewsletterDatesStore = defineStore("newsletterDates", {
|
export const useNewsletterDatesStore = defineStore("newsletterDates", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
|
initialized: false as boolean,
|
||||||
dates: [] as Array<NewsletterDatesViewModel>,
|
dates: [] as Array<NewsletterDatesViewModel>,
|
||||||
origin: [] as Array<NewsletterDatesViewModel>,
|
origin: [] as Array<NewsletterDatesViewModel>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
@ -38,6 +42,7 @@ export const useNewsletterDatesStore = defineStore("newsletterDates", {
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = result.data;
|
this.origin = result.data;
|
||||||
this.dates = cloneDeep(this.origin);
|
this.dates = cloneDeep(this.origin);
|
||||||
|
this.initialized = true;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -49,6 +54,8 @@ export const useNewsletterDatesStore = defineStore("newsletterDates", {
|
||||||
return http.get(`/admin/newsletter/${newsletterId}/dates`);
|
return http.get(`/admin/newsletter/${newsletterId}/dates`);
|
||||||
},
|
},
|
||||||
async synchronizeActiveNewsletterDates() {
|
async synchronizeActiveNewsletterDates() {
|
||||||
|
if (!this.initialized) return;
|
||||||
|
|
||||||
this.syncingNewsletterDates = "syncing";
|
this.syncingNewsletterDates = "syncing";
|
||||||
const newsletterId = useNewsletterStore().activeNewsletter;
|
const newsletterId = useNewsletterStore().activeNewsletter;
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import isEqual from "lodash.isequal";
|
||||||
export const useNewsletterRecipientsStore = defineStore("newsletterRecipients", {
|
export const useNewsletterRecipientsStore = defineStore("newsletterRecipients", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
|
initialized: false as boolean,
|
||||||
recipients: [] as Array<number>,
|
recipients: [] as Array<number>,
|
||||||
origin: [] as Array<number>,
|
origin: [] as Array<number>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
@ -31,6 +32,7 @@ export const useNewsletterRecipientsStore = defineStore("newsletterRecipients",
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = result.data.map((d: NewsletterRecipientsViewModel) => d.memberId);
|
this.origin = result.data.map((d: NewsletterRecipientsViewModel) => d.memberId);
|
||||||
this.recipients = cloneDeep(this.origin);
|
this.recipients = cloneDeep(this.origin);
|
||||||
|
this.initialized = true;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -42,8 +44,11 @@ export const useNewsletterRecipientsStore = defineStore("newsletterRecipients",
|
||||||
return http.get(`/admin/newsletter/${newsletterId}/recipients`);
|
return http.get(`/admin/newsletter/${newsletterId}/recipients`);
|
||||||
},
|
},
|
||||||
async synchronizeActiveNewsletterRecipients() {
|
async synchronizeActiveNewsletterRecipients() {
|
||||||
|
if (!this.initialized) return;
|
||||||
|
|
||||||
this.syncingNewsletterRecipients = "syncing";
|
this.syncingNewsletterRecipients = "syncing";
|
||||||
const newsletterId = useNewsletterStore().activeNewsletter;
|
const newsletterId = useNewsletterStore().activeNewsletter;
|
||||||
|
|
||||||
await http
|
await http
|
||||||
.patch(`/admin/newsletter/${newsletterId}/synchronize/recipients`, {
|
.patch(`/admin/newsletter/${newsletterId}/synchronize/recipients`, {
|
||||||
recipients: this.recipients,
|
recipients: this.recipients,
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { ProtocolAgendaViewModel, SyncProtocolAgendaViewModel } from "@/viewmodels/admin/club/protocol/protocolAgenda.models";
|
import type {
|
||||||
|
ProtocolAgendaViewModel,
|
||||||
|
SyncProtocolAgendaViewModel,
|
||||||
|
} from "@/viewmodels/admin/club/protocol/protocolAgenda.models";
|
||||||
import { useProtocolStore } from "./protocol";
|
import { useProtocolStore } from "./protocol";
|
||||||
import cloneDeep from "lodash.clonedeep";
|
import cloneDeep from "lodash.clonedeep";
|
||||||
import isEqual from "lodash.isequal";
|
import isEqual from "lodash.isequal";
|
||||||
|
@ -9,6 +12,7 @@ import differenceWith from "lodash.differencewith";
|
||||||
export const useProtocolAgendaStore = defineStore("protocolAgenda", {
|
export const useProtocolAgendaStore = defineStore("protocolAgenda", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
|
initialized: false as boolean,
|
||||||
agenda: [] as Array<ProtocolAgendaViewModel>,
|
agenda: [] as Array<ProtocolAgendaViewModel>,
|
||||||
origin: [] as Array<ProtocolAgendaViewModel>,
|
origin: [] as Array<ProtocolAgendaViewModel>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
@ -29,6 +33,7 @@ export const useProtocolAgendaStore = defineStore("protocolAgenda", {
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = result.data;
|
this.origin = result.data;
|
||||||
this.agenda = cloneDeep(this.origin);
|
this.agenda = cloneDeep(this.origin);
|
||||||
|
this.initialized = true;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -55,6 +60,8 @@ export const useProtocolAgendaStore = defineStore("protocolAgenda", {
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
async synchronizeActiveProtocolAgenda() {
|
async synchronizeActiveProtocolAgenda() {
|
||||||
|
if (!this.initialized) return;
|
||||||
|
|
||||||
this.syncingProtocolAgenda = "syncing";
|
this.syncingProtocolAgenda = "syncing";
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import differenceWith from "lodash.differencewith";
|
||||||
export const useProtocolDecisionStore = defineStore("protocolDecision", {
|
export const useProtocolDecisionStore = defineStore("protocolDecision", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
|
initialized: false as boolean,
|
||||||
decision: [] as Array<ProtocolDecisionViewModel>,
|
decision: [] as Array<ProtocolDecisionViewModel>,
|
||||||
origin: [] as Array<ProtocolDecisionViewModel>,
|
origin: [] as Array<ProtocolDecisionViewModel>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
@ -33,9 +34,11 @@ export const useProtocolDecisionStore = defineStore("protocolDecision", {
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = result.data;
|
this.origin = result.data;
|
||||||
this.decision = cloneDeep(this.origin);
|
this.decision = cloneDeep(this.origin);
|
||||||
|
this.initialized = true;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
this.loading = "failed";
|
this.loading = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -59,6 +62,8 @@ export const useProtocolDecisionStore = defineStore("protocolDecision", {
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
async synchronizeActiveProtocolDecision() {
|
async synchronizeActiveProtocolDecision() {
|
||||||
|
if (!this.initialized) return;
|
||||||
|
|
||||||
this.syncingProtocolDecision = "syncing";
|
this.syncingProtocolDecision = "syncing";
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
|
|
||||||
|
|
|
@ -12,15 +12,19 @@ import isEqual from "lodash.isequal";
|
||||||
export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
presence: [] as Array<number>,
|
initialized: false as boolean,
|
||||||
origin: [] as Array<number>,
|
presence: [] as Array<ProtocolPresenceViewModel>,
|
||||||
|
origin: [] as Array<ProtocolPresenceViewModel>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
syncingProtocolPresence: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
syncingProtocolPresence: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
detectedChangeProtocolPresence: (state) =>
|
detectedChangeProtocolPresence: (state) =>
|
||||||
!isEqual(state.origin, state.presence) && state.syncingProtocolPresence != "syncing",
|
!isEqual(
|
||||||
|
state.origin.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId),
|
||||||
|
state.presence.sort((a: ProtocolPresenceViewModel, b: ProtocolPresenceViewModel) => a.memberId - b.memberId)
|
||||||
|
) && state.syncingProtocolPresence != "syncing",
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setProtocolPresenceSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
setProtocolPresenceSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
||||||
|
@ -30,8 +34,9 @@ export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
this.fetchProtocolPresencePromise()
|
this.fetchProtocolPresencePromise()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = result.data.map((d: ProtocolPresenceViewModel) => d.memberId);
|
this.origin = result.data;
|
||||||
this.presence = cloneDeep(this.origin);
|
this.presence = cloneDeep(this.origin);
|
||||||
|
this.initialized = true;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -43,8 +48,11 @@ export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
||||||
return http.get(`/admin/protocol/${protocolId}/presence`);
|
return http.get(`/admin/protocol/${protocolId}/presence`);
|
||||||
},
|
},
|
||||||
async synchronizeActiveProtocolPresence() {
|
async synchronizeActiveProtocolPresence() {
|
||||||
|
if (!this.initialized) return;
|
||||||
|
|
||||||
this.syncingProtocolPresence = "syncing";
|
this.syncingProtocolPresence = "syncing";
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
|
|
||||||
await http
|
await http
|
||||||
.put(`/admin/protocol/${protocolId}/synchronize/presence`, {
|
.put(`/admin/protocol/${protocolId}/synchronize/presence`, {
|
||||||
presence: this.presence,
|
presence: this.presence,
|
||||||
|
@ -57,7 +65,7 @@ export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
||||||
});
|
});
|
||||||
this.fetchProtocolPresencePromise()
|
this.fetchProtocolPresencePromise()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = result.data.map((d: ProtocolPresenceViewModel) => d.memberId);
|
this.origin = result.data;
|
||||||
if (this.detectedChangeProtocolPresence) this.syncingProtocolPresence = "detectedChanges";
|
if (this.detectedChangeProtocolPresence) this.syncingProtocolPresence = "detectedChanges";
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const useProtocolPrintoutStore = defineStore("protocolPrintout", {
|
||||||
http
|
http
|
||||||
.get(`/admin/protocol/${protocolId}/printouts`)
|
.get(`/admin/protocol/${protocolId}/printouts`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.printout = result.data;
|
this.printout = result.data.reverse();
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import type { ProtocolVotingViewModel, SyncProtocolVotingViewModel } from "@/viewmodels/admin/club/protocol/protocolVoting.models";
|
import type {
|
||||||
|
ProtocolVotingViewModel,
|
||||||
|
SyncProtocolVotingViewModel,
|
||||||
|
} from "@/viewmodels/admin/club/protocol/protocolVoting.models";
|
||||||
import { useProtocolStore } from "./protocol";
|
import { useProtocolStore } from "./protocol";
|
||||||
import cloneDeep from "lodash.clonedeep";
|
import cloneDeep from "lodash.clonedeep";
|
||||||
import isEqual from "lodash.isequal";
|
import isEqual from "lodash.isequal";
|
||||||
|
@ -10,6 +13,7 @@ import differenceWith from "lodash.differencewith";
|
||||||
export const useProtocolVotingStore = defineStore("protocolVoting", {
|
export const useProtocolVotingStore = defineStore("protocolVoting", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
|
initialized: false as boolean,
|
||||||
voting: [] as Array<ProtocolVotingViewModel>,
|
voting: [] as Array<ProtocolVotingViewModel>,
|
||||||
origin: [] as Array<ProtocolVotingViewModel>,
|
origin: [] as Array<ProtocolVotingViewModel>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
@ -30,6 +34,7 @@ export const useProtocolVotingStore = defineStore("protocolVoting", {
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.origin = result.data;
|
this.origin = result.data;
|
||||||
this.voting = cloneDeep(this.origin);
|
this.voting = cloneDeep(this.origin);
|
||||||
|
this.initialized = true;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -59,6 +64,8 @@ export const useProtocolVotingStore = defineStore("protocolVoting", {
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
async synchronizeActiveProtocolVoting() {
|
async synchronizeActiveProtocolVoting() {
|
||||||
|
if (!this.initialized) return;
|
||||||
|
|
||||||
this.syncingProtocolVoting = "syncing";
|
this.syncingProtocolVoting = "syncing";
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import type { MemberViewModel } from "../member/member.models";
|
|
||||||
|
|
||||||
export interface ProtocolPresenceViewModel {
|
export interface ProtocolPresenceViewModel {
|
||||||
memberId: number;
|
memberId: number;
|
||||||
member: MemberViewModel;
|
absent: boolean;
|
||||||
protocolId: number;
|
protocolId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchNewsletterDates();
|
// this.fetchNewsletterDates();
|
||||||
this.fetchCalendars();
|
this.fetchCalendars();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -58,7 +58,7 @@ export default defineComponent({
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchNewsletterByActiveId();
|
// this.fetchNewsletterByActiveId();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useNewsletterStore, ["fetchNewsletterByActiveId"]),
|
...mapActions(useNewsletterStore, ["fetchNewsletterByActiveId"]),
|
||||||
|
|
|
@ -205,8 +205,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchMembers(0, 1000, true);
|
this.fetchMembers(0, 1000, "", true);
|
||||||
this.fetchNewsletterRecipients();
|
// this.fetchNewsletterRecipients();
|
||||||
this.fetchQueries();
|
this.fetchQueries();
|
||||||
this.loadQuery();
|
this.loadQuery();
|
||||||
},
|
},
|
||||||
|
|
|
@ -73,7 +73,7 @@ export default defineComponent({
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchProtocolAgenda();
|
// this.fetchProtocolAgenda();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolAgendaStore, ["fetchProtocolAgenda", "createProtocolAgenda"]),
|
...mapActions(useProtocolAgendaStore, ["fetchProtocolAgenda", "createProtocolAgenda"]),
|
||||||
|
|
|
@ -73,7 +73,7 @@ export default defineComponent({
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchProtocolDecision();
|
// this.fetchProtocolDecision();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolDecisionStore, ["fetchProtocolDecision", "createProtocolDecision"]),
|
...mapActions(useProtocolDecisionStore, ["fetchProtocolDecision", "createProtocolDecision"]),
|
||||||
|
|
|
@ -80,7 +80,7 @@ export default defineComponent({
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchProtocolByActiveId();
|
// this.fetchProtocolByActiveId();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolStore, ["fetchProtocolByActiveId"]),
|
...mapActions(useProtocolStore, ["fetchProtocolByActiveId"]),
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<Combobox v-model="presence" :disabled="!can('create', 'club', 'protocol')" multiple>
|
<Combobox v-model="presence" :disabled="!can('create', 'club', 'protocol')" multiple by="memberId">
|
||||||
<ComboboxLabel>Anwesende suchen</ComboboxLabel>
|
<ComboboxLabel>Anwesende suchen</ComboboxLabel>
|
||||||
<div class="relative mt-1">
|
<div class="relative mt-1">
|
||||||
<ComboboxInput
|
<ComboboxInput
|
||||||
|
@ -34,8 +34,8 @@
|
||||||
<ComboboxOption
|
<ComboboxOption
|
||||||
v-for="member in filtered"
|
v-for="member in filtered"
|
||||||
as="template"
|
as="template"
|
||||||
:key="member.id"
|
:key="member.memberId"
|
||||||
:value="member.id"
|
:value="member"
|
||||||
v-slot="{ selected, active }"
|
v-slot="{ selected, active }"
|
||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||||
{{ member.firstname }} {{ member.lastname }} {{ member.nameaffix }}
|
{{ getMember(member.memberId)?.firstname }} {{ getMember(member.memberId)?.lastname }} {{ getMember(member.memberId)?.nameaffix }}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="selected"
|
v-if="selected"
|
||||||
|
@ -63,18 +63,24 @@
|
||||||
</Combobox>
|
</Combobox>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<p>Ausgewählte Anwesende</p>
|
<p>Anwesenheit</p>
|
||||||
<div class="flex flex-col gap-2 grow overflow-y-auto">
|
<div class="flex flex-col gap-2 grow overflow-y-auto">
|
||||||
<div
|
<div
|
||||||
v-for="member in selected"
|
v-for="member in presence"
|
||||||
:key="member.id"
|
:key="member.memberId"
|
||||||
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"
|
||||||
>
|
>
|
||||||
<p>{{ member.lastname }}, {{ member.firstname }} {{ member.nameaffix ? `- ${member.nameaffix}` : "" }}</p>
|
<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>
|
||||||
|
<label class="flex flex-row gap-2 items-center">
|
||||||
|
<input type="checkbox" v-model="member.absent" />
|
||||||
|
war abwesend
|
||||||
|
</label>
|
||||||
|
</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"
|
||||||
@click="removeSelected(member.id)"
|
@click="removeSelected(member.memberId)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -117,38 +123,31 @@ 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<MemberViewModel> {
|
filtered(): Array<{memberId:number, absent:boolean; protocolId:number}> {
|
||||||
return this.query === ""
|
return (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 ?? "")}));
|
||||||
},
|
|
||||||
sorted(): Array<MemberViewModel> {
|
|
||||||
return this.selected.sort((a, b) => {
|
|
||||||
if (a.lastname < b.lastname) return -1;
|
|
||||||
if (a.lastname > b.lastname) return 1;
|
|
||||||
if (a.firstname < b.firstname) return -1;
|
|
||||||
if (a.firstname > b.firstname) return 1;
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
selected(): Array<MemberViewModel> {
|
|
||||||
return this.members.filter((m) => this.presence.includes(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);
|
||||||
this.fetchProtocolPresence();
|
// this.fetchProtocolPresence();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useMemberStore, ["fetchMembers"]),
|
...mapActions(useMemberStore, ["fetchMembers"]),
|
||||||
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
||||||
removeSelected(id: number) {
|
removeSelected(id: number) {
|
||||||
let index = this.presence.findIndex((s) => s == id);
|
let index = this.presence.findIndex((s) => s.memberId == id);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
this.presence.splice(index, 1);
|
this.presence.splice(index, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,10 @@ import { useProtocolStore } from "@/stores/admin/club/protocol/protocol";
|
||||||
import { useModalStore } from "@/stores/modal";
|
import { useModalStore } from "@/stores/modal";
|
||||||
import ProtocolSyncing from "@/components/admin/club/protocol/ProtocolSyncing.vue";
|
import ProtocolSyncing from "@/components/admin/club/protocol/ProtocolSyncing.vue";
|
||||||
import { PrinterIcon } from "@heroicons/vue/24/outline";
|
import { PrinterIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { useProtocolAgendaStore } from "@/stores/admin/club/protocol/protocolAgenda";
|
||||||
|
import { useProtocolDecisionStore } from "@/stores/admin/club/protocol/protocolDecision";
|
||||||
|
import { useProtocolPresenceStore } from "@/stores/admin/club/protocol/protocolPresence";
|
||||||
|
import { useProtocolVotingStore } from "@/stores/admin/club/protocol/protocolVoting";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -88,6 +92,10 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchProtocolByActiveId();
|
this.fetchProtocolByActiveId();
|
||||||
|
this.fetchProtocolAgenda()
|
||||||
|
this.fetchProtocolDecision()
|
||||||
|
this.fetchProtocolPresence()
|
||||||
|
this.fetchProtocolVoting()
|
||||||
},
|
},
|
||||||
// this.syncState is undefined, so it will never work
|
// this.syncState is undefined, so it will never work
|
||||||
// beforeRouteLeave(to, from, next) {
|
// beforeRouteLeave(to, from, next) {
|
||||||
|
@ -108,6 +116,10 @@ export default defineComponent({
|
||||||
// },
|
// },
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolStore, ["fetchProtocolByActiveId"]),
|
...mapActions(useProtocolStore, ["fetchProtocolByActiveId"]),
|
||||||
|
...mapActions(useProtocolAgendaStore, ["fetchProtocolAgenda"]),
|
||||||
|
...mapActions(useProtocolDecisionStore, ["fetchProtocolDecision"]),
|
||||||
|
...mapActions(useProtocolPresenceStore,["fetchProtocolPresence"]),
|
||||||
|
...mapActions(useProtocolVotingStore,["fetchProtocolVoting"]),
|
||||||
...mapActions(useModalStore, ["openModal"]),
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
openInfoModal() {
|
openInfoModal() {
|
||||||
this.openModal(
|
this.openModal(
|
||||||
|
|
|
@ -90,7 +90,7 @@ export default defineComponent({
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchProtocolVoting();
|
// this.fetchProtocolVoting();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolVotingStore, ["fetchProtocolVoting", "createProtocolVoting"]),
|
...mapActions(useProtocolVotingStore, ["fetchProtocolVoting", "createProtocolVoting"]),
|
||||||
|
|
Loading…
Reference in a new issue