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

169 lines
5.4 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">
2025-03-03 17:06:10 +01:00
<DetailFormInput title="Einsatztitel" v-model="title" />
2025-02-24 11:46:02 +01:00
<div class="flex flex-col sm:flex-row gap-2">
2025-03-01 17:07:11 +01:00
<ForceSelect title="Einsatzleiter" :available-forces="availableForces" v-model="command" />
<ForceSelect title="Bericht Ersteller" :available-forces="availableForces" v-model="secretary" />
2025-02-24 11:46:02 +01:00
</div>
<div class="flex flex-col sm:flex-row gap-2">
2025-03-03 17:06:10 +01:00
<DetailFormInput title="Einsatzbeginn" v-model="start" type="datetime-local" growing />
<DetailFormInput title="Einsatzende" v-model="end" type="datetime-local" :min="start" growing />
2025-02-24 11:46:02 +01:00
<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"
>
2025-03-01 17:07:11 +01:00
<span v-if="duration.days != '00'">{{ duration.days }}d</span> {{ duration.hours }}h {{ duration.minutes }}m
2025-02-24 11:46:02 +01:00
</p>
</div>
</div>
2025-03-03 17:06:10 +01:00
<DetailFormInput title="Stichwort" v-model="mission_short" />
<DetailFormInput title="Einsatzort" v-model="location" />
<DetailFormInput title="Weitere Anwesende (andere Wehren, Polizei, Rettungsdienst)" v-model="others" />
2025-02-24 11:46:02 +01:00
<div class="flex flex-col sm:flex-row gap-2">
2025-03-03 17:06:10 +01:00
<DetailFormInput title="Anzahl getretteter Personen" type="number" v-model="rescued" min="0" />
<DetailFormInput title="Anzahl geborgener Personen" type="number" v-model="recovered" min="0" />
2025-02-24 11:46:02 +01:00
</div>
2025-03-03 17:06:10 +01:00
<DetailFormEditor title="Einsatzbeschreibung" :text="editor" />
2025-02-24 11:46:02 +01:00
<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-03-03 17:06:10 +01:00
import { mapState } 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-03-03 17:06:10 +01:00
import "@lottiefiles/lottie-player";
import DetailFormInput from "@/components/admin/operation/mission/DetailFormInput.vue";
import DetailFormEditor from "@/components/admin/operation/mission/DetailFormEditor.vue";
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-03-01 12:29:53 +01:00
awareness: {
2025-03-03 17:06:10 +01:00
type: Object as PropType<undefined>,
2025-03-01 12:29:53 +01:00
default: undefined,
},
2025-02-28 14:02:06 +01:00
},
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() {
2025-03-01 17:07:11 +01:00
return this.document.getMap("form").get("title") as string;
2025-02-28 14:02:06 +01:00
},
set(val: string) {
this.document.getMap("form").set("title", val);
},
},
2025-03-01 17:07:11 +01:00
command: {
get() {
return this.document.getMap("form").get("command") as string;
},
set(val: string) {
this.document.getMap("form").set("command", val);
},
},
secretary: {
get() {
return this.document.getMap("form").get("secretary") as string;
},
set(val: string) {
this.document.getMap("form").set("secretary", val);
},
},
start: {
get() {
2025-03-03 17:06:10 +01:00
return this.document.getMap("form").get("start") as string;
2025-03-01 17:07:11 +01:00
},
set(val: string) {
this.document.getMap("form").set("start", val);
},
},
end: {
get() {
return this.document.getMap("form").get("end") as string;
},
set(val: string) {
this.document.getMap("form").set("end", val);
},
},
duration() {
const diffInMs = new Date(this.end).getTime() - new Date(this.start).getTime();
const durationDate = new Date(diffInMs || 0);
return {
days: (durationDate.getUTCDate() - 1).toString().padStart(2, "0"),
hours: durationDate.getUTCHours().toString().padStart(2, "0"),
minutes: durationDate.getUTCMinutes().toString().padStart(2, "0"),
};
},
mission_short: {
get() {
2025-03-03 17:06:10 +01:00
return this.document.getMap("form").get("mission_short") as string;
2025-03-01 17:07:11 +01:00
},
set(val: string) {
this.document.getMap("form").set("mission_short", val);
},
},
location: {
get() {
2025-03-03 17:06:10 +01:00
return this.document.getMap("form").get("location") as string;
2025-03-01 17:07:11 +01:00
},
set(val: string) {
this.document.getMap("form").set("location", val);
},
},
others: {
get() {
2025-03-03 17:06:10 +01:00
return this.document.getMap("form").get("others") as string;
2025-03-01 17:07:11 +01:00
},
set(val: string) {
this.document.getMap("form").set("others", val);
},
},
rescued: {
get() {
2025-03-03 17:06:10 +01:00
return (this.document.getMap("form").get("rescued") || "0") as string;
2025-03-01 17:07:11 +01:00
},
set(val: number) {
this.document.getMap("form").set("rescued", val);
},
},
recovered: {
get() {
2025-03-03 17:06:10 +01:00
return (this.document.getMap("form").get("recovered") || "0") as string;
2025-03-01 17:07:11 +01:00
},
set(val: number) {
this.document.getMap("form").set("recovered", val);
},
},
2025-02-28 14:02:06 +01:00
editor() {
return this.document.getText("editor");
},
2025-02-26 13:21:09 +01:00
},
2025-02-24 11:46:02 +01:00
});
</script>