connect to backend

This commit is contained in:
Julian Krauser 2025-06-04 14:30:41 +02:00
parent 6c8d57a7e5
commit ddeac1aa26
41 changed files with 221 additions and 291 deletions

View file

@ -51,14 +51,7 @@ export default defineComponent({
};
},
computed: {
...mapState(useEquipmentStore, ["activeEquipmentObj"]),
...mapState(useAbilityStore, ["can"]),
},
mounted() {
this.fetchEquipmentByActiveId();
},
methods: {
...mapActions(useEquipmentStore, ["fetchEquipmentByActiveId"]),
},
});
</script>

View file

@ -11,10 +11,11 @@
<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 gap-2 items-center">
<PencilSquareIcon v-if="!row.done" class="w-5 h-5" />
<PhotoIcon v-if="row.providedImage" class="w-5 h-5" />
<p>{{ row.reported }} - {{ row.status }}</p>
<PhotoIcon v-if="row.imageCount != 0" class="w-5 h-5" />
<p>{{ row.reportedAt }} - {{ row.status }}</p>
</div>
<div class="p-2">
<p v-if="row.reportedBy">gemeldet von: {{ row.reportedBy }}</p>
<p>Beschreibung: {{ row.description }}</p>
</div>
</div>

View file

@ -9,12 +9,12 @@
>
<p class="mx-auto">Geräte-Typ bearbeiten</p>
<div>
<label for="name">Typ</label>
<input type="text" id="name" required v-model="equipmentType.type" />
<label for="type">Typ</label>
<input type="text" id="type" required v-model="equipmentType.type" />
</div>
<div>
<label for="location">Beschreibung</label>
<input type="text" id="location" v-model="equipmentType.description" />
<label for="description">Beschreibung</label>
<input type="text" id="description" v-model="equipmentType.description" />
</div>
<div class="flex flex-row justify-end gap-2">
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">

View file

@ -15,7 +15,7 @@
>
<div v-for="point in points" :key="point.title">
<OkNotOk
v-if="point.type == 'iO-niO'"
v-if="point.type == InspectionPointEnum.oknok"
:inspectionPoint="point"
:modelValue="boolPointResult(point.id)"
@update:model-value="(val) => updateCheckResult(point.id, val)"

View file

@ -147,8 +147,8 @@ export default defineComponent({
let formData = e.target.elements;
let createInspectionPlan: CreateInspectionPlanViewModel = {
title: formData.name.value,
inspectionInterval: formData.name.value,
remindTime: formData.name.value,
inspectionInterval: formData.interval.value,
remindTime: formData.remind.value,
relatedId: this.selectedType,
assigned: this.active,
};

View file

@ -10,8 +10,9 @@
<input type="text" id="interval" :value="activeInspectionPlanObj.inspectionInterval" reaonly />
</div>
</div>
<p>Prüfungspunkte</p>
<p>Prüfungspunkte:</p>
<div v-if="activeInspectionPlanObj?.inspectionPoints" class="flex flex-col gap-2 grow overflow-y-scroll">
<small v-if="activeInspectionPlanObj?.inspectionPoints.length == 0">keine Prüfpunkte enthalten</small>
<div
v-for="point in activeInspectionPlanObj?.inspectionPoints"
class="flex flex-col h-fit w-full border border-primary rounded-md"

View file

@ -13,8 +13,26 @@
<input type="text" id="name" required v-model="inspectionPlan.title" />
</div>
<div>
<label for="interval">Intervall (optional)</label>
<input type="text" id="interval" placeholder="<number>-(d|m|y) oder DD/MM" />
<label for="interval">Intervall</label>
<input
type="text"
id="interval"
placeholder="<zahl>-(d|m|y) oder DD/MM oder DD/*"
required
pattern="^\d+-(d|m|y)$|^\d{2}/\d{2}$|^\d{2}/\*$"
title="Eingabe muss im Format <zahl>-(d|m|y), DD/MM oder DD/* sein"
/>
</div>
<div>
<label for="remind">Erinnerung vor Fälligkeit</label>
<input
type="text"
id="remind"
placeholder="<zahl>-(d|m|y) oder DD/MM oder DD/*"
required
pattern="^\d+-(d|m|y)$|^\d{2}/\d{2}$|^\d{2}/\*$"
title="Eingabe muss im Format <zahl>-(d|m|y), DD/MM oder DD/* sein"
/>
</div>
<div class="flex flex-row justify-end gap-2">
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
@ -95,7 +113,8 @@ export default defineComponent({
let updateInspectionPlan: UpdateInspectionPlanViewModel = {
id: this.inspectionPlan.id,
title: formData.name.value,
inspectionInterval: formData.location.value || null,
inspectionInterval: formData.interval.value,
remindTime: formData.remind.value,
};
this.status = "loading";
this.updateActiveInspectionPlan(updateInspectionPlan)

View file

@ -11,10 +11,11 @@
<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 gap-2 items-center">
<PencilSquareIcon v-if="!row.done" class="w-5 h-5" />
<PhotoIcon v-if="row.providedImage" class="w-5 h-5" />
<p>{{ row.reported }} - {{ row.status }}</p>
<PhotoIcon v-if="row.imageCount != 0" class="w-5 h-5" />
<p>{{ row.reportedAt }} - {{ row.status }}</p>
</div>
<div class="p-2">
<p v-if="row.reportedBy">gemeldet von: {{ row.reportedBy }}</p>
<p>Beschreibung: {{ row.description }}</p>
</div>
</div>

View file

@ -9,12 +9,12 @@
>
<p class="mx-auto">Fahrzeug-Typ bearbeiten</p>
<div>
<label for="name">Typ</label>
<input type="text" id="name" required v-model="vehicleType.type" />
<label for="type">Typ</label>
<input type="text" id="type" required v-model="vehicleType.type" />
</div>
<div>
<label for="location">Beschreibung</label>
<input type="text" id="location" v-model="vehicleType.description" />
<label for="description">Beschreibung</label>
<input type="text" id="description" v-model="vehicleType.description" />
</div>
<div class="flex flex-row justify-end gap-2">
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">

View file

@ -17,7 +17,7 @@
<div class="flex flex-row gap-4">
<button v-if="can('create', 'unit', 'vehicle_type')" primary class="w-fit!" @click="openCreateModal">
Geräte-Typ erstellen
Fahrzeug-Typ erstellen
</button>
</div>
</div>

View file

@ -11,10 +11,11 @@
<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 gap-2 items-center">
<PencilSquareIcon v-if="!row.done" class="w-5 h-5" />
<PhotoIcon v-if="row.providedImage" class="w-5 h-5" />
<p>{{ row.reported }} - {{ row.status }}</p>
<PhotoIcon v-if="row.imageCount != 0" class="w-5 h-5" />
<p>{{ row.reportedAt }} - {{ row.status }}</p>
</div>
<div class="p-2">
<p v-if="row.reportedBy">gemeldet von: {{ row.reportedBy }}</p>
<p>Beschreibung: {{ row.description }}</p>
</div>
</div>

View file

@ -17,7 +17,7 @@
<label for="location">Verortung (optional)</label>
<input type="text" id="location" v-model="wearable.location" />
</div>
<MemberSearchSelectMultiple title="Träger (optional)" />
<MemberSearchSelectSingle title="Träger (optional)" v-model="wearable.wearerId" />
<div>
<label for="commissioned">In-Betrieb-Nahme</label>
<input type="date" id="commissioned" required v-model="wearable.commissioned" />
@ -30,7 +30,9 @@
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
abbrechen
</button>
<button primary type="submit" class="w-fit!" :disabled="status == 'loading'">speichern</button>
<button primary type="submit" class="w-fit!" :disabled="status == 'loading' || canSaveOrReset">
speichern
</button>
<Spinner v-if="status == 'loading'" class="my-auto" />
<SuccessCheckmark v-else-if="status?.status == 'success'" />
<FailureXMark v-else-if="status?.status == 'failed'" />
@ -54,7 +56,7 @@ import FailureXMark from "@/components/FailureXMark.vue";
import ScanInput from "@/components/ScanInput.vue";
import isEqual from "lodash.isequal";
import cloneDeep from "lodash.clonedeep";
import MemberSearchSelectMultiple from "@/components/search/MemberSearchSelectMultiple.vue";
import MemberSearchSelectSingle from "@/components/search/MemberSearchSelectSingle.vue";
</script>
<script lang="ts">
@ -109,7 +111,8 @@ export default defineComponent({
name: formData.name.value,
location: formData.location.value,
commissioned: formData.commissioned.value,
decommissioned: formData.decommissioned.value ?? null,
decommissioned: formData.decommissioned.value || null,
wearerId: this.wearable.wearerId,
};
this.status = "loading";
this.updateActiveWearable(updateWearable)

View file

@ -1,37 +1,43 @@
<template>
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
<Spinner v-if="loading == 'loading'" class="mx-auto" />
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
<form
v-else-if="wearableType != null"
class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto"
@submit.prevent="triggerUpdate"
>
<p class="mx-auto">Kleidungstyp bearbeiten</p>
<div>
<label for="name">Bezeichnung</label>
<input type="text" id="name" required v-model="wearableType.type" />
</div>
<div>
<label for="description">Beschreibung (optional)</label>
<input type="text" id="description" v-model="wearableType.description" />
</div>
<div class="flex flex-row justify-end gap-2">
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
abbrechen
</button>
<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>
<MainTemplate :title="`Kleidungs-Typ ${origin?.type} - Daten bearbeiten`">
<template #headerInsert>
<RouterLink to="../" class="text-primary">zurück zur Liste (abbrechen)</RouterLink>
</template>
<template #main>
<Spinner v-if="loading == 'loading'" class="mx-auto" />
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
<form
v-else-if="wearableType != null"
class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto"
@submit.prevent="triggerUpdate"
>
<p class="mx-auto">Kleidungstyp bearbeiten</p>
<div>
<label for="type">Bezeichnung</label>
<input type="text" id="type" required v-model="wearableType.type" />
</div>
<div>
<label for="description">Beschreibung (optional)</label>
<input type="text" id="description" v-model="wearableType.description" />
</div>
<div class="flex flex-row justify-end gap-2">
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
abbrechen
</button>
<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>
</template>
</MainTemplate>
</template>
<script setup lang="ts">
import { defineComponent } from "vue";
import { mapActions, mapState } from "pinia";
import MainTemplate from "@/templates/Main.vue";
import { useWearableTypeStore } from "@/stores/admin/unit/wearableType/wearableType";
import type {
CreateWearableTypeViewModel,
@ -93,7 +99,7 @@ export default defineComponent({
let formData = e.target.elements;
let updateWearableType: UpdateWearableTypeViewModel = {
id: this.wearableType.id,
type: formData.name.value,
type: formData.type.value,
description: formData.description.value,
};
this.status = "loading";

View file

@ -17,7 +17,7 @@
<div class="flex flex-row gap-4">
<button v-if="can('create', 'unit', 'wearable_type')" primary class="w-fit!" @click="openCreateModal">
Geräte-Typ erstellen
Kleidungs-Typ erstellen
</button>
</div>
</div>