inspection create
This commit is contained in:
parent
ee700d9e02
commit
b359044cb5
12 changed files with 799 additions and 7 deletions
|
@ -8,7 +8,10 @@
|
|||
@search="(search) => {}"
|
||||
>
|
||||
<template #pageRow="{ row }: { row: InspectionViewModel }">
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-unit-inspection-execute', params: { inspection: row.id } }"
|
||||
class="flex flex-col h-fit w-full border border-primary rounded-md"
|
||||
>
|
||||
<div class="bg-primary p-2 text-white flex flex-row gap-2 items-center">
|
||||
<PencilSquareIcon v-if="row.isOpen" class="w-5 h-5" />
|
||||
<p>{{ row.inspectionPlan.title }} - {{ row.finished }}</p>
|
||||
|
@ -17,11 +20,19 @@
|
|||
<p v-if="row.context">Kontext: {{ row.context }}</p>
|
||||
<p v-if="row.nextInspection">nächste Inspektion: {{ row.nextInspection }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
</Pagination>
|
||||
<div class="flex flex-row gap-4">
|
||||
<button v-if="can('create', 'unit', 'equipment')" primary class="w-fit!" @click="">Prüfung durchführen</button>
|
||||
<RouterLink
|
||||
v-if="can('create', 'unit', 'equipment')"
|
||||
:to="{ name: 'admin-unit-inspection-plan', params: { type: 'equipment', relatedId: equipmentId } }"
|
||||
button
|
||||
primary
|
||||
class="w-fit!"
|
||||
@click=""
|
||||
>Prüfung durchführen</RouterLink
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
57
src/views/admin/unit/inspection/InspectionExecute.vue
Normal file
57
src/views/admin/unit/inspection/InspectionExecute.vue
Normal file
|
@ -0,0 +1,57 @@
|
|||
<template>
|
||||
<MainTemplate>
|
||||
<template #topBar>
|
||||
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
||||
<h1 class="font-bold text-xl h-8">Prüfung durchführen</h1>
|
||||
</div>
|
||||
</template>
|
||||
<template #diffMain>
|
||||
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
|
||||
<form class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto" @submit.prevent="">
|
||||
<div class="flex flex-row justify-end gap-2">
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-unit-inspection_plan' }"
|
||||
primary-outline
|
||||
button
|
||||
class="w-fit!"
|
||||
:disabled="status == 'loading' || status?.status == 'success'"
|
||||
>
|
||||
abbrechen
|
||||
</RouterLink>
|
||||
<button primary type="submit" class="w-fit!" :disabled="status == 'loading'">speichern</button>
|
||||
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
</MainTemplate>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapActions, mapState } from "pinia";
|
||||
import MainTemplate from "@/templates/Main.vue";
|
||||
import Spinner from "@/components/Spinner.vue";
|
||||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import ScanInput from "@/components/ScanInput.vue";
|
||||
import InspectionPlanSearchSelect from "@/components/search/InspectionPlanSearchSelect.vue";
|
||||
import EquipmentSearchSelect from "@/components/search/EquipmentSearchSelect.vue";
|
||||
import VehicleSearchSelect from "@/components/search/VehicleSearchSelect.vue";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
inspection: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||
timeout: null as any,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
111
src/views/admin/unit/inspection/InspectionPlan.vue
Normal file
111
src/views/admin/unit/inspection/InspectionPlan.vue
Normal file
|
@ -0,0 +1,111 @@
|
|||
<template>
|
||||
<MainTemplate>
|
||||
<template #topBar>
|
||||
<div class="flex flex-row items-center justify-between pt-5 pb-3 px-7">
|
||||
<h1 class="font-bold text-xl h-8">Prüfung erstellen</h1>
|
||||
</div>
|
||||
</template>
|
||||
<template #diffMain>
|
||||
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
|
||||
<form class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto" @submit.prevent="">
|
||||
<div class="flex flex-row">
|
||||
<div
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
class="w-1/2 p-0.5 first:pl-0 last:pr-0 cursor-pointer"
|
||||
@click="
|
||||
active = tab.key;
|
||||
related = '';
|
||||
inspectionPlan = '';
|
||||
"
|
||||
>
|
||||
<p
|
||||
:class="[
|
||||
'w-full rounded-lg py-2.5 text-sm text-center font-medium leading-5 focus:ring-0 outline-hidden',
|
||||
tab.key == active
|
||||
? 'bg-red-200 shadow-sm border-b-2 border-primary rounded-b-none'
|
||||
: ' hover:bg-red-200',
|
||||
]"
|
||||
>
|
||||
{{ tab.title }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<EquipmentSearchSelect v-if="active == 'equipment'" title="Gerät" useScanner v-model="related" />
|
||||
<VehicleSearchSelect v-else title="Fahrzeug" useScanner v-model="related" />
|
||||
|
||||
<InspectionPlanSearchSelect title="Prüfplan" :type="active" v-model="inspectionPlan" />
|
||||
|
||||
<div class="flex flex-row justify-end gap-2">
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-unit-inspection_plan' }"
|
||||
primary-outline
|
||||
button
|
||||
class="w-fit!"
|
||||
:disabled="status == 'loading' || status?.status == 'success'"
|
||||
>
|
||||
abbrechen
|
||||
</RouterLink>
|
||||
<button primary type="submit" class="w-fit!" :disabled="status == 'loading'">speichern</button>
|
||||
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
</MainTemplate>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { defineComponent, type PropType } from "vue";
|
||||
import { mapActions, mapState } from "pinia";
|
||||
import MainTemplate from "@/templates/Main.vue";
|
||||
import Spinner from "@/components/Spinner.vue";
|
||||
import SuccessCheckmark from "@/components/SuccessCheckmark.vue";
|
||||
import FailureXMark from "@/components/FailureXMark.vue";
|
||||
import ScanInput from "@/components/ScanInput.vue";
|
||||
import InspectionPlanSearchSelect from "@/components/search/InspectionPlanSearchSelect.vue";
|
||||
import EquipmentSearchSelect from "@/components/search/EquipmentSearchSelect.vue";
|
||||
import VehicleSearchSelect from "@/components/search/VehicleSearchSelect.vue";
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default defineComponent({
|
||||
props: {
|
||||
type: {
|
||||
type: String as PropType<"vehicle" | "equipment">,
|
||||
default: "equipment",
|
||||
},
|
||||
relatedId: String,
|
||||
inspectionPlanId: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
|
||||
timeout: null as any,
|
||||
related: "",
|
||||
inspectionPlan: "",
|
||||
active: "equipment" as "equipment" | "vehicle",
|
||||
tabs: [
|
||||
{
|
||||
key: "equipment",
|
||||
title: "Gerät",
|
||||
},
|
||||
{
|
||||
key: "vehicle",
|
||||
title: "Fahrzeug",
|
||||
},
|
||||
] as Array<{ key: "equipment" | "vehicle"; title: string }>,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
if (["vehicle", "equipment"].includes(this.type)) {
|
||||
this.active = this.type;
|
||||
this.inspectionPlan = this.inspectionPlanId ?? "";
|
||||
this.related = this.relatedId ?? "";
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
|
@ -138,7 +138,6 @@ export default defineComponent({
|
|||
this.active = queryType as "equipment" | "vehicle";
|
||||
this.selectedType = queryId as string;
|
||||
}
|
||||
console.log(query);
|
||||
},
|
||||
beforeUnmount() {
|
||||
try {
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
@search="(search) => {}"
|
||||
>
|
||||
<template #pageRow="{ row }: { row: InspectionViewModel }">
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-unit-inspection-execute', params: { inspection: row.id } }"
|
||||
class="flex flex-col h-fit w-full border border-primary rounded-md"
|
||||
>
|
||||
<div class="bg-primary p-2 text-white flex flex-row gap-2 items-center">
|
||||
<PencilSquareIcon v-if="row.isOpen" class="w-5 h-5" />
|
||||
<p>{{ row.inspectionPlan.title }} - {{ row.finished }}</p>
|
||||
|
@ -17,11 +20,19 @@
|
|||
<p v-if="row.context">Kontext: {{ row.context }}</p>
|
||||
<p v-if="row.nextInspection">nächste Inspektion: {{ row.nextInspection }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
</Pagination>
|
||||
<div class="flex flex-row gap-4">
|
||||
<button v-if="can('create', 'unit', 'vehicle')" primary class="w-fit!" @click="">Prüfung durchführen</button>
|
||||
<RouterLink
|
||||
v-if="can('create', 'unit', 'vehicle')"
|
||||
:to="{ name: 'admin-unit-inspection-plan', params: { type: 'vehicle', relatedId: vehicleId } }"
|
||||
button
|
||||
primary
|
||||
class="w-fit!"
|
||||
@click=""
|
||||
>Prüfung durchführen</RouterLink
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
:totalCount="totalCount"
|
||||
:indicateLoading="loading == 'loading'"
|
||||
useSearch
|
||||
useScanner
|
||||
@load-data="(offset, count, search) => fetchVehicles(offset, count, search)"
|
||||
@search="(search) => fetchVehicles(0, maxEntriesPerPage, search, true)"
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue