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

213 lines
6.1 KiB
Vue
Raw Normal View History

2025-02-24 11:46:02 +01:00
<template>
2025-03-06 11:57:07 +01:00
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto pb-20">
2025-03-05 15:29:09 +01:00
<DetailFormInput title="Einsatztitel" v-model="title" :awareness="awareness" :enabled="enabled" />
2025-02-24 11:46:02 +01:00
<div class="flex flex-col sm:flex-row gap-2">
2025-03-05 15:29:09 +01:00
<ForceSelect title="Einsatzleiter" :available-forces="availableForces" v-model="command" :enabled="enabled" />
<ForceSelect
title="Bericht Ersteller"
:available-forces="availableForces"
v-model="secretary"
:enabled="enabled"
/>
2025-02-24 11:46:02 +01:00
</div>
<div class="flex flex-col sm:flex-row gap-2">
2025-03-05 15:29:09 +01:00
<DetailFormInput
title="Einsatzbeginn"
v-model="start"
type="datetime-local"
growing
:awareness="awareness"
:enabled="enabled"
/>
2025-03-04 15:03:34 +01:00
<DetailFormInput
title="Einsatzende"
v-model="end"
type="datetime-local"
:min="start"
growing
:awareness="awareness"
2025-03-05 15:29:09 +01:00
:enabled="enabled"
2025-03-04 15:03:34 +01:00
/>
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-05 15:29:09 +01:00
<DetailFormInput title="Stichwort" v-model="mission_short" :awareness="awareness" :enabled="enabled" />
<DetailFormInput title="Einsatzort" v-model="location" :awareness="awareness" :enabled="enabled" />
2025-03-04 15:03:34 +01:00
<DetailFormInput
title="Weitere Anwesende (andere Wehren, Polizei, Rettungsdienst)"
v-model="others"
:awareness="awareness"
2025-03-05 15:29:09 +01:00
:enabled="enabled"
2025-03-04 15:03:34 +01:00
/>
2025-02-24 11:46:02 +01:00
<div class="flex flex-col sm:flex-row gap-2">
2025-03-04 15:03:34 +01:00
<DetailFormInput
title="Anzahl getretteter Personen"
type="number"
v-model="rescued"
min="0"
:awareness="awareness"
2025-03-05 15:29:09 +01:00
:enabled="enabled"
2025-03-04 15:03:34 +01:00
/>
<DetailFormInput
title="Anzahl geborgener Personen"
type="number"
v-model="recovered"
min="0"
:awareness="awareness"
2025-03-05 15:29:09 +01:00
:enabled="enabled"
2025-03-04 15:03:34 +01:00
/>
2025-02-24 11:46:02 +01:00
</div>
2025-03-05 15:29:09 +01:00
<DetailFormEditor title="Einsatzbeschreibung" :text="editor" :awareness="awareness" :enabled="enabled" />
2025-03-06 11:57:07 +01:00
<DetailFormVehicle :map="vehicle" :awareness="awareness" :enabled="enabled" />
2025-02-24 11:46:02 +01:00
<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 { useForceStore } from "@/stores/admin/configuration/force";
2025-02-28 14:02:06 +01:00
import * as Y from "yjs";
2025-03-06 11:57:07 +01:00
import { Awareness } from "@/helpers/awareness";
2025-03-05 15:29:09 +01:00
import DetailFormInput from "./DetailFormInput.vue";
import DetailFormEditor from "./DetailFormEditor.vue";
2025-03-06 11:57:07 +01:00
import DetailFormVehicle from "./DetailFormVehicle.vue";
import ForceSelect from "@/components/admin/ForceSelect.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-04 15:03:34 +01:00
type: Object as PropType<Awareness>,
required: true,
2025-03-01 12:29:53 +01:00
},
2025-03-05 15:29:09 +01:00
enabled: {
type: Boolean,
default: true,
},
2025-02-28 14:02:06 +01:00
},
2025-02-24 11:46:02 +01:00
computed: {
...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-03-06 11:57:07 +01:00
vehicle() {
return this.document.getMap<Y.Map<number | string>>("vehicle");
},
equipment() {
return this.document.getMap("equipment");
},
contact() {
return this.document.getMap("contact");
},
2025-02-26 13:21:09 +01:00
},
2025-02-24 11:46:02 +01:00
});
</script>