2025-05-14 09:13:47 +02:00
|
|
|
<template>
|
|
|
|
<div class="flex flex-col gap-2 h-full w-full">
|
|
|
|
<Pagination
|
|
|
|
:items="damageReports"
|
|
|
|
:totalCount="totalCount"
|
|
|
|
:indicateLoading="false"
|
2025-07-17 10:37:40 +02:00
|
|
|
@load-data="(offset, count, search) => fetchDamageReportForVehicle(offset, count, search)"
|
|
|
|
@search="(search) => fetchDamageReportForVehicle(0, 25, search, true)"
|
2025-05-14 09:13:47 +02:00
|
|
|
>
|
|
|
|
<template #pageRow="{ row }: { row: DamageReportViewModel }">
|
2025-07-17 10:37:40 +02:00
|
|
|
<RouterLink
|
|
|
|
:to="{ name: 'admin-unit-damage_report-overview', params: { damageReportId: row.id } }"
|
|
|
|
class="flex flex-col h-fit w-full border border-primary rounded-md"
|
|
|
|
>
|
2025-05-14 09:13:47 +02:00
|
|
|
<div class="bg-primary p-2 text-white flex flex-row gap-2 items-center">
|
|
|
|
<PencilSquareIcon v-if="!row.done" class="w-5 h-5" />
|
2025-07-17 10:42:48 +02:00
|
|
|
<p class="grow">{{ new Date(row.reportedAt).toLocaleString("de") }} - {{ row.status }}</p>
|
2025-07-17 10:37:40 +02:00
|
|
|
<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>
|
2025-07-19 11:02:03 +02:00
|
|
|
<div v-if="row.repair" class="cursor-pointer">
|
2025-07-17 10:37:40 +02:00
|
|
|
<WrenchScrewdriverIcon class="w-5 h-5" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2025-05-14 09:13:47 +02:00
|
|
|
</div>
|
|
|
|
<div class="p-2">
|
|
|
|
<p>Beschreibung: {{ row.description }}</p>
|
|
|
|
</div>
|
2025-07-17 10:37:40 +02:00
|
|
|
</RouterLink>
|
2025-05-14 09:13:47 +02:00
|
|
|
</template>
|
|
|
|
</Pagination>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { defineComponent } from "vue";
|
|
|
|
import { mapActions, mapState } from "pinia";
|
|
|
|
import { useAbilityStore } from "@/stores/ability";
|
|
|
|
import { useVehicleDamageReportStore } from "@/stores/admin/unit/vehicle/damageReport";
|
|
|
|
import Pagination from "@/components/Pagination.vue";
|
2025-06-04 12:49:42 +02:00
|
|
|
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
2025-07-17 10:37:40 +02:00
|
|
|
import { PhotoIcon, PencilSquareIcon, MapPinIcon, WrenchScrewdriverIcon, UserIcon } from "@heroicons/vue/24/outline";
|
2025-05-14 09:13:47 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
export default defineComponent({
|
|
|
|
props: {
|
|
|
|
vehicleId: String,
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(useAbilityStore, ["can"]),
|
|
|
|
...mapState(useVehicleDamageReportStore, ["damageReports", "loading", "totalCount"]),
|
|
|
|
},
|
|
|
|
mounted() {
|
2025-07-17 10:37:40 +02:00
|
|
|
this.fetchDamageReportForVehicle(0, 25, "", true);
|
2025-05-14 09:13:47 +02:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(useVehicleDamageReportStore, ["fetchDamageReportForVehicle"]),
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|