#2-protocol #6
12 changed files with 221 additions and 62 deletions
18
package-lock.json
generated
18
package-lock.json
generated
|
@ -16,6 +16,7 @@
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"lodash.difference": "^4.5.0",
|
"lodash.difference": "^4.5.0",
|
||||||
|
"lodash.differencewith": "^4.5.0",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pdf-dist": "^1.0.0",
|
"pdf-dist": "^1.0.0",
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
"@types/eslint": "~9.6.0",
|
"@types/eslint": "~9.6.0",
|
||||||
"@types/lodash.clonedeep": "^4.5.9",
|
"@types/lodash.clonedeep": "^4.5.9",
|
||||||
"@types/lodash.difference": "^4.5.9",
|
"@types/lodash.difference": "^4.5.9",
|
||||||
|
"@types/lodash.differencewith": "^4.5.9",
|
||||||
"@types/lodash.isequal": "^4.5.8",
|
"@types/lodash.isequal": "^4.5.8",
|
||||||
"@types/node": "^20.14.5",
|
"@types/node": "^20.14.5",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
|
@ -3096,6 +3098,16 @@
|
||||||
"@types/lodash": "*"
|
"@types/lodash": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/lodash.differencewith": {
|
||||||
|
"version": "4.5.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/lodash.differencewith/-/lodash.differencewith-4.5.9.tgz",
|
||||||
|
"integrity": "sha512-nMaREKoe7J3WvnsO7HDRxvnPT3mWmZD3EAECpy7gBGJ6S5nQ66uVlkRe+ZXs6261ZNb2fH9Ny4oUUiSOCmTnLw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/lodash": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/lodash.isequal": {
|
"node_modules/@types/lodash.isequal": {
|
||||||
"version": "4.5.8",
|
"version": "4.5.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/lodash.isequal/-/lodash.isequal-4.5.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/lodash.isequal/-/lodash.isequal-4.5.8.tgz",
|
||||||
|
@ -6720,6 +6732,12 @@
|
||||||
"integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==",
|
"integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/lodash.differencewith": {
|
||||||
|
"version": "4.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/lodash.differencewith/-/lodash.differencewith-4.5.0.tgz",
|
||||||
|
"integrity": "sha512-/8JFjydAS+4bQuo3CpLMBv7WxGFyk7/etOAsrQUCu0a9QVDemxv0YQ0rFyeZvqlUD314SERfNlgnlqqHmaQ0Cg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/lodash.isequal": {
|
"node_modules/lodash.isequal": {
|
||||||
"version": "4.5.0",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"lodash.clonedeep": "^4.5.0",
|
"lodash.clonedeep": "^4.5.0",
|
||||||
"lodash.difference": "^4.5.0",
|
"lodash.difference": "^4.5.0",
|
||||||
|
"lodash.differencewith": "^4.5.0",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
"pdf-dist": "^1.0.0",
|
"pdf-dist": "^1.0.0",
|
||||||
|
@ -48,6 +49,7 @@
|
||||||
"@types/eslint": "~9.6.0",
|
"@types/eslint": "~9.6.0",
|
||||||
"@types/lodash.clonedeep": "^4.5.9",
|
"@types/lodash.clonedeep": "^4.5.9",
|
||||||
"@types/lodash.difference": "^4.5.9",
|
"@types/lodash.difference": "^4.5.9",
|
||||||
|
"@types/lodash.differencewith": "^4.5.9",
|
||||||
"@types/lodash.isequal": "^4.5.8",
|
"@types/lodash.isequal": "^4.5.8",
|
||||||
"@types/node": "^20.14.5",
|
"@types/node": "^20.14.5",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<CloudIcon v-if="syncing == 'synced'" class="w-5 h-5" />
|
<CloudIcon v-if="syncing == 'synced'" class="w-5 h-5" />
|
||||||
<CloudArrowUpIcon v-else-if="syncing == 'detectedChanges'" class="w-5 h-5 cursor-pointer" @click="syncAll" />
|
<CloudArrowUpIcon
|
||||||
|
v-else-if="syncing == 'detectedChanges'"
|
||||||
|
class="w-5 h-5 cursor-pointer animate-bounce"
|
||||||
|
@click="syncAll"
|
||||||
|
/>
|
||||||
<ArrowPathIcon v-else-if="syncing == 'syncing'" class="w-5 h-5 animate-spin" />
|
<ArrowPathIcon v-else-if="syncing == 'syncing'" class="w-5 h-5 animate-spin" />
|
||||||
<ExclamationTriangleIcon v-else class="w-5 h-5 animate-[ping_1s_ease-in-out_3] text-red-500" />
|
<ExclamationTriangleIcon
|
||||||
|
v-else
|
||||||
|
class="w-5 h-5 animate-[ping_1s_ease-in-out_3] text-red-500 cursor-pointer"
|
||||||
|
@click="syncAll"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -10,6 +18,8 @@ import { defineComponent } from "vue";
|
||||||
import { mapState, mapActions } from "pinia";
|
import { mapState, mapActions } from "pinia";
|
||||||
import { useProtocolStore } from "@/stores/admin/protocol";
|
import { useProtocolStore } from "@/stores/admin/protocol";
|
||||||
import { ArrowPathIcon, CloudArrowUpIcon, CloudIcon, ExclamationTriangleIcon } from "@heroicons/vue/24/outline";
|
import { ArrowPathIcon, CloudArrowUpIcon, CloudIcon, ExclamationTriangleIcon } from "@heroicons/vue/24/outline";
|
||||||
|
import { useProtocolAgendaStore } from "@/stores/admin/protocolAgenda";
|
||||||
|
import { useProtocolPresenceStore } from "@/stores/admin/protocolPresence";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -24,6 +34,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
detectedChangeProtocol() {
|
detectedChangeProtocol() {
|
||||||
clearTimeout(this.protocolTimer);
|
clearTimeout(this.protocolTimer);
|
||||||
|
this.setProtocolSyncingState("synced");
|
||||||
if (this.detectedChangeProtocol == false) {
|
if (this.detectedChangeProtocol == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +43,29 @@ export default defineComponent({
|
||||||
this.synchronizeActiveProtocol();
|
this.synchronizeActiveProtocol();
|
||||||
}, 10000);
|
}, 10000);
|
||||||
},
|
},
|
||||||
|
detectedChangeProtocolAgenda() {
|
||||||
|
console.log(this.detectedChangeProtocolAgenda);
|
||||||
|
clearTimeout(this.protocolAgendaTimer);
|
||||||
|
if (this.detectedChangeProtocolAgenda == false) {
|
||||||
|
this.setProtocolAgendaSyncingState("synced");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setProtocolAgendaSyncingState("detectedChanges");
|
||||||
|
this.protocolAgendaTimer = setTimeout(() => {
|
||||||
|
this.synchronizeActiveProtocolAgenda();
|
||||||
|
}, 10000);
|
||||||
|
},
|
||||||
|
detectedChangeProtocolPresence() {
|
||||||
|
clearTimeout(this.protocolPresenceTimer);
|
||||||
|
this.setProtocolPresenceSyncingState("synced");
|
||||||
|
if (this.detectedChangeProtocolPresence == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setProtocolPresenceSyncingState("detectedChanges");
|
||||||
|
this.protocolPresenceTimer = setTimeout(() => {
|
||||||
|
this.synchronizeActiveProtocolPresence();
|
||||||
|
}, 10000);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
emits: {
|
emits: {
|
||||||
syncState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
syncState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
||||||
|
@ -41,6 +75,8 @@ export default defineComponent({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
protocolTimer: undefined as undefined | any,
|
protocolTimer: undefined as undefined | any,
|
||||||
|
protocolAgendaTimer: undefined as undefined | any,
|
||||||
|
protocolPresenceTimer: undefined as undefined | any,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -48,12 +84,16 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
if (!this.protocolTimer) clearTimeout(this.protocolTimer);
|
if (!this.protocolTimer) clearTimeout(this.protocolTimer);
|
||||||
|
if (!this.protocolAgendaTimer) clearTimeout(this.protocolAgendaTimer);
|
||||||
|
if (!this.protocolPresenceTimer) clearTimeout(this.protocolPresenceTimer);
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useProtocolStore, ["activeProtocolObj", "syncingProtocol", "detectedChangeProtocol"]),
|
...mapState(useProtocolStore, ["syncingProtocol", "detectedChangeProtocol"]),
|
||||||
|
...mapState(useProtocolAgendaStore, ["syncingProtocolAgenda", "detectedChangeProtocolAgenda"]),
|
||||||
|
...mapState(useProtocolPresenceStore, ["syncingProtocolPresence", "detectedChangeProtocolPresence"]),
|
||||||
|
|
||||||
syncing(): "synced" | "syncing" | "detectedChanges" | "failed" {
|
syncing(): "synced" | "syncing" | "detectedChanges" | "failed" {
|
||||||
let states = [this.syncingProtocol];
|
let states = [this.syncingProtocol, this.syncingProtocolAgenda, this.syncingProtocolPresence];
|
||||||
|
|
||||||
if (states.includes("failed")) return "failed";
|
if (states.includes("failed")) return "failed";
|
||||||
else if (states.includes("syncing")) return "syncing";
|
else if (states.includes("syncing")) return "syncing";
|
||||||
|
@ -63,9 +103,15 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolStore, ["synchronizeActiveProtocol", "setProtocolSyncingState"]),
|
...mapActions(useProtocolStore, ["synchronizeActiveProtocol", "setProtocolSyncingState"]),
|
||||||
|
...mapActions(useProtocolAgendaStore, ["synchronizeActiveProtocolAgenda", "setProtocolAgendaSyncingState"]),
|
||||||
|
...mapActions(useProtocolPresenceStore, ["synchronizeActiveProtocolPresence", "setProtocolPresenceSyncingState"]),
|
||||||
syncAll() {
|
syncAll() {
|
||||||
if (!this.protocolTimer) clearTimeout(this.protocolTimer);
|
if (!this.protocolTimer) clearTimeout(this.protocolTimer);
|
||||||
|
if (!this.protocolAgendaTimer) clearTimeout(this.protocolAgendaTimer);
|
||||||
|
if (!this.protocolPresenceTimer) clearTimeout(this.protocolPresenceTimer);
|
||||||
this.synchronizeActiveProtocol();
|
this.synchronizeActiveProtocol();
|
||||||
|
this.synchronizeActiveProtocolAgenda();
|
||||||
|
this.synchronizeActiveProtocolPresence();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,8 @@ export const useProtocolStore = defineStore("protocol", {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
detectedChangeProtocol: (state) => !isEqual(state.origin, state.activeProtocolObj),
|
detectedChangeProtocol: (state) =>
|
||||||
|
!isEqual(state.origin, state.activeProtocolObj) && state.syncingProtocol != "syncing",
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setProtocolSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
setProtocolSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
||||||
|
@ -80,7 +81,7 @@ export const useProtocolStore = defineStore("protocol", {
|
||||||
|
|
||||||
this.syncingProtocol = "syncing";
|
this.syncingProtocol = "syncing";
|
||||||
await http
|
await http
|
||||||
.put(`/admin/protocol/${this.origin.id}/synchronize`, {
|
.patch(`/admin/protocol/${this.origin.id}/synchronize`, {
|
||||||
title: this.activeProtocolObj.title,
|
title: this.activeProtocolObj.title,
|
||||||
date: this.activeProtocolObj.date,
|
date: this.activeProtocolObj.date,
|
||||||
starttime: this.activeProtocolObj.starttime,
|
starttime: this.activeProtocolObj.starttime,
|
||||||
|
@ -96,7 +97,6 @@ export const useProtocolStore = defineStore("protocol", {
|
||||||
this.fetchProtocolById(this.origin.id)
|
this.fetchProtocolById(this.origin.id)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.origin = res.data;
|
this.origin = res.data;
|
||||||
this.activeProtocolObj = cloneDeep(this.origin);
|
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,42 +1,82 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
|
||||||
import type {
|
import type {
|
||||||
ProtocolAgendaViewModel,
|
ProtocolAgendaViewModel,
|
||||||
SyncProtocolAgendaViewModel,
|
SyncProtocolAgendaViewModel,
|
||||||
} from "../../viewmodels/admin/protocolAgenda.models";
|
} from "../../viewmodels/admin/protocolAgenda.models";
|
||||||
import { useProtocolStore } from "./protocol";
|
import { useProtocolStore } from "./protocol";
|
||||||
|
import cloneDeep from "lodash.clonedeep";
|
||||||
|
import isEqual from "lodash.isEqual";
|
||||||
|
import differenceWith from "lodash.differencewith";
|
||||||
|
|
||||||
export const useProtocolAgendaStore = defineStore("protocolAgenda", {
|
export const useProtocolAgendaStore = defineStore("protocolAgenda", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
agenda: [] as Array<ProtocolAgendaViewModel>,
|
agenda: [] as Array<ProtocolAgendaViewModel>,
|
||||||
|
origin: [] as Array<ProtocolAgendaViewModel>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
syncingProtocolAgenda: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
getters: {
|
||||||
|
detectedChangeProtocolAgenda: (state) =>
|
||||||
|
!isEqual(state.origin, state.agenda) && state.syncingProtocolAgenda != "syncing",
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
setProtocolAgendaSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
||||||
|
this.syncingProtocolAgenda = state;
|
||||||
|
},
|
||||||
fetchProtocolAgenda() {
|
fetchProtocolAgenda() {
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
this.fetchProtocolAgendaPromise()
|
||||||
.get(`/admin/protocol/${protocolId}/agenda`)
|
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.agenda = result.data;
|
this.origin = result.data;
|
||||||
|
this.agenda = cloneDeep(this.origin);
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.loading = "failed";
|
this.loading = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async synchronizeActiveProtocolAgenda(
|
fetchProtocolAgendaPromise() {
|
||||||
agenda: Array<SyncProtocolAgendaViewModel>
|
|
||||||
): Promise<AxiosResponse<any, any>> {
|
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
const result = await http.patch(`/admin/protocol/${protocolId}/synchronize/agenda`, {
|
return http.get(`/admin/protocol/${protocolId}/agenda`);
|
||||||
agenda: agenda,
|
},
|
||||||
|
createProtocolAgenda() {
|
||||||
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
|
if (protocolId == null) return;
|
||||||
|
return http
|
||||||
|
.post(`/admin/protocol/${protocolId}/agenda`)
|
||||||
|
.then((res) => {
|
||||||
|
this.agenda.push({
|
||||||
|
id: res.data,
|
||||||
|
topic: "",
|
||||||
|
context: "",
|
||||||
|
protocolId,
|
||||||
});
|
});
|
||||||
this.fetchProtocolAgenda();
|
})
|
||||||
return result;
|
.catch((err) => {});
|
||||||
|
},
|
||||||
|
async synchronizeActiveProtocolAgenda() {
|
||||||
|
this.syncingProtocolAgenda = "syncing";
|
||||||
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
|
console.log(this.agenda, this.origin, differenceWith(this.agenda, this.origin, isEqual));
|
||||||
|
|
||||||
|
await http
|
||||||
|
.patch(`/admin/protocol/${protocolId}/synchronize/agenda`, {
|
||||||
|
agenda: differenceWith(this.agenda, this.origin, isEqual),
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
this.syncingProtocolAgenda = "synced";
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.syncingProtocolAgenda = "failed";
|
||||||
|
});
|
||||||
|
this.fetchProtocolAgendaPromise()
|
||||||
|
.then((res) => {
|
||||||
|
this.origin = res.data;
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,9 @@ import type {
|
||||||
SyncProtocolDecisionViewModel,
|
SyncProtocolDecisionViewModel,
|
||||||
} from "../../viewmodels/admin/protocolDecision.models";
|
} from "../../viewmodels/admin/protocolDecision.models";
|
||||||
import { useProtocolStore } from "./protocol";
|
import { useProtocolStore } from "./protocol";
|
||||||
|
import cloneDeep from "lodash.clonedeep";
|
||||||
|
import isEqual from "lodash.isEqual";
|
||||||
|
import difference from "lodash.difference";
|
||||||
|
|
||||||
export const useProtocolDecisionStore = defineStore("protocolDecision", {
|
export const useProtocolDecisionStore = defineStore("protocolDecision", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
|
|
@ -6,37 +6,60 @@ import type {
|
||||||
SyncProtocolPresenceViewModel,
|
SyncProtocolPresenceViewModel,
|
||||||
} from "../../viewmodels/admin/protocolPresence.models";
|
} from "../../viewmodels/admin/protocolPresence.models";
|
||||||
import { useProtocolStore } from "./protocol";
|
import { useProtocolStore } from "./protocol";
|
||||||
|
import cloneDeep from "lodash.clonedeep";
|
||||||
|
import isEqual from "lodash.isEqual";
|
||||||
|
|
||||||
export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
export const useProtocolPresenceStore = defineStore("protocolPresence", {
|
||||||
state: () => {
|
state: () => {
|
||||||
return {
|
return {
|
||||||
presence: [] as Array<ProtocolPresenceViewModel>,
|
presence: [] as Array<number>,
|
||||||
|
origin: [] as Array<number>,
|
||||||
loading: "loading" as "loading" | "fetched" | "failed",
|
loading: "loading" as "loading" | "fetched" | "failed",
|
||||||
|
syncingProtocolPresence: "synced" as "synced" | "syncing" | "detectedChanges" | "failed",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
getters: {
|
||||||
|
detectedChangeProtocolPresence: (state) =>
|
||||||
|
!isEqual(state.origin, state.presence) && state.syncingProtocolPresence != "syncing",
|
||||||
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
setProtocolPresenceSyncingState(state: "synced" | "syncing" | "detectedChanges" | "failed") {
|
||||||
|
this.syncingProtocolPresence = state;
|
||||||
|
},
|
||||||
fetchProtocolPresence() {
|
fetchProtocolPresence() {
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
this.fetchProtocolPresencePromise()
|
||||||
.get(`/admin/protocol/${protocolId}/presence`)
|
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.presence = result.data;
|
this.origin = result.data.map((d: ProtocolPresenceViewModel) => d.memberId);
|
||||||
|
this.presence = cloneDeep(this.origin);
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.loading = "failed";
|
this.loading = "failed";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async synchronizeActiveProtocolPresence(
|
fetchProtocolPresencePromise() {
|
||||||
presence: Array<SyncProtocolPresenceViewModel>
|
|
||||||
): Promise<AxiosResponse<any, any>> {
|
|
||||||
const protocolId = useProtocolStore().activeProtocol;
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
const result = await http.patch(`/admin/protocol/${protocolId}/synchronize/presence`, {
|
return http.get(`/admin/protocol/${protocolId}/presence`);
|
||||||
presence: presence,
|
},
|
||||||
|
async synchronizeActiveProtocolPresence() {
|
||||||
|
this.syncingProtocolPresence = "syncing";
|
||||||
|
const protocolId = useProtocolStore().activeProtocol;
|
||||||
|
await http
|
||||||
|
.put(`/admin/protocol/${protocolId}/synchronize/presence`, {
|
||||||
|
presence: this.presence,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
this.syncingProtocolPresence = "synced";
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
this.syncingProtocolPresence = "failed";
|
||||||
});
|
});
|
||||||
this.fetchProtocolPresence();
|
this.fetchProtocolPresencePromise()
|
||||||
return result;
|
.then((result) => {
|
||||||
|
this.origin = result.data.map((d: ProtocolPresenceViewModel) => d.memberId);
|
||||||
|
})
|
||||||
|
.catch((err) => {});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,9 @@ import type {
|
||||||
SyncProtocolVotingViewModel,
|
SyncProtocolVotingViewModel,
|
||||||
} from "../../viewmodels/admin/protocolVoting.models";
|
} from "../../viewmodels/admin/protocolVoting.models";
|
||||||
import { useProtocolStore } from "./protocol";
|
import { useProtocolStore } from "./protocol";
|
||||||
|
import cloneDeep from "lodash.clonedeep";
|
||||||
|
import isEqual from "lodash.isEqual";
|
||||||
|
import difference from "lodash.difference";
|
||||||
|
|
||||||
export const useProtocolVotingStore = defineStore("protocolVoting", {
|
export const useProtocolVotingStore = defineStore("protocolVoting", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
|
|
@ -5,13 +5,29 @@
|
||||||
↺ laden fehlgeschlagen
|
↺ laden fehlgeschlagen
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<details class="flex flex-col gap-2 rounded-lg w-full justify-between border border-primary overflow-hidden">
|
<div class="flex flex-col gap-2 h-full overflow-y-auto">
|
||||||
|
<details
|
||||||
|
v-for="item in agenda"
|
||||||
|
class="flex flex-col gap-2 rounded-lg w-full justify-between border border-primary overflow-hidden min-h-fit"
|
||||||
|
>
|
||||||
<summary class="flex flex-row gap-2 bg-primary p-2 w-full justify-between items-center cursor-pointer">
|
<summary class="flex flex-row gap-2 bg-primary p-2 w-full justify-between items-center cursor-pointer">
|
||||||
<svg class="fill-white stroke-white opacity-75 w-4 h-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
|
<svg
|
||||||
|
class="fill-white stroke-white opacity-75 w-4 h-4"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
>
|
||||||
<path d="M12.95 10.707l.707-.707L8 4.343 6.586 5.757 10.828 10l-4.242 4.243L8 15.657l4.95-4.95z" />
|
<path d="M12.95 10.707l.707-.707L8 4.343 6.586 5.757 10.828 10l-4.242 4.243L8 15.657l4.95-4.95z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<input type="text" name="title" id="title" placeholder="TOP" autocomplete="off" />
|
<input
|
||||||
|
type="text"
|
||||||
|
name="title"
|
||||||
|
id="title"
|
||||||
|
placeholder="TOP"
|
||||||
|
autocomplete="off"
|
||||||
|
v-model="item.topic"
|
||||||
|
@keyup.prevent
|
||||||
|
/>
|
||||||
</summary>
|
</summary>
|
||||||
<QuillEditor
|
<QuillEditor
|
||||||
id="top"
|
id="top"
|
||||||
|
@ -20,19 +36,24 @@
|
||||||
style="height: 250px; max-height: 250px; min-height: 250px"
|
style="height: 250px; max-height: 250px; min-height: 250px"
|
||||||
contentType="html"
|
contentType="html"
|
||||||
:toolbar="toolbarOptions"
|
:toolbar="toolbarOptions"
|
||||||
|
v-model:content="item.context"
|
||||||
/>
|
/>
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button primary class="!w-fit" @click="createProtocolAgenda">Eintrag hinzufügen</button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState, mapWritableState } from "pinia";
|
||||||
import Spinner from "@/components/Spinner.vue";
|
import Spinner from "@/components/Spinner.vue";
|
||||||
import { QuillEditor } from "@vueup/vue-quill";
|
import { QuillEditor } from "@vueup/vue-quill";
|
||||||
import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
import "@vueup/vue-quill/dist/vue-quill.snow.css";
|
||||||
import { toolbarOptions } from "@/helpers/quillConfig";
|
import { toolbarOptions } from "@/helpers/quillConfig";
|
||||||
import { useProtocolAgendaStore } from "@/stores/admin/protocolAgenda";
|
import { useProtocolAgendaStore } from "@/stores/admin/protocolAgenda";
|
||||||
|
import type { ProtocolAgendaViewModel } from "@/viewmodels/admin/protocolAgenda.models";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -41,13 +62,13 @@ export default defineComponent({
|
||||||
protocolId: String,
|
protocolId: String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useProtocolAgendaStore, ["agenda", "loading"]),
|
...mapWritableState(useProtocolAgendaStore, ["agenda", "loading"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchProtocolAgenda();
|
this.fetchProtocolAgenda();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(useProtocolAgendaStore, ["fetchProtocolAgenda"]),
|
...mapActions(useProtocolAgendaStore, ["fetchProtocolAgenda", "createProtocolAgenda"]),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState, mapWritableState } from "pinia";
|
||||||
import Spinner from "@/components/Spinner.vue";
|
import Spinner from "@/components/Spinner.vue";
|
||||||
import { useProtocolStore } from "@/stores/admin/protocol";
|
import { useProtocolStore } from "@/stores/admin/protocol";
|
||||||
import { QuillEditor } from "@vueup/vue-quill";
|
import { QuillEditor } from "@vueup/vue-quill";
|
||||||
|
@ -56,7 +56,7 @@ export default defineComponent({
|
||||||
protocolId: String,
|
protocolId: String,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useProtocolStore, ["activeProtocol", "loadingActive", "activeProtocolObj"]),
|
...mapWritableState(useProtocolStore, ["loadingActive", "activeProtocolObj"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchProtocolByActiveId();
|
this.fetchProtocolByActiveId();
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
<p v-else-if="loading == 'failed'" @click="fetchProtocolPresence" class="cursor-pointer">
|
<p v-else-if="loading == 'failed'" @click="fetchProtocolPresence" class="cursor-pointer">
|
||||||
↺ laden fehlgeschlagen
|
↺ laden fehlgeschlagen
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<Combobox v-model="selected" multiple>
|
<Combobox v-model="presence" multiple>
|
||||||
<ComboboxLabel>Anwesende suchen</ComboboxLabel>
|
<ComboboxLabel>Anwesende suchen</ComboboxLabel>
|
||||||
<div class="relative mt-1">
|
<div class="relative mt-1">
|
||||||
<ComboboxInput
|
<ComboboxInput
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
v-for="member in filtered"
|
v-for="member in filtered"
|
||||||
as="template"
|
as="template"
|
||||||
:key="member.id"
|
:key="member.id"
|
||||||
:value="member"
|
:value="member.id"
|
||||||
v-slot="{ selected, active }"
|
v-slot="{ selected, active }"
|
||||||
>
|
>
|
||||||
<li
|
<li
|
||||||
|
@ -78,7 +79,7 @@
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState, mapWritableState } from "pinia";
|
||||||
import Spinner from "@/components/Spinner.vue";
|
import Spinner from "@/components/Spinner.vue";
|
||||||
import {
|
import {
|
||||||
Combobox,
|
Combobox,
|
||||||
|
@ -105,11 +106,10 @@ export default defineComponent({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
query: "" as String,
|
query: "" as String,
|
||||||
selected: [] as Array<MemberViewModel>,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useProtocolPresenceStore, ["presence", "loading"]),
|
...mapWritableState(useProtocolPresenceStore, ["presence", "loading"]),
|
||||||
...mapState(useMemberStore, ["members"]),
|
...mapState(useMemberStore, ["members"]),
|
||||||
filtered(): Array<MemberViewModel> {
|
filtered(): Array<MemberViewModel> {
|
||||||
return this.query === ""
|
return this.query === ""
|
||||||
|
@ -130,6 +130,9 @@ export default defineComponent({
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
selected(): Array<MemberViewModel> {
|
||||||
|
return this.members.filter((m) => this.presence.includes(m.id));
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.fetchMembers();
|
this.fetchMembers();
|
||||||
|
@ -139,9 +142,9 @@ export default defineComponent({
|
||||||
...mapActions(useMemberStore, ["fetchMembers"]),
|
...mapActions(useMemberStore, ["fetchMembers"]),
|
||||||
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
...mapActions(useProtocolPresenceStore, ["fetchProtocolPresence"]),
|
||||||
removeSelected(id: number) {
|
removeSelected(id: number) {
|
||||||
let index = this.selected.findIndex((s) => s.id == id);
|
let index = this.presence.findIndex((s) => s == id);
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
this.selected.splice(index, 1);
|
this.presence.splice(index, 1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<MainTemplate>
|
<MainTemplate>
|
||||||
<template #headerInsert>
|
<template #headerInsert>
|
||||||
<RouterLink to="../" class="text-primary">zurück zur Liste</RouterLink>
|
<RouterLink to="../" class="text-primary w-fit">zurück zur Liste</RouterLink>
|
||||||
</template>
|
</template>
|
||||||
<template #topBar>
|
<template #topBar>
|
||||||
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
|
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
|
||||||
|
|
Loading…
Reference in a new issue