equipmenttype form

This commit is contained in:
Julian Krauser 2025-03-31 10:59:41 +02:00
parent 8be88a5245
commit 5641dbb57f
9 changed files with 114 additions and 52 deletions

View file

@ -22,7 +22,7 @@ import { useAbilityStore } from "@/stores/ability";
import { useDamageReportStore } from "@/stores/admin/unit/damageReport/damageReport";
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
import Pagination from "@/components/Pagination.vue";
import DamageReportListItem from "@components/admin/unit/damageReport/DamageReportListItem.vue";
import DamageReportListItem from "@/components/admin/unit/damageReport/DamageReportListItem.vue";
</script>
<script lang="ts">

View file

@ -34,11 +34,10 @@
</template>
<script setup lang="ts">
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
import { defineComponent } from "vue";
import { mapActions, mapState } from "pinia";
import MainTemplate from "@/templates/Main.vue";
import { RouterLink, RouterView } from "vue-router";
import { useModalStore } from "@/stores/modal";
import { useAbilityStore } from "@/stores/ability";
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
</script>
@ -65,13 +64,6 @@ export default defineComponent({
},
methods: {
...mapActions(useEquipmentStore, ["fetchEquipmentByActiveId"]),
...mapActions(useModalStore, ["openModal"]),
openDeleteModal() {
this.openModal(
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/member/DeleteMemberModal.vue"))),
this.equipmentId ?? ""
);
},
},
});
</script>

View file

@ -0,0 +1,42 @@
<template>
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
<Pagination
:items="[]"
:totalCount="0"
:indicateLoading="false"
@load-data="(offset, count, search) => {}"
@search="(search) => {}"
>
<template #pageRow="{ row }: { row: { id: string } }">
<p>{{ row }}</p>
</template>
</Pagination>
<div class="flex flex-row gap-4">
<button v-if="can('create', 'unit', 'equipment_type')" primary class="!w-fit" @click="">
Prüfplan erstellen
</button>
</div>
</div>
</template>
<script setup lang="ts">
import { defineComponent } from "vue";
import { mapActions, mapState } from "pinia";
import Pagination from "@/components/Pagination.vue";
import { useAbilityStore } from "@/stores/ability";
</script>
<script lang="ts">
export default defineComponent({
data() {
return {
currentPage: 0,
maxEntriesPerPage: 25,
};
},
computed: {
...mapState(useAbilityStore, ["can"]),
},
});
</script>

View file

@ -0,0 +1,47 @@
<template>
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
<div v-if="activeEquipmentTypeObj != null" class="flex flex-col gap-2 w-full">
<div>
<label for="type">Typ</label>
<input type="text" id="type" :value="activeEquipmentTypeObj.type" readonly />
</div>
<div>
<label for="description">Beschreibung</label>
<textarea id="description" :value="activeEquipmentTypeObj.description" class="h-18" readonly></textarea>
</div>
<div>
<label for="interval">Intervall</label>
<input type="text" id="interval" :value="activeEquipmentTypeObj.inspectionInterval" reaonly />
</div>
</div>
<Spinner v-if="loadingActive == 'loading'" class="mx-auto" />
<p v-else-if="loadingActive == 'failed'" @click="fetchEquipmentTypeByActiveId" 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 { useEquipmentTypeStore } from "@/stores/admin/unit/equipmentType/equipmentType";
</script>
<script lang="ts">
export default defineComponent({
props: {
equipmentTypeId: String,
},
computed: {
...mapState(useEquipmentTypeStore, ["activeEquipmentTypeObj", "loadingActive"]),
},
mounted() {
this.fetchEquipmentTypeByActiveId();
},
methods: {
...mapActions(useEquipmentTypeStore, ["fetchEquipmentTypeByActiveId"]),
},
});
</script>