ff-operation/src/views/admin/operation/mission/MissionDetail.vue

135 lines
4.1 KiB
Vue
Raw Normal View History

2025-02-24 11:46:02 +01:00
<template>
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
<div>
<label for="title">Einsatztitel</label>
2025-02-26 13:21:09 +01:00
<input type="text" id="title" v-model="title" />
2025-02-24 11:46:02 +01:00
</div>
<div class="flex flex-col sm:flex-row gap-2">
<ForceSelect title="Einsatzleiter" :available-forces="availableForces" />
<ForceSelect title="Bericht Ersteller" :available-forces="availableForces" />
</div>
<div class="flex flex-col sm:flex-row gap-2">
<div class="grow">
2025-02-27 15:08:56 +01:00
<label for="start">Einsatzbeginn</label>
<input type="datetime-local" id="start" />
2025-02-24 11:46:02 +01:00
</div>
<div class="grow">
2025-02-27 15:08:56 +01:00
<label for="end">Einsatzende</label>
<input type="datetime-local" id="end" />
2025-02-24 11:46:02 +01:00
</div>
<div class="w-full sm:w-fit min-w-fit">
<p>Dauer</p>
<p
class="rounded-md shadow-sm relative block w-full sm:w-fit px-3 py-2 border border-gray-300 text-gray-900 sm:text-sm"
>
00h 00m
</p>
</div>
</div>
<div>
2025-02-27 15:08:56 +01:00
<label for="mission_short">Stichwort</label>
<input type="text" id="mission_short" />
2025-02-24 11:46:02 +01:00
</div>
<div>
2025-02-27 15:08:56 +01:00
<label for="location">Einsatzort</label>
2025-02-24 11:46:02 +01:00
<input type="text" id="title" />
</div>
<div>
<label for="title">Weitere Anwesende (andere Wehren, Polizei, Rettungsdienst)</label>
<input type="text" id="title" />
</div>
<div class="flex flex-col sm:flex-row gap-2">
<div class="w-full">
2025-02-27 15:08:56 +01:00
<label for="rescued">Anzahl getretteter Personen</label>
<input type="number" id="rescued" value="0" />
2025-02-24 11:46:02 +01:00
</div>
<div class="w-full">
2025-02-27 15:08:56 +01:00
<label for="recovered">Anzahl geborgener Personen</label>
<input type="number" id="recovered" value="0" />
2025-02-24 11:46:02 +01:00
</div>
</div>
<div class="flex flex-col">
<label for="summary">Einsatzbeschreibung</label>
<QuillEditor
id="summary"
theme="snow"
style="height: 250px; max-height: 250px; min-height: 250px"
contentType="html"
2025-02-26 13:21:09 +01:00
:options="{ modules: moduleOptions }"
2025-02-24 11:46:02 +01:00
:enable="can('create', 'operation', 'mission')"
:style="!can('create', 'operation', 'mission') ? 'opacity: 75%; background: rgb(243 244 246)' : ''"
2025-02-26 13:21:09 +01:00
@ready="initEditor"
2025-02-24 11:46:02 +01:00
/>
<!--v-model:content=""-->
</div>
<div class="flex flex-col">
<p>Eingesetzte Fahrzeuge</p>
</div>
<div class="flex flex-col">
<p>Eingesetztes Material</p>
</div>
<div class="flex flex-col">
<p>Kontaktdaten</p>
</div>
</div>
</template>
<script setup lang="ts">
2025-02-28 14:02:06 +01:00
import { defineComponent, type PropType } from "vue";
2025-02-26 13:21:09 +01:00
import { mapActions, mapState, mapWritableState } from "pinia";
2025-02-24 11:46:02 +01:00
import { useAbilityStore } from "@/stores/ability";
2025-02-26 13:21:09 +01:00
import { Quill, QuillEditor } from "@vueup/vue-quill";
2025-02-26 16:26:43 +01:00
import type QuillCursors from "quill-cursors";
2025-02-24 11:46:02 +01:00
import "@vueup/vue-quill/dist/vue-quill.snow.css";
2025-02-26 13:21:09 +01:00
import { QuillBinding } from "y-quill";
import { moduleOptions } from "@/helpers/quillConfig";
2025-02-24 11:46:02 +01:00
import ForceSelect from "@/components/admin/ForceSelect.vue";
import { useForceStore } from "@/stores/admin/configuration/force";
2025-02-28 14:02:06 +01:00
import * as Y from "yjs";
2025-02-24 11:46:02 +01:00
</script>
<script lang="ts">
export default defineComponent({
2025-02-28 14:02:06 +01:00
props: {
document: {
type: Object as PropType<Y.Doc>,
required: true,
},
},
2025-02-24 11:46:02 +01:00
data() {
2025-02-26 13:21:09 +01:00
return {
binding: undefined as undefined | QuillBinding,
cursors: undefined as undefined | QuillCursors,
};
2025-02-24 11:46:02 +01:00
},
computed: {
...mapState(useAbilityStore, ["can"]),
...mapState(useForceStore, ["availableForces"]),
2025-02-28 14:02:06 +01:00
title: {
get() {
return this.document.getMap("form").get("title");
},
set(val: string) {
this.document.getMap("form").set("title", val);
},
},
editor() {
return this.document.getText("editor");
},
2025-02-26 13:21:09 +01:00
},
2025-02-28 16:46:15 +01:00
beforeUnmount() {
if (this.binding) {
this.binding.destroy();
this.binding = undefined;
}
},
2025-02-26 13:21:09 +01:00
methods: {
initEditor(quill: Quill) {
2025-02-28 16:46:15 +01:00
quill.history.clear();
2025-02-26 13:21:09 +01:00
this.binding = new QuillBinding(this.editor, quill);
this.cursors = quill.getModule("cursors") as QuillCursors;
},
2025-02-24 11:46:02 +01:00
},
});
</script>