next and running inspections

This commit is contained in:
Julian Krauser 2025-07-10 13:22:38 +02:00
parent 1409cf8045
commit 74b05ee97f
14 changed files with 280 additions and 75 deletions

View file

@ -14,9 +14,9 @@
>
<div class="bg-primary p-2 text-white flex flex-row gap-2 items-center">
<PencilSquareIcon v-if="row.isOpen" class="w-5 h-5" />
<p>{{ row.inspectionPlan.title }} - {{ row.finished }}</p>
<p>{{ row.inspectionPlan.title }} - {{ row.finished ?? "in Arbeit" }}</p>
</div>
<div class="p-2">
<div v-if="row.context || row.nextInspection" class="p-2">
<p v-if="row.context">Kontext: {{ row.context }}</p>
<p v-if="row.nextInspection">nächste Inspektion: {{ row.nextInspection }}</p>
</div>
@ -30,9 +30,9 @@
button
primary
class="w-fit!"
@click=""
>Prüfung durchführen</RouterLink
>
Prüfung durchführen
</RouterLink>
</div>
</div>
</template>

View file

@ -14,36 +14,45 @@
v-else-if="activeInspectionObj != null"
class="flex flex-col gap-4 py-2 grow w-full max-w-xl mx-auto overflow-hidden"
>
<div>
<p>Kontext:</p>
<textarea readonly :value="activeInspectionObj.context || '---'" class="h-18"></textarea>
</div>
<div class="flex flex-col gap-2 grow overflow-y-scroll">
<div v-for="point in points" :key="point.title" class="contents">
<OkNotOk
v-if="point.type == InspectionPointEnum.oknok"
:inspectionPoint="point"
:editable="activeInspectionObj.isOpen"
:modelValue="boolPointResult(point.id)"
@update:model-value="(val) => updateCheckResult(point.id, val)"
/>
<NumberInput
v-else-if="point.type == InspectionPointEnum.number"
:inspectionPoint="point"
:editable="activeInspectionObj.isOpen"
:modelValue="pointResult(point.id)"
@update:model-value="(val) => updateCheckResult(point.id, val)"
/>
<TextInput
v-else-if="point.type == InspectionPointEnum.text"
:inspectionPoint="point"
:editable="activeInspectionObj.isOpen"
:modelValue="pointResult(point.id)"
@update:model-value="(val) => updateCheckResult(point.id, val)"
/>
<FileInput
v-else-if="point.type == InspectionPointEnum.file"
:inspectionPoint="point"
:editable="activeInspectionObj.isOpen"
:modelValue="pointResult(point.id)"
@update:model-value="(val) => updateCheckResult(point.id, val)"
@update:upload="(val) => (fileStore[point.id] = val)"
/>
</div>
</div>
<div class="flex flex-row justify-end flex-wrap min-h-fit gap-2">
<div v-if="activeInspectionObj.isOpen" class="flex flex-row justify-end flex-wrap min-h-fit gap-2">
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
verwerfen
</button>
@ -69,6 +78,9 @@
<SuccessCheckmark v-else-if="status?.status == 'success'" />
<FailureXMark v-else-if="status?.status == 'failed'" />
</div>
<div v-else>
<button primary type="button" @click="">Bericht anzeigen</button>
</div>
</div>
</template>
</MainTemplate>

View file

@ -1,45 +0,0 @@
<template>
<div class="flex flex-col w-full h-full gap-2 justify-center">
<Pagination
:items="[]"
:totalCount="0"
:indicateLoading="false"
@load-data="(offset, count, search) => {}"
@search="(search) => {}"
>
<template #pageRow="{ row }: { row: any }">
{{ row }}
</template>
</Pagination>
<div class="flex flex-row gap-4">
<RouterLink
v-if="can('create', 'unit', 'inspection')"
:to="{ name: 'admin-unit-inspection-start' }"
primary
button
class="w-fit!"
>
Prüfung starten
</RouterLink>
</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 {};
},
computed: {
...mapState(useAbilityStore, ["can"]),
},
});
</script>

View file

@ -0,0 +1,69 @@
<template>
<div class="flex flex-col w-full h-full gap-2 justify-center">
<Pagination
:items="nextInspections"
:totalCount="nextTotalCount"
:indicateLoading="nextLoading == 'loading'"
@load-data="(offset, count, search) => fetchNextInspections(offset, count, search)"
@search="(search) => fetchNextInspections(0, maxEntriesPerPage, search, true)"
>
<template #pageRow="{ row }: { row: InspectionNextViewModel }">
<RouterLink
:to="{
name: 'admin-unit-inspection-start',
params: { type: row.assigned, relatedId: row.relatedId, inspectionPlanId: row.inspectionPlanId },
}"
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">
<p>
{{ row.related.name }} <small v-if="row.related.code">({{ row.related.code }})</small> -
{{ row.inspectionPlan.title }} - {{ row.dueDate ?? "ohne Fälligkeit" }}
</p>
</div>
</RouterLink>
</template>
</Pagination>
<div class="flex flex-row gap-4">
<RouterLink
v-if="can('create', 'unit', 'inspection')"
:to="{ name: 'admin-unit-inspection-start' }"
primary
button
class="w-fit!"
>
Prüfung starten
</RouterLink>
</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";
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
import type { InspectionNextViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
</script>
<script lang="ts">
export default defineComponent({
data() {
return {
maxEntriesPerPage: 25,
};
},
computed: {
...mapState(useInspectionStore, ["nextInspections", "nextTotalCount", "nextLoading"]),
...mapState(useAbilityStore, ["can"]),
},
mounted() {
this.fetchNextInspections(0, this.maxEntriesPerPage, "", true);
},
methods: {
...mapActions(useInspectionStore, ["fetchNextInspections"]),
},
});
</script>

View file

@ -0,0 +1,68 @@
<template>
<div class="flex flex-col w-full h-full gap-2 justify-center">
<Pagination
:items="inspections"
:totalCount="totalCount"
:indicateLoading="loading == 'loading'"
@load-data="(offset, count, search) => fetchRunningInspections(offset, count, search)"
@search="(search) => fetchRunningInspections(0, maxEntriesPerPage, search, true)"
>
<template #pageRow="{ row }: { row: MinifiedInspectionViewModel }">
<RouterLink
:to="{ name: 'admin-unit-inspection-execute', params: { inspectionId: row.id } }"
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.isOpen" class="w-5 h-5" />
<p>{{ row.inspectionPlan.title }} - in Arbeit seit {{ row.created }}</p>
</div>
<div v-if="row.context" class="p-2">
<p v-if="row.context">Kontext: {{ row.context }}</p>
</div>
</RouterLink>
</template>
</Pagination>
<div class="flex flex-row gap-4">
<RouterLink
v-if="can('create', 'unit', 'inspection')"
:to="{ name: 'admin-unit-inspection-start' }"
primary
button
class="w-fit!"
>
Prüfung starten
</RouterLink>
</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";
import type { MinifiedInspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
import { PencilSquareIcon } from "@heroicons/vue/24/outline";
</script>
<script lang="ts">
export default defineComponent({
data() {
return {
maxEntriesPerPage: 25,
};
},
computed: {
...mapState(useInspectionStore, ["inspections", "totalCount", "loading"]),
...mapState(useAbilityStore, ["can"]),
},
mounted() {
this.fetchRunningInspections(0, this.maxEntriesPerPage, "", true);
},
methods: {
...mapActions(useInspectionStore, ["fetchRunningInspections"]),
},
});
</script>

View file

@ -14,9 +14,9 @@
>
<div class="bg-primary p-2 text-white flex flex-row gap-2 items-center">
<PencilSquareIcon v-if="row.isOpen" class="w-5 h-5" />
<p>{{ row.inspectionPlan.title }} - {{ row.finished }}</p>
<p>{{ row.inspectionPlan.title }} - {{ row.finished ?? "in Arbeit" }}</p>
</div>
<div class="p-2">
<div v-if="row.context || row.nextInspection" class="p-2">
<p v-if="row.context">Kontext: {{ row.context }}</p>
<p v-if="row.nextInspection">nächste Inspektion: {{ row.nextInspection }}</p>
</div>
@ -30,9 +30,9 @@
button
primary
class="w-fit!"
@click=""
>Prüfung durchführen</RouterLink
>
Prüfung durchführen
</RouterLink>
</div>
</div>
</template>

View file

@ -14,9 +14,9 @@
>
<div class="bg-primary p-2 text-white flex flex-row gap-2 items-center">
<PencilSquareIcon v-if="row.isOpen" class="w-5 h-5" />
<p>{{ row.inspectionPlan.title }} - {{ row.finished }}</p>
<p>{{ row.inspectionPlan.title }} - {{ row.finished ?? "in Arbeit" }}</p>
</div>
<div class="p-2">
<div v-if="row.context || row.nextInspection" class="p-2">
<p v-if="row.context">Kontext: {{ row.context }}</p>
<p v-if="row.nextInspection">nächste Inspektion: {{ row.nextInspection }}</p>
</div>
@ -30,9 +30,9 @@
button
primary
class="w-fit!"
@click=""
>Prüfung durchführen</RouterLink
>
Prüfung durchführen
</RouterLink>
</div>
</div>
</template>