view models and data structure

This commit is contained in:
Julian Krauser 2025-03-26 12:45:14 +01:00
parent 45fe7b34c3
commit 5faa4b7906
37 changed files with 157 additions and 516 deletions

View file

@ -1,16 +1,16 @@
<template>
<RouterLink
:to="{ name: 'admin-unit-damageReport-overview', params: { damageReportId: damageReport.id } }"
:to="{ name: 'admin-unit-damage_report-overview', params: { damageReportId: damageReport.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>
{{ damageReport.lastname }}, {{ damageReport.firstname }}
{{ damageReport.nameaffix ? `- ${damageReport.nameaffix}` : "" }}
{{ damageReport.affectedEquipment.name }}
</p>
</div>
<div class="p-2">
<p v-if="damageReport.internalId">ID: {{ damageReport.internalId }}</p>
<p v-if="damageReport.affectedEquipment">Code: {{ damageReport.affectedEquipment.code }}</p>
<p v-if="damageReport.description">Beschreibung: {{ damageReport.description }}</p>
</div>
</RouterLink>
</template>

View file

@ -100,7 +100,7 @@ import FailureXMark from "@/components/FailureXMark.vue";
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipmentType/equipment.models";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipment/equipment.models";
import { useSalutationStore } from "../../../../stores/admin/configuration/salutation";
import type { SalutationViewModel } from "../../../../viewmodels/admin/configuration/salutation.models";
</script>
@ -133,12 +133,10 @@ export default defineComponent({
if (!this.selectedSalutation) return;
let formData = e.target.elements;
let createEquipment: CreateEquipmentViewModel = {
salutationId: this.selectedSalutation.id,
firstname: formData.firstname.value,
lastname: formData.lastname.value,
nameaffix: formData.nameaffix.value,
birthdate: formData.birthdate.value,
internalId: formData.internalId.value,
code: "",
name: "",
location: "",
equipmentTypeId: "",
};
this.status = "loading";
this.createEquipment(createEquipment)

View file

@ -5,11 +5,11 @@
>
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
<p>
{{ equipment.lastname }}, {{ equipment.firstname }} {{ equipment.nameaffix ? `- ${equipment.nameaffix}` : "" }}
{{ equipment.name }}
</p>
</div>
<div class="p-2">
<p v-if="equipment.internalId">ID: {{ equipment.internalId }}</p>
<p v-if="equipment.code">Code: {{ equipment.code }}</p>
</div>
</RouterLink>
</template>
@ -18,7 +18,7 @@
import { defineComponent, type PropType } from "vue";
import { mapState, mapActions } from "pinia";
import { useAbilityStore } from "@/stores/ability";
import type { EquipmentViewModel } from "@/viewmodels/admin/unit/equipmentType/equipment.models";
import type { EquipmentViewModel } from "@/viewmodels/admin/unit/equipment/equipment.models";
</script>
<script lang="ts">

View file

@ -5,53 +5,6 @@
</div>
<br />
<form class="flex flex-col gap-4 py-2" @submit.prevent="triggerCreate">
<div>
<Listbox v-model="selectedSalutation" name="salutation" by="id">
<ListboxLabel>Anrede</ListboxLabel>
<div class="relative mt-1">
<ListboxButton
class="rounded-md shadow-sm 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-none focus:ring-0 focus:z-10 sm:text-sm resize-none"
>
<span class="block truncate w-full text-start"> {{ selectedSalutation?.salutation }}</span>
<span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
</span>
</ListboxButton>
<transition
leave-active-class="transition duration-100 ease-in"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<ListboxOptions
class="absolute mt-1 max-h-60 z-20 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm h-32 overflow-y-auto"
>
<ListboxOption
v-slot="{ active, selected }"
v-for="salutation in salutations"
:key="salutation.id"
:value="salutation"
as="template"
>
<li
:class="[
active ? 'bg-red-200 text-amber-900' : 'text-gray-900',
'relative cursor-default select-none py-2 pl-10 pr-4',
]"
>
<span :class="[selected ? 'font-medium' : 'font-normal', 'block truncate']">{{
salutation.salutation
}}</span>
<span v-if="selected" class="absolute inset-y-0 left-0 flex items-center pl-3 text-primary">
<CheckIcon class="h-5 w-5" aria-hidden="true" />
</span>
</li>
</ListboxOption>
</ListboxOptions>
</transition>
</div>
</Listbox>
</div>
<div>
<label for="firstname">Vorname</label>
<input type="text" id="firstname" required />
@ -100,7 +53,7 @@ import FailureXMark from "@/components/FailureXMark.vue";
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipmentType/equipment.models";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipment/equipment.models";
import { useSalutationStore } from "../../../../stores/admin/configuration/salutation";
import type { SalutationViewModel } from "../../../../viewmodels/admin/configuration/salutation.models";
</script>
@ -111,7 +64,6 @@ export default defineComponent({
return {
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
timeout: undefined as any,
selectedSalutation: null as null | SalutationViewModel,
};
},
computed: {
@ -130,15 +82,12 @@ export default defineComponent({
...mapActions(useEquipmentStore, ["createEquipment"]),
...mapActions(useSalutationStore, ["fetchSalutations"]),
triggerCreate(e: any) {
if (!this.selectedSalutation) return;
let formData = e.target.elements;
let createEquipment: CreateEquipmentViewModel = {
salutationId: this.selectedSalutation.id,
firstname: formData.firstname.value,
lastname: formData.lastname.value,
nameaffix: formData.nameaffix.value,
birthdate: formData.birthdate.value,
internalId: formData.internalId.value,
code: "",
name: "",
location: "",
equipmentTypeId: "",
};
this.status = "loading";
this.createEquipment(createEquipment)

View file

@ -1,16 +1,13 @@
<template>
<RouterLink
:to="{ name: 'admin-unit-equipment-overview', params: { equipmentId: equipment.id } }"
:to="{ name: 'admin-unit-equipment_type-overview', params: { equipmentTypeId: equipmentType.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>
{{ equipment.lastname }}, {{ equipment.firstname }} {{ equipment.nameaffix ? `- ${equipment.nameaffix}` : "" }}
{{ equipmentType.type }}
</p>
</div>
<div class="p-2">
<p v-if="equipment.internalId">ID: {{ equipment.internalId }}</p>
</div>
</RouterLink>
</template>
@ -18,13 +15,13 @@
import { defineComponent, type PropType } from "vue";
import { mapState, mapActions } from "pinia";
import { useAbilityStore } from "@/stores/ability";
import type { EquipmentViewModel } from "@/viewmodels/admin/unit/equipmentType/equipment.models";
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
</script>
<script lang="ts">
export default defineComponent({
props: {
equipment: { type: Object as PropType<EquipmentViewModel>, default: {} },
equipmentType: { type: Object as PropType<EquipmentTypeViewModel>, default: {} },
},
computed: {
...mapState(useAbilityStore, ["can"]),

View file

@ -100,7 +100,7 @@ import FailureXMark from "@/components/FailureXMark.vue";
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipmentType/equipment.models";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipment/equipment.models";
import { useSalutationStore } from "../../../../stores/admin/configuration/salutation";
import type { SalutationViewModel } from "../../../../viewmodels/admin/configuration/salutation.models";
</script>
@ -133,12 +133,10 @@ export default defineComponent({
if (!this.selectedSalutation) return;
let formData = e.target.elements;
let createEquipment: CreateEquipmentViewModel = {
salutationId: this.selectedSalutation.id,
firstname: formData.firstname.value,
lastname: formData.lastname.value,
nameaffix: formData.nameaffix.value,
birthdate: formData.birthdate.value,
internalId: formData.internalId.value,
code: "",
name: "",
location: "",
equipmentTypeId: "",
};
this.status = "loading";
this.createEquipment(createEquipment)

View file

@ -1,16 +1,15 @@
<template>
<RouterLink
:to="{ name: 'admin-unit-respiratoryGear-overview', params: { respiratoryGearId: respiratoryGear.id } }"
:to="{ name: 'admin-unit-respiratory_gear-overview', params: { respiratoryGearId: respiratoryGear.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>
{{ respiratoryGear.lastname }}, {{ respiratoryGear.firstname }}
{{ respiratoryGear.nameaffix ? `- ${respiratoryGear.nameaffix}` : "" }}
{{ respiratoryGear.equipment.name }}
</p>
</div>
<div class="p-2">
<p v-if="respiratoryGear.internalId">ID: {{ respiratoryGear.internalId }}</p>
<p v-if="respiratoryGear.equipment">Code: {{ respiratoryGear.equipment.code }}</p>
</div>
</RouterLink>
</template>

View file

@ -100,7 +100,7 @@ import FailureXMark from "@/components/FailureXMark.vue";
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipmentType/equipment.models";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipment/equipment.models";
import { useSalutationStore } from "../../../../stores/admin/configuration/salutation";
import type { SalutationViewModel } from "../../../../viewmodels/admin/configuration/salutation.models";
</script>
@ -133,12 +133,10 @@ export default defineComponent({
if (!this.selectedSalutation) return;
let formData = e.target.elements;
let createEquipment: CreateEquipmentViewModel = {
salutationId: this.selectedSalutation.id,
firstname: formData.firstname.value,
lastname: formData.lastname.value,
nameaffix: formData.nameaffix.value,
birthdate: formData.birthdate.value,
internalId: formData.internalId.value,
code: "",
name: "",
location: "",
equipmentTypeId: "",
};
this.status = "loading";
this.createEquipment(createEquipment)

View file

@ -1,16 +1,13 @@
<template>
<RouterLink
:to="{ name: 'admin-unit-respiratoryMission-overview', params: { respiratoryMissionId: respiratoryMission.id } }"
:to="{ name: 'admin-unit-respiratory_mission-overview', params: { respiratoryMissionId: respiratoryMission.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>
{{ respiratoryMission.lastname }}, {{ respiratoryMission.firstname }}
{{ respiratoryMission.nameaffix ? `- ${respiratoryMission.nameaffix}` : "" }}
</p>
<p>{{ respiratoryMission.title }} - {{ respiratoryMission.date }}</p>
</div>
<div class="p-2">
<p v-if="respiratoryMission.internalId">ID: {{ respiratoryMission.internalId }}</p>
<p v-if="respiratoryMission.description">{{ respiratoryMission.description }}</p>
</div>
</RouterLink>
</template>

View file

@ -100,7 +100,7 @@ import FailureXMark from "@/components/FailureXMark.vue";
import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue";
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid";
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipmentType/equipment.models";
import type { CreateEquipmentViewModel } from "@/viewmodels/admin/unit/equipment/equipment.models";
import { useSalutationStore } from "../../../../stores/admin/configuration/salutation";
import type { SalutationViewModel } from "../../../../viewmodels/admin/configuration/salutation.models";
</script>
@ -133,12 +133,10 @@ export default defineComponent({
if (!this.selectedSalutation) return;
let formData = e.target.elements;
let createEquipment: CreateEquipmentViewModel = {
salutationId: this.selectedSalutation.id,
firstname: formData.firstname.value,
lastname: formData.lastname.value,
nameaffix: formData.nameaffix.value,
birthdate: formData.birthdate.value,
internalId: formData.internalId.value,
code: "",
name: "",
location: "",
equipmentTypeId: "",
};
this.status = "loading";
this.createEquipment(createEquipment)

View file

@ -1,16 +1,16 @@
<template>
<RouterLink
:to="{ name: 'admin-unit-respiratoryWearer-overview', params: { respiratoryWearerId: respiratoryWearer.id } }"
:to="{ name: 'admin-unit-respiratory_wearer-overview', params: { respiratoryWearerId: respiratoryWearer.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>
{{ respiratoryWearer.lastname }}, {{ respiratoryWearer.firstname }}
{{ respiratoryWearer.nameaffix ? `- ${respiratoryWearer.nameaffix}` : "" }}
{{ respiratoryWearer.member.lastname }}, {{ respiratoryWearer.member.firstname }}
{{ respiratoryWearer.member.nameaffix ? `- ${respiratoryWearer.member.nameaffix}` : "" }}
</p>
</div>
<div class="p-2">
<p v-if="respiratoryWearer.internalId">ID: {{ respiratoryWearer.internalId }}</p>
<p v-if="respiratoryWearer.internalId">ID: {{ respiratoryWearer.member.internalId }}</p>
</div>
</RouterLink>
</template>

View file

@ -5,53 +5,6 @@
</div>
<br />
<form class="flex flex-col gap-4 py-2" @submit.prevent="triggerCreate">
<div>
<Listbox v-model="selectedSalutation" name="salutation" by="id">
<ListboxLabel>Anrede</ListboxLabel>
<div class="relative mt-1">
<ListboxButton
class="rounded-md shadow-sm 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-none focus:ring-0 focus:z-10 sm:text-sm resize-none"
>
<span class="block truncate w-full text-start"> {{ selectedSalutation?.salutation }}</span>
<span class="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
<ChevronUpDownIcon class="h-5 w-5 text-gray-400" aria-hidden="true" />
</span>
</ListboxButton>
<transition
leave-active-class="transition duration-100 ease-in"
leave-from-class="opacity-100"
leave-to-class="opacity-0"
>
<ListboxOptions
class="absolute mt-1 max-h-60 z-20 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm h-32 overflow-y-auto"
>
<ListboxOption
v-slot="{ active, selected }"
v-for="salutation in salutations"
:key="salutation.id"
:value="salutation"
as="template"
>
<li
:class="[
active ? 'bg-red-200 text-amber-900' : 'text-gray-900',
'relative cursor-default select-none py-2 pl-10 pr-4',
]"
>
<span :class="[selected ? 'font-medium' : 'font-normal', 'block truncate']">{{
salutation.salutation
}}</span>
<span v-if="selected" class="absolute inset-y-0 left-0 flex items-center pl-3 text-primary">
<CheckIcon class="h-5 w-5" aria-hidden="true" />
</span>
</li>
</ListboxOption>
</ListboxOptions>
</transition>
</div>
</Listbox>
</div>
<div>
<label for="firstname">Vorname</label>
<input type="text" id="firstname" required />
@ -111,7 +64,6 @@ export default defineComponent({
return {
status: null as null | "loading" | { status: "success" | "failed"; reason?: string },
timeout: undefined as any,
selectedSalutation: null as null | SalutationViewModel,
};
},
computed: {
@ -130,15 +82,9 @@ export default defineComponent({
...mapActions(useVehicleStore, ["createVehicle"]),
...mapActions(useSalutationStore, ["fetchSalutations"]),
triggerCreate(e: any) {
if (!this.selectedSalutation) return;
let formData = e.target.elements;
let createVehicle: CreateVehicleViewModel = {
salutationId: this.selectedSalutation.id,
firstname: formData.firstname.value,
lastname: formData.lastname.value,
nameaffix: formData.nameaffix.value,
birthdate: formData.birthdate.value,
internalId: formData.internalId.value,
name: "",
};
this.status = "loading";
this.createVehicle(createVehicle)

View file

@ -4,10 +4,7 @@
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>{{ vehicle.lastname }}, {{ vehicle.firstname }} {{ vehicle.nameaffix ? `- ${vehicle.nameaffix}` : "" }}</p>
</div>
<div class="p-2">
<p v-if="vehicle.internalId">ID: {{ vehicle.internalId }}</p>
<p>{{ vehicle.name }}</p>
</div>
</RouterLink>
</template>

View file

@ -68,24 +68,14 @@ export const useDamageReportStore = defineStore("damageReport", {
},
async createDamageReport(damageReport: CreateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/damageReport`, {
salutationId: damageReport.salutationId,
firstname: damageReport.firstname,
lastname: damageReport.lastname,
nameaffix: damageReport.nameaffix,
birthdate: damageReport.birthdate,
internalId: damageReport.internalId,
// TODO: data
});
this.fetchDamageReports();
return result;
},
async updateDamageReport(damageReport: UpdateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/damageReport/${damageReport.id}`, {
salutationId: damageReport.salutationId,
firstname: damageReport.firstname,
lastname: damageReport.lastname,
nameaffix: damageReport.nameaffix,
birthdate: damageReport.birthdate,
internalId: damageReport.internalId,
// TODO: data
});
this.fetchDamageReports();
return result;

View file

@ -2,9 +2,8 @@ import { defineStore } from "pinia";
import type {
EquipmentViewModel,
CreateEquipmentViewModel,
EquipmentStatisticsViewModel,
UpdateEquipmentViewModel,
} from "@/viewmodels/admin/unit/equipmentType/equipment.models";
} from "@/viewmodels/admin/unit/equipment/equipment.models";
import { http } from "@/serverCom";
import type { AxiosResponse } from "axios";
@ -16,7 +15,6 @@ export const useEquipmentStore = defineStore("equipment", {
loading: "loading" as "loading" | "fetched" | "failed",
activeEquipment: null as string | null,
activeEquipmentObj: null as EquipmentViewModel | null,
activeEquipmentStatistics: null as EquipmentStatisticsViewModel | null,
loadingActive: "loading" as "loading" | "fetched" | "failed",
};
},
@ -79,14 +77,6 @@ export const useEquipmentStore = defineStore("equipment", {
fetchEquipmentById(id: string) {
return http.get(`/admin/equipment/${id}`);
},
fetchEquipmentStatisticsByActiveId() {
http
.get(`/admin/equipment/${this.activeEquipment}/statistics`)
.then((res) => {
this.activeEquipmentStatistics = res.data;
})
.catch((err) => {});
},
async printEquipmentByActiveId() {
return http.get(`/admin/equipment/${this.activeEquipment}/print`, {
responseType: "blob",
@ -97,24 +87,14 @@ export const useEquipmentStore = defineStore("equipment", {
},
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/equipment`, {
salutationId: equipment.salutationId,
firstname: equipment.firstname,
lastname: equipment.lastname,
nameaffix: equipment.nameaffix,
birthdate: equipment.birthdate,
internalId: equipment.internalId,
// TODO: data
});
this.fetchEquipments();
return result;
},
async updateActiveEquipment(equipment: UpdateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/equipment/${equipment.id}`, {
salutationId: equipment.salutationId,
firstname: equipment.firstname,
lastname: equipment.lastname,
nameaffix: equipment.nameaffix,
birthdate: equipment.birthdate,
internalId: equipment.internalId,
// TODO: data
});
this.fetchEquipments();
return result;

View file

@ -3,7 +3,7 @@ import type {
EquipmentTypeViewModel,
CreateEquipmentTypeViewModel,
UpdateEquipmentTypeViewModel,
} from "@/viewmodels/admin/unit/equipmentType.models";
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
import { http } from "@/serverCom";
import type { AxiosResponse } from "axios";
@ -79,24 +79,14 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
},
async createEquipmentType(equipmentType: CreateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/equipmentType`, {
salutationId: equipmentType.salutationId,
firstname: equipmentType.firstname,
lastname: equipmentType.lastname,
nameaffix: equipmentType.nameaffix,
birthdate: equipmentType.birthdate,
internalId: equipmentType.internalId,
// TODO: data
});
this.fetchEquipmentTypes();
return result;
},
async updateActiveEquipmentType(equipmentType: UpdateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/equipmentType/${equipmentType.id}`, {
salutationId: equipmentType.salutationId,
firstname: equipmentType.firstname,
lastname: equipmentType.lastname,
nameaffix: equipmentType.nameaffix,
birthdate: equipmentType.birthdate,
internalId: equipmentType.internalId,
// TODO: data
});
this.fetchEquipmentTypes();
return result;

View file

@ -87,12 +87,7 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
},
async createRespiratoryGear(respiratoryGear: CreateRespiratoryGearViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/respiratoryGear`, {
salutationId: respiratoryGear.salutationId,
firstname: respiratoryGear.firstname,
lastname: respiratoryGear.lastname,
nameaffix: respiratoryGear.nameaffix,
birthdate: respiratoryGear.birthdate,
internalId: respiratoryGear.internalId,
// TODO: data
});
this.fetchRespiratoryGears();
return result;
@ -101,12 +96,7 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
respiratoryGear: UpdateRespiratoryGearViewModel
): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/respiratoryGear/${respiratoryGear.id}`, {
salutationId: respiratoryGear.salutationId,
firstname: respiratoryGear.firstname,
lastname: respiratoryGear.lastname,
nameaffix: respiratoryGear.nameaffix,
birthdate: respiratoryGear.birthdate,
internalId: respiratoryGear.internalId,
// TODO: data
});
this.fetchRespiratoryGears();
return result;

View file

@ -93,12 +93,7 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
respiratoryMission: CreateRespiratoryMissionViewModel
): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/respiratoryMission`, {
salutationId: respiratoryMission.salutationId,
firstname: respiratoryMission.firstname,
lastname: respiratoryMission.lastname,
nameaffix: respiratoryMission.nameaffix,
birthdate: respiratoryMission.birthdate,
internalId: respiratoryMission.internalId,
// TODO: data
});
this.fetchRespiratoryMissions();
return result;
@ -107,12 +102,7 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
respiratoryMission: UpdateRespiratoryMissionViewModel
): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/respiratoryMission/${respiratoryMission.id}`, {
salutationId: respiratoryMission.salutationId,
firstname: respiratoryMission.firstname,
lastname: respiratoryMission.lastname,
nameaffix: respiratoryMission.nameaffix,
birthdate: respiratoryMission.birthdate,
internalId: respiratoryMission.internalId,
// TODO: data
});
this.fetchRespiratoryMissions();
return result;

View file

@ -93,12 +93,7 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
respiratoryWearer: CreateRespiratoryWearerViewModel
): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/respiratoryWearer`, {
salutationId: respiratoryWearer.salutationId,
firstname: respiratoryWearer.firstname,
lastname: respiratoryWearer.lastname,
nameaffix: respiratoryWearer.nameaffix,
birthdate: respiratoryWearer.birthdate,
internalId: respiratoryWearer.internalId,
// TODO: data
});
this.fetchRespiratoryWearers();
return result;
@ -107,12 +102,7 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
respiratoryWearer: UpdateRespiratoryWearerViewModel
): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/respiratoryWearer/${respiratoryWearer.id}`, {
salutationId: respiratoryWearer.salutationId,
firstname: respiratoryWearer.firstname,
lastname: respiratoryWearer.lastname,
nameaffix: respiratoryWearer.nameaffix,
birthdate: respiratoryWearer.birthdate,
internalId: respiratoryWearer.internalId,
// TODO: data
});
this.fetchRespiratoryWearers();
return result;

View file

@ -2,7 +2,6 @@ import { defineStore } from "pinia";
import type {
VehicleViewModel,
CreateVehicleViewModel,
VehicleStatisticsViewModel,
UpdateVehicleViewModel,
} from "@/viewmodels/admin/unit/vehicle/vehicle.models";
import { http } from "@/serverCom";
@ -16,7 +15,6 @@ export const useVehicleStore = defineStore("vehicle", {
loading: "loading" as "loading" | "fetched" | "failed",
activeVehicle: null as string | null,
activeVehicleObj: null as VehicleViewModel | null,
activeVehicleStatistics: null as VehicleStatisticsViewModel | null,
loadingActive: "loading" as "loading" | "fetched" | "failed",
};
},
@ -79,14 +77,6 @@ export const useVehicleStore = defineStore("vehicle", {
fetchVehicleById(id: string) {
return http.get(`/admin/vehicle/${id}`);
},
fetchVehicleStatisticsByActiveId() {
http
.get(`/admin/vehicle/${this.activeVehicle}/statistics`)
.then((res) => {
this.activeVehicleStatistics = res.data;
})
.catch((err) => {});
},
async printVehicleByActiveId() {
return http.get(`/admin/vehicle/${this.activeVehicle}/print`, {
responseType: "blob",
@ -97,24 +87,14 @@ export const useVehicleStore = defineStore("vehicle", {
},
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.post(`/admin/vehicle`, {
salutationId: vehicle.salutationId,
firstname: vehicle.firstname,
lastname: vehicle.lastname,
nameaffix: vehicle.nameaffix,
birthdate: vehicle.birthdate,
internalId: vehicle.internalId,
// TODO: data
});
this.fetchVehicles();
return result;
},
async updateActiveVehicle(vehicle: UpdateVehicleViewModel): Promise<AxiosResponse<any, any>> {
const result = await http.patch(`/admin/vehicle/${vehicle.id}`, {
salutationId: vehicle.salutationId,
firstname: vehicle.firstname,
lastname: vehicle.lastname,
nameaffix: vehicle.nameaffix,
birthdate: vehicle.birthdate,
internalId: vehicle.internalId,
// TODO: data
});
this.fetchVehicles();
return result;

View file

@ -1,39 +1,20 @@
import type { EquipmentViewModel } from "../equipment/equipment.models";
export interface DamageReportViewModel {
id: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface DamageReportStatisticsViewModel {
id: string;
salutation: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
todayAge: number;
ageThisYear: number;
exactAge: string;
reported: Date;
status: string;
description: string;
affectedEquipmentId: string;
affectedEquipment: EquipmentViewModel;
}
export interface CreateDamageReportViewModel {
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
description: string;
affectedEquipmentId: string;
}
export interface UpdateDamageReportViewModel {
id: string;
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
status: string;
}

View file

@ -0,0 +1,25 @@
import type { EquipmentTypeViewModel } from "../equipmentType/equipmentType.models";
export interface EquipmentViewModel {
id: string;
code: string;
name: string;
location: string;
equipmentTypeId: string;
equipmentType: EquipmentTypeViewModel;
}
export interface CreateEquipmentViewModel {
code: string;
name: string;
location: string;
equipmentTypeId: string;
}
export interface UpdateEquipmentViewModel {
id: string;
code: string;
name: string;
location: string;
equipmentTypeId: string;
}

View file

@ -1,39 +0,0 @@
export interface EquipmentTypeViewModel {
id: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface EquipmentTypeStatisticsViewModel {
id: string;
salutation: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
todayAge: number;
ageThisYear: number;
exactAge: string;
}
export interface CreateEquipmentTypeViewModel {
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface UpdateEquipmentTypeViewModel {
id: string;
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}

View file

@ -1,39 +0,0 @@
export interface EquipmentViewModel {
id: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface EquipmentStatisticsViewModel {
id: string;
salutation: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
todayAge: number;
ageThisYear: number;
exactAge: string;
}
export interface CreateEquipmentViewModel {
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface UpdateEquipmentViewModel {
id: string;
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}

View file

@ -0,0 +1,20 @@
export interface EquipmentTypeViewModel {
id: string;
type: string;
description: string;
inspectionInterval: `${number}${"d" | "m" | "y"}`;
// attached inspection plans
}
export interface CreateEquipmentTypeViewModel {
type: string;
description: string;
inspectionInterval: `${number}${"d" | "m" | "y"}`;
}
export interface UpdateEquipmentTypeViewModel {
id: string;
type: string;
description: string;
inspectionInterval: `${number}${"d" | "m" | "y"}`;
}

View file

@ -1,39 +1,16 @@
import type { EquipmentViewModel } from "../equipment/equipment.models";
export interface RespiratoryGearViewModel {
id: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface RespiratoryGearStatisticsViewModel {
id: string;
salutation: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
todayAge: number;
ageThisYear: number;
exactAge: string;
equipmentId: string;
equipment: EquipmentViewModel;
}
export interface CreateRespiratoryGearViewModel {
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
equipmentId: string;
}
export interface UpdateRespiratoryGearViewModel {
id: string;
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
equipmentId: string;
}

View file

@ -1,39 +1,20 @@
export interface RespiratoryMissionViewModel {
id: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface RespiratoryMissionStatisticsViewModel {
id: string;
salutation: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
todayAge: number;
ageThisYear: number;
exactAge: string;
date: Date;
title: string;
description: string;
// refs to used respiratory gear and wearers
}
export interface CreateRespiratoryMissionViewModel {
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
date: Date;
title: string;
description: string;
}
export interface UpdateRespiratoryMissionViewModel {
id: string;
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
date: Date;
title: string;
description: string;
}

View file

@ -1,39 +1,16 @@
import type { MemberViewModel } from "../../club/member/member.models";
export interface RespiratoryWearerViewModel {
id: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface RespiratoryWearerStatisticsViewModel {
id: string;
salutation: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
todayAge: number;
ageThisYear: number;
exactAge: string;
memberId: string;
member: MemberViewModel;
}
export interface CreateRespiratoryWearerViewModel {
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
memberId: string;
}
export interface UpdateRespiratoryWearerViewModel {
id: string;
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
memberId: string;
}

View file

@ -1,39 +1,13 @@
export interface VehicleViewModel {
id: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
}
export interface VehicleStatisticsViewModel {
id: string;
salutation: string;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
todayAge: number;
ageThisYear: number;
exactAge: string;
name: string;
}
export interface CreateVehicleViewModel {
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
name: string;
}
export interface UpdateVehicleViewModel {
id: string;
salutationId: number;
firstname: string;
lastname: string;
nameaffix: string;
birthdate: Date;
internalId?: string;
name: string;
}

View file

@ -7,12 +7,12 @@
</template>
<template #diffMain>
<div class="flex flex-col w-full h-full gap-2 justify-center px-7">
<div class="w-full flex flex-row max-lg:flex-wrap justify-center">
<div class="w-full flex flex-row justify-center">
<div
v-for="tab in tabs"
:key="tab.route"
@click="isActive = tab.route"
class="w-1/2 md:w-1/3 lg:w-full p-0.5 first:pl-0 last:pr-0 cursor-pointer"
class="w-full p-0.5 first:pl-0 last:pr-0 cursor-pointer"
>
<p
:class="[
@ -58,10 +58,10 @@ export default defineComponent({
data() {
return {
tabs: [
{ route: "overview", title: "offen" },
{ route: "membership", title: "bearbeitet" },
{ route: "open", title: "offen" },
{ route: "done", title: "bearbeitet" },
],
isActive: "overview",
isActive: "open",
currentPage: 0,
maxEntriesPerPage: 25,
};

View file

@ -39,7 +39,7 @@ import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
import { useModalStore } from "@/stores/modal";
import Pagination from "@/components/Pagination.vue";
import { useAbilityStore } from "@/stores/ability";
import type { EquipmentViewModel } from "../../../../viewmodels/admin/unit/equipmentType/equipment.models";
import type { EquipmentViewModel } from "../../../../viewmodels/admin/unit/equipment/equipment.models";
import EquipmentListItem from "../../../../components/admin/unit/equipment/EquipmentListItem.vue";
</script>

View file

@ -6,7 +6,7 @@
<template #topBar>
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
<h1 class="font-bold text-xl h-8 min-h-fit grow">
{{ activeEquipmentObj?.lastname }}, {{ activeEquipmentObj?.firstname }}
{{ activeEquipmentObj?.name }}
</h1>
<RouterLink v-if="can('update', 'unit', 'equipment')" :to="{ name: 'admin-unit-equipment-edit' }">

View file

@ -38,7 +38,7 @@ import { useEquipmentTypeStore } from "@/stores/admin/unit/equipmentType/equipme
import { useModalStore } from "@/stores/modal";
import Pagination from "@/components/Pagination.vue";
import { useAbilityStore } from "@/stores/ability";
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType.models";
import type { EquipmentTypeViewModel } from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
import EquipmentTypeListItem from "@/components/admin/unit/equipmentType/EquipmentTypeListItem.vue";
</script>

View file

@ -6,7 +6,7 @@
<template #topBar>
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
<h1 class="font-bold text-xl h-8 min-h-fit grow">
{{ activeEquipmentTypeObj?.lastname }}, {{ activeEquipmentTypeObj?.firstname }}
{{ activeEquipmentTypeObj?.type }}
</h1>
<RouterLink v-if="can('update', 'unit', 'equipment_type')" :to="{ name: 'admin-unit-equipment_type-edit' }">

View file

@ -5,9 +5,7 @@
</template>
<template #topBar>
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
<h1 class="font-bold text-xl h-8 min-h-fit grow">
{{ activeRespiratoryGearObj?.lastname }}, {{ activeRespiratoryGearObj?.firstname }}
</h1>
<h1 class="font-bold text-xl h-8 min-h-fit grow">AGT-Gerät: {{ activeRespiratoryGearObj?.equipment.name }}</h1>
<RouterLink v-if="can('update', 'unit', 'respiratory_gear')" :to="{ name: 'admin-unit-respiratory_gear-edit' }">
<PencilIcon class="w-5 h-5" />

View file

@ -5,9 +5,7 @@
</template>
<template #topBar>
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
<h1 class="font-bold text-xl h-8 min-h-fit grow">
{{ activeRespiratoryMissionObj?.lastname }}, {{ activeRespiratoryMissionObj?.firstname }}
</h1>
<h1 class="font-bold text-xl h-8 min-h-fit grow">AGT-Einsatz: {{ activeRespiratoryMissionObj?.title }}</h1>
<RouterLink
v-if="can('update', 'unit', 'respiratory_mission')"

View file

@ -6,7 +6,8 @@
<template #topBar>
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
<h1 class="font-bold text-xl h-8 min-h-fit grow">
{{ activeRespiratoryWearerObj?.lastname }}, {{ activeRespiratoryWearerObj?.firstname }}
AGT-Träger: {{ activeRespiratoryWearerObj?.member.lastname }},
{{ activeRespiratoryWearerObj?.member.firstname }}
</h1>
<RouterLink