68 lines
2.6 KiB
Vue
68 lines
2.6 KiB
Vue
<template>
|
|
<div class="flex flex-col gap-2 h-full w-full">
|
|
<Pagination
|
|
:items="damageReports"
|
|
:totalCount="totalCount"
|
|
:indicateLoading="loading == 'loading'"
|
|
@load-data="(offset, count, search) => fetchDamageReportForWearable(offset, count, search)"
|
|
>
|
|
<template #pageRow="{ row }: { row: DamageReportViewModel }">
|
|
<RouterLink
|
|
:to="{ name: 'admin-unit-damage_report-overview', params: { damageReportId: row.id } }"
|
|
:disabled="!can('read', 'unit', 'damage_report')"
|
|
class="flex flex-col h-fit w-full border border-primary rounded-md"
|
|
>
|
|
<div class="bg-primary p-2 text-white flex flex-row gap-2 items-center">
|
|
<PencilSquareIcon v-if="row.closedAt == undefined" class="w-5 h-5" />
|
|
<p class="grow">{{ row.title }} - {{ new Date(row.reportedAt).toLocaleString("de") }} - {{ row.status }}</p>
|
|
<div class="flex flex-row gap-2">
|
|
<div v-if="row.images.length != 0" class="cursor-pointer">
|
|
<PhotoIcon class="w-5 h-5" />
|
|
</div>
|
|
<div v-if="row.location" class="cursor-pointer">
|
|
<MapPinIcon class="w-5 h-5" />
|
|
</div>
|
|
<div v-if="row.reportedBy" class="cursor-pointer">
|
|
<UserIcon class="w-5 h-5" />
|
|
</div>
|
|
<div v-if="row.repair" class="cursor-pointer">
|
|
<WrenchScrewdriverIcon class="w-5 h-5" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="p-2">
|
|
<p>Beschreibung: {{ row.description }}</p>
|
|
</div>
|
|
</RouterLink>
|
|
</template>
|
|
</Pagination>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { defineComponent } from "vue";
|
|
import { mapActions, mapState } from "pinia";
|
|
import { useAbilityStore } from "@/stores/ability";
|
|
import { useWearableDamageReportStore } from "@/stores/admin/unit/wearable/damageReport";
|
|
import Pagination from "@/components/Pagination.vue";
|
|
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
|
import { PhotoIcon, PencilSquareIcon, MapPinIcon, WrenchScrewdriverIcon, UserIcon } from "@heroicons/vue/24/outline";
|
|
</script>
|
|
|
|
<script lang="ts">
|
|
export default defineComponent({
|
|
props: {
|
|
wearableId: String,
|
|
},
|
|
computed: {
|
|
...mapState(useAbilityStore, ["can"]),
|
|
...mapState(useWearableDamageReportStore, ["damageReports", "loading", "totalCount"]),
|
|
},
|
|
mounted() {
|
|
this.fetchDamageReportForWearable(0, 25, "", true);
|
|
},
|
|
methods: {
|
|
...mapActions(useWearableDamageReportStore, ["fetchDamageReportForWearable"]),
|
|
},
|
|
});
|
|
</script>
|