decisions and voting

This commit is contained in:
Julian Krauser 2024-10-18 14:20:58 +02:00
parent c0bfc00862
commit d62436722a
6 changed files with 246 additions and 34 deletions

View file

@ -4,12 +4,50 @@
<p v-else-if="loading == 'failed'" @click="fetchProtocolDecision" class="cursor-pointer">
&#8634; laden fehlgeschlagen
</p>
<div class="flex flex-col gap-2 h-full overflow-y-auto">
<details
v-for="item in decision"
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">
<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" />
</svg>
<input
type="text"
name="title"
id="title"
placeholder="Einscheidung"
autocomplete="off"
v-model="item.topic"
@keyup.prevent
/>
</summary>
<QuillEditor
id="top"
theme="snow"
placeholder="Entscheidung Inhalt..."
style="height: 250px; max-height: 250px; min-height: 250px"
contentType="html"
:toolbar="toolbarOptions"
v-model:content="item.context"
/>
</details>
</div>
<button primary class="!w-fit" @click="createProtocolDecision">Eintrag hinzufügen</button>
</div>
</template>
<script setup lang="ts">
import { defineComponent } from "vue";
import { mapActions, mapState } from "pinia";
import { mapActions, mapState, mapWritableState } from "pinia";
import Spinner from "@/components/Spinner.vue";
import { useProtocolStore } from "@/stores/admin/protocol";
import { QuillEditor } from "@vueup/vue-quill";
@ -24,13 +62,13 @@ export default defineComponent({
protocolId: String,
},
computed: {
...mapState(useProtocolDecisionStore, ["decision", "loading"]),
...mapWritableState(useProtocolDecisionStore, ["decision", "loading"]),
},
mounted() {
this.fetchProtocolDecision();
},
methods: {
...mapActions(useProtocolDecisionStore, ["fetchProtocolDecision"]),
...mapActions(useProtocolDecisionStore, ["fetchProtocolDecision", "createProtocolDecision"]),
},
});
</script>

View file

@ -4,6 +4,61 @@
<p v-else-if="loading == 'failed'" @click="fetchProtocolVoting" class="cursor-pointer">
&#8634; laden fehlgeschlagen
</p>
<div class="flex flex-col gap-2 h-full overflow-y-auto">
<details
v-for="item in voting"
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">
<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" />
</svg>
<input
type="text"
name="title"
id="title"
placeholder="Einscheidung"
autocomplete="off"
v-model="item.topic"
@keyup.prevent
/>
</summary>
<QuillEditor
id="top"
theme="snow"
placeholder="Entscheidung Inhalt..."
style="height: 100px; max-height: 100px; min-height: 100px"
contentType="html"
:toolbar="toolbarOptions"
v-model:content="item.context"
/>
<div class="px-2 pb-2">
<p>Ergebnis:</p>
<div class="flex flex-row gap-2">
<div class="w-full">
<p>dafür</p>
<input type="number" v-model="item.favour" />
</div>
<div class="w-full">
<p>dagegen</p>
<input type="number" v-model="item.against" />
</div>
<div class="w-full">
<p>enthalten</p>
<input type="number" v-model="item.abstain" />
</div>
</div>
</div>
</details>
</div>
<button primary class="!w-fit" @click="createProtocolVoting">Abstimmung hinzufügen</button>
</div>
</template>
@ -30,7 +85,7 @@ export default defineComponent({
this.fetchProtocolVoting();
},
methods: {
...mapActions(useProtocolVotingStore, ["fetchProtocolVoting"]),
...mapActions(useProtocolVotingStore, ["fetchProtocolVoting", "createProtocolVoting"]),
},
});
</script>