diff --git a/src/components/admin/unit/inspection/FileInput.vue b/src/components/admin/unit/inspection/FileInput.vue
index 7ade43d..e02c470 100644
--- a/src/components/admin/unit/inspection/FileInput.vue
+++ b/src/components/admin/unit/inspection/FileInput.vue
@@ -13,6 +13,7 @@
type="button"
class="flex flex-row gap-2"
@click="($refs.fileInput as HTMLInputElement).click()"
+ :disabled="!editable"
>
Datei wählenDatei gewählt
@@ -47,6 +48,10 @@ export default defineComponent({
type: String,
default: "",
},
+ editable: {
+ type: Boolean,
+ default: true,
+ },
},
emits: {
"update:model-value": (p: string) => {
diff --git a/src/components/admin/unit/inspection/NumberInput.vue b/src/components/admin/unit/inspection/NumberInput.vue
index eb3cc4d..b93b720 100644
--- a/src/components/admin/unit/inspection/NumberInput.vue
+++ b/src/components/admin/unit/inspection/NumberInput.vue
@@ -16,7 +16,8 @@
v-model="value"
:min="inspectionPoint.min"
:max="inspectionPoint.max"
- :class="{ 'ring-red-500! ring-1!': isInRange }"
+ :class="{ 'ring-red-500! ring-1!': isInRange && editable }"
+ :disabled="!editable"
/>
@@ -38,6 +39,10 @@ export default defineComponent({
type: String,
default: "",
},
+ editable: {
+ type: Boolean,
+ default: true,
+ },
},
emits: ["update:model-value"],
computed: {
diff --git a/src/components/admin/unit/inspection/OkNotOk.vue b/src/components/admin/unit/inspection/OkNotOk.vue
index 4394ba8..b32170d 100644
--- a/src/components/admin/unit/inspection/OkNotOk.vue
+++ b/src/components/admin/unit/inspection/OkNotOk.vue
@@ -6,7 +6,7 @@
Beschreibung: {{ inspectionPoint.description }}
-
+
,
default: "",
},
+ editable: {
+ type: Boolean,
+ default: true,
+ },
},
emits: ["update:model-value"],
data() {
diff --git a/src/components/admin/unit/inspection/TextInput.vue b/src/components/admin/unit/inspection/TextInput.vue
index 4ff65c4..664c3d4 100644
--- a/src/components/admin/unit/inspection/TextInput.vue
+++ b/src/components/admin/unit/inspection/TextInput.vue
@@ -11,8 +11,9 @@
:id="inspectionPoint.id"
:name="inspectionPoint.id"
class="h-18"
- :class="{ 'ring-red-500! ring-1!': value == '' }"
+ :class="{ 'ring-red-500! ring-1!': value == '' && editable }"
v-model="value"
+ :disabled="!editable"
>
@@ -34,6 +35,10 @@ export default defineComponent({
type: String,
default: "",
},
+ editable: {
+ type: Boolean,
+ default: true,
+ },
},
emits: ["update:model-value"],
computed: {
diff --git a/src/router/index.ts b/src/router/index.ts
index d17640f..9ed65d6 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -930,12 +930,12 @@ const router = createRouter({
{
path: "next",
name: "admin-unit-inspection",
- component: () => import("@/views/admin/unit/inspection/NextInspection.vue"),
+ component: () => import("@/views/admin/unit/inspection/NextInspections.vue"),
},
{
path: "running",
name: "admin-unit-inspection-running",
- component: () => import("@/views/admin/unit/inspection/NextInspection.vue"),
+ component: () => import("@/views/admin/unit/inspection/RunningInspections.vue"),
},
],
},
diff --git a/src/stores/admin/unit/inspection/inspection.ts b/src/stores/admin/unit/inspection/inspection.ts
index a0fcd11..bfef211 100644
--- a/src/stores/admin/unit/inspection/inspection.ts
+++ b/src/stores/admin/unit/inspection/inspection.ts
@@ -3,19 +3,77 @@ import { http } from "@/serverCom";
import type { AxiosResponse } from "axios";
import type {
CreateInspectionViewModel,
+ InspectionNextViewModel,
InspectionViewModel,
+ MinifiedInspectionViewModel,
UpdateInspectionViewModel,
} from "@/viewmodels/admin/unit/inspection/inspection.models";
export const useInspectionStore = defineStore("inspection", {
state: () => {
return {
+ inspections: [] as Array,
+ totalCount: 0 as number,
+ loading: "loading" as "loading" | "fetched" | "failed",
+ nextInspections: [] as Array,
+ nextTotalCount: 0 as number,
+ nextLoading: "loading" as "loading" | "fetched" | "failed",
activeInspection: null as string | null,
activeInspectionObj: null as InspectionViewModel | null,
loadingActive: "loading" as "loading" | "fetched" | "failed",
};
},
actions: {
+ fetchRunningInspections(offset = 0, count = 25, search = "", clear = false) {
+ if (clear) this.inspections = [];
+ this.loading = "loading";
+ http
+ .get(`/admin/inspection/running?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
+ .then((result) => {
+ this.totalCount = result.data.total;
+ result.data.inspections
+ .filter((elem: MinifiedInspectionViewModel) => this.inspections.findIndex((m) => m.id == elem.id) == -1)
+ .map(
+ (elem: MinifiedInspectionViewModel, index: number): MinifiedInspectionViewModel & { tab_pos: number } => {
+ return {
+ ...elem,
+ tab_pos: index + offset,
+ };
+ }
+ )
+ .forEach((elem: MinifiedInspectionViewModel & { tab_pos: number }) => {
+ this.inspections.push(elem);
+ });
+ this.loading = "fetched";
+ })
+ .catch((err) => {
+ this.loading = "failed";
+ });
+ },
+ fetchNextInspections(offset = 0, count = 25, search = "", clear = false) {
+ if (clear) this.nextInspections = [];
+ this.nextLoading = "loading";
+ http
+ .get(`/admin/inspection/next?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
+ .then((result) => {
+ this.nextTotalCount = result.data.total;
+ result.data.inspections
+ .filter((elem: InspectionNextViewModel) => this.nextInspections.findIndex((m) => m.id == elem.id) == -1)
+ .map((elem: InspectionNextViewModel, index: number): InspectionNextViewModel & { tab_pos: number } => {
+ return {
+ ...elem,
+ tab_pos: index + offset,
+ };
+ })
+ .forEach((elem: InspectionNextViewModel & { tab_pos: number }) => {
+ this.nextInspections.push(elem);
+ });
+ this.nextLoading = "fetched";
+ })
+ .catch((err) => {
+ this.nextLoading = "failed";
+ });
+ },
fetchInspectionByActiveId() {
this.loadingActive = "loading";
http
diff --git a/src/viewmodels/admin/unit/inspection/inspection.models.ts b/src/viewmodels/admin/unit/inspection/inspection.models.ts
index 0ffde9c..f2a56d1 100644
--- a/src/viewmodels/admin/unit/inspection/inspection.models.ts
+++ b/src/viewmodels/admin/unit/inspection/inspection.models.ts
@@ -7,18 +7,7 @@ import type {
import type { VehicleViewModel } from "../vehicle/vehicle.models";
import type { WearableViewModel } from "../wearable/wearable.models";
-export type InspectionViewModel = {
- id: string;
- inspectionPlanId: string;
- inspectionPlan: InspectionPlanViewModel;
- inspectionVersionedPlanId: string;
- inspectionVersionedPlan: InspectionVersionedPlanViewModel;
- context: string;
- created: Date;
- finished?: Date;
- isOpen: boolean;
- nextInspection?: Date;
- checks: Array;
+export type InspectionRelated = {
relatedId: string;
} & (
| {
@@ -35,6 +24,41 @@ export type InspectionViewModel = {
}
);
+export type InspectionViewModel = {
+ id: string;
+ inspectionPlanId: string;
+ inspectionPlan: InspectionPlanViewModel;
+ inspectionVersionedPlanId: string;
+ inspectionVersionedPlan: InspectionVersionedPlanViewModel;
+ context: string;
+ created: Date;
+ finished?: Date;
+ isOpen: boolean;
+ nextInspection?: Date;
+ checks: Array;
+ relatedId: string;
+} & InspectionRelated;
+
+export type MinifiedInspectionViewModel = {
+ id: string;
+ inspectionPlanId: string;
+ inspectionPlan: InspectionPlanViewModel;
+ context: string;
+ created: Date;
+ finished?: Date;
+ isOpen: boolean;
+ nextInspection?: Date;
+ relatedId: string;
+} & InspectionRelated;
+
+export type InspectionNextViewModel = {
+ id: string;
+ inspectionPlanId: string;
+ inspectionPlan: InspectionPlanViewModel;
+ dueDate: Date;
+ relatedId: string;
+} & InspectionRelated;
+
export interface InspectionPointResultViewModel {
inspectionId: string;
inspectionPointId: string;
diff --git a/src/views/admin/unit/equipment/Inspection.vue b/src/views/admin/unit/equipment/Inspection.vue
index 16ca4e0..40ff9e9 100644
--- a/src/views/admin/unit/equipment/Inspection.vue
+++ b/src/views/admin/unit/equipment/Inspection.vue
@@ -14,9 +14,9 @@
>
-
{{ row.inspectionPlan.title }} - {{ row.finished }}
+
{{ row.inspectionPlan.title }} - {{ row.finished ?? "in Arbeit" }}
-
+
Kontext: {{ row.context }}
nächste Inspektion: {{ row.nextInspection }}
@@ -30,9 +30,9 @@
button
primary
class="w-fit!"
- @click=""
- >Prüfung durchführen
+ Prüfung durchführen
+
diff --git a/src/views/admin/unit/inspection/InspectionExecute.vue b/src/views/admin/unit/inspection/InspectionExecute.vue
index c12dec8..35072c2 100644
--- a/src/views/admin/unit/inspection/InspectionExecute.vue
+++ b/src/views/admin/unit/inspection/InspectionExecute.vue
@@ -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"
>
+
+
-
+
@@ -69,6 +78,9 @@
+
+
+
diff --git a/src/views/admin/unit/inspection/NextInspection.vue b/src/views/admin/unit/inspection/NextInspection.vue
deleted file mode 100644
index e19eeb4..0000000
--- a/src/views/admin/unit/inspection/NextInspection.vue
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
{}"
- @search="(search) => {}"
- >
-
- {{ row }}
-
-
-
-
-
- Prüfung starten
-
-
-
-
-
-
-
-
diff --git a/src/views/admin/unit/inspection/NextInspections.vue b/src/views/admin/unit/inspection/NextInspections.vue
new file mode 100644
index 0000000..20dabb7
--- /dev/null
+++ b/src/views/admin/unit/inspection/NextInspections.vue
@@ -0,0 +1,69 @@
+
+
+
fetchNextInspections(offset, count, search)"
+ @search="(search) => fetchNextInspections(0, maxEntriesPerPage, search, true)"
+ >
+
+
+
+
+ {{ row.related.name }} ({{ row.related.code }}) -
+ {{ row.inspectionPlan.title }} - {{ row.dueDate ?? "ohne Fälligkeit" }}
+
+
+
+
+
+
+
+
+ Prüfung starten
+
+
+
+
+
+
+
+
diff --git a/src/views/admin/unit/inspection/RunningInspections.vue b/src/views/admin/unit/inspection/RunningInspections.vue
new file mode 100644
index 0000000..2a1bb58
--- /dev/null
+++ b/src/views/admin/unit/inspection/RunningInspections.vue
@@ -0,0 +1,68 @@
+
+
+
fetchRunningInspections(offset, count, search)"
+ @search="(search) => fetchRunningInspections(0, maxEntriesPerPage, search, true)"
+ >
+
+
+
+
+
{{ row.inspectionPlan.title }} - in Arbeit seit {{ row.created }}
+
+
+
Kontext: {{ row.context }}
+
+
+
+
+
+
+
+ Prüfung starten
+
+
+
+
+
+
+
+
diff --git a/src/views/admin/unit/vehicle/Inspection.vue b/src/views/admin/unit/vehicle/Inspection.vue
index c50789a..193c62e 100644
--- a/src/views/admin/unit/vehicle/Inspection.vue
+++ b/src/views/admin/unit/vehicle/Inspection.vue
@@ -14,9 +14,9 @@
>
-
{{ row.inspectionPlan.title }} - {{ row.finished }}
+
{{ row.inspectionPlan.title }} - {{ row.finished ?? "in Arbeit" }}
-
+
Kontext: {{ row.context }}
nächste Inspektion: {{ row.nextInspection }}
@@ -30,9 +30,9 @@
button
primary
class="w-fit!"
- @click=""
- >Prüfung durchführen
+ Prüfung durchführen
+
diff --git a/src/views/admin/unit/wearable/Inspection.vue b/src/views/admin/unit/wearable/Inspection.vue
index a5045c0..d5e54be 100644
--- a/src/views/admin/unit/wearable/Inspection.vue
+++ b/src/views/admin/unit/wearable/Inspection.vue
@@ -14,9 +14,9 @@
>
-
{{ row.inspectionPlan.title }} - {{ row.finished }}
+
{{ row.inspectionPlan.title }} - {{ row.finished ?? "in Arbeit" }}
-
+
Kontext: {{ row.context }}
nächste Inspektion: {{ row.nextInspection }}
@@ -30,9 +30,9 @@
button
primary
class="w-fit!"
- @click=""
- >Prüfung durchführen
+ Prüfung durchführen
+