unit/#103-base-management #110
141 changed files with 3303 additions and 996 deletions
|
@ -24,7 +24,7 @@
|
|||
<script setup lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useModalStore } from "../stores/modal";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import {
|
||||
barcodeFormats,
|
||||
defaultConstraintOptions,
|
||||
|
@ -32,7 +32,7 @@ import {
|
|||
handleScannerError,
|
||||
trackFunctionOptions,
|
||||
type Camera,
|
||||
} from "../helpers/codeScanner";
|
||||
} from "@/helpers/codeScanner";
|
||||
import { QrcodeStream, type DetectedBarcode } from "vue-qrcode-reader";
|
||||
import { XMarkIcon } from "@heroicons/vue/24/outline";
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<template>
|
||||
<div @click="showInfo" class="cursor-pointer">
|
||||
<InformationCircleIcon class="w-5 h-5" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineAsyncComponent, defineComponent, markRaw } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import { InformationCircleIcon } from "@heroicons/vue/24/outline";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
showInfo() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/InspectionTimeFormatExplainModal.vue")))
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,55 @@
|
|||
<template>
|
||||
<div class="relative w-full md:max-w-md">
|
||||
<div class="flex flex-row gap-2 items-center justify-center">
|
||||
<InformationCircleIcon class="text-gray-500 h-5 w-5" />
|
||||
<p class="text-xl font-medium">Zeit Format für Erinnerung und Intervall</p>
|
||||
</div>
|
||||
<br />
|
||||
<table class="min-w-full text-sm border border-gray-200 rounded">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="px-3 py-2 font-mono text-gray-700 border-b border-gray-100"><zahl>-(d|m|y)</td>
|
||||
<td class="px-3 py-2 text-gray-600 border-b border-gray-100">
|
||||
Ein Intervall, z.B. <span class="font-mono">7-d</span> für alle 7 Tage,
|
||||
<span class="font-mono">1-m</span> für jeden Monat.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-3 py-2 font-mono text-gray-700 border-b border-gray-100">DD/MM</td>
|
||||
<td class="px-3 py-2 text-gray-600 border-b border-gray-100">
|
||||
Ein bestimmtes Datum, z.B. <span class="font-mono">15/06</span> für den 15. Juni.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="px-3 py-2 font-mono text-gray-700">DD/*</td>
|
||||
<td class="px-3 py-2 text-gray-600">
|
||||
Ein Tag jeden Monats, z.B. <span class="font-mono">01/*</span> für den ersten Tag jedes Monats.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Im Fall von Erinnerungen wird das Format als zeitliche Angabe vor einem Datum verwendet.</p>
|
||||
<br />
|
||||
|
||||
<div class="flex flex-row justify-end">
|
||||
<div class="flex flex-row gap-4 py-2">
|
||||
<button primary-outline @click="closeModal">schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import { InformationCircleIcon } from "@heroicons/vue/24/outline";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["closeModal"]),
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -16,7 +16,7 @@
|
|||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -40,7 +40,7 @@ import Spinner from "@/components/Spinner.vue";
|
|||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import { useEquipmentTypeStore } from "@/stores/admin/unit/equipmentType/equipmentType";
|
||||
import type { CreateEquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import type { CreateEquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipment/equipmentType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -39,7 +39,7 @@ import Spinner from "@/components/Spinner.vue";
|
|||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import { useEquipmentTypeStore } from "@/stores/admin/unit/equipmentType/equipmentType";
|
||||
import type { CreateEquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import type { CreateEquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipment/equipmentType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -8,6 +8,16 @@
|
|||
{{ equipmentType.type }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col p-2">
|
||||
<div class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Anzahl angelegter Geräte:</p>
|
||||
<p class="grow overflow-hidden">{{ equipmentType.equipmentCount }}</p>
|
||||
</div>
|
||||
<div v-if="equipmentType.description" class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Beschreibung:</p>
|
||||
<p class="grow overflow-hidden">{{ equipmentType.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
|
@ -15,7 +25,7 @@
|
|||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipment/equipmentType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
<template>
|
||||
<div class="w-full md:max-w-md">
|
||||
<div class="flex flex-col items-center">
|
||||
<p class="text-xl font-medium">angefangene Prüfung löschen</p>
|
||||
</div>
|
||||
<br />
|
||||
<p class="text-center">
|
||||
{{ activeInspectionObj?.inspectionPlan.title }} zu {{ activeInspectionObj?.related.name }}
|
||||
<small v-if="activeInspectionObj?.related.code">({{ activeInspectionObj?.related.code }})</small> begonnen am
|
||||
{{ new Date(activeInspectionObj?.created ?? "").toLocaleDateString("de-de") }} löschen?
|
||||
</p>
|
||||
<br />
|
||||
|
||||
<div class="flex flex-row gap-2">
|
||||
<button
|
||||
primary
|
||||
type="submit"
|
||||
:disabled="status == 'loading' || status?.status == 'success'"
|
||||
@click="triggerDelete"
|
||||
>
|
||||
löschen
|
||||
</button>
|
||||
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row justify-end">
|
||||
<div class="flex flex-row gap-4 py-2">
|
||||
<button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
|
||||
abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import Spinner from "@/components/Spinner.vue";
|
||||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||
timeout: undefined as any,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useInspectionStore, ["activeInspectionObj"]),
|
||||
},
|
||||
beforeUnmount() {
|
||||
try {
|
||||
clearTimeout(this.timeout);
|
||||
} catch (error) {}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["closeModal"]),
|
||||
...mapActions(useInspectionStore, ["deleteInspection"]),
|
||||
triggerDelete() {
|
||||
if (!this.activeInspectionObj) return;
|
||||
|
||||
this.status = "loading";
|
||||
this.deleteInspection(this.activeInspectionObj.id)
|
||||
.then(() => {
|
||||
this.status = { status: "success" };
|
||||
this.timeout = setTimeout(() => {
|
||||
this.$router.push({ name: "admin-unit-inspection" });
|
||||
this.closeModal();
|
||||
}, 1500);
|
||||
})
|
||||
.catch(() => {
|
||||
this.status = { status: "failed" };
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
91
src/components/admin/unit/inspection/FileInput.vue
Normal file
91
src/components/admin/unit/inspection/FileInput.vue
Normal file
|
@ -0,0 +1,91 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||
<p>{{ inspectionPoint.title }}</p>
|
||||
<DocumentCheckIcon class="w-5 h-5 cursor-pointer" @click="openDetailView" />
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<p v-if="inspectionPoint.description" class="pb-2">Beschreibung: {{ inspectionPoint.description }}</p>
|
||||
<hr v-if="inspectionPoint.description" />
|
||||
<label :for="inspectionPoint.id">{{ inspectionPoint.others == "pdf" ? "PDF" : "Bild" }}-Datei</label>
|
||||
<button
|
||||
:primary="value != ''"
|
||||
:primary-outline="value == ''"
|
||||
type="button"
|
||||
class="flex flex-row gap-2"
|
||||
@click="($refs.fileInput as HTMLInputElement).click()"
|
||||
:disabled="!editable"
|
||||
>
|
||||
<span v-if="value == ''">Datei wählen</span><span v-else>Datei gewählt</span>
|
||||
<CheckIcon v-if="value != ''" class="h-5 w-5" />
|
||||
</button>
|
||||
<input
|
||||
ref="fileInput"
|
||||
:id="inspectionPoint.id"
|
||||
:name="inspectionPoint.id"
|
||||
type="file"
|
||||
:accept="inspectionPoint.others == 'pdf' ? 'application/pdf' : 'image/*'"
|
||||
hidden
|
||||
@change="selectFile"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineAsyncComponent, defineComponent, markRaw, type PropType } from "vue";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { CheckIcon, DocumentCheckIcon } from "@heroicons/vue/24/outline";
|
||||
import { mapActions } from "pinia";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
inspectionPoint: {
|
||||
type: Object as PropType<InspectionPointViewModel>,
|
||||
required: true,
|
||||
},
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
editable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
emits: {
|
||||
"update:model-value": (p: string) => {
|
||||
return true;
|
||||
},
|
||||
"update:upload": (p: File | null) => {
|
||||
return true;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val: string | number) {
|
||||
this.$emit("update:model-value", val.toString());
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
selectFile(e: Event) {
|
||||
this.$emit("update:upload", (e.target as HTMLInputElement).files?.[0] ?? null);
|
||||
this.value = "set";
|
||||
},
|
||||
openDetailView() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/inspection/UploadedFileViewModal.vue"))),
|
||||
this.inspectionPoint
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,83 @@
|
|||
<template>
|
||||
<div class="relative w-full md:max-w-md">
|
||||
<div class="flex flex-col items-center">
|
||||
<p class="text-xl font-medium">Prüfung abschließen</p>
|
||||
</div>
|
||||
<br />
|
||||
<div class="flex flex-col gap-2">
|
||||
<p class="flex flex-row text-sm">
|
||||
<InformationCircleIcon class="text-gray-500 h-5 w-5" /> Nach abschluss der Prüfung können keine Änderung mehr an
|
||||
dieser vorgenommen werden. <br />
|
||||
Es wird ein PDF ausgedruckt und ist dann zu dieser Prüfung verfügbar.
|
||||
</p>
|
||||
<br />
|
||||
<div class="flex flex-row gap-2">
|
||||
<button :disabled="status == 'loading' || status?.status == 'success'" primary @click="finishInspection">
|
||||
Prüfung abschließen
|
||||
</button>
|
||||
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="flex flex-row justify-end">
|
||||
<div class="flex flex-row gap-4 py-2">
|
||||
<button primary-outline @click="closeModal" :disabled="status == 'loading' || status?.status == 'success'">
|
||||
abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import { InformationCircleIcon } from "@heroicons/vue/24/outline";
|
||||
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
|
||||
import Spinner from "@/components/Spinner.vue";
|
||||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||
timeout: null as any,
|
||||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
try {
|
||||
clearTimeout(this.timeout);
|
||||
} catch (error) {}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["closeModal"]),
|
||||
...mapActions(useInspectionStore, ["finishActiveInspection"]),
|
||||
|
||||
finishInspection(e: any) {
|
||||
this.status = "loading";
|
||||
this.finishActiveInspection()
|
||||
.then(() => {
|
||||
this.status = { status: "success" };
|
||||
this.timeout = setTimeout(() => {
|
||||
this.closeModal();
|
||||
}, 2100);
|
||||
})
|
||||
.catch((err) => {
|
||||
this.status = { status: "failed" };
|
||||
})
|
||||
.finally(() => {
|
||||
this.timeout = setTimeout(() => {
|
||||
this.status = null;
|
||||
}, 2000);
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,62 @@
|
|||
<template>
|
||||
<div class="w-full h-full flex flex-col gap-2">
|
||||
<Spinner v-if="status == 'loading'" />
|
||||
<div class="grow">
|
||||
<iframe ref="viewer" class="w-full h-full" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row gap-2 justify-end">
|
||||
<a ref="download" button primary class="w-fit!">download</a>
|
||||
<button primary-outline class="w-fit!" @click="closeModal">schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import Spinner from "@/components/Spinner.vue";
|
||||
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useModalStore, ["data"]),
|
||||
...mapState(useInspectionStore, ["activeInspectionObj"]),
|
||||
},
|
||||
mounted() {
|
||||
this.fetchItem();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["closeModal"]),
|
||||
...mapActions(useInspectionStore, ["fetchInspectionPrintoutById"]),
|
||||
fetchItem() {
|
||||
this.status = "loading";
|
||||
this.fetchInspectionPrintoutById()
|
||||
.then((response) => {
|
||||
this.status = { status: "success" };
|
||||
const blob = new Blob([response.data], { type: "application/pdf" });
|
||||
(this.$refs.viewer as HTMLIFrameElement).src = window.URL.createObjectURL(blob);
|
||||
|
||||
const fileURL = window.URL.createObjectURL(new Blob([response.data]));
|
||||
const fileLink = this.$refs.download as HTMLAnchorElement;
|
||||
fileLink.href = fileURL;
|
||||
fileLink.setAttribute(
|
||||
"download",
|
||||
`Prüf-Ausdruck_${[this.activeInspectionObj?.related.code ?? "", this.activeInspectionObj?.related.name].join("_")}_${this.activeInspectionObj?.inspectionPlan.title}_${new Date(this.activeInspectionObj?.created ?? "").toLocaleDateString("de-de")}.pdf`
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
this.status = { status: "failed" };
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
80
src/components/admin/unit/inspection/NumberInput.vue
Normal file
80
src/components/admin/unit/inspection/NumberInput.vue
Normal file
|
@ -0,0 +1,80 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||
<p>{{ inspectionPoint.title }}</p>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<p v-if="inspectionPoint.description" class="pb-2">Beschreibung: {{ inspectionPoint.description }}</p>
|
||||
<hr v-if="inspectionPoint.description" />
|
||||
<label :for="inspectionPoint.id">
|
||||
Zahl <small>{{ restrictedRange }}</small>
|
||||
</label>
|
||||
<input
|
||||
:id="inspectionPoint.id"
|
||||
:name="inspectionPoint.id"
|
||||
type="number"
|
||||
v-model="value"
|
||||
:min="inspectionPoint.min"
|
||||
:max="inspectionPoint.max"
|
||||
:class="{ 'ring-red-500! ring-1!': isInRange && editable }"
|
||||
:disabled="!editable"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
inspectionPoint: {
|
||||
type: Object as PropType<InspectionPointViewModel>,
|
||||
required: true,
|
||||
},
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
editable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
emits: ["update:model-value"],
|
||||
computed: {
|
||||
value: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val: string | number) {
|
||||
this.$emit("update:model-value", val.toString());
|
||||
},
|
||||
},
|
||||
restrictedRange() {
|
||||
let range = "";
|
||||
if (this.inspectionPoint.min != null) range += `min. ${this.inspectionPoint.min}`;
|
||||
if (this.inspectionPoint.max != null) range += ` bis max. ${this.inspectionPoint.max}`;
|
||||
return range;
|
||||
},
|
||||
isInRange() {
|
||||
if (this.inspectionPoint.min != null && this.inspectionPoint.max != null)
|
||||
return Number(this.value) < this.inspectionPoint.min || this.inspectionPoint.max < Number(this.value);
|
||||
|
||||
if (this.inspectionPoint.min != null) return Number(this.value) < this.inspectionPoint.min;
|
||||
|
||||
if (this.inspectionPoint.max != null) return this.inspectionPoint.max < Number(this.value);
|
||||
|
||||
return false;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (!this.value) {
|
||||
this.value = String(this.inspectionPoint.min ?? 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -6,18 +6,19 @@
|
|||
<div class="p-2">
|
||||
<p v-if="inspectionPoint.description" class="pb-2">Beschreibung: {{ inspectionPoint.description }}</p>
|
||||
<hr v-if="inspectionPoint.description" />
|
||||
<RadioGroup v-model="value" :name="inspectionPoint.id" class="flex flex-row gap-2">
|
||||
<RadioGroupOption
|
||||
<div class="flex flex-row gap-2">
|
||||
<button
|
||||
v-for="option in options"
|
||||
:key="option.key"
|
||||
button
|
||||
:primary="value == option.key"
|
||||
:primary-outline="value != option.key"
|
||||
:disabled="!editable"
|
||||
:value="option.key"
|
||||
@click="value = option.key"
|
||||
>
|
||||
{{ option.title }}
|
||||
</RadioGroupOption>
|
||||
</RadioGroup>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -25,7 +26,7 @@
|
|||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { RadioGroup, RadioGroupOption } from "@headlessui/vue";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -36,8 +37,12 @@ export default defineComponent({
|
|||
required: true,
|
||||
},
|
||||
modelValue: {
|
||||
type: String as PropType<"true" | "false">,
|
||||
default: "false",
|
||||
type: String as PropType<"true" | "false" | "">,
|
||||
default: "",
|
||||
},
|
||||
editable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
emits: ["update:model-value"],
|
||||
|
@ -46,7 +51,7 @@ export default defineComponent({
|
|||
options: [
|
||||
{ key: "true", title: "OK" },
|
||||
{ key: "false", title: "nicht OK" },
|
||||
],
|
||||
] as Array<{ key: "true" | "false"; title: string }>,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -59,5 +64,8 @@ export default defineComponent({
|
|||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.value == "") this.value = "false";
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -6,23 +6,22 @@
|
|||
<div class="p-2">
|
||||
<p v-if="inspectionPoint.description" class="pb-2">Beschreibung: {{ inspectionPoint.description }}</p>
|
||||
<hr v-if="inspectionPoint.description" />
|
||||
<label :for="inspectionPoint.id">{{ inspectionPoint.type == "number" ? "Zahl" : "Freitext" }}</label>
|
||||
<input
|
||||
v-if="inspectionPoint.type == 'number'"
|
||||
<label :for="inspectionPoint.id">Freitext</label>
|
||||
<textarea
|
||||
:id="inspectionPoint.id"
|
||||
:name="inspectionPoint.id"
|
||||
type="number"
|
||||
required
|
||||
class="h-18"
|
||||
:class="{ 'ring-red-500! ring-1!': value == '' && editable }"
|
||||
v-model="value"
|
||||
/>
|
||||
<textarea v-else :id="inspectionPoint.id" :name="inspectionPoint.id" required class="h-18" v-model="value" />
|
||||
:disabled="!editable"
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -36,6 +35,10 @@ export default defineComponent({
|
|||
type: String,
|
||||
default: "",
|
||||
},
|
||||
editable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
emits: ["update:model-value"],
|
||||
computed: {
|
|
@ -0,0 +1,63 @@
|
|||
<template>
|
||||
<div class="w-full h-full flex flex-col gap-2">
|
||||
<Spinner v-if="status == 'loading'" />
|
||||
<div class="grow">
|
||||
<iframe v-if="data.others == 'pdf'" ref="viewer" class="w-full h-full" />
|
||||
<img v-else ref="viewer" class="w-full h-full object-contain" />
|
||||
</div>
|
||||
|
||||
<div class="flex flex-row gap-2 justify-end">
|
||||
<a ref="download" button primary class="w-fit!">download</a>
|
||||
<button primary-outline class="w-fit!" @click="closeModal">schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
import Spinner from "@/components/Spinner.vue";
|
||||
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
data() {
|
||||
return {
|
||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useModalStore, ["data"]),
|
||||
...mapState(useInspectionStore, ["activeInspectionObj"]),
|
||||
},
|
||||
mounted() {
|
||||
this.fetchItem();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["closeModal"]),
|
||||
...mapActions(useInspectionStore, ["fetchUploadedFileByPointId"]),
|
||||
fetchItem() {
|
||||
this.status = "loading";
|
||||
this.fetchUploadedFileByPointId(this.data.id)
|
||||
.then((response) => {
|
||||
this.status = { status: "success" };
|
||||
const blob = new Blob([response.data], { type: this.data.others == "pdf" ? "application/pdf" : "image/png" });
|
||||
(this.$refs.viewer as HTMLIFrameElement).src = window.URL.createObjectURL(blob);
|
||||
|
||||
const fileURL = window.URL.createObjectURL(new Blob([response.data]));
|
||||
const fileLink = this.$refs.download as HTMLAnchorElement;
|
||||
fileLink.href = fileURL;
|
||||
fileLink.setAttribute(
|
||||
"download",
|
||||
this.data.others == "pdf" ? `${this.data.title}.pdf` : `${this.data.title}.png`
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
this.status = { status: "failed" };
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -16,7 +16,7 @@
|
|||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center gap-2">
|
||||
<ClipboardDocumentCheckIcon v-if="modelValue.type == InspectionPointEnum.oknok" class="w-6 h-6" />
|
||||
<CalculatorIcon v-else-if="modelValue.type == InspectionPointEnum.number" class="w-6 h-6" />
|
||||
<BoldIcon v-else-if="modelValue.type == InspectionPointEnum.text" class="w-6 h-6" />
|
||||
<DocumentIcon v-else-if="modelValue.type == InspectionPointEnum.file" class="w-6 h-6" />
|
||||
|
||||
<input type="text" placeholder="Titel" class="grow !w-fit" v-model="title" required />
|
||||
|
||||
<div class="flex flex-col">
|
||||
<ChevronUpIcon v-if="index != 0" class="text-white w-4 h-4 stroke-2 cursor-pointer" @click="$emit('up')" />
|
||||
<ChevronDownIcon
|
||||
v-if="index != totalCount - 1"
|
||||
class="text-white w-4 h-4 stroke-2 cursor-pointer"
|
||||
@click="$emit('down')"
|
||||
/>
|
||||
</div>
|
||||
<TrashIcon class="h-5 w-5 cursor-pointer" @click="$emit('remove')" />
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<textarea name="description" placeholder="Beschreibung" v-model="description"></textarea>
|
||||
<div v-if="modelValue.type == InspectionPointEnum.number">
|
||||
<label for="min">Mindestens</label>
|
||||
<input type="number" v-model="min" min="0" />
|
||||
</div>
|
||||
<div v-if="modelValue.type == InspectionPointEnum.number">
|
||||
<label for="max">Maximal</label>
|
||||
<input type="number" v-model="max" :min="Number(min ?? 0) + 1" />
|
||||
</div>
|
||||
<div v-if="modelValue.type == InspectionPointEnum.file">
|
||||
<p>Dateiart</p>
|
||||
<div class="flex flex-row gap-2">
|
||||
<button :primary="others == 'img'" :primary-outline="others != 'img'" type="button" @click="others = 'img'">
|
||||
Bild
|
||||
</button>
|
||||
<button :primary="others == 'pdf'" :primary-outline="others != 'pdf'" type="button" @click="others = 'pdf'">
|
||||
PDF
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { InspectionPointEnum } from "@/enums/inspectionEnum";
|
||||
import {
|
||||
BoldIcon,
|
||||
CalculatorIcon,
|
||||
ClipboardDocumentCheckIcon,
|
||||
TrashIcon,
|
||||
ChevronUpIcon,
|
||||
ChevronDownIcon,
|
||||
DocumentIcon,
|
||||
} from "@heroicons/vue/24/outline";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
index: { type: Number, default: 0 },
|
||||
totalCount: { type: Number, default: 0 },
|
||||
modelValue: {
|
||||
type: Object as PropType<InspectionPointViewModel>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: ["up", "down", "remove", "update:model-value"],
|
||||
computed: {
|
||||
title: {
|
||||
get() {
|
||||
return this.modelValue.title;
|
||||
},
|
||||
set(val: string) {
|
||||
this.$emit("update:model-value", { ...this.modelValue, title: val });
|
||||
},
|
||||
},
|
||||
description: {
|
||||
get() {
|
||||
return this.modelValue.description;
|
||||
},
|
||||
set(val: string) {
|
||||
this.$emit("update:model-value", { ...this.modelValue, description: val });
|
||||
},
|
||||
},
|
||||
min: {
|
||||
get() {
|
||||
return this.modelValue.min;
|
||||
},
|
||||
set(val: string) {
|
||||
this.$emit("update:model-value", { ...this.modelValue, min: String(val) == "" ? null : String(val) });
|
||||
},
|
||||
},
|
||||
max: {
|
||||
get() {
|
||||
return this.modelValue.max;
|
||||
},
|
||||
set(val: string) {
|
||||
this.$emit("update:model-value", { ...this.modelValue, max: String(val) == "" ? null : String(val) });
|
||||
},
|
||||
},
|
||||
others: {
|
||||
get() {
|
||||
return this.modelValue.others;
|
||||
},
|
||||
set(val: string) {
|
||||
this.$emit("update:model-value", { ...this.modelValue, others: val == "" ? null : val });
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.modelValue.type == InspectionPointEnum.file && !this.others) {
|
||||
this.others = "img";
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -1,17 +1,20 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-unit-inspection_plan-overview', params: { inspectionPlanId: inspectionPlan.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 justify-between items-center">
|
||||
<p>{{ inspectionPlan.title }}</p>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<p>Interval: {{ inspectionPlan.inspectionInterval }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||
<p>
|
||||
{{ damageReport.related.name }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<p v-if="damageReport.related">Code: {{ damageReport.related.code }}</p>
|
||||
<p v-if="damageReport.description">Beschreibung: {{ damageReport.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
damageReport: { type: Object as PropType<DamageReportViewModel>, default: {} },
|
||||
},
|
||||
computed: {
|
||||
...mapState(useAbilityStore, ["can"]),
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -18,7 +18,7 @@
|
|||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { RespiratoryGearViewModel } from "@/viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
||||
import type { RespiratoryGearViewModel } from "@/viewmodels/admin/unit/respiratory/respiratoryGear.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { RespiratoryMissionViewModel } from "@/viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
||||
import type { RespiratoryMissionViewModel } from "@/viewmodels/admin/unit/respiratory/respiratoryMission.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { RespiratoryWearerViewModel } from "@/viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
||||
import type { RespiratoryWearerViewModel } from "@/viewmodels/admin/unit/respiratory/respiratoryWearer.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||
<p>{{ vehicle.name }}</p>
|
||||
</div>
|
||||
<div class="p-2">
|
||||
<p v-if="vehicle.code">Code: {{ vehicle.code }}</p>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import Spinner from "@/components/Spinner.vue";
|
|||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import { useVehicleTypeStore } from "@/stores/admin/unit/vehicleType/vehicleType";
|
||||
import type { CreateVehicleTypeViewModel } from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
import type { CreateVehicleTypeViewModel } from "@/viewmodels/admin/unit/vehicle/vehicleType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -8,6 +8,16 @@
|
|||
{{ vehicleType.type }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col p-2">
|
||||
<div class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Anzahl angelegter Fahrzeuge:</p>
|
||||
<p class="grow overflow-hidden">{{ vehicleType.vehicleCount }}</p>
|
||||
</div>
|
||||
<div v-if="vehicleType.description" class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Beschreibung:</p>
|
||||
<p class="grow overflow-hidden">{{ vehicleType.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
|
@ -15,7 +25,7 @@
|
|||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { VehicleTypeViewModel } from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
import type { VehicleTypeViewModel } from "@/viewmodels/admin/unit/vehicle/vehicleType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -40,7 +40,7 @@ import Spinner from "@/components/Spinner.vue";
|
|||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import { useWearableTypeStore } from "@/stores/admin/unit/wearableType/wearableType";
|
||||
import type { CreateWearableTypeViewModel } from "@/viewmodels/admin/unit/wearableType/wearableType.models";
|
||||
import type { CreateWearableTypeViewModel } from "@/viewmodels/admin/unit/wearable/wearableType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -39,7 +39,7 @@ import Spinner from "@/components/Spinner.vue";
|
|||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import { useWearableTypeStore } from "@/stores/admin/unit/wearableType/wearableType";
|
||||
import type { CreateWearableTypeViewModel } from "@/viewmodels/admin/unit/wearableType/wearableType.models";
|
||||
import type { CreateWearableTypeViewModel } from "@/viewmodels/admin/unit/wearable/wearableType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
|
@ -1,18 +1,33 @@
|
|||
<template>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-unit-wearable_type-overview', params: { wearableTypeId: wearableType.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 justify-between items-center">
|
||||
<p>
|
||||
{{ wearableType.type }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col p-2">
|
||||
<div class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Anzahl angelegter Kleidung:</p>
|
||||
<p class="grow overflow-hidden">{{ wearableType.wearableCount }}</p>
|
||||
</div>
|
||||
<div v-if="wearableType.description" class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Beschreibung:</p>
|
||||
<p class="grow overflow-hidden">{{ wearableType.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { defineAsyncComponent, defineComponent, markRaw, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import { PencilIcon, TrashIcon } from "@heroicons/vue/24/outline";
|
||||
import { useAbilityStore } from "@/stores/ability";
|
||||
import type { WearableTypeViewModel } from "@/viewmodels/admin/unit/wearableType/wearableType.models";
|
||||
import type { WearableTypeViewModel } from "@/viewmodels/admin/unit/wearable/wearableType.models";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -23,5 +38,14 @@ export default defineComponent({
|
|||
computed: {
|
||||
...mapState(useAbilityStore, ["can"]),
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
openDeleteModal() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/wearableType/DeleteWearableTypeModal.vue"))),
|
||||
this.wearableType.id
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
@ -32,12 +32,12 @@
|
|||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0 && query == ''" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="equipment in filtered"
|
||||
v-for="equipment in available"
|
||||
as="template"
|
||||
:key="equipment.id"
|
||||
:value="equipment.id"
|
||||
|
@ -59,7 +59,7 @@
|
|||
}"
|
||||
>
|
||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||
{{ equipment.name }}
|
||||
{{ equipment.name }}<span v-if="equipment.code"> - Code: {{ equipment.code }}</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="selected"
|
||||
|
@ -137,11 +137,15 @@ export default defineComponent({
|
|||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<EquipmentViewModel>,
|
||||
filtered: [] as Array<EquipmentViewModel>,
|
||||
chosen: undefined as undefined | EquipmentViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
|
@ -154,10 +158,22 @@ export default defineComponent({
|
|||
},
|
||||
mounted() {
|
||||
this.loadEquipmentInitial();
|
||||
this.preloadAll();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useEquipmentStore, ["searchEquipments", "fetchEquipmentById"]),
|
||||
...mapActions(useEquipmentStore, ["searchEquipments", "fetchEquipmentById", "getAllEquipments"]),
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
preloadAll() {
|
||||
this.loading = true;
|
||||
this.getAllEquipments()
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "") return;
|
||||
|
@ -172,7 +188,7 @@ export default defineComponent({
|
|||
});
|
||||
},
|
||||
getEquipmentFromSearch(id: string) {
|
||||
return this.filtered.find((f) => f.id == id);
|
||||
return this.available.find((f) => f.id == id);
|
||||
},
|
||||
loadEquipmentInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
@ -26,12 +26,12 @@
|
|||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0 && query == ''" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="equipmentType in filtered"
|
||||
v-for="equipmentType in available"
|
||||
as="template"
|
||||
:key="equipmentType.id"
|
||||
:value="equipmentType.id"
|
||||
|
@ -86,7 +86,7 @@ import {
|
|||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import Spinner from "../Spinner.vue";
|
||||
import { useEquipmentTypeStore } from "@/stores/admin/unit/equipmentType/equipmentType";
|
||||
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipment/equipmentType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -125,11 +125,15 @@ export default defineComponent({
|
|||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<EquipmentTypeViewModel>,
|
||||
filtered: [] as Array<EquipmentTypeViewModel>,
|
||||
chosen: undefined as undefined | EquipmentTypeViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
|
@ -142,9 +146,21 @@ export default defineComponent({
|
|||
},
|
||||
mounted() {
|
||||
this.loadEquipmentTypeInitial();
|
||||
this.preloadAll();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useEquipmentTypeStore, ["searchEquipmentTypes", "fetchEquipmentTypeById"]),
|
||||
...mapActions(useEquipmentTypeStore, ["searchEquipmentTypes", "fetchEquipmentTypeById", "getAllEquipmentTypes"]),
|
||||
preloadAll() {
|
||||
this.loading = true;
|
||||
this.getAllEquipmentTypes()
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "") return;
|
||||
|
@ -159,7 +175,7 @@ export default defineComponent({
|
|||
});
|
||||
},
|
||||
getEquipmentTypeFromSearch(id: string) {
|
||||
return this.filtered.find((f) => f.id == id);
|
||||
return this.available.find((f) => f.id == id);
|
||||
},
|
||||
loadEquipmentTypeInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
@ -26,12 +26,12 @@
|
|||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0 && query == ''" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="inspectionPlan in filtered"
|
||||
v-for="inspectionPlan in available"
|
||||
as="template"
|
||||
:key="inspectionPlan.id"
|
||||
:value="inspectionPlan.id"
|
||||
|
@ -86,7 +86,7 @@ import {
|
|||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import Spinner from "../Spinner.vue";
|
||||
import { useInspectionPlanStore } from "@/stores/admin/unit/inspectionPlan/inspectionPlan";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -101,10 +101,6 @@ export default defineComponent({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
type: {
|
||||
type: String as PropType<"vehicle" | "equipment">,
|
||||
default: "equipment",
|
||||
},
|
||||
},
|
||||
emits: ["update:model-value"],
|
||||
watch: {
|
||||
|
@ -129,11 +125,15 @@ export default defineComponent({
|
|||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<InspectionPlanViewModel>,
|
||||
filtered: [] as Array<InspectionPlanViewModel>,
|
||||
chosen: undefined as undefined | InspectionPlanViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
|
@ -146,9 +146,25 @@ export default defineComponent({
|
|||
},
|
||||
mounted() {
|
||||
this.loadInspectionPlanInitial();
|
||||
this.preloadAll();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useInspectionPlanStore, ["searchInspectionPlans", "fetchInspectionPlanById"]),
|
||||
...mapActions(useInspectionPlanStore, [
|
||||
"searchInspectionPlans",
|
||||
"fetchInspectionPlanById",
|
||||
"getAllInspectionPlans",
|
||||
]),
|
||||
preloadAll() {
|
||||
this.loading = true;
|
||||
this.getAllInspectionPlans()
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "") return;
|
||||
|
@ -163,7 +179,7 @@ export default defineComponent({
|
|||
});
|
||||
},
|
||||
getInspectionPlanFromSearch(id: string) {
|
||||
return this.filtered.find((f) => f.id == id);
|
||||
return this.available.find((f) => f.id == id);
|
||||
},
|
||||
loadInspectionPlanInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
|
|
215
src/components/search/InspectionPlanSearchSelectWithRelated.vue
Normal file
215
src/components/search/InspectionPlanSearchSelectWithRelated.vue
Normal file
|
@ -0,0 +1,215 @@
|
|||
<template>
|
||||
<div class="w-full">
|
||||
<Combobox v-model="selected" :disabled="disabled">
|
||||
<ComboboxLabel>{{ title }}</ComboboxLabel>
|
||||
<div class="relative mt-1">
|
||||
<ComboboxInput
|
||||
class="rounded-md shadow-xs relative block w-full px-3 py-2 border border-gray-300 focus:border-primary placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-hidden focus:ring-0 focus:z-10 sm:text-sm resize-none"
|
||||
:displayValue="() => chosen?.title ?? ''"
|
||||
@input="query = $event.target.value"
|
||||
/>
|
||||
<ComboboxButton class="absolute inset-y-0 right-0 flex items-center pr-2">
|
||||
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||
</ComboboxButton>
|
||||
<TransitionRoot
|
||||
leave="transition ease-in duration-100"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0"
|
||||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<Spinner />
|
||||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="available.length === 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="inspectionPlan in available"
|
||||
as="template"
|
||||
:key="inspectionPlan.id"
|
||||
:value="inspectionPlan.id"
|
||||
v-slot="{ selected, active }"
|
||||
>
|
||||
<li
|
||||
class="relative cursor-default select-none py-2 pl-10 pr-4"
|
||||
:class="{
|
||||
'bg-primary text-white': active,
|
||||
'text-gray-900': !active,
|
||||
}"
|
||||
>
|
||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||
{{ inspectionPlan.title }}
|
||||
</span>
|
||||
<span
|
||||
v-if="selected"
|
||||
class="absolute inset-y-0 left-0 flex items-center pl-3"
|
||||
:class="{ 'text-white': active, 'text-primary': !active }"
|
||||
>
|
||||
<CheckIcon class="h-5 w-5" aria-hidden="true" />
|
||||
</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
</ComboboxOptions>
|
||||
</TransitionRoot>
|
||||
</div>
|
||||
</Combobox>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxLabel,
|
||||
ComboboxInput,
|
||||
ComboboxButton,
|
||||
ComboboxOptions,
|
||||
ComboboxOption,
|
||||
TransitionRoot,
|
||||
} from "@headlessui/vue";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import Spinner from "../Spinner.vue";
|
||||
import { useInspectionPlanStore } from "@/stores/admin/unit/inspectionPlan/inspectionPlan";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
title: String,
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
relatedType: {
|
||||
type: String as PropType<"vehicleType" | "equipmentType" | "wearableType">,
|
||||
default: "equipmentType",
|
||||
},
|
||||
relatedTypeId: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: ["update:model-value"],
|
||||
watch: {
|
||||
modelValue() {
|
||||
if (this.initialLoaded) return;
|
||||
this.initialLoaded = true;
|
||||
this.loadInspectionPlanInitial();
|
||||
},
|
||||
relatedType() {
|
||||
this.reload();
|
||||
},
|
||||
relatedTypeId() {
|
||||
this.reload();
|
||||
},
|
||||
query() {
|
||||
this.deferingSearch = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.deferingSearch = false;
|
||||
this.search();
|
||||
}, 600);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
initialLoaded: false as boolean,
|
||||
loading: false as boolean,
|
||||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<InspectionPlanViewModel>,
|
||||
filtered: [] as Array<InspectionPlanViewModel>,
|
||||
chosen: undefined as undefined | InspectionPlanViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val: string) {
|
||||
this.chosen = this.getInspectionPlanFromSearch(val);
|
||||
this.$emit("update:model-value", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.reload();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useInspectionPlanStore, [
|
||||
"fetchInspectionPlanById",
|
||||
"getAllInspectionPlansWithRelated",
|
||||
"searchInspectionPlansWithRelated",
|
||||
]),
|
||||
reload() {
|
||||
this.chosen = undefined;
|
||||
this.filtered = [];
|
||||
this.preloadAll();
|
||||
this.loadInspectionPlanInitial();
|
||||
},
|
||||
preloadAll() {
|
||||
this.all = [];
|
||||
if (this.relatedTypeId == "") return;
|
||||
this.loading = true;
|
||||
this.getAllInspectionPlansWithRelated(this.relatedType, this.relatedTypeId)
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "" || this.relatedTypeId == "") return;
|
||||
this.loading = true;
|
||||
this.searchInspectionPlansWithRelated(this.relatedType, this.relatedTypeId, this.query)
|
||||
.then((res) => {
|
||||
this.filtered = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
getInspectionPlanFromSearch(id: string) {
|
||||
return this.available.find((f) => f.id == id);
|
||||
},
|
||||
loadInspectionPlanInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
this.fetchInspectionPlanById(this.modelValue)
|
||||
.then((res) => {
|
||||
this.chosen = res.data;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -18,7 +18,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
@ -105,7 +105,7 @@ export default defineComponent({
|
|||
emits: ["update:model-value"],
|
||||
watch: {
|
||||
modelValue() {
|
||||
if (this.initialLoaded) return;
|
||||
//if (this.initialLoaded) return;
|
||||
this.initialLoaded = true;
|
||||
this.loadMemberInitial();
|
||||
},
|
||||
|
@ -162,7 +162,7 @@ export default defineComponent({
|
|||
return this.filtered.find((f) => f.id == id);
|
||||
},
|
||||
loadMemberInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
if (this.modelValue == "" || this.modelValue == null) return;
|
||||
this.fetchMemberById(this.modelValue)
|
||||
.then((res) => {
|
||||
this.chosen = res.data;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
@ -32,12 +32,12 @@
|
|||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0 && query == ''" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="vehicle in filtered"
|
||||
v-for="vehicle in available"
|
||||
as="template"
|
||||
:key="vehicle.id"
|
||||
:value="vehicle.id"
|
||||
|
@ -59,7 +59,7 @@
|
|||
}"
|
||||
>
|
||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||
{{ vehicle.name }}
|
||||
{{ vehicle.name }}<span v-if="vehicle.code"> - Code: {{ vehicle.code }}</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="selected"
|
||||
|
@ -137,11 +137,15 @@ export default defineComponent({
|
|||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<VehicleViewModel>,
|
||||
filtered: [] as Array<VehicleViewModel>,
|
||||
chosen: undefined as undefined | VehicleViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
|
@ -154,10 +158,22 @@ export default defineComponent({
|
|||
},
|
||||
mounted() {
|
||||
this.loadVehicleInitial();
|
||||
this.preloadAll();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useVehicleStore, ["searchVehicles", "fetchVehicleById"]),
|
||||
...mapActions(useVehicleStore, ["searchVehicles", "fetchVehicleById", "getAllVehicles"]),
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
preloadAll() {
|
||||
this.loading = true;
|
||||
this.getAllVehicles()
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "") return;
|
||||
|
@ -172,7 +188,7 @@ export default defineComponent({
|
|||
});
|
||||
},
|
||||
getVehicleFromSearch(id: string) {
|
||||
return this.filtered.find((f) => f.id == id);
|
||||
return this.available.find((f) => f.id == id);
|
||||
},
|
||||
loadVehicleInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
@ -26,12 +26,12 @@
|
|||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0 && query == ''" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="vehicleType in filtered"
|
||||
v-for="vehicleType in available"
|
||||
as="template"
|
||||
:key="vehicleType.id"
|
||||
:value="vehicleType.id"
|
||||
|
@ -86,7 +86,7 @@ import {
|
|||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import Spinner from "../Spinner.vue";
|
||||
import { useVehicleTypeStore } from "@/stores/admin/unit/vehicleType/vehicleType";
|
||||
import type { VehicleTypeViewModel } from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
import type { VehicleTypeViewModel } from "@/viewmodels/admin/unit/vehicle/vehicleType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -125,11 +125,15 @@ export default defineComponent({
|
|||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<VehicleTypeViewModel>,
|
||||
filtered: [] as Array<VehicleTypeViewModel>,
|
||||
chosen: undefined as undefined | VehicleTypeViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
|
@ -142,9 +146,21 @@ export default defineComponent({
|
|||
},
|
||||
mounted() {
|
||||
this.loadVehicleTypeInitial();
|
||||
this.preloadAll();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useVehicleTypeStore, ["searchVehicleTypes", "fetchVehicleTypeById"]),
|
||||
...mapActions(useVehicleTypeStore, ["searchVehicleTypes", "fetchVehicleTypeById", "getAllVehicleTypes"]),
|
||||
preloadAll() {
|
||||
this.loading = true;
|
||||
this.getAllVehicleTypes()
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "") return;
|
||||
|
@ -159,7 +175,7 @@ export default defineComponent({
|
|||
});
|
||||
},
|
||||
getVehicleTypeFromSearch(id: string) {
|
||||
return this.filtered.find((f) => f.id == id);
|
||||
return this.available.find((f) => f.id == id);
|
||||
},
|
||||
loadVehicleTypeInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
|
|
212
src/components/search/WearableSearchSelect.vue
Normal file
212
src/components/search/WearableSearchSelect.vue
Normal file
|
@ -0,0 +1,212 @@
|
|||
<template>
|
||||
<div class="w-full">
|
||||
<Combobox v-model="selected" :disabled="disabled">
|
||||
<ComboboxLabel>{{ title }}</ComboboxLabel>
|
||||
<div class="relative mt-1">
|
||||
<ComboboxInput
|
||||
class="rounded-md shadow-xs relative block w-full px-3 py-2 border border-gray-300 focus:border-primary placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-hidden focus:ring-0 focus:z-10 sm:text-sm resize-none"
|
||||
:class="useScanner ? 'pl-9!' : ''"
|
||||
:displayValue="() => chosen?.name ?? ''"
|
||||
@input="query = $event.target.value"
|
||||
/>
|
||||
<QrCodeIcon
|
||||
v-if="useScanner"
|
||||
class="absolute h-6 stroke-1 left-2 top-1/2 -translate-y-1/2 cursor-pointer z-10"
|
||||
@click="scanCode"
|
||||
/>
|
||||
<ComboboxButton class="absolute inset-y-0 right-0 flex items-center pr-2">
|
||||
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
|
||||
</ComboboxButton>
|
||||
<TransitionRoot
|
||||
leave="transition ease-in duration-100"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0"
|
||||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<Spinner />
|
||||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="available.length === 0 && all.length == 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="wearable in available"
|
||||
as="template"
|
||||
:key="wearable.id"
|
||||
:value="wearable.id"
|
||||
v-slot="{ selected, active }"
|
||||
>
|
||||
<li
|
||||
class="relative cursor-default select-none py-2 pl-10 pr-4"
|
||||
:class="{
|
||||
'bg-primary text-white': active,
|
||||
'text-gray-900': !active,
|
||||
}"
|
||||
>
|
||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||
{{ wearable.name }}<span v-if="wearable.code"> - Code: {{ wearable.code }}</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="selected"
|
||||
class="absolute inset-y-0 left-0 flex items-center pl-3"
|
||||
:class="{ 'text-white': active, 'text-primary': !active }"
|
||||
>
|
||||
<CheckIcon class="h-5 w-5" aria-hidden="true" />
|
||||
</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
</ComboboxOptions>
|
||||
</TransitionRoot>
|
||||
</div>
|
||||
</Combobox>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineAsyncComponent, defineComponent, markRaw, type Prop } from "vue";
|
||||
import { mapState, mapActions } from "pinia";
|
||||
import {
|
||||
Combobox,
|
||||
ComboboxLabel,
|
||||
ComboboxInput,
|
||||
ComboboxButton,
|
||||
ComboboxOptions,
|
||||
ComboboxOption,
|
||||
TransitionRoot,
|
||||
} from "@headlessui/vue";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import Spinner from "../Spinner.vue";
|
||||
import { useWearableStore } from "@/stores/admin/unit/wearable/wearable";
|
||||
import type { WearableViewModel } from "@/viewmodels/admin/unit/wearable/wearable.models";
|
||||
import { QrCodeIcon } from "@heroicons/vue/24/outline";
|
||||
import { useModalStore } from "@/stores/modal";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
modelValue: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
title: String,
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
useScanner: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
emits: ["update:model-value"],
|
||||
watch: {
|
||||
modelValue() {
|
||||
if (this.initialLoaded) return;
|
||||
this.initialLoaded = true;
|
||||
this.loadWearableInitial();
|
||||
},
|
||||
query() {
|
||||
this.deferingSearch = true;
|
||||
clearTimeout(this.timer);
|
||||
this.timer = setTimeout(() => {
|
||||
this.deferingSearch = false;
|
||||
this.search();
|
||||
}, 600);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
initialLoaded: false as boolean,
|
||||
loading: false as boolean,
|
||||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<WearableViewModel>,
|
||||
filtered: [] as Array<WearableViewModel>,
|
||||
chosen: undefined as undefined | WearableViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
},
|
||||
set(val: string) {
|
||||
this.chosen = this.getWearableFromSearch(val);
|
||||
this.$emit("update:model-value", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.loadWearableInitial();
|
||||
this.preloadAll();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useWearableStore, ["searchWearables", "fetchWearableById", "getAllWearables"]),
|
||||
...mapActions(useModalStore, ["openModal"]),
|
||||
preloadAll() {
|
||||
this.loading = true;
|
||||
this.getAllWearables()
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "") return;
|
||||
this.loading = true;
|
||||
this.searchWearables(this.query)
|
||||
.then((res) => {
|
||||
this.filtered = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
getWearableFromSearch(id: string) {
|
||||
return this.all.find((f) => f.id == id);
|
||||
},
|
||||
loadWearableInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
this.fetchWearableById(this.modelValue)
|
||||
.then((res) => {
|
||||
this.chosen = res.data;
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
scanCode() {
|
||||
this.openModal(
|
||||
markRaw(defineAsyncComponent(() => import("@/components/CodeDetector.vue"))),
|
||||
"codeScanInput",
|
||||
(result: string) => {
|
||||
this.getWearableFromSearch(result);
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -18,7 +18,7 @@
|
|||
@after-leave="query = ''"
|
||||
>
|
||||
<ComboboxOptions
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-10"
|
||||
class="absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-md ring-1 ring-black/5 focus:outline-hidden sm:text-sm z-20"
|
||||
>
|
||||
<ComboboxOption v-if="loading || deferingSearch" as="template" disabled>
|
||||
<li class="flex flex-row gap-2 text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
|
@ -26,12 +26,12 @@
|
|||
<span class="font-normal block truncate">suche</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0 && query == ''" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0 && all.length == 0" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">tippe, um zu suchen...</span>
|
||||
</li>
|
||||
</ComboboxOption>
|
||||
<ComboboxOption v-else-if="filtered.length === 0" as="template" disabled>
|
||||
<ComboboxOption v-else-if="available.length === 0 && query != ''" as="template" disabled>
|
||||
<li class="text-text relative cursor-default select-none py-2 pl-3 pr-4">
|
||||
<span class="font-normal block truncate">Keine Auswahl gefunden.</span>
|
||||
</li>
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
<ComboboxOption
|
||||
v-if="!(loading || deferingSearch)"
|
||||
v-for="wearableType in filtered"
|
||||
v-for="wearableType in available"
|
||||
as="template"
|
||||
:key="wearableType.id"
|
||||
:value="wearableType.id"
|
||||
|
@ -86,7 +86,7 @@ import {
|
|||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
|
||||
import Spinner from "../Spinner.vue";
|
||||
import { useWearableTypeStore } from "@/stores/admin/unit/wearableType/wearableType";
|
||||
import type { WearableTypeViewModel } from "@/viewmodels/admin/unit/wearableType/wearableType.models";
|
||||
import type { WearableTypeViewModel } from "@/viewmodels/admin/unit/wearable/wearableType.models";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
@ -125,11 +125,15 @@ export default defineComponent({
|
|||
deferingSearch: false as boolean,
|
||||
timer: undefined as any,
|
||||
query: "" as string,
|
||||
all: [] as Array<WearableTypeViewModel>,
|
||||
filtered: [] as Array<WearableTypeViewModel>,
|
||||
chosen: undefined as undefined | WearableTypeViewModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
available() {
|
||||
return this.query == "" ? this.all : this.filtered;
|
||||
},
|
||||
selected: {
|
||||
get() {
|
||||
return this.modelValue;
|
||||
|
@ -142,9 +146,21 @@ export default defineComponent({
|
|||
},
|
||||
mounted() {
|
||||
this.loadWearableTypeInitial();
|
||||
this.preloadAll();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useWearableTypeStore, ["searchWearableTypes", "fetchWearableTypeById"]),
|
||||
...mapActions(useWearableTypeStore, ["searchWearableTypes", "fetchWearableTypeById", "getAllWearableTypes"]),
|
||||
preloadAll() {
|
||||
this.loading = true;
|
||||
this.getAllWearableTypes()
|
||||
.then((res) => {
|
||||
this.all = res.data;
|
||||
})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
search() {
|
||||
this.filtered = [];
|
||||
if (this.query == "") return;
|
||||
|
@ -159,7 +175,7 @@ export default defineComponent({
|
|||
});
|
||||
},
|
||||
getWearableTypeFromSearch(id: string) {
|
||||
return this.filtered.find((f) => f.id == id);
|
||||
return this.all.find((f) => f.id == id);
|
||||
},
|
||||
loadWearableTypeInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { equipmentDemoData } from "./equipment";
|
||||
|
||||
export const damageReportDemoData: Array<DamageReportViewModel> = [
|
||||
{
|
||||
id: "sdfgh",
|
||||
reported: new Date(),
|
||||
status: "in Arbeit",
|
||||
done: false,
|
||||
description: "knjgljna g",
|
||||
providedImage: [],
|
||||
relatedId: "abc",
|
||||
related: {
|
||||
id: "abc",
|
||||
code: "0456984224498",
|
||||
name: "B-Schlauch",
|
||||
location: "HLF",
|
||||
commissioned: new Date(),
|
||||
equipmentTypeId: "xyz",
|
||||
equipmentType: {
|
||||
id: "xyz",
|
||||
type: "B-Schlauch",
|
||||
description: "Shläuche vom Typ B",
|
||||
inspectionPlans: [],
|
||||
},
|
||||
inspections: [],
|
||||
},
|
||||
assigned: "equipment",
|
||||
},
|
||||
];
|
|
@ -1,17 +0,0 @@
|
|||
import type { EquipmentViewModel } from "@/viewmodels/admin/unit/equipment/equipment.models";
|
||||
import { equipmentTypeDemoData } from "./equipmentType";
|
||||
import { inspectionDemoData } from "./inspectionPlan";
|
||||
|
||||
export const equipmentDemoData: Array<EquipmentViewModel> = [
|
||||
{
|
||||
id: "abc",
|
||||
code: "0456984224498",
|
||||
name: "B-Schlauch",
|
||||
location: "HLF",
|
||||
commissioned: new Date(),
|
||||
decommissioned: undefined,
|
||||
equipmentTypeId: equipmentTypeDemoData[0].id,
|
||||
equipmentType: equipmentTypeDemoData[0],
|
||||
inspections: [inspectionDemoData[0]],
|
||||
},
|
||||
];
|
|
@ -1,11 +0,0 @@
|
|||
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import { inspectionPlanDemoData } from "./inspectionPlan";
|
||||
|
||||
export const equipmentTypeDemoData: Array<EquipmentTypeViewModel> = [
|
||||
{
|
||||
id: "xyz",
|
||||
type: "B-Schlauch",
|
||||
description: "Shläuche vom Typ B",
|
||||
inspectionPlans: [inspectionPlanDemoData[0], inspectionPlanDemoData[1]],
|
||||
},
|
||||
];
|
|
@ -1,156 +0,0 @@
|
|||
import type {
|
||||
InspectionPlanViewModel,
|
||||
InspectionPointViewModel,
|
||||
} from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import type {
|
||||
InspectionPointResultViewModel,
|
||||
InspectionViewModel,
|
||||
} from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
|
||||
export const inspectionPointDemoData: Array<InspectionPointViewModel> = [
|
||||
{
|
||||
id: "edf",
|
||||
title: "vorhandene Spritzstellen ausgebessert",
|
||||
description: "",
|
||||
type: "number",
|
||||
},
|
||||
{
|
||||
id: "ghi",
|
||||
title: "Einband der Kupplung sitzt fest",
|
||||
description: "",
|
||||
type: "iO-niO",
|
||||
},
|
||||
{
|
||||
id: "lmn",
|
||||
title: "Das überstehende Drahtende des Knaggenteiles sitzt versenkt",
|
||||
description: "",
|
||||
type: "iO-niO",
|
||||
},
|
||||
{
|
||||
id: "jgj",
|
||||
title: "Gebrauchsprüfdruck 12bar",
|
||||
description: "",
|
||||
type: "iO-niO",
|
||||
},
|
||||
];
|
||||
|
||||
export const inspectionPlanDemoData: Array<InspectionPlanViewModel> = [
|
||||
{
|
||||
id: "abc",
|
||||
title: "Sichtprüfung",
|
||||
version: 1,
|
||||
inspectionInterval: "1-m",
|
||||
remindTime: "1-m",
|
||||
created: new Date(),
|
||||
inspectionPoints: [inspectionPointDemoData[0], inspectionPointDemoData[1], inspectionPointDemoData[2]],
|
||||
relatedId: "xyz",
|
||||
related: {
|
||||
id: "xyz",
|
||||
type: "B-Schlauch",
|
||||
description: "Shläuche vom Typ B",
|
||||
inspectionPlans: [],
|
||||
},
|
||||
assigned: "equipment",
|
||||
},
|
||||
{
|
||||
id: "cba",
|
||||
title: "Druckprüfung",
|
||||
version: 1,
|
||||
inspectionInterval: "1-m",
|
||||
remindTime: "22/10",
|
||||
created: new Date(),
|
||||
inspectionPoints: [inspectionPointDemoData[3]],
|
||||
relatedId: "xyz",
|
||||
related: {
|
||||
id: "xyz",
|
||||
type: "B-Schlauch",
|
||||
description: "Shläuche vom Typ B",
|
||||
inspectionPlans: [],
|
||||
},
|
||||
assigned: "equipment",
|
||||
},
|
||||
];
|
||||
|
||||
export const inspectionPointResultDemoData: Array<InspectionPointResultViewModel> = [
|
||||
{
|
||||
inspectionId: "jkvshdfg",
|
||||
inspectionVersionedPlanId: inspectionPlanDemoData[0].id,
|
||||
inspectionPointId: inspectionPointDemoData[0].id,
|
||||
value: "5",
|
||||
},
|
||||
{
|
||||
inspectionId: "jkvshdfg",
|
||||
inspectionVersionedPlanId: inspectionPlanDemoData[0].id,
|
||||
inspectionPointId: inspectionPointDemoData[1].id,
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
inspectionId: "jkvshdfg",
|
||||
inspectionVersionedPlanId: inspectionPlanDemoData[0].id,
|
||||
inspectionPointId: inspectionPointDemoData[1].id,
|
||||
value: "",
|
||||
},
|
||||
];
|
||||
|
||||
export const inspectionDemoData: Array<InspectionViewModel> = [
|
||||
{
|
||||
id: "jkvshdfg",
|
||||
inspectionPlanId: inspectionPlanDemoData[0].id,
|
||||
inspectionPlan: inspectionPlanDemoData[0],
|
||||
inspectionVersionedPlanId: inspectionPlanDemoData[0].id,
|
||||
inspectionVersionedPlan: inspectionPlanDemoData[0],
|
||||
context: "",
|
||||
created: new Date(),
|
||||
finished: undefined,
|
||||
nextInspection: undefined,
|
||||
isOpen: true,
|
||||
checks: [inspectionPointResultDemoData[0], inspectionPointResultDemoData[1], inspectionPointResultDemoData[2]],
|
||||
relatedId: "abc",
|
||||
related: {
|
||||
id: "abc",
|
||||
code: "0456984224498",
|
||||
name: "B-Schlauch",
|
||||
location: "HLF",
|
||||
commissioned: new Date(),
|
||||
equipmentTypeId: "xyz",
|
||||
equipmentType: {
|
||||
id: "xyz",
|
||||
type: "B-Schlauch",
|
||||
description: "Shläuche vom Typ B",
|
||||
inspectionPlans: [],
|
||||
},
|
||||
inspections: [],
|
||||
},
|
||||
assigned: "equipment",
|
||||
},
|
||||
{
|
||||
id: "jkvshdfg",
|
||||
inspectionPlanId: inspectionPlanDemoData[0].id,
|
||||
inspectionPlan: inspectionPlanDemoData[0],
|
||||
inspectionVersionedPlanId: inspectionPlanDemoData[0].id,
|
||||
inspectionVersionedPlan: inspectionPlanDemoData[0],
|
||||
context: "sohgfpb",
|
||||
created: new Date(),
|
||||
finished: new Date(),
|
||||
nextInspection: new Date(),
|
||||
isOpen: false,
|
||||
checks: [inspectionPointResultDemoData[0], inspectionPointResultDemoData[1], inspectionPointResultDemoData[2]],
|
||||
relatedId: "abc",
|
||||
related: {
|
||||
id: "abc",
|
||||
code: "0456984224498",
|
||||
name: "B-Schlauch",
|
||||
location: "HLF",
|
||||
commissioned: new Date(),
|
||||
equipmentTypeId: "xyz",
|
||||
equipmentType: {
|
||||
id: "xyz",
|
||||
type: "B-Schlauch",
|
||||
description: "Shläuche vom Typ B",
|
||||
inspectionPlans: [],
|
||||
},
|
||||
inspections: [],
|
||||
},
|
||||
assigned: "equipment",
|
||||
},
|
||||
];
|
|
@ -1,10 +0,0 @@
|
|||
import type { RespiratoryGearViewModel } from "@/viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
||||
import { equipmentDemoData } from "./equipment";
|
||||
|
||||
export const respiratoryGearDemoData: Array<RespiratoryGearViewModel> = [
|
||||
{
|
||||
id: "adfsg",
|
||||
equipmentId: equipmentDemoData[0].id,
|
||||
equipment: equipmentDemoData[0],
|
||||
},
|
||||
];
|
|
@ -1,11 +0,0 @@
|
|||
import type { RespiratoryMissionViewModel } from "@/viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
||||
import { equipmentDemoData } from "./equipment";
|
||||
|
||||
export const respiratoryMissionDemoData: Array<RespiratoryMissionViewModel> = [
|
||||
{
|
||||
id: "adfsg",
|
||||
date: new Date(),
|
||||
title: "B5",
|
||||
description: "B5 Einsatz",
|
||||
},
|
||||
];
|
|
@ -1,17 +0,0 @@
|
|||
import type { RespiratoryWearerViewModel } from "@/viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
||||
|
||||
export const respiratoryWearerDemoData: Array<RespiratoryWearerViewModel> = [
|
||||
{
|
||||
id: "dfghj",
|
||||
memberId: "9469991d-fa22-4899-82ce-b1ba5de990dc",
|
||||
member: {
|
||||
id: "9469991d-fa22-4899-82ce-b1ba5de990dc",
|
||||
salutation: { id: 3, salutation: "Herr" },
|
||||
firstname: "Julian",
|
||||
lastname: "Krauser",
|
||||
nameaffix: "",
|
||||
birthdate: new Date("2003-09-20"),
|
||||
internalId: "1312",
|
||||
},
|
||||
},
|
||||
];
|
|
@ -1,27 +0,0 @@
|
|||
import type { VehicleViewModel } from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { vehicleTypeDemoData } from "./vehicleType";
|
||||
|
||||
export const vehicleDemoData: Array<VehicleViewModel> = [
|
||||
{
|
||||
id: "kjhb",
|
||||
code: "",
|
||||
name: "HLF",
|
||||
location: "Tor 1",
|
||||
commissioned: new Date(),
|
||||
decommissioned: undefined,
|
||||
vehicleTypeId: vehicleTypeDemoData[0].id,
|
||||
vehicleType: vehicleTypeDemoData[0],
|
||||
inspections: [],
|
||||
},
|
||||
{
|
||||
id: "kjhdfgb",
|
||||
code: "",
|
||||
name: "LF",
|
||||
location: "Tor 2",
|
||||
commissioned: new Date(),
|
||||
decommissioned: undefined,
|
||||
vehicleTypeId: vehicleTypeDemoData[1].id,
|
||||
vehicleType: vehicleTypeDemoData[1],
|
||||
inspections: [],
|
||||
},
|
||||
];
|
|
@ -1,16 +0,0 @@
|
|||
import type { VehicleTypeViewModel } from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
|
||||
export const vehicleTypeDemoData: Array<VehicleTypeViewModel> = [
|
||||
{
|
||||
id: "xyfgdghfz",
|
||||
type: "HLF 20/10",
|
||||
description: "HLF",
|
||||
inspectionPlans: [],
|
||||
},
|
||||
{
|
||||
id: "abc",
|
||||
type: "LF 8/6",
|
||||
description: "LF",
|
||||
inspectionPlans: [],
|
||||
},
|
||||
];
|
|
@ -1,25 +0,0 @@
|
|||
import type { WearableViewModel } from "@/viewmodels/admin/unit/wearable/wearable.models";
|
||||
import { wearableTypeDemoData } from "./wearableType";
|
||||
|
||||
export const wearableDemoData: Array<WearableViewModel> = [
|
||||
{
|
||||
id: "absdfgc",
|
||||
code: "0456984224498",
|
||||
name: "Jacke",
|
||||
location: "Spint",
|
||||
commissioned: new Date(),
|
||||
decommissioned: undefined,
|
||||
wearerId: "9469991d-fa22-4899-82ce-b1ba5de990dc",
|
||||
wearer: {
|
||||
id: "9469991d-fa22-4899-82ce-b1ba5de990dc",
|
||||
salutation: { id: 3, salutation: "Herr" },
|
||||
firstname: "Julian",
|
||||
lastname: "Krauser",
|
||||
nameaffix: "",
|
||||
birthdate: new Date("2003-09-20"),
|
||||
internalId: "1312",
|
||||
},
|
||||
wearableTypeId: wearableTypeDemoData[0].id,
|
||||
wearableType: wearableTypeDemoData[0],
|
||||
},
|
||||
];
|
|
@ -1,9 +0,0 @@
|
|||
import type { WearableTypeViewModel } from "@/viewmodels/admin/unit/wearableType/wearableType.models";
|
||||
|
||||
export const wearableTypeDemoData: Array<WearableTypeViewModel> = [
|
||||
{
|
||||
id: "xyz",
|
||||
type: "Jacke",
|
||||
description: "Bayern 2000",
|
||||
},
|
||||
];
|
6
src/enums/inspectionEnum.ts
Normal file
6
src/enums/inspectionEnum.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export enum InspectionPointEnum {
|
||||
oknok = "oknok",
|
||||
text = "text",
|
||||
number = "number",
|
||||
file = "file",
|
||||
}
|
|
@ -102,7 +102,9 @@ select[readonly] {
|
|||
}
|
||||
|
||||
input[disabled],
|
||||
textarea[disabled],
|
||||
textarea[disabled] {
|
||||
@apply opacity-75;
|
||||
}
|
||||
select[disabled] {
|
||||
@apply opacity-75 pointer-events-none;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import { resetWearableStores, setWearableId } from "./unit/wearable";
|
|||
import { resetInspectionPlanStores, setInspectionPlanId } from "./unit/inspectionPlan";
|
||||
import { setVehicleTypeId } from "./unit/vehicleType";
|
||||
import { resetInspectionStores, setInspectionId } from "./unit/inspection";
|
||||
import { setWearableTypeId } from "./unit/wearableType";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
|
@ -498,6 +499,12 @@ const router = createRouter({
|
|||
component: () => import("@/views/admin/ViewSelect.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "inspection",
|
||||
name: "admin-unit-wearable-inspection",
|
||||
component: () => import("@/views/admin/unit/wearable/Inspection.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "report",
|
||||
name: "admin-unit-wearable-damage_report",
|
||||
|
@ -706,6 +713,25 @@ const router = createRouter({
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "maintenance",
|
||||
name: "admin-unit-maintenance-route",
|
||||
component: () => import("@/views/admin/unit/maintenance/MaintenanceRouting.vue"),
|
||||
meta: { type: "read", section: "unit", module: "maintenance" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
name: "admin-unit-maintenance",
|
||||
component: () => import("@/views/admin/unit/maintenance/Maintenance.vue"),
|
||||
},
|
||||
{
|
||||
path: "done",
|
||||
name: "admin-unit-maintenance-done",
|
||||
component: () => import("@/views/admin/unit/maintenance/Maintenance.vue"),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "equipment-type",
|
||||
name: "admin-unit-equipment_type-route",
|
||||
|
@ -806,12 +832,33 @@ const router = createRouter({
|
|||
component: () => import("@/views/admin/unit/wearableType/WearableType.vue"),
|
||||
},
|
||||
{
|
||||
path: ":wearableTypeId/edit",
|
||||
name: "admin-unit-wearable_type-edit",
|
||||
component: () => import("@/views/admin/unit/wearableType/UpdateWearableType.vue"),
|
||||
meta: { type: "update", section: "unit", module: "wearable_type" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
path: ":wearableTypeId",
|
||||
name: "admin-unit-wearable_type-routing",
|
||||
component: () => import("@/views/admin/unit/wearableType/WearableTypeRouting.vue"),
|
||||
beforeEnter: [setWearableTypeId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
path: "overview",
|
||||
name: "admin-unit-wearable_type-overview",
|
||||
component: () => import("@/views/admin/unit/wearableType/Overview.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "inspection-plan",
|
||||
name: "admin-unit-wearable_type-inspection_plan",
|
||||
component: () => import("@/views/admin/unit/wearableType/InspectionPlans.vue"),
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "edit",
|
||||
name: "admin-unit-wearable_type-edit",
|
||||
component: () => import("@/views/admin/unit/wearableType/UpdateWearableType.vue"),
|
||||
meta: { type: "update", section: "unit", module: "wearable_type" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
props: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -851,7 +898,15 @@ const router = createRouter({
|
|||
{
|
||||
path: "edit",
|
||||
name: "admin-unit-inspection_plan-edit",
|
||||
component: () => import("@/views/admin/ViewSelect.vue"),
|
||||
component: () => import("@/views/admin/unit/inspectionPlan/UpdateInspectionPlan.vue"),
|
||||
meta: { type: "update", section: "unit", module: "inspection_plan" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
path: "pointedit",
|
||||
name: "admin-unit-inspection_plan-pointedit",
|
||||
component: () => import("@/views/admin/unit/inspectionPlan/UpdateInspectionPlanPoints.vue"),
|
||||
meta: { type: "update", section: "unit", module: "inspection_plan" },
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
props: true,
|
||||
|
@ -869,13 +924,25 @@ const router = createRouter({
|
|||
children: [
|
||||
{
|
||||
path: "",
|
||||
name: "admin-unit-inspection",
|
||||
redirect: { name: "admin-unit-inspection-plan" },
|
||||
name: "admin-unit-inspection-routing",
|
||||
component: () => import("@/views/admin/unit/inspection/InspectionRouting.vue"),
|
||||
children: [
|
||||
{
|
||||
path: "next",
|
||||
name: "admin-unit-inspection",
|
||||
component: () => import("@/views/admin/unit/inspection/NextInspections.vue"),
|
||||
},
|
||||
{
|
||||
path: "running",
|
||||
name: "admin-unit-inspection-running",
|
||||
component: () => import("@/views/admin/unit/inspection/RunningInspections.vue"),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "plan/:type?/:relatedId?/:inspectionPlanId?",
|
||||
name: "admin-unit-inspection-plan",
|
||||
component: () => import("@/views/admin/unit/inspection/InspectionPlan.vue"),
|
||||
path: "start/:type?/:relatedId?/:inspectionPlanId?",
|
||||
name: "admin-unit-inspection-start",
|
||||
component: () => import("@/views/admin/unit/inspection/InspectionStart.vue"),
|
||||
beforeEnter: [],
|
||||
props: true,
|
||||
},
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
|
||||
import { useEquipmentDamageReportStore } from "@/stores/admin/unit/equipment/damageReport";
|
||||
import { useEquipmentInspectionStore } from "@/stores/admin/unit/equipment/inspection";
|
||||
|
||||
export async function setEquipmentId(to: any, from: any, next: any) {
|
||||
const EquipmentStore = useEquipmentStore();
|
||||
EquipmentStore.activeEquipment = to.params?.equipmentId ?? null;
|
||||
const equipmentStore = useEquipmentStore();
|
||||
equipmentStore.activeEquipment = to.params?.equipmentId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useEquipmentDamageReportStore().$reset();
|
||||
useEquipmentInspectionStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetEquipmentStores(to: any, from: any, next: any) {
|
||||
const EquipmentStore = useEquipmentStore();
|
||||
EquipmentStore.activeEquipment = null;
|
||||
EquipmentStore.activeEquipmentObj = null;
|
||||
const equipmentStore = useEquipmentStore();
|
||||
equipmentStore.activeEquipment = null;
|
||||
equipmentStore.activeEquipmentObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useEquipmentDamageReportStore().$reset();
|
||||
useEquipmentInspectionStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { useInspectionStore } from "@/stores/admin/unit/inspection/inspection";
|
||||
|
||||
export async function setInspectionId(to: any, from: any, next: any) {
|
||||
const InspectionStore = useInspectionStore();
|
||||
InspectionStore.activeInspection = to.params?.inspectionId ?? null;
|
||||
const inspectionStore = useInspectionStore();
|
||||
inspectionStore.activeInspection = to.params?.inspectionId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
@ -10,9 +10,9 @@ export async function setInspectionId(to: any, from: any, next: any) {
|
|||
}
|
||||
|
||||
export async function resetInspectionStores(to: any, from: any, next: any) {
|
||||
const InspectionStore = useInspectionStore();
|
||||
InspectionStore.activeInspection = null;
|
||||
InspectionStore.activeInspectionObj = null;
|
||||
const inspectionStore = useInspectionStore();
|
||||
inspectionStore.activeInspection = null;
|
||||
inspectionStore.activeInspectionObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
|
|
@ -1,20 +1,21 @@
|
|||
import { useInspectionPlanStore } from "@/stores/admin/unit/inspectionPlan/inspectionPlan";
|
||||
import { useInspectionPointStore } from "@/stores/admin/unit/inspectionPlan/inspectionPoint";
|
||||
|
||||
export async function setInspectionPlanId(to: any, from: any, next: any) {
|
||||
const InspectionPlanStore = useInspectionPlanStore();
|
||||
InspectionPlanStore.activeInspectionPlan = to.params?.inspectionPlanId ?? null;
|
||||
const inspectionPlanStore = useInspectionPlanStore();
|
||||
inspectionPlanStore.activeInspectionPlan = to.params?.inspectionPlanId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useInspectionPointStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetInspectionPlanStores(to: any, from: any, next: any) {
|
||||
const InspectionPlanStore = useInspectionPlanStore();
|
||||
InspectionPlanStore.activeInspectionPlan = null;
|
||||
InspectionPlanStore.activeInspectionPlanObj = null;
|
||||
const inspectionPlanStore = useInspectionPlanStore();
|
||||
inspectionPlanStore.activeInspectionPlan = null;
|
||||
inspectionPlanStore.activeInspectionPlanObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useInspectionPointStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { useRespiratoryGearStore } from "@/stores/admin/unit/respiratoryGear/respiratoryGear";
|
||||
|
||||
export async function setRespiratoryGearId(to: any, from: any, next: any) {
|
||||
const RespiratoryGearStore = useRespiratoryGearStore();
|
||||
RespiratoryGearStore.activeRespiratoryGear = to.params?.respiratoryGearId ?? null;
|
||||
const respiratoryGearStore = useRespiratoryGearStore();
|
||||
respiratoryGearStore.activeRespiratoryGear = to.params?.respiratoryGearId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
@ -10,9 +10,9 @@ export async function setRespiratoryGearId(to: any, from: any, next: any) {
|
|||
}
|
||||
|
||||
export async function resetRespiratoryGearStores(to: any, from: any, next: any) {
|
||||
const RespiratoryGearStore = useRespiratoryGearStore();
|
||||
RespiratoryGearStore.activeRespiratoryGear = null;
|
||||
RespiratoryGearStore.activeRespiratoryGearObj = null;
|
||||
const respiratoryGearStore = useRespiratoryGearStore();
|
||||
respiratoryGearStore.activeRespiratoryGear = null;
|
||||
respiratoryGearStore.activeRespiratoryGearObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { useRespiratoryMissionStore } from "@/stores/admin/unit/respiratoryMission/respiratoryMission";
|
||||
|
||||
export async function setRespiratoryMissionId(to: any, from: any, next: any) {
|
||||
const RespiratoryMissionStore = useRespiratoryMissionStore();
|
||||
RespiratoryMissionStore.activeRespiratoryMission = to.params?.respiratoryMissionId ?? null;
|
||||
const respiratoryMissionStore = useRespiratoryMissionStore();
|
||||
respiratoryMissionStore.activeRespiratoryMission = to.params?.respiratoryMissionId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
@ -10,9 +10,9 @@ export async function setRespiratoryMissionId(to: any, from: any, next: any) {
|
|||
}
|
||||
|
||||
export async function resetRespiratoryMissionStores(to: any, from: any, next: any) {
|
||||
const RespiratoryMissionStore = useRespiratoryMissionStore();
|
||||
RespiratoryMissionStore.activeRespiratoryMission = null;
|
||||
RespiratoryMissionStore.activeRespiratoryMissionObj = null;
|
||||
const respiratoryMissionStore = useRespiratoryMissionStore();
|
||||
respiratoryMissionStore.activeRespiratoryMission = null;
|
||||
respiratoryMissionStore.activeRespiratoryMissionObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { useRespiratoryWearerStore } from "@/stores/admin/unit/respiratoryWearer/respiratoryWearer";
|
||||
|
||||
export async function setRespiratoryWearerId(to: any, from: any, next: any) {
|
||||
const RespiratoryWearerStore = useRespiratoryWearerStore();
|
||||
RespiratoryWearerStore.activeRespiratoryWearer = to.params?.respiratoryWearerId ?? null;
|
||||
const respiratoryWearerStore = useRespiratoryWearerStore();
|
||||
respiratoryWearerStore.activeRespiratoryWearer = to.params?.respiratoryWearerId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
@ -10,9 +10,9 @@ export async function setRespiratoryWearerId(to: any, from: any, next: any) {
|
|||
}
|
||||
|
||||
export async function resetRespiratoryWearerStores(to: any, from: any, next: any) {
|
||||
const RespiratoryWearerStore = useRespiratoryWearerStore();
|
||||
RespiratoryWearerStore.activeRespiratoryWearer = null;
|
||||
RespiratoryWearerStore.activeRespiratoryWearerObj = null;
|
||||
const respiratoryWearerStore = useRespiratoryWearerStore();
|
||||
respiratoryWearerStore.activeRespiratoryWearer = null;
|
||||
respiratoryWearerStore.activeRespiratoryWearerObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
import { useVehicleStore } from "@/stores/admin/unit/vehicle/vehicle";
|
||||
import { useVehicleDamageReportStore } from "@/stores/admin/unit/vehicle/damageReport";
|
||||
import { useVehicleInspectionStore } from "@/stores/admin/unit/vehicle/inspection";
|
||||
|
||||
export async function setVehicleId(to: any, from: any, next: any) {
|
||||
const VehicleStore = useVehicleStore();
|
||||
VehicleStore.activeVehicle = to.params?.vehicleId ?? null;
|
||||
const vehicleStore = useVehicleStore();
|
||||
vehicleStore.activeVehicle = to.params?.vehicleId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useVehicleDamageReportStore().$reset();
|
||||
useVehicleInspectionStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetVehicleStores(to: any, from: any, next: any) {
|
||||
const VehicleStore = useVehicleStore();
|
||||
VehicleStore.activeVehicle = null;
|
||||
VehicleStore.activeVehicleObj = null;
|
||||
const vehicleStore = useVehicleStore();
|
||||
vehicleStore.activeVehicle = null;
|
||||
vehicleStore.activeVehicleObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useVehicleDamageReportStore().$reset();
|
||||
useVehicleInspectionStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
import { useWearableStore } from "@/stores/admin/unit/wearable/wearable";
|
||||
import { useWearableDamageReportStore } from "@/stores/admin/unit/wearable/damageReport";
|
||||
import { useWearableTypeInspectionPlanStore } from "@/stores/admin/unit/wearableType/inspectionPlan";
|
||||
|
||||
export async function setWearableId(to: any, from: any, next: any) {
|
||||
const WearableStore = useWearableStore();
|
||||
WearableStore.activeWearable = to.params?.wearableId ?? null;
|
||||
const wearableStore = useWearableStore();
|
||||
wearableStore.activeWearable = to.params?.wearableId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useWearableDamageReportStore().$reset();
|
||||
useWearableTypeInspectionPlanStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetWearableStores(to: any, from: any, next: any) {
|
||||
const WearableStore = useWearableStore();
|
||||
WearableStore.activeWearable = null;
|
||||
WearableStore.activeWearableObj = null;
|
||||
const wearableStore = useWearableStore();
|
||||
wearableStore.activeWearable = null;
|
||||
wearableStore.activeWearableObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
useWearableDamageReportStore().$reset();
|
||||
useWearableTypeInspectionPlanStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
|
21
src/router/unit/wearableType.ts
Normal file
21
src/router/unit/wearableType.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { useWearableTypeStore } from "@/stores/admin/unit/wearableType/wearableType";
|
||||
import { useWearableTypeInspectionPlanStore } from "@/stores/admin/unit/wearableType/inspectionPlan";
|
||||
|
||||
export async function setWearableTypeId(to: any, from: any, next: any) {
|
||||
const wearableTypeStore = useWearableTypeStore();
|
||||
wearableTypeStore.activeWearableType = to.params?.wearableTypeId ?? null;
|
||||
|
||||
useWearableTypeInspectionPlanStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetWearableTypeStores(to: any, from: any, next: any) {
|
||||
const wearableTypeStore = useWearableTypeStore();
|
||||
wearableTypeStore.activeWearableType = null;
|
||||
wearableTypeStore.activeWearableTypeObj = null;
|
||||
|
||||
useWearableTypeInspectionPlanStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
|
@ -110,19 +110,22 @@ export const useNavigationStore = defineStore("navigation", {
|
|||
...(abilityStore.can("read", "unit", "equipment") ? [{ key: "equipment", title: "Gerätschaften" }] : []),
|
||||
...(abilityStore.can("read", "unit", "vehicle") ? [{ key: "vehicle", title: "Fahrzeuge" }] : []),
|
||||
...(abilityStore.can("read", "unit", "wearable") ? [{ key: "wearable", title: "Kleidung" }] : []),
|
||||
...(abilityStore.can("read", "unit", "respiratory_gear")
|
||||
...(false && abilityStore.can("read", "unit", "respiratory_gear")
|
||||
? [{ key: "respiratory_gear", title: "Atemschutz-Geräte" }]
|
||||
: []),
|
||||
...(abilityStore.can("read", "unit", "respiratory_wearer")
|
||||
...(false && abilityStore.can("read", "unit", "respiratory_wearer")
|
||||
? [{ key: "respiratory_wearer", title: "Atemschutz-Träger" }]
|
||||
: []),
|
||||
...(abilityStore.can("read", "unit", "respiratory_mission")
|
||||
...(false && abilityStore.can("read", "unit", "respiratory_mission")
|
||||
? [{ key: "respiratory_mission", title: "Atemschutz-Einsätze" }]
|
||||
: []),
|
||||
...(abilityStore.can("create", "unit", "inspection") ? [{ key: "inspection", title: "Prüfungen" }] : []),
|
||||
...(abilityStore.can("read", "unit", "damage_report")
|
||||
? [{ key: "damage_report", title: "Schadensmeldungen" }]
|
||||
: []),
|
||||
...(abilityStore.can("read", "unit", "maintenance")
|
||||
? [{ key: "maintenance", title: "Wartungen / Reparaturen" }]
|
||||
: []),
|
||||
{ key: "divider1", title: "Basisdaten" },
|
||||
...(abilityStore.can("read", "unit", "equipment_type")
|
||||
? [{ key: "equipment_type", title: "Geräte-Typen" }]
|
||||
|
|
|
@ -3,11 +3,9 @@ import type {
|
|||
DamageReportViewModel,
|
||||
CreateDamageReportViewModel,
|
||||
UpdateDamageReportViewModel,
|
||||
} from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
} from "@/viewmodels/admin/unit/damageReport.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { VehicleViewModel } from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
||||
|
||||
export const useDamageReportStore = defineStore("damageReport", {
|
||||
state: () => {
|
||||
|
@ -19,12 +17,9 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
},
|
||||
actions: {
|
||||
fetchDamageReports(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.damageReports = damageReportDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
//TODO enable fetch of done reports
|
||||
http
|
||||
.get(`/admin/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
|
@ -68,13 +63,6 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
fetchDamageReportById(id: string) {
|
||||
return http.get(`/admin/damageReport/${id}`);
|
||||
},
|
||||
async createDamageReport(damageReport: CreateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/damageReport`, {
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchDamageReports();
|
||||
return result;
|
||||
},
|
||||
async updateDamageReport(damageReport: UpdateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/damageReport/${damageReport.id}`, {
|
||||
// TODO: data
|
||||
|
@ -82,10 +70,5 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
this.fetchDamageReports();
|
||||
return result;
|
||||
},
|
||||
async deleteDamageReport(damageReport: number): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.delete(`/admin/damageReport/${damageReport}`);
|
||||
this.fetchDamageReports();
|
||||
return result;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import { useEquipmentStore } from "./equipment";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
|
||||
export const useEquipmentDamageReportStore = defineStore("equipmentDamageReport", {
|
||||
state: () => {
|
||||
|
@ -15,17 +14,11 @@ export const useEquipmentDamageReportStore = defineStore("equipmentDamageReport"
|
|||
actions: {
|
||||
fetchDamageReportForEquipment(offset = 0, count = 25, search = "", clear = false) {
|
||||
const equipmentId = useEquipmentStore().activeEquipment;
|
||||
this.damageReports = damageReportDemoData
|
||||
.filter((drdd) => drdd.relatedId == equipmentId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/equipment/${equipmentId}/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/damagereport/equipment/${equipmentId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/equipment/equipment.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentDemoData } from "@/demodata/equipment";
|
||||
|
||||
export const useEquipmentStore = defineStore("equipment", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
},
|
||||
actions: {
|
||||
fetchEquipments(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.equipments = equipmentDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.equipments.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.equipments = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -68,9 +63,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
});
|
||||
},
|
||||
fetchEquipmentByActiveId() {
|
||||
this.activeEquipmentObj = equipmentDemoData.find((e) => e.id == this.activeEquipment) as EquipmentViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipment/${this.activeEquipment}`)
|
||||
|
@ -87,14 +79,22 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
},
|
||||
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipment`, {
|
||||
// TODO: data
|
||||
equipmentTypeId: equipment.equipmentTypeId,
|
||||
name: equipment.name,
|
||||
code: equipment.code,
|
||||
location: equipment.location,
|
||||
commissioned: equipment.commissioned,
|
||||
});
|
||||
this.fetchEquipments();
|
||||
return result;
|
||||
},
|
||||
async updateActiveEquipment(equipment: UpdateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/equipment/${equipment.id}`, {
|
||||
// TODO: data
|
||||
name: equipment.name,
|
||||
code: equipment.code,
|
||||
location: equipment.location,
|
||||
commissioned: equipment.commissioned,
|
||||
decommissioned: equipment.decommissioned,
|
||||
});
|
||||
this.fetchEquipments();
|
||||
return result;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
||||
import { useEquipmentStore } from "./equipment";
|
||||
|
||||
export const useEquipmentInspectionStore = defineStore("equipmentInspection", {
|
||||
|
@ -13,20 +12,12 @@ export const useEquipmentInspectionStore = defineStore("equipmentInspection", {
|
|||
};
|
||||
},
|
||||
actions: {
|
||||
fetchInspectionForEquipment(offset = 0, count = 25, search = "", clear = false) {
|
||||
fetchInspectionForEquipment(offset = 0, count = 25, clear = false) {
|
||||
const equipmentId = useEquipmentStore().activeEquipment;
|
||||
this.inspections = inspectionDemoData
|
||||
.filter((idd) => idd.relatedId == equipmentId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.inspections.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.inspections = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/equipment/${equipmentId}/inspection?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.get(`/admin/inspection/equipment/${equipmentId}?offset=${offset}&count=${count}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.inspections
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
EquipmentTypeViewModel,
|
||||
CreateEquipmentTypeViewModel,
|
||||
UpdateEquipmentTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
} from "@/viewmodels/admin/unit/equipment/equipmentType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentTypeDemoData } from "@/demodata/equipmentType";
|
||||
|
||||
export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||
state: () => {
|
||||
|
@ -21,17 +20,13 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
actions: {
|
||||
fetchEquipmentTypes(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.equipmentTypes = equipmentTypeDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.equipmentTypes.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.equipmentTypes = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/equipmentType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.equipments
|
||||
result.data.equipmentTypes
|
||||
.filter((elem: EquipmentTypeViewModel) => this.equipmentTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||
.map((elem: EquipmentTypeViewModel, index: number): EquipmentTypeViewModel & { tab_pos: number } => {
|
||||
return {
|
||||
|
@ -50,20 +45,15 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
async getAllEquipmentTypes(): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/equipmentType?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.equipments };
|
||||
return { ...res, data: res.data.equipmentTypes };
|
||||
});
|
||||
},
|
||||
async searchEquipmentTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/equipmentType?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.equipments };
|
||||
return { ...res, data: res.data.equipmentTypes };
|
||||
});
|
||||
},
|
||||
fetchEquipmentTypeByActiveId() {
|
||||
this.activeEquipmentTypeObj = equipmentTypeDemoData.find(
|
||||
(e) => e.id == this.activeEquipmentType
|
||||
) as EquipmentTypeViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipmentType/${this.activeEquipmentType}`)
|
||||
|
@ -80,14 +70,16 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
async createEquipmentType(equipmentType: CreateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipmentType`, {
|
||||
// TODO: data
|
||||
type: equipmentType.type,
|
||||
description: equipmentType.description,
|
||||
});
|
||||
this.fetchEquipmentTypes();
|
||||
return result;
|
||||
},
|
||||
async updateActiveEquipmentType(equipmentType: UpdateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/equipmentType/${equipmentType.id}`, {
|
||||
// TODO: data
|
||||
type: equipmentType.type,
|
||||
description: equipmentType.description,
|
||||
});
|
||||
this.fetchEquipmentTypes();
|
||||
return result;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type {
|
||||
EquipmentTypeViewModel,
|
||||
CreateEquipmentTypeViewModel,
|
||||
UpdateEquipmentTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentTypeDemoData } from "@/demodata/equipmentType";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { useEquipmentTypeStore } from "./equipmentType";
|
||||
|
||||
export const useEquipmentTypeInspectionPlanStore = defineStore("equipmentTypeInspectionPlan", {
|
||||
|
@ -21,14 +13,11 @@ export const useEquipmentTypeInspectionPlanStore = defineStore("equipmentTypeIns
|
|||
actions: {
|
||||
fetchInspectionPlanForEquipmentType() {
|
||||
const equipmentTypeId = useEquipmentTypeStore().activeEquipmentType;
|
||||
this.inspectionPlans = inspectionPlanDemoData.filter((ipdd) => ipdd.relatedId == equipmentTypeId);
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/equipmentType/${equipmentTypeId}/inspectionPlan`)
|
||||
.get(`/admin/inspectionPlan/equipmentType/${equipmentTypeId}?noLimit=true`)
|
||||
.then((result) => {
|
||||
this.inspectionPlans = result.data;
|
||||
this.inspectionPlans = result.data.inspectionPlans;
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -1,23 +1,81 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import type {
|
||||
CreateInspectionViewModel,
|
||||
CreateOrUpdateInspectionPointResultCommand,
|
||||
InspectionNextViewModel,
|
||||
InspectionViewModel,
|
||||
MinifiedInspectionViewModel,
|
||||
UpdateInspectionViewModel,
|
||||
} from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
|
||||
export const useInspectionStore = defineStore("inspection", {
|
||||
state: () => {
|
||||
return {
|
||||
inspections: [] as Array<MinifiedInspectionViewModel & { tab_pos: number }>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
nextInspections: [] as Array<InspectionNextViewModel & { tab_pos: number }>,
|
||||
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";
|
||||
this.activeInspectionObj = inspectionDemoData.find((e) => e.id == this.activeInspection) as InspectionViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/inspection/${this.activeInspection}`)
|
||||
|
@ -32,23 +90,61 @@ export const useInspectionStore = defineStore("inspection", {
|
|||
fetchInspectionById(id: string) {
|
||||
return http.get(`/admin/inspection/${id}`);
|
||||
},
|
||||
async createInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||
fetchInspectionPrintoutById() {
|
||||
return http.get(`/admin/inspection/${this.activeInspectionObj?.id}/printout`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchUploadedFileByPointId(id: string) {
|
||||
return http.get(`/admin/inspection/${this.activeInspectionObj?.id}/${id}/upload`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
async createInspection(inspection: CreateInspectionViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/inspection`, {
|
||||
// TODO: data
|
||||
assigned: inspection.assigned,
|
||||
relatedId: inspection.relatedId,
|
||||
inspectionPlanId: inspection.inspectionPlanId,
|
||||
nextInspection: inspection.nextInspection,
|
||||
context: inspection.context,
|
||||
});
|
||||
return result;
|
||||
},
|
||||
async updateActiveInspection(inspection: UpdateInspectionViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspection/${this.activeInspection}`, {
|
||||
nextInspection: inspection.nextInspection,
|
||||
context: inspection.context,
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
},
|
||||
async updateActiveInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspection/${inspection.id}`, {
|
||||
// TODO: data
|
||||
async updateActiveInspectionResults(
|
||||
results: Array<CreateOrUpdateInspectionPointResultCommand>,
|
||||
files: { [key: string]: File | null }
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const formData = new FormData();
|
||||
formData.append("results", JSON.stringify(results));
|
||||
Object.entries(files).forEach(([key, file]) => {
|
||||
if (file) {
|
||||
const extension = file.name.split(".").pop() || "";
|
||||
formData.append(`files`, new File([file], `${key}.${extension}`, { type: file.type }));
|
||||
}
|
||||
});
|
||||
const result = await http.patch(`/admin/inspection/${this.activeInspection}/results`, formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
},
|
||||
async deleteInspection(inspection: number): Promise<AxiosResponse<any, any>> {
|
||||
async finishActiveInspection(): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspection/${this.activeInspection}/finish`);
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
},
|
||||
async deleteInspection(inspection: string): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.delete(`/admin/inspection/${inspection}`);
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
},
|
||||
},
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
InspectionPlanViewModel,
|
||||
CreateInspectionPlanViewModel,
|
||||
UpdateInspectionPlanViewModel,
|
||||
} from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
} from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
||||
|
||||
export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
|||
},
|
||||
actions: {
|
||||
fetchInspectionPlans(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.inspectionPlans = inspectionPlanDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.inspectionPlans.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.inspectionPlans = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -53,26 +48,31 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
|||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
async getInspectionPlansByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/inspectionPlan/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
async searchInspectionPlans(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/inspectionPlan?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
async getAllInspectionPlansWithRelated(
|
||||
related: "vehicleType" | "equipmentType" | "wearableType",
|
||||
relatedId: string
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/inspectionPlan/${related}/${relatedId}?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
async searchInspectionPlansWithRelated(
|
||||
related: "vehicleType" | "equipmentType" | "wearableType",
|
||||
relatedId: string,
|
||||
search: string
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.get(`/admin/inspectionPlan/${related}/${relatedId}?search=${search}&noLimit=true`)
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
fetchInspectionPlanByActiveId() {
|
||||
this.activeInspectionPlanObj = inspectionPlanDemoData.find(
|
||||
(e) => e.id == this.activeInspectionPlan
|
||||
) as InspectionPlanViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/inspectionPlan/${this.activeInspectionPlan}`)
|
||||
|
@ -89,14 +89,20 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
|||
},
|
||||
async createInspectionPlan(inspectionPlan: CreateInspectionPlanViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/inspectionPlan`, {
|
||||
// TODO: data
|
||||
title: inspectionPlan.title,
|
||||
inspectionInterval: inspectionPlan.inspectionInterval,
|
||||
remindTime: inspectionPlan.remindTime,
|
||||
relatedId: inspectionPlan.relatedId,
|
||||
assigned: inspectionPlan.assigned,
|
||||
});
|
||||
this.fetchInspectionPlans();
|
||||
return result;
|
||||
},
|
||||
async updateActiveInspectionPlan(inspectionPlan: UpdateInspectionPlanViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspectionPlan/${inspectionPlan.id}`, {
|
||||
// TODO: data
|
||||
title: inspectionPlan.title,
|
||||
inspectionInterval: inspectionPlan.inspectionInterval,
|
||||
remindTime: inspectionPlan.remindTime,
|
||||
});
|
||||
this.fetchInspectionPlans();
|
||||
return result;
|
||||
|
|
37
src/stores/admin/unit/inspectionPlan/inspectionPoint.ts
Normal file
37
src/stores/admin/unit/inspectionPlan/inspectionPoint.ts
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type { InspectionPointViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { useInspectionPlanStore } from "./inspectionPlan";
|
||||
|
||||
export const useInspectionPointStore = defineStore("inspectionPoint", {
|
||||
state: () => {
|
||||
return {
|
||||
inspectionPoints: [] as Array<InspectionPointViewModel>,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
fetchInspectionPoints() {
|
||||
const inspectionPlanId = useInspectionPlanStore().activeInspectionPlan;
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/inspectionPlan/${inspectionPlanId}/points`)
|
||||
.then((result) => {
|
||||
this.inspectionPoints = result.data;
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = "failed";
|
||||
});
|
||||
},
|
||||
async updateActiveInspectionPoints(
|
||||
inspectionPoints: Array<InspectionPointViewModel>
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const inspectionPlanId = useInspectionPlanStore().activeInspectionPlan;
|
||||
const result = await http.patch(`/admin/inspectionPlan/${inspectionPlanId}/points`, inspectionPoints);
|
||||
this.fetchInspectionPoints();
|
||||
return result;
|
||||
},
|
||||
},
|
||||
});
|
74
src/stores/admin/unit/maintenance/maintenance.ts
Normal file
74
src/stores/admin/unit/maintenance/maintenance.ts
Normal file
|
@ -0,0 +1,74 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type {
|
||||
MaintenanceViewModel,
|
||||
CreateMaintenanceViewModel,
|
||||
UpdateMaintenanceViewModel,
|
||||
} from "@/viewmodels/admin/unit/maintenance.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const useMaintenanceStore = defineStore("maintenance", {
|
||||
state: () => {
|
||||
return {
|
||||
maintenances: [] as Array<MaintenanceViewModel & { tab_pos: number }>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
fetchMaintenances(offset = 0, count = 25, search = "", clear = false) {
|
||||
if (clear) this.maintenances = [];
|
||||
this.loading = "loading";
|
||||
//TODO enable fetch of done reports
|
||||
http
|
||||
.get(`/admin/maintenance?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.maintenances
|
||||
.filter((elem: MaintenanceViewModel) => this.maintenances.findIndex((m) => m.id == elem.id) == -1)
|
||||
.map((elem: MaintenanceViewModel, index: number): MaintenanceViewModel & { tab_pos: number } => {
|
||||
return {
|
||||
...elem,
|
||||
tab_pos: index + offset,
|
||||
};
|
||||
})
|
||||
.forEach((elem: MaintenanceViewModel & { tab_pos: number }) => {
|
||||
this.maintenances.push(elem);
|
||||
});
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = "failed";
|
||||
});
|
||||
},
|
||||
async getAllMaintenances(): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/maintenance?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.maintenances };
|
||||
});
|
||||
},
|
||||
async getMaintenancesByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/maintenance/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.maintenances };
|
||||
});
|
||||
},
|
||||
async searchMaintenances(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/maintenance?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.maintenances };
|
||||
});
|
||||
},
|
||||
fetchMaintenanceById(id: string) {
|
||||
return http.get(`/admin/maintenance/${id}`);
|
||||
},
|
||||
async updateMaintenance(maintenance: UpdateMaintenanceViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/maintenance/${maintenance.id}`, {
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchMaintenances();
|
||||
return result;
|
||||
},
|
||||
},
|
||||
});
|
|
@ -3,10 +3,9 @@ import type {
|
|||
RespiratoryGearViewModel,
|
||||
CreateRespiratoryGearViewModel,
|
||||
UpdateRespiratoryGearViewModel,
|
||||
} from "@/viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
||||
} from "@/viewmodels/admin/unit/respiratory/respiratoryGear.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryGearDemoData } from "@/demodata/respiratoryGear";
|
||||
|
||||
export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryGears(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryGears = respiratoryGearDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryGears.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryGears = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -59,11 +54,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
});
|
||||
},
|
||||
fetchRespiratoryGearByActiveId() {
|
||||
this.activeRespiratoryGearObj = respiratoryGearDemoData.find(
|
||||
(e) => e.id == this.activeRespiratoryGear
|
||||
) as RespiratoryGearViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryGear/${this.activeRespiratoryGear}`)
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
RespiratoryMissionViewModel,
|
||||
CreateRespiratoryMissionViewModel,
|
||||
UpdateRespiratoryMissionViewModel,
|
||||
} from "@/viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
||||
} from "@/viewmodels/admin/unit/respiratory/respiratoryMission.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryMissionDemoData } from "@/demodata/respiratoryMission";
|
||||
|
||||
export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryMissions(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryMissions = respiratoryMissionDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryMissions.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryMissions = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -63,11 +58,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
});
|
||||
},
|
||||
fetchRespiratoryMissionByActiveId() {
|
||||
this.activeRespiratoryMissionObj = this.respiratoryMissions.find(
|
||||
(e) => e.id == this.activeRespiratoryMission
|
||||
) as RespiratoryMissionViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryMission/${this.activeRespiratoryMission}`)
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
RespiratoryWearerViewModel,
|
||||
CreateRespiratoryWearerViewModel,
|
||||
UpdateRespiratoryWearerViewModel,
|
||||
} from "@/viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
||||
} from "@/viewmodels/admin/unit/respiratory/respiratoryWearer.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryWearerDemoData } from "@/demodata/respiratoryWearer";
|
||||
|
||||
export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryWearers(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryWearers = respiratoryWearerDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryWearers.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryWearers = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -63,11 +58,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
});
|
||||
},
|
||||
fetchRespiratoryWearerByActiveId() {
|
||||
this.activeRespiratoryWearerObj = respiratoryWearerDemoData.find(
|
||||
(e) => e.id == this.activeRespiratoryWearer
|
||||
) as RespiratoryWearerViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryWearer/${this.activeRespiratoryWearer}`)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import { useVehicleStore } from "./vehicle";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
|
||||
export const useVehicleDamageReportStore = defineStore("vehicleDamageReport", {
|
||||
state: () => {
|
||||
|
@ -15,17 +14,11 @@ export const useVehicleDamageReportStore = defineStore("vehicleDamageReport", {
|
|||
actions: {
|
||||
fetchDamageReportForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
||||
const vehicleId = useVehicleStore().activeVehicle;
|
||||
this.damageReports = damageReportDemoData
|
||||
.filter((drdd) => drdd.relatedId == vehicleId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/vehicle/${vehicleId}/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/damagereport/vehicle/${vehicleId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
||||
import { useVehicleStore } from "./vehicle";
|
||||
|
||||
export const useVehicleInspectionStore = defineStore("vehicleInspection", {
|
||||
|
@ -15,17 +14,11 @@ export const useVehicleInspectionStore = defineStore("vehicleInspection", {
|
|||
actions: {
|
||||
fetchInspectionForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
||||
const vehicleId = useVehicleStore().activeVehicle;
|
||||
this.inspections = inspectionDemoData
|
||||
.filter((idd) => idd.relatedId == vehicleId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.inspections.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.inspections = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/vehicle/${vehicleId}/inspection?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/inspection/vehicle/${vehicleId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { vehicleDemoData } from "@/demodata/vehicle";
|
||||
|
||||
export const useVehicleStore = defineStore("vehicle", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
},
|
||||
actions: {
|
||||
fetchVehicles(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.vehicles = vehicleDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.vehicles.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.vehicles = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -68,9 +63,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
});
|
||||
},
|
||||
fetchVehicleByActiveId() {
|
||||
this.activeVehicleObj = vehicleDemoData.find((e) => e.id == this.activeVehicle) as VehicleViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/vehicle/${this.activeVehicle}`)
|
||||
|
@ -87,14 +79,22 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
},
|
||||
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/vehicle`, {
|
||||
// TODO: data
|
||||
vehicleTypeId: vehicle.vehicleTypeId,
|
||||
name: vehicle.name,
|
||||
code: vehicle.code,
|
||||
location: vehicle.location,
|
||||
commissioned: vehicle.commissioned,
|
||||
});
|
||||
this.fetchVehicles();
|
||||
return result;
|
||||
},
|
||||
async updateActiveVehicle(vehicle: UpdateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/vehicle/${vehicle.id}`, {
|
||||
// TODO: data
|
||||
name: vehicle.name,
|
||||
code: vehicle.code,
|
||||
location: vehicle.location,
|
||||
commissioned: vehicle.commissioned,
|
||||
decommissioned: vehicle.decommissioned,
|
||||
});
|
||||
this.fetchVehicles();
|
||||
return result;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type {
|
||||
VehicleTypeViewModel,
|
||||
CreateVehicleTypeViewModel,
|
||||
UpdateVehicleTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { vehicleTypeDemoData } from "@/demodata/vehicleType";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { useVehicleTypeStore } from "./vehicleType";
|
||||
|
||||
export const useVehicleTypeInspectionPlanStore = defineStore("vehicleTypeInspectionPlan", {
|
||||
|
@ -22,14 +14,11 @@ export const useVehicleTypeInspectionPlanStore = defineStore("vehicleTypeInspect
|
|||
actions: {
|
||||
fetchInspectionPlanForVehicleType() {
|
||||
const vehicleTypeId = useVehicleTypeStore().activeVehicleType;
|
||||
this.inspectionPlans = inspectionPlanDemoData.filter((ipdd) => ipdd.relatedId == vehicleTypeId);
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/vehicleType/${vehicleTypeId}/inspectionPlan`)
|
||||
.get(`/admin/inspectionPlan/vehicleType/${vehicleTypeId}?noLimit=true`)
|
||||
.then((result) => {
|
||||
this.inspectionPlans = result.data;
|
||||
this.inspectionPlans = result.data.inspectionPlans;
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
VehicleTypeViewModel,
|
||||
CreateVehicleTypeViewModel,
|
||||
UpdateVehicleTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
} from "@/viewmodels/admin/unit/vehicle/vehicleType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { vehicleTypeDemoData } from "@/demodata/vehicleType";
|
||||
|
||||
export const useVehicleTypeStore = defineStore("vehicleType", {
|
||||
state: () => {
|
||||
|
@ -21,17 +20,13 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
|||
},
|
||||
actions: {
|
||||
fetchVehicleTypes(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.vehicleTypes = vehicleTypeDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.vehicleTypes.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.vehicleTypes = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/vehicleType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.vehicles
|
||||
result.data.vehicleTypes
|
||||
.filter((elem: VehicleTypeViewModel) => this.vehicleTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||
.map((elem: VehicleTypeViewModel, index: number): VehicleTypeViewModel & { tab_pos: number } => {
|
||||
return {
|
||||
|
@ -50,20 +45,15 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
|||
},
|
||||
async getAllVehicleTypes(): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/vehicleType?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.vehicles };
|
||||
return { ...res, data: res.data.vehicleTypes };
|
||||
});
|
||||
},
|
||||
async searchVehicleTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/vehicleType?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.vehicles };
|
||||
return { ...res, data: res.data.vehicleTypes };
|
||||
});
|
||||
},
|
||||
fetchVehicleTypeByActiveId() {
|
||||
this.activeVehicleTypeObj = vehicleTypeDemoData.find(
|
||||
(e) => e.id == this.activeVehicleType
|
||||
) as VehicleTypeViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/vehicleType/${this.activeVehicleType}`)
|
||||
|
@ -80,14 +70,16 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
|||
},
|
||||
async createVehicleType(vehicleType: CreateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/vehicleType`, {
|
||||
// TODO: data
|
||||
type: vehicleType.type,
|
||||
description: vehicleType.description,
|
||||
});
|
||||
this.fetchVehicleTypes();
|
||||
return result;
|
||||
},
|
||||
async updateActiveVehicleType(vehicleType: UpdateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/vehicleType/${vehicleType.id}`, {
|
||||
// TODO: data
|
||||
type: vehicleType.type,
|
||||
description: vehicleType.description,
|
||||
});
|
||||
this.fetchVehicleTypes();
|
||||
return result;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import { useWearableStore } from "./wearable";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
|
||||
export const useWearableDamageReportStore = defineStore("wearableDamageReport", {
|
||||
state: () => {
|
||||
|
@ -15,17 +14,11 @@ export const useWearableDamageReportStore = defineStore("wearableDamageReport",
|
|||
actions: {
|
||||
fetchDamageReportForWearable(offset = 0, count = 25, search = "", clear = false) {
|
||||
const wearableId = useWearableStore().activeWearable;
|
||||
this.damageReports = damageReportDemoData
|
||||
.filter((drdd) => drdd.relatedId == wearableId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/wearable/${wearableId}/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/damagereport/wearable/${wearableId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
43
src/stores/admin/unit/wearable/inspection.ts
Normal file
43
src/stores/admin/unit/wearable/inspection.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import { useWearableStore } from "./wearable";
|
||||
|
||||
export const useWearableInspectionStore = defineStore("wearableInspection", {
|
||||
state: () => {
|
||||
return {
|
||||
inspections: [] as Array<InspectionViewModel & { tab_pos: number }>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
fetchInspectionForWearable(offset = 0, count = 25, search = "", clear = false) {
|
||||
const wearableId = useWearableStore().activeWearable;
|
||||
if (clear) this.inspections = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/inspection/wearable/${wearableId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.inspections
|
||||
.filter((elem: InspectionViewModel) => this.inspections.findIndex((m) => m.id == elem.id) == -1)
|
||||
.map((elem: InspectionViewModel, index: number): InspectionViewModel & { tab_pos: number } => {
|
||||
return {
|
||||
...elem,
|
||||
tab_pos: index + offset,
|
||||
};
|
||||
})
|
||||
.forEach((elem: InspectionViewModel & { tab_pos: number }) => {
|
||||
this.inspections.push(elem);
|
||||
});
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = "failed";
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
|
@ -6,7 +6,6 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/wearable/wearable.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { wearableDemoData } from "@/demodata/wearable";
|
||||
|
||||
export const useWearableStore = defineStore("wearable", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useWearableStore = defineStore("wearable", {
|
|||
},
|
||||
actions: {
|
||||
fetchWearables(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.wearables = wearableDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.wearables.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.wearables = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -68,9 +63,6 @@ export const useWearableStore = defineStore("wearable", {
|
|||
});
|
||||
},
|
||||
fetchWearableByActiveId() {
|
||||
this.activeWearableObj = wearableDemoData.find((e) => e.id == this.activeWearable) as WearableViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/wearable/${this.activeWearable}`)
|
||||
|
@ -87,14 +79,24 @@ export const useWearableStore = defineStore("wearable", {
|
|||
},
|
||||
async createWearable(wearable: CreateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/wearable`, {
|
||||
// TODO: data
|
||||
wearableTypeId: wearable.wearableTypeId,
|
||||
name: wearable.name,
|
||||
code: wearable.code,
|
||||
location: wearable.location,
|
||||
commissioned: wearable.commissioned,
|
||||
wearerId: wearable.wearerId,
|
||||
});
|
||||
this.fetchWearables();
|
||||
return result;
|
||||
},
|
||||
async updateActiveWearable(wearable: UpdateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/wearable/${wearable.id}`, {
|
||||
// TODO: data
|
||||
name: wearable.name,
|
||||
code: wearable.code,
|
||||
location: wearable.location,
|
||||
commissioned: wearable.commissioned,
|
||||
decommissioned: wearable.decommissioned,
|
||||
wearerId: wearable.wearerId,
|
||||
});
|
||||
this.fetchWearables();
|
||||
return result;
|
||||
|
|
29
src/stores/admin/unit/wearableType/inspectionPlan.ts
Normal file
29
src/stores/admin/unit/wearableType/inspectionPlan.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { useWearableTypeStore } from "./wearableType";
|
||||
|
||||
export const useWearableTypeInspectionPlanStore = defineStore("wearableTypeInspectionPlan", {
|
||||
state: () => {
|
||||
return {
|
||||
inspectionPlans: [] as Array<InspectionPlanViewModel>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
fetchInspectionPlanForWearableType() {
|
||||
const wearableTypeId = useWearableTypeStore().activeWearableType;
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/inspectionPlan/wearableType/${wearableTypeId}?noLimit=true`)
|
||||
.then((result) => {
|
||||
this.inspectionPlans = result.data.inspectionPlans;
|
||||
this.loading = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = "failed";
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
|
@ -3,10 +3,9 @@ import type {
|
|||
WearableTypeViewModel,
|
||||
CreateWearableTypeViewModel,
|
||||
UpdateWearableTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/wearableType/wearableType.models";
|
||||
} from "@/viewmodels/admin/unit/wearable/wearableType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { wearableTypeDemoData } from "@/demodata/wearableType";
|
||||
|
||||
export const useWearableTypeStore = defineStore("wearableType", {
|
||||
state: () => {
|
||||
|
@ -14,21 +13,20 @@ export const useWearableTypeStore = defineStore("wearableType", {
|
|||
wearableTypes: [] as Array<WearableTypeViewModel & { tab_pos: number }>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
activeWearableType: null as string | null,
|
||||
activeWearableTypeObj: null as WearableTypeViewModel | null,
|
||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
fetchWearableTypes(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.wearableTypes = wearableTypeDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.wearableTypes.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.wearableTypes = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/wearableType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.wearables
|
||||
result.data.wearableTypes
|
||||
.filter((elem: WearableTypeViewModel) => this.wearableTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||
.map((elem: WearableTypeViewModel, index: number): WearableTypeViewModel & { tab_pos: number } => {
|
||||
return {
|
||||
|
@ -47,27 +45,41 @@ export const useWearableTypeStore = defineStore("wearableType", {
|
|||
},
|
||||
async getAllWearableTypes(): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/wearableType?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.wearables };
|
||||
return { ...res, data: res.data.wearableTypes };
|
||||
});
|
||||
},
|
||||
async searchWearableTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/wearableType?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.wearables };
|
||||
return { ...res, data: res.data.wearableTypes };
|
||||
});
|
||||
},
|
||||
fetchWearableTypeByActiveId() {
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/wearableType/${this.activeWearableType}`)
|
||||
.then((res) => {
|
||||
this.activeWearableTypeObj = res.data;
|
||||
this.loadingActive = "fetched";
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loadingActive = "failed";
|
||||
});
|
||||
},
|
||||
fetchWearableTypeById(id: string) {
|
||||
return http.get(`/admin/wearableType/${id}`);
|
||||
},
|
||||
async createWearableType(wearableType: CreateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/wearableType`, {
|
||||
// TODO: data
|
||||
type: wearableType.type,
|
||||
description: wearableType.description,
|
||||
});
|
||||
this.fetchWearableTypes();
|
||||
return result;
|
||||
},
|
||||
async updateWearableType(wearableType: UpdateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/wearableType/${wearableType.id}`, {
|
||||
// TODO: data
|
||||
type: wearableType.type,
|
||||
description: wearableType.description,
|
||||
});
|
||||
this.fetchWearableTypes();
|
||||
return result;
|
||||
|
|
|
@ -21,6 +21,7 @@ export type PermissionModule =
|
|||
| "respiratory_wearer"
|
||||
| "respiratory_mission"
|
||||
| "damage_report"
|
||||
| "maintenance"
|
||||
// configuration
|
||||
| "qualification"
|
||||
| "award"
|
||||
|
@ -95,6 +96,7 @@ export const permissionModules: Array<PermissionModule> = [
|
|||
"respiratory_wearer",
|
||||
"respiratory_mission",
|
||||
"damage_report",
|
||||
"maintenance",
|
||||
// configuration
|
||||
"qualification",
|
||||
"award",
|
||||
|
@ -131,6 +133,7 @@ export const sectionsAndModules: SectionsAndModulesObject = {
|
|||
"respiratory_wearer",
|
||||
"respiratory_mission",
|
||||
"damage_report",
|
||||
"maintenance",
|
||||
],
|
||||
configuration: [
|
||||
"qualification",
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||
import type { VehicleViewModel } from "../vehicle/vehicle.models";
|
||||
import type { WearableViewModel } from "../wearable/wearable.models";
|
||||
import type { EquipmentViewModel } from "./equipment/equipment.models";
|
||||
import type { MaintenanceViewModel } from "./maintenance.models";
|
||||
import type { VehicleViewModel } from "./vehicle/vehicle.models";
|
||||
import type { WearableViewModel } from "./wearable/wearable.models";
|
||||
|
||||
export type DamageReportViewModel = {
|
||||
id: string;
|
||||
reported: Date;
|
||||
status: string;
|
||||
done: boolean;
|
||||
description: string;
|
||||
providedImage: Array<string>;
|
||||
export type DamageReportAssigned = {
|
||||
relatedId: string;
|
||||
} & (
|
||||
| {
|
||||
|
@ -25,8 +20,20 @@ export type DamageReportViewModel = {
|
|||
}
|
||||
);
|
||||
|
||||
export type DamageReportViewModel = {
|
||||
id: string;
|
||||
reportedAt: Date;
|
||||
status: string;
|
||||
done: boolean;
|
||||
description: string;
|
||||
imageCount: number;
|
||||
reportedBy: string;
|
||||
maintenance?: MaintenanceViewModel;
|
||||
} & DamageReportAssigned;
|
||||
|
||||
export interface CreateDamageReportViewModel {
|
||||
description: string;
|
||||
reportedBy: string;
|
||||
affectedId: string;
|
||||
affected: "equipment" | "vehicle" | "wearable";
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import type { EquipmentTypeViewModel } from "../equipmentType/equipmentType.models";
|
||||
import type { InspectionViewModel } from "../inspection/inspection.models";
|
||||
import type { EquipmentTypeViewModel } from "./equipmentType.models";
|
||||
|
||||
export interface EquipmentViewModel {
|
||||
id: string;
|
||||
|
@ -10,7 +9,6 @@ export interface EquipmentViewModel {
|
|||
decommissioned?: Date;
|
||||
equipmentTypeId: string;
|
||||
equipmentType: EquipmentTypeViewModel;
|
||||
inspections: Array<InspectionViewModel>;
|
||||
}
|
||||
|
||||
export interface CreateEquipmentViewModel {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import type { InspectionPlanViewModel } from "../inspectionPlan/inspectionPlan.models";
|
||||
|
||||
export interface EquipmentTypeViewModel {
|
||||
id: string;
|
||||
type: string;
|
||||
description: string;
|
||||
inspectionPlans: Array<InspectionPlanViewModel>;
|
||||
equipmentCount: number;
|
||||
}
|
||||
|
||||
export interface CreateEquipmentTypeViewModel {
|
|
@ -1,9 +1,28 @@
|
|||
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||
import type {
|
||||
InspectionPlanViewModel,
|
||||
InspectionPointViewModel,
|
||||
InspectionVersionedPlanViewModel,
|
||||
} from "../inspectionPlan/inspectionPlan.models";
|
||||
} from "./inspectionPlan.models";
|
||||
import type { VehicleViewModel } from "../vehicle/vehicle.models";
|
||||
import type { WearableViewModel } from "../wearable/wearable.models";
|
||||
|
||||
export type InspectionRelated = {
|
||||
relatedId: string;
|
||||
} & (
|
||||
| {
|
||||
assigned: "equipment";
|
||||
related: EquipmentViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "vehicle";
|
||||
related: VehicleViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "wearable";
|
||||
related: WearableViewModel;
|
||||
}
|
||||
);
|
||||
|
||||
export type InspectionViewModel = {
|
||||
id: string;
|
||||
|
@ -18,20 +37,50 @@ export type InspectionViewModel = {
|
|||
nextInspection?: Date;
|
||||
checks: Array<InspectionPointResultViewModel>;
|
||||
relatedId: string;
|
||||
} & (
|
||||
| {
|
||||
assigned: "equipment";
|
||||
related: EquipmentViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "vehicle";
|
||||
related: VehicleViewModel;
|
||||
}
|
||||
);
|
||||
} & 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;
|
||||
inspectionVersionedPlanId: string;
|
||||
inspectionPointId: string;
|
||||
inspectionPoint?: InspectionPointViewModel;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type CreateInspectionViewModel = {
|
||||
assigned: "equipment" | "vehicle" | "wearable";
|
||||
relatedId: string;
|
||||
inspectionPlanId: string;
|
||||
nextInspection?: Date;
|
||||
context?: string;
|
||||
};
|
||||
|
||||
export type UpdateInspectionViewModel = {
|
||||
id: string;
|
||||
nextInspection?: Date;
|
||||
context?: string;
|
||||
};
|
||||
|
||||
export interface CreateOrUpdateInspectionPointResultCommand {
|
||||
inspectionPointId: string;
|
||||
value: string;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import type { EquipmentTypeViewModel } from "../equipmentType/equipmentType.models";
|
||||
import type { VehicleTypeViewModel } from "../vehicleType/vehicleType.models";
|
||||
import type { InspectionPointEnum } from "@/enums/inspectionEnum";
|
||||
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||
import type { VehicleViewModel } from "../vehicle/vehicle.models";
|
||||
import type { EquipmentTypeViewModel } from "../equipment/equipmentType.models";
|
||||
import type { VehicleTypeViewModel } from "../vehicle/vehicleType.models";
|
||||
import type { WearableTypeViewModel } from "../wearable/wearableType.models";
|
||||
|
||||
export type PlanTimeDefinition = `${number}-${"d" | "m" | "y"}` | `${number}/${number | "*"}`;
|
||||
|
||||
|
@ -21,6 +25,10 @@ export type InspectionPlanViewModel = {
|
|||
assigned: "vehicle";
|
||||
related: VehicleTypeViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "wearable";
|
||||
related: WearableTypeViewModel;
|
||||
}
|
||||
);
|
||||
|
||||
export interface InspectionVersionedPlanViewModel {
|
||||
|
@ -34,8 +42,11 @@ export interface InspectionPointViewModel {
|
|||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
type: "iO-niO" | "text" | "number";
|
||||
type: InspectionPointEnum;
|
||||
min?: number;
|
||||
max?: number;
|
||||
others?: string;
|
||||
sort: number;
|
||||
}
|
||||
|
||||
export interface CreateInspectionPlanViewModel {
|
||||
|
@ -43,7 +54,7 @@ export interface CreateInspectionPlanViewModel {
|
|||
inspectionInterval: PlanTimeDefinition;
|
||||
remindTime: PlanTimeDefinition;
|
||||
relatedId: string;
|
||||
assigned: "vehicle" | "equipment";
|
||||
assigned: "vehicle" | "equipment" | "wearable";
|
||||
}
|
||||
|
||||
export interface UpdateInspectionPlanViewModel {
|
43
src/viewmodels/admin/unit/maintenance.models.ts
Normal file
43
src/viewmodels/admin/unit/maintenance.models.ts
Normal file
|
@ -0,0 +1,43 @@
|
|||
import type { DamageReportViewModel } from "./damageReport.models";
|
||||
import type { EquipmentViewModel } from "./equipment/equipment.models";
|
||||
import type { VehicleViewModel } from "./vehicle/vehicle.models";
|
||||
import type { WearableViewModel } from "./wearable/wearable.models";
|
||||
|
||||
export type MaintenanceAssigned = {
|
||||
relatedId: string;
|
||||
} & (
|
||||
| {
|
||||
assigned: "equipment";
|
||||
related: EquipmentViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "vehicle";
|
||||
related: VehicleViewModel;
|
||||
}
|
||||
| {
|
||||
assigned: "wearable";
|
||||
related: WearableViewModel;
|
||||
}
|
||||
);
|
||||
|
||||
export type MaintenanceViewModel = {
|
||||
id: string;
|
||||
createdAt: Date;
|
||||
status: string;
|
||||
done: boolean;
|
||||
description: string;
|
||||
reports: DamageReportViewModel[];
|
||||
} & MaintenanceAssigned;
|
||||
|
||||
export interface CreateMaintenanceViewModel {
|
||||
description: string;
|
||||
reportedBy: string;
|
||||
affectedId: string;
|
||||
affected: "equipment" | "vehicle" | "wearable";
|
||||
}
|
||||
|
||||
export interface UpdateMaintenanceViewModel {
|
||||
id: string;
|
||||
status: string;
|
||||
done: boolean;
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import type { InspectionViewModel } from "../inspection/inspection.models";
|
||||
import type { VehicleTypeViewModel } from "../vehicleType/vehicleType.models";
|
||||
import type { VehicleTypeViewModel } from "./vehicleType.models";
|
||||
|
||||
export interface VehicleViewModel {
|
||||
id: string;
|
||||
|
@ -10,7 +9,6 @@ export interface VehicleViewModel {
|
|||
decommissioned?: Date;
|
||||
vehicleTypeId: string;
|
||||
vehicleType: VehicleTypeViewModel;
|
||||
inspections: Array<InspectionViewModel>;
|
||||
}
|
||||
|
||||
export interface CreateVehicleViewModel {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import type { InspectionPlanViewModel } from "../inspectionPlan/inspectionPlan.models";
|
||||
|
||||
export interface VehicleTypeViewModel {
|
||||
id: string;
|
||||
type: string;
|
||||
description: string;
|
||||
inspectionPlans: Array<InspectionPlanViewModel>;
|
||||
vehicleCount: number;
|
||||
}
|
||||
|
||||
export interface CreateVehicleTypeViewModel {
|
|
@ -1,5 +1,5 @@
|
|||
import type { MemberViewModel } from "@/viewmodels/admin/club/member/member.models";
|
||||
import type { WearableTypeViewModel } from "../wearableType/wearableType.models";
|
||||
import type { WearableTypeViewModel } from "./wearableType.models";
|
||||
|
||||
export interface WearableViewModel {
|
||||
id: string;
|
||||
|
|
|
@ -2,6 +2,7 @@ export interface WearableTypeViewModel {
|
|||
id: string;
|
||||
type: string;
|
||||
description: string;
|
||||
wearableCount: number;
|
||||
}
|
||||
|
||||
export interface CreateWearableTypeViewModel {
|
|
@ -74,9 +74,7 @@ import { useNewsletterRecipientsStore } from "@/stores/admin/club/newsletter/new
|
|||
import { useAbilityStore } from "@/stores/ability";
|
||||
import { useQueryStoreStore } from "@/stores/admin/configuration/queryStore";
|
||||
import { useQueryBuilderStore } from "@/stores/admin/club/queryBuilder";
|
||||
import cloneDeep from "lodash.clonedeep";
|
||||
import MemberSearchSelectMultiple from "@/components/search/MemberSearchSelectMultiple.vue";
|
||||
import MemberSearchSelect from "@/components/search/MemberSearchSelect.vue";
|
||||
import type { FieldType } from "@/types/dynamicQueries";
|
||||
import DoubleConfirmClick from "@/components/DoubleConfirmClick.vue";
|
||||
</script>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue