diff --git a/src/components/admin/unit/equipmentType/EquipmentTypeListItem.vue b/src/components/admin/unit/equipmentType/EquipmentTypeListItem.vue index f3f50a1..7859fe1 100644 --- a/src/components/admin/unit/equipmentType/EquipmentTypeListItem.vue +++ b/src/components/admin/unit/equipmentType/EquipmentTypeListItem.vue @@ -8,6 +8,12 @@ {{ equipmentType.type }}

+
+
+

Beschreibung:

+

{{ equipmentType.description }}

+
+
diff --git a/src/components/admin/unit/vehicleType/VehicleTypeListItem.vue b/src/components/admin/unit/vehicleType/VehicleTypeListItem.vue index b18a059..6b621ef 100644 --- a/src/components/admin/unit/vehicleType/VehicleTypeListItem.vue +++ b/src/components/admin/unit/vehicleType/VehicleTypeListItem.vue @@ -8,6 +8,12 @@ {{ vehicleType.type }}

+
+
+

Beschreibung:

+

{{ vehicleType.description }}

+
+
diff --git a/src/components/admin/unit/wearableType/WearableTypeListItem.vue b/src/components/admin/unit/wearableType/WearableTypeListItem.vue index ce86f5b..a6cb6b9 100644 --- a/src/components/admin/unit/wearableType/WearableTypeListItem.vue +++ b/src/components/admin/unit/wearableType/WearableTypeListItem.vue @@ -4,6 +4,23 @@

{{ wearableType.type }}

+
+ + + +
+ +
+
+ +
+
+

Beschreibung:

+

{{ wearableType.description }}

+
@@ -25,5 +42,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 + ); + }, + }, }); diff --git a/src/components/search/EquipmentSearchSelect.vue b/src/components/search/EquipmentSearchSelect.vue index 2f60486..6bd5683 100644 --- a/src/components/search/EquipmentSearchSelect.vue +++ b/src/components/search/EquipmentSearchSelect.vue @@ -59,7 +59,7 @@ }" > - {{ equipment.name }} + {{ equipment.name }} - Code: {{ equipment.code }} 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; diff --git a/src/components/search/VehicleSearchSelect.vue b/src/components/search/VehicleSearchSelect.vue index 5f19211..21de173 100644 --- a/src/components/search/VehicleSearchSelect.vue +++ b/src/components/search/VehicleSearchSelect.vue @@ -59,7 +59,7 @@ }" > - {{ vehicle.name }} + {{ vehicle.name }} - Code: {{ vehicle.code }} ({ ...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) => { @@ -66,13 +63,6 @@ export const useDamageReportStore = defineStore("damageReport", { fetchDamageReportById(id: string) { return http.get(`/admin/damageReport/${id}`); }, - async createDamageReport(damageReport: CreateDamageReportViewModel): Promise> { - const result = await http.post(`/admin/damageReport`, { - // TODO: data - }); - this.fetchDamageReports(); - return result; - }, async updateDamageReport(damageReport: UpdateDamageReportViewModel): Promise> { const result = await http.patch(`/admin/damageReport/${damageReport.id}`, { // TODO: data @@ -80,10 +70,5 @@ export const useDamageReportStore = defineStore("damageReport", { this.fetchDamageReports(); return result; }, - async deleteDamageReport(damageReport: number): Promise> { - const result = await http.delete(`/admin/damageReport/${damageReport}`); - this.fetchDamageReports(); - return result; - }, }, }); diff --git a/src/stores/admin/unit/equipment/damageReport.ts b/src/stores/admin/unit/equipment/damageReport.ts index afda1e8..eabf261 100644 --- a/src/stores/admin/unit/equipment/damageReport.ts +++ b/src/stores/admin/unit/equipment/damageReport.ts @@ -14,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; diff --git a/src/stores/admin/unit/equipment/equipment.ts b/src/stores/admin/unit/equipment/equipment.ts index 7550a23..67e92c0 100644 --- a/src/stores/admin/unit/equipment/equipment.ts +++ b/src/stores/admin/unit/equipment/equipment.ts @@ -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> { 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> { 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; diff --git a/src/stores/admin/unit/equipment/inspection.ts b/src/stores/admin/unit/equipment/inspection.ts index 3a3e715..adbe911 100644 --- a/src/stores/admin/unit/equipment/inspection.ts +++ b/src/stores/admin/unit/equipment/inspection.ts @@ -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 diff --git a/src/stores/admin/unit/equipmentType/equipmentType.ts b/src/stores/admin/unit/equipmentType/equipmentType.ts index c35b859..694e635 100644 --- a/src/stores/admin/unit/equipmentType/equipmentType.ts +++ b/src/stores/admin/unit/equipmentType/equipmentType.ts @@ -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> { 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> { 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> { const result = await http.post(`/admin/equipmentType`, { - // TODO: data + type: equipmentType.type, + description: equipmentType.description, }); this.fetchEquipmentTypes(); return result; }, async updateActiveEquipmentType(equipmentType: UpdateEquipmentTypeViewModel): Promise> { const result = await http.patch(`/admin/equipmentType/${equipmentType.id}`, { - // TODO: data + type: equipmentType.type, + description: equipmentType.description, }); this.fetchEquipmentTypes(); return result; diff --git a/src/stores/admin/unit/equipmentType/inspectionPlan.ts b/src/stores/admin/unit/equipmentType/inspectionPlan.ts index c412056..dc3b31f 100644 --- a/src/stores/admin/unit/equipmentType/inspectionPlan.ts +++ b/src/stores/admin/unit/equipmentType/inspectionPlan.ts @@ -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,12 +13,9 @@ 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}`) .then((result) => { this.inspectionPlans = result.data; this.loading = "fetched"; diff --git a/src/stores/admin/unit/inspection/inspection.ts b/src/stores/admin/unit/inspection/inspection.ts index 30b7b8b..abe1877 100644 --- a/src/stores/admin/unit/inspection/inspection.ts +++ b/src/stores/admin/unit/inspection/inspection.ts @@ -1,7 +1,6 @@ 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"; export const useInspectionStore = defineStore("inspection", { @@ -14,10 +13,6 @@ export const useInspectionStore = defineStore("inspection", { }, actions: { 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}`) @@ -34,14 +29,17 @@ export const useInspectionStore = defineStore("inspection", { }, async createInspection(inspection: any): Promise> { const result = await http.post(`/admin/inspection`, { - // TODO: data + context: "", + inspectionPlanId: "", + relatedId: "", + assigned: "equipment|vehicle", }); this.fetchInspectionByActiveId(); return result; }, async updateActiveInspection(inspection: any): Promise> { const result = await http.patch(`/admin/inspection/${inspection.id}`, { - // TODO: data + context: "", }); this.fetchInspectionByActiveId(); return result; diff --git a/src/stores/admin/unit/inspectionPlan/inspectionPlan.ts b/src/stores/admin/unit/inspectionPlan/inspectionPlan.ts index 02ab39d..78f4d73 100644 --- a/src/stores/admin/unit/inspectionPlan/inspectionPlan.ts +++ b/src/stores/admin/unit/inspectionPlan/inspectionPlan.ts @@ -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,12 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", { return { ...res, data: res.data.inspectionPlans }; }); }, - async getInspectionPlansByIds(ids: Array): Promise> { - return await http - .post(`/admin/inspectionPlan/ids`, { - ids, - }) - .then((res) => { - return { ...res, data: res.data.inspectionPlans }; - }); - }, async searchInspectionPlans(search: string): Promise> { return await http.get(`/admin/inspectionPlan?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 +70,20 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", { }, async createInspectionPlan(inspectionPlan: CreateInspectionPlanViewModel): Promise> { 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> { const result = await http.patch(`/admin/inspectionPlan/${inspectionPlan.id}`, { - // TODO: data + title: inspectionPlan.title, + inspectionInterval: inspectionPlan.inspectionInterval, + remindTime: inspectionPlan.remindTime, }); this.fetchInspectionPlans(); return result; diff --git a/src/stores/admin/unit/respiratoryGear/respiratoryGear.ts b/src/stores/admin/unit/respiratoryGear/respiratoryGear.ts index 2b2e548..a49110c 100644 --- a/src/stores/admin/unit/respiratoryGear/respiratoryGear.ts +++ b/src/stores/admin/unit/respiratoryGear/respiratoryGear.ts @@ -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}`) diff --git a/src/stores/admin/unit/respiratoryMission/respiratoryMission.ts b/src/stores/admin/unit/respiratoryMission/respiratoryMission.ts index cc890ed..3b511fd 100644 --- a/src/stores/admin/unit/respiratoryMission/respiratoryMission.ts +++ b/src/stores/admin/unit/respiratoryMission/respiratoryMission.ts @@ -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}`) diff --git a/src/stores/admin/unit/respiratoryWearer/respiratoryWearer.ts b/src/stores/admin/unit/respiratoryWearer/respiratoryWearer.ts index 6f17e98..cdf1181 100644 --- a/src/stores/admin/unit/respiratoryWearer/respiratoryWearer.ts +++ b/src/stores/admin/unit/respiratoryWearer/respiratoryWearer.ts @@ -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}`) diff --git a/src/stores/admin/unit/vehicle/damageReport.ts b/src/stores/admin/unit/vehicle/damageReport.ts index 7774732..29a470d 100644 --- a/src/stores/admin/unit/vehicle/damageReport.ts +++ b/src/stores/admin/unit/vehicle/damageReport.ts @@ -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; diff --git a/src/stores/admin/unit/vehicle/inspection.ts b/src/stores/admin/unit/vehicle/inspection.ts index 00314f2..23885b9 100644 --- a/src/stores/admin/unit/vehicle/inspection.ts +++ b/src/stores/admin/unit/vehicle/inspection.ts @@ -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; diff --git a/src/stores/admin/unit/vehicle/vehicle.ts b/src/stores/admin/unit/vehicle/vehicle.ts index 75e54f6..7138cea 100644 --- a/src/stores/admin/unit/vehicle/vehicle.ts +++ b/src/stores/admin/unit/vehicle/vehicle.ts @@ -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> { 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> { 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; diff --git a/src/stores/admin/unit/vehicleType/inspectionPlan.ts b/src/stores/admin/unit/vehicleType/inspectionPlan.ts index 9b6aa27..6f1c1c6 100644 --- a/src/stores/admin/unit/vehicleType/inspectionPlan.ts +++ b/src/stores/admin/unit/vehicleType/inspectionPlan.ts @@ -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,12 +14,9 @@ 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}`) .then((result) => { this.inspectionPlans = result.data; this.loading = "fetched"; diff --git a/src/stores/admin/unit/vehicleType/vehicleType.ts b/src/stores/admin/unit/vehicleType/vehicleType.ts index 257716f..9ec3904 100644 --- a/src/stores/admin/unit/vehicleType/vehicleType.ts +++ b/src/stores/admin/unit/vehicleType/vehicleType.ts @@ -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> { 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> { 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> { const result = await http.post(`/admin/vehicleType`, { - // TODO: data + type: vehicleType.type, + description: vehicleType.description, }); this.fetchVehicleTypes(); return result; }, async updateActiveVehicleType(vehicleType: UpdateVehicleTypeViewModel): Promise> { const result = await http.patch(`/admin/vehicleType/${vehicleType.id}`, { - // TODO: data + type: vehicleType.type, + description: vehicleType.description, }); this.fetchVehicleTypes(); return result; diff --git a/src/stores/admin/unit/wearable/damageReport.ts b/src/stores/admin/unit/wearable/damageReport.ts index c4d067c..4cb2420 100644 --- a/src/stores/admin/unit/wearable/damageReport.ts +++ b/src/stores/admin/unit/wearable/damageReport.ts @@ -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; diff --git a/src/stores/admin/unit/wearable/wearable.ts b/src/stores/admin/unit/wearable/wearable.ts index 2b22f21..a25cc49 100644 --- a/src/stores/admin/unit/wearable/wearable.ts +++ b/src/stores/admin/unit/wearable/wearable.ts @@ -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> { 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> { 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; diff --git a/src/stores/admin/unit/wearableType/wearableType.ts b/src/stores/admin/unit/wearableType/wearableType.ts index 884f532..06b73a1 100644 --- a/src/stores/admin/unit/wearableType/wearableType.ts +++ b/src/stores/admin/unit/wearableType/wearableType.ts @@ -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: () => { @@ -18,17 +17,13 @@ export const useWearableTypeStore = defineStore("wearableType", { }, 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,12 +42,12 @@ export const useWearableTypeStore = defineStore("wearableType", { }, async getAllWearableTypes(): Promise> { 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> { return await http.get(`/admin/wearableType?search=${search}&noLimit=true`).then((res) => { - return { ...res, data: res.data.wearables }; + return { ...res, data: res.data.wearableTypes }; }); }, fetchWearableTypeById(id: string) { @@ -60,14 +55,16 @@ export const useWearableTypeStore = defineStore("wearableType", { }, async createWearableType(wearableType: CreateWearableTypeViewModel): Promise> { const result = await http.post(`/admin/wearableType`, { - // TODO: data + type: wearableType.type, + description: wearableType.description, }); this.fetchWearableTypes(); return result; }, async updateWearableType(wearableType: UpdateWearableTypeViewModel): Promise> { const result = await http.patch(`/admin/wearableType/${wearableType.id}`, { - // TODO: data + type: wearableType.type, + description: wearableType.description, }); this.fetchWearableTypes(); return result; diff --git a/src/viewmodels/admin/unit/inspection/inspection.models.ts b/src/viewmodels/admin/unit/inspection/inspection.models.ts index 6565377..3f65cad 100644 --- a/src/viewmodels/admin/unit/inspection/inspection.models.ts +++ b/src/viewmodels/admin/unit/inspection/inspection.models.ts @@ -34,6 +34,6 @@ export interface InspectionPointResultViewModel { inspectionId: string; inspectionVersionedPlanId: string; inspectionPointId: string; - inspectionPoint: InspectionPointViewModel; + inspectionPoint?: InspectionPointViewModel; value: string; } diff --git a/src/viewmodels/admin/unit/inspection/inspectionPlan.models.ts b/src/viewmodels/admin/unit/inspection/inspectionPlan.models.ts index c5b1043..4d7b9a9 100644 --- a/src/viewmodels/admin/unit/inspection/inspectionPlan.models.ts +++ b/src/viewmodels/admin/unit/inspection/inspectionPlan.models.ts @@ -1,6 +1,8 @@ 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"; export type PlanTimeDefinition = `${number}-${"d" | "m" | "y"}` | `${number}/${number | "*"}`; @@ -16,11 +18,11 @@ export type InspectionPlanViewModel = { } & ( | { assigned: "equipment"; - related: EquipmentViewModel; + related: EquipmentTypeViewModel; } | { assigned: "vehicle"; - related: VehicleViewModel; + related: VehicleTypeViewModel; } ); diff --git a/src/views/admin/unit/damageReport/DamageReportRouting.vue b/src/views/admin/unit/damageReport/DamageReportRouting.vue index 356e095..fdb9a49 100644 --- a/src/views/admin/unit/damageReport/DamageReportRouting.vue +++ b/src/views/admin/unit/damageReport/DamageReportRouting.vue @@ -51,14 +51,7 @@ export default defineComponent({ }; }, computed: { - ...mapState(useEquipmentStore, ["activeEquipmentObj"]), ...mapState(useAbilityStore, ["can"]), }, - mounted() { - this.fetchEquipmentByActiveId(); - }, - methods: { - ...mapActions(useEquipmentStore, ["fetchEquipmentByActiveId"]), - }, }); diff --git a/src/views/admin/unit/equipment/DamageReport.vue b/src/views/admin/unit/equipment/DamageReport.vue index fbe0f8d..aa2df0a 100644 --- a/src/views/admin/unit/equipment/DamageReport.vue +++ b/src/views/admin/unit/equipment/DamageReport.vue @@ -11,10 +11,11 @@
- -

{{ row.reported }} - {{ row.status }}

+ +

{{ row.reportedAt }} - {{ row.status }}

+

gemeldet von: {{ row.reportedBy }}

Beschreibung: {{ row.description }}

diff --git a/src/views/admin/unit/equipmentType/UpdateEquipmentType.vue b/src/views/admin/unit/equipmentType/UpdateEquipmentType.vue index 5d1af44..997e0be 100644 --- a/src/views/admin/unit/equipmentType/UpdateEquipmentType.vue +++ b/src/views/admin/unit/equipmentType/UpdateEquipmentType.vue @@ -9,12 +9,12 @@ >

Geräte-Typ bearbeiten

- - + +
- - + +
-

Prüfungspunkte

+

Prüfungspunkte:

+ keine Prüfpunkte enthalten
- - + + +
+
+ +
diff --git a/src/views/admin/unit/wearable/DamageReport.vue b/src/views/admin/unit/wearable/DamageReport.vue index 555a273..8f2600d 100644 --- a/src/views/admin/unit/wearable/DamageReport.vue +++ b/src/views/admin/unit/wearable/DamageReport.vue @@ -11,10 +11,11 @@
- -

{{ row.reported }} - {{ row.status }}

+ +

{{ row.reportedAt }} - {{ row.status }}

+

gemeldet von: {{ row.reportedBy }}

Beschreibung: {{ row.description }}

diff --git a/src/views/admin/unit/wearable/UpdateWearable.vue b/src/views/admin/unit/wearable/UpdateWearable.vue index 3811695..2bcccbf 100644 --- a/src/views/admin/unit/wearable/UpdateWearable.vue +++ b/src/views/admin/unit/wearable/UpdateWearable.vue @@ -17,7 +17,7 @@ - +
@@ -30,7 +30,9 @@ - + @@ -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";