ff-admin/src/views/admin/unit/wearable/Overview.vue

68 lines
2.2 KiB
Vue

<template>
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
<div v-if="activeWearableObj != null" class="flex flex-col gap-2 w-full">
<div>
<label for="type">Typ</label>
<input type="text" id="type" :value="activeWearableObj.wearableType.type" readonly />
</div>
<div>
<label for="name">Bezeichnung</label>
<input type="text" id="name" :value="activeWearableObj.name" readonly />
</div>
<div>
<label for="code">Code</label>
<input type="text" id="code" :value="activeWearableObj.code" readonly />
</div>
<div>
<label for="location">Verortung</label>
<input type="text" id="location" :value="activeWearableObj.location" readonly />
</div>
<div>
<label for="commissioned">In-Betrieb-Nahme</label>
<input type="date" id="commissioned" :value="activeWearableObj.commissioned" readonly />
</div>
<div>
<label for="decommissioned">Außer-Betrieb-Nahme</label>
<input type="date" id="decommissioned" :value="activeWearableObj.decommissioned" readonly />
</div>
<div>
<label for="wearer">Träger</label>
<input
type="text"
id="wearer"
:value="(activeWearableObj.wearer?.firstname ?? '') + ' ' + (activeWearableObj.wearer?.lastname ?? '')"
readonly
/>
</div>
</div>
<Spinner v-if="loadingActive == 'loading'" class="mx-auto" />
<p v-else-if="loadingActive == 'failed'" @click="fetchWearableByActiveId" class="cursor-pointer">
&#8634; laden fehlgeschlagen
</p>
</div>
</template>
<script setup lang="ts">
import { defineComponent } from "vue";
import { mapActions, mapState } from "pinia";
import Spinner from "@/components/Spinner.vue";
import { useWearableStore } from "@/stores/admin/unit/wearable/wearable";
</script>
<script lang="ts">
export default defineComponent({
props: {
wearableId: String,
},
computed: {
...mapState(useWearableStore, ["activeWearableObj", "loadingActive"]),
},
mounted() {
this.fetchWearableByActiveId();
},
methods: {
...mapActions(useWearableStore, ["fetchWearableByActiveId"]),
},
});
</script>