2025-03-24 17:16:07 +01:00
|
|
|
<template>
|
2025-03-27 17:02:21 +01:00
|
|
|
<div class="flex flex-col w-full h-full gap-2 justify-center px-7">
|
|
|
|
<Pagination
|
|
|
|
:items="damageReports"
|
|
|
|
:totalCount="totalCount"
|
|
|
|
:indicateLoading="loading == 'loading'"
|
|
|
|
@load-data="(offset, count, search) => fetchDamageReports(offset, count, search)"
|
|
|
|
@search="(search) => fetchDamageReports(0, maxEntriesPerPage, search, true)"
|
|
|
|
>
|
|
|
|
<template #pageRow="{ row }: { row: DamageReportViewModel }">
|
|
|
|
<DamageReportListItem :damageReport="row" />
|
|
|
|
</template>
|
|
|
|
</Pagination>
|
|
|
|
</div>
|
2025-03-24 17:16:07 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { defineComponent } from "vue";
|
|
|
|
import { mapActions, mapState } from "pinia";
|
|
|
|
import MainTemplate from "@/templates/Main.vue";
|
2025-03-25 10:42:40 +01:00
|
|
|
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";
|
2025-03-24 17:16:07 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
export default defineComponent({
|
|
|
|
data() {
|
2025-03-25 10:42:40 +01:00
|
|
|
return {
|
|
|
|
maxEntriesPerPage: 25,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(useDamageReportStore, ["damageReports", "totalCount", "loading"]),
|
|
|
|
...mapState(useAbilityStore, ["can"]),
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.fetchDamageReports(0, this.maxEntriesPerPage, "", true);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(useDamageReportStore, ["fetchDamageReports"]),
|
2025-03-24 17:16:07 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|