inspection finish and print
This commit is contained in:
parent
d96c73d5b1
commit
5d26885da3
14 changed files with 367 additions and 29 deletions
|
@ -4,8 +4,7 @@
|
|||
:items="inspections"
|
||||
:totalCount="totalCount"
|
||||
:indicateLoading="false"
|
||||
@load-data="(offset, count, search) => {}"
|
||||
@search="(search) => {}"
|
||||
@load-data="(offset, count, search) => fetchInspectionForEquipment(offset, count, false)"
|
||||
>
|
||||
<template #pageRow="{ row }: { row: InspectionViewModel }">
|
||||
<RouterLink
|
||||
|
|
|
@ -6,6 +6,13 @@
|
|||
<small v-if="activeInspectionObj?.related.code">({{ activeInspectionObj?.related.code }})</small> -
|
||||
{{ activeInspectionObj?.inspectionPlan.title }}
|
||||
</h1>
|
||||
<div class="flex flex-row gap-2">
|
||||
<TrashIcon
|
||||
v-if="activeInspectionObj?.isOpen && can('delete', 'unit', 'inspection')"
|
||||
class="w-5 h-5 cursor-pointer"
|
||||
@click="openDeleteModal"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<template #main>
|
||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||
|
@ -79,7 +86,7 @@
|
|||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||
</div>
|
||||
<div v-else>
|
||||
<button primary type="button" @click="">Bericht anzeigen</button>
|
||||
<button primary type="button" @click="openPrintModal">Bericht anzeigen</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -103,6 +110,8 @@ import { useModalStore } from "@/stores/modal";
|
|||
import NumberInput from "@/components/admin/unit/inspection/NumberInput.vue";
|
||||
import TextInput from "@/components/admin/unit/inspection/TextInput.vue";
|
||||
import FileInput from "@/components/admin/unit/inspection/FileInput.vue";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import { DocumentTextIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -137,8 +146,11 @@ export default defineComponent({
|
|||
);
|
||||
},
|
||||
...mapState(useInspectionStore, ["activeInspectionObj", "loadingActive"]),
|
||||
...mapState(useAbilityStore, ["can"]),
|
||||
points() {
|
||||
return this.activeInspectionObj?.inspectionVersionedPlan.inspectionPoints ?? [];
|
||||
return (this.activeInspectionObj?.inspectionVersionedPlan.inspectionPoints ?? [])
|
||||
.slice()
|
||||
.sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|
||||
},
|
||||
pointResult() {
|
||||
return (pointId: string) => {
|
||||
|
@ -172,8 +184,24 @@ export default defineComponent({
|
|||
} catch (error) {}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useInspectionStore, ["fetchInspectionByActiveId"]),
|
||||
...mapActions(useInspectionStore, ["fetchInspectionByActiveId", "updateActiveInspectionResults"]),
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
openDeleteModal() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/inspection/DeleteInspectionModal.vue"))),
|
||||
parseInt(this.inspectionId ?? "")
|
||||
);
|
||||
},
|
||||
openPrintModal() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/inspection/InspectionPrintModal.vue")))
|
||||
);
|
||||
},
|
||||
finishInspection() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/inspection/InspectionFinishModal.vue")))
|
||||
);
|
||||
},
|
||||
resetForm() {
|
||||
this.checks = cloneDeep(this.activeInspectionObj?.checks ?? []);
|
||||
},
|
||||
|
@ -194,9 +222,7 @@ export default defineComponent({
|
|||
triggerUpdate(e: any) {
|
||||
if (this.activeInspectionObj == null) return;
|
||||
this.status = "loading";
|
||||
new Promise<void>((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
this.updateActiveInspectionResults(this.checks, this.fileStore)
|
||||
.then(() => {
|
||||
this.status = { status: "success" };
|
||||
})
|
||||
|
@ -209,11 +235,6 @@ export default defineComponent({
|
|||
}, 2000);
|
||||
});
|
||||
},
|
||||
finishInspection() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/inspection/InspectionFinishModal.vue")))
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -32,14 +32,15 @@
|
|||
|
||||
<InspectionPlanSearchSelectWithRelated
|
||||
title="Prüfplan"
|
||||
:relatedType="active"
|
||||
:relatedType="`${active}Type`"
|
||||
:relatedTypeId="relatedType"
|
||||
v-model="inspectionPlan"
|
||||
/>
|
||||
|
||||
<div>
|
||||
<label for="nextInspection">
|
||||
Nächste Prüfung (optional) - Intervall: {{ selectedInspectionPlan?.inspectionInterval }}
|
||||
<label for="nextInspection" class="flex flex-row justify-between">
|
||||
Nächste Prüfung (optional) - Intervall: {{ selectedInspectionPlan?.inspectionInterval ?? "xx" }}
|
||||
<InspectionTimeFormatExplainIcon />
|
||||
</label>
|
||||
<input id="nextInspection" type="date" />
|
||||
</div>
|
||||
|
@ -87,6 +88,7 @@ import { useVehicleStore } from "@/stores/admin/unit/vehicle/vehicle";
|
|||
import { useWearableStore } from "@/stores/admin/unit/wearable/wearable";
|
||||
import type { CreateInspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
|
||||
import InspectionTimeFormatExplainIcon from "@/components/admin/unit/InspectionTimeFormatExplainIcon.vue";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -34,7 +34,10 @@
|
|||
<input type="text" id="name" required />
|
||||
</div>
|
||||
<div>
|
||||
<label for="interval">Intervall</label>
|
||||
<label for="interval" class="flex flex-row justify-between">
|
||||
Intervall
|
||||
<InspectionTimeFormatExplainIcon />
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="interval"
|
||||
|
@ -45,7 +48,10 @@
|
|||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="remind">Erinnerung vor Fälligkeit</label>
|
||||
<label for="remind" class="flex flex-row justify-between">
|
||||
Erinnerung vor Fälligkeit
|
||||
<InspectionTimeFormatExplainIcon />
|
||||
</label>
|
||||
<input
|
||||
type="text"
|
||||
id="remind"
|
||||
|
@ -88,6 +94,7 @@ import type { CreateInspectionPlanViewModel } from "@/viewmodels/admin/unit/insp
|
|||
import { useEquipmentTypeStore } from "@/stores/admin/unit/equipmentType/equipmentType";
|
||||
import EquipmentTypeSearchSelect from "@/components/search/EquipmentTypeSearchSelect.vue";
|
||||
import VehicleTypeSearchSelect from "@/components/search/VehicleTypeSearchSelect.vue";
|
||||
import InspectionTimeFormatExplainIcon from "@/components/admin/unit/InspectionTimeFormatExplainIcon.vue";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue