connect to backend
This commit is contained in:
parent
6c8d57a7e5
commit
ddeac1aa26
41 changed files with 221 additions and 291 deletions
|
@ -8,6 +8,12 @@
|
|||
{{ equipmentType.type }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col p-2">
|
||||
<div class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Beschreibung:</p>
|
||||
<p class="grow overflow-hidden">{{ equipmentType.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
{{ vehicleType.type }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-col p-2">
|
||||
<div class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Beschreibung:</p>
|
||||
<p class="grow overflow-hidden">{{ vehicleType.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -4,6 +4,23 @@
|
|||
<p>
|
||||
{{ wearableType.type }}
|
||||
</p>
|
||||
<div class="flex flex-row">
|
||||
<RouterLink
|
||||
v-if="can('update', 'unit', 'wearable_type')"
|
||||
:to="{ name: 'admin-unit-wearable_type-edit', params: { wearableTypeId: wearableType.id } }"
|
||||
>
|
||||
<PencilIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||
</RouterLink>
|
||||
<div v-if="can('delete', 'unit', 'wearable_type')" @click="openDeleteModal">
|
||||
<TrashIcon class="w-5 h-5 p-1 box-content cursor-pointer" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col p-2">
|
||||
<div class="flex flex-row gap-2">
|
||||
<p class="min-w-16">Beschreibung:</p>
|
||||
<p class="grow overflow-hidden">{{ wearableType.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -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
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
}"
|
||||
>
|
||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||
{{ equipment.name }}
|
||||
{{ equipment.name }}<span v-if="equipment.code"> - Code: {{ equipment.code }}</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="selected"
|
||||
|
|
|
@ -105,7 +105,7 @@ export default defineComponent({
|
|||
emits: ["update:model-value"],
|
||||
watch: {
|
||||
modelValue() {
|
||||
if (this.initialLoaded) return;
|
||||
//if (this.initialLoaded) return;
|
||||
this.initialLoaded = true;
|
||||
this.loadMemberInitial();
|
||||
},
|
||||
|
@ -162,7 +162,7 @@ export default defineComponent({
|
|||
return this.filtered.find((f) => f.id == id);
|
||||
},
|
||||
loadMemberInitial() {
|
||||
if (this.modelValue == "") return;
|
||||
if (this.modelValue == "" || this.modelValue == null) return;
|
||||
this.fetchMemberById(this.modelValue)
|
||||
.then((res) => {
|
||||
this.chosen = res.data;
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
}"
|
||||
>
|
||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
||||
{{ vehicle.name }}
|
||||
{{ vehicle.name }}<span v-if="vehicle.code"> - Code: {{ vehicle.code }}</span>
|
||||
</span>
|
||||
<span
|
||||
v-if="selected"
|
||||
|
|
|
@ -17,12 +17,9 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
},
|
||||
actions: {
|
||||
fetchDamageReports(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.damageReports = damageReportDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
//TODO enable fetch of done reports
|
||||
http
|
||||
.get(`/admin/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
|
@ -66,13 +63,6 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
fetchDamageReportById(id: string) {
|
||||
return http.get(`/admin/damageReport/${id}`);
|
||||
},
|
||||
async createDamageReport(damageReport: CreateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/damageReport`, {
|
||||
// TODO: data
|
||||
});
|
||||
this.fetchDamageReports();
|
||||
return result;
|
||||
},
|
||||
async updateDamageReport(damageReport: UpdateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/damageReport/${damageReport.id}`, {
|
||||
// TODO: data
|
||||
|
@ -80,10 +70,5 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
this.fetchDamageReports();
|
||||
return result;
|
||||
},
|
||||
async deleteDamageReport(damageReport: number): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.delete(`/admin/damageReport/${damageReport}`);
|
||||
this.fetchDamageReports();
|
||||
return result;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/equipment/equipment.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentDemoData } from "@/demodata/equipment";
|
||||
|
||||
export const useEquipmentStore = defineStore("equipment", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
},
|
||||
actions: {
|
||||
fetchEquipments(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.equipments = equipmentDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.equipments.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.equipments = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -68,9 +63,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
});
|
||||
},
|
||||
fetchEquipmentByActiveId() {
|
||||
this.activeEquipmentObj = equipmentDemoData.find((e) => e.id == this.activeEquipment) as EquipmentViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipment/${this.activeEquipment}`)
|
||||
|
@ -87,14 +79,22 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
},
|
||||
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipment`, {
|
||||
// TODO: data
|
||||
equipmentTypeId: equipment.equipmentTypeId,
|
||||
name: equipment.name,
|
||||
code: equipment.code,
|
||||
location: equipment.location,
|
||||
commissioned: equipment.commissioned,
|
||||
});
|
||||
this.fetchEquipments();
|
||||
return result;
|
||||
},
|
||||
async updateActiveEquipment(equipment: UpdateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/equipment/${equipment.id}`, {
|
||||
// TODO: data
|
||||
name: equipment.name,
|
||||
code: equipment.code,
|
||||
location: equipment.location,
|
||||
commissioned: equipment.commissioned,
|
||||
decommissioned: equipment.decommissioned,
|
||||
});
|
||||
this.fetchEquipments();
|
||||
return result;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
||||
import { useEquipmentStore } from "./equipment";
|
||||
|
||||
export const useEquipmentInspectionStore = defineStore("equipmentInspection", {
|
||||
|
@ -13,20 +12,12 @@ export const useEquipmentInspectionStore = defineStore("equipmentInspection", {
|
|||
};
|
||||
},
|
||||
actions: {
|
||||
fetchInspectionForEquipment(offset = 0, count = 25, search = "", clear = false) {
|
||||
fetchInspectionForEquipment(offset = 0, count = 25, clear = false) {
|
||||
const equipmentId = useEquipmentStore().activeEquipment;
|
||||
this.inspections = inspectionDemoData
|
||||
.filter((idd) => idd.relatedId == equipmentId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.inspections.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.inspections = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/equipment/${equipmentId}/inspection?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.get(`/admin/inspection/equipment/${equipmentId}?offset=${offset}&count=${count}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.inspections
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
EquipmentTypeViewModel,
|
||||
CreateEquipmentTypeViewModel,
|
||||
UpdateEquipmentTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
} from "@/viewmodels/admin/unit/equipment/equipmentType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentTypeDemoData } from "@/demodata/equipmentType";
|
||||
|
||||
export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||
state: () => {
|
||||
|
@ -21,17 +20,13 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
actions: {
|
||||
fetchEquipmentTypes(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.equipmentTypes = equipmentTypeDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.equipmentTypes.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.equipmentTypes = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/equipmentType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.equipments
|
||||
result.data.equipmentTypes
|
||||
.filter((elem: EquipmentTypeViewModel) => this.equipmentTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||
.map((elem: EquipmentTypeViewModel, index: number): EquipmentTypeViewModel & { tab_pos: number } => {
|
||||
return {
|
||||
|
@ -50,20 +45,15 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
async getAllEquipmentTypes(): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/equipmentType?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.equipments };
|
||||
return { ...res, data: res.data.equipmentTypes };
|
||||
});
|
||||
},
|
||||
async searchEquipmentTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/equipmentType?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.equipments };
|
||||
return { ...res, data: res.data.equipmentTypes };
|
||||
});
|
||||
},
|
||||
fetchEquipmentTypeByActiveId() {
|
||||
this.activeEquipmentTypeObj = equipmentTypeDemoData.find(
|
||||
(e) => e.id == this.activeEquipmentType
|
||||
) as EquipmentTypeViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipmentType/${this.activeEquipmentType}`)
|
||||
|
@ -80,14 +70,16 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
},
|
||||
async createEquipmentType(equipmentType: CreateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipmentType`, {
|
||||
// TODO: data
|
||||
type: equipmentType.type,
|
||||
description: equipmentType.description,
|
||||
});
|
||||
this.fetchEquipmentTypes();
|
||||
return result;
|
||||
},
|
||||
async updateActiveEquipmentType(equipmentType: UpdateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/equipmentType/${equipmentType.id}`, {
|
||||
// TODO: data
|
||||
type: equipmentType.type,
|
||||
description: equipmentType.description,
|
||||
});
|
||||
this.fetchEquipmentTypes();
|
||||
return result;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type {
|
||||
EquipmentTypeViewModel,
|
||||
CreateEquipmentTypeViewModel,
|
||||
UpdateEquipmentTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentTypeDemoData } from "@/demodata/equipmentType";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { useEquipmentTypeStore } from "./equipmentType";
|
||||
|
||||
export const useEquipmentTypeInspectionPlanStore = defineStore("equipmentTypeInspectionPlan", {
|
||||
|
@ -21,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";
|
||||
|
|
|
@ -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<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/inspection`, {
|
||||
// TODO: data
|
||||
context: "",
|
||||
inspectionPlanId: "",
|
||||
relatedId: "",
|
||||
assigned: "equipment|vehicle",
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
},
|
||||
async updateActiveInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspection/${inspection.id}`, {
|
||||
// TODO: data
|
||||
context: "",
|
||||
});
|
||||
this.fetchInspectionByActiveId();
|
||||
return result;
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
InspectionPlanViewModel,
|
||||
CreateInspectionPlanViewModel,
|
||||
UpdateInspectionPlanViewModel,
|
||||
} from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
} from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
||||
|
||||
export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
|||
},
|
||||
actions: {
|
||||
fetchInspectionPlans(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.inspectionPlans = inspectionPlanDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.inspectionPlans.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.inspectionPlans = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -53,26 +48,12 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
|||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
async getInspectionPlansByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/inspectionPlan/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
async searchInspectionPlans(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/inspectionPlan?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.inspectionPlans };
|
||||
});
|
||||
},
|
||||
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<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/inspectionPlan`, {
|
||||
// TODO: data
|
||||
title: inspectionPlan.title,
|
||||
inspectionInterval: inspectionPlan.inspectionInterval,
|
||||
remindTime: inspectionPlan.remindTime,
|
||||
relatedId: inspectionPlan.relatedId,
|
||||
assigned: inspectionPlan.assigned,
|
||||
});
|
||||
this.fetchInspectionPlans();
|
||||
return result;
|
||||
},
|
||||
async updateActiveInspectionPlan(inspectionPlan: UpdateInspectionPlanViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/inspectionPlan/${inspectionPlan.id}`, {
|
||||
// TODO: data
|
||||
title: inspectionPlan.title,
|
||||
inspectionInterval: inspectionPlan.inspectionInterval,
|
||||
remindTime: inspectionPlan.remindTime,
|
||||
});
|
||||
this.fetchInspectionPlans();
|
||||
return result;
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
RespiratoryGearViewModel,
|
||||
CreateRespiratoryGearViewModel,
|
||||
UpdateRespiratoryGearViewModel,
|
||||
} from "@/viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
||||
} from "@/viewmodels/admin/unit/respiratory/respiratoryGear.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryGearDemoData } from "@/demodata/respiratoryGear";
|
||||
|
||||
export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryGears(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryGears = respiratoryGearDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryGears.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryGears = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -59,11 +54,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
});
|
||||
},
|
||||
fetchRespiratoryGearByActiveId() {
|
||||
this.activeRespiratoryGearObj = respiratoryGearDemoData.find(
|
||||
(e) => e.id == this.activeRespiratoryGear
|
||||
) as RespiratoryGearViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryGear/${this.activeRespiratoryGear}`)
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
RespiratoryMissionViewModel,
|
||||
CreateRespiratoryMissionViewModel,
|
||||
UpdateRespiratoryMissionViewModel,
|
||||
} from "@/viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
||||
} from "@/viewmodels/admin/unit/respiratory/respiratoryMission.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryMissionDemoData } from "@/demodata/respiratoryMission";
|
||||
|
||||
export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryMissions(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryMissions = respiratoryMissionDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryMissions.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryMissions = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -63,11 +58,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
});
|
||||
},
|
||||
fetchRespiratoryMissionByActiveId() {
|
||||
this.activeRespiratoryMissionObj = this.respiratoryMissions.find(
|
||||
(e) => e.id == this.activeRespiratoryMission
|
||||
) as RespiratoryMissionViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryMission/${this.activeRespiratoryMission}`)
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
RespiratoryWearerViewModel,
|
||||
CreateRespiratoryWearerViewModel,
|
||||
UpdateRespiratoryWearerViewModel,
|
||||
} from "@/viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
||||
} from "@/viewmodels/admin/unit/respiratory/respiratoryWearer.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryWearerDemoData } from "@/demodata/respiratoryWearer";
|
||||
|
||||
export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
},
|
||||
actions: {
|
||||
fetchRespiratoryWearers(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.respiratoryWearers = respiratoryWearerDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.respiratoryWearers.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.respiratoryWearers = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -63,11 +58,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
});
|
||||
},
|
||||
fetchRespiratoryWearerByActiveId() {
|
||||
this.activeRespiratoryWearerObj = respiratoryWearerDemoData.find(
|
||||
(e) => e.id == this.activeRespiratoryWearer
|
||||
) as RespiratoryWearerViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/respiratoryWearer/${this.activeRespiratoryWearer}`)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import { useVehicleStore } from "./vehicle";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
|
||||
export const useVehicleDamageReportStore = defineStore("vehicleDamageReport", {
|
||||
state: () => {
|
||||
|
@ -15,17 +14,11 @@ export const useVehicleDamageReportStore = defineStore("vehicleDamageReport", {
|
|||
actions: {
|
||||
fetchDamageReportForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
||||
const vehicleId = useVehicleStore().activeVehicle;
|
||||
this.damageReports = damageReportDemoData
|
||||
.filter((drdd) => drdd.relatedId == vehicleId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/vehicle/${vehicleId}/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/damagereport/vehicle/${vehicleId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
||||
import { useVehicleStore } from "./vehicle";
|
||||
|
||||
export const useVehicleInspectionStore = defineStore("vehicleInspection", {
|
||||
|
@ -15,17 +14,11 @@ export const useVehicleInspectionStore = defineStore("vehicleInspection", {
|
|||
actions: {
|
||||
fetchInspectionForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
||||
const vehicleId = useVehicleStore().activeVehicle;
|
||||
this.inspections = inspectionDemoData
|
||||
.filter((idd) => idd.relatedId == vehicleId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.inspections.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.inspections = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/vehicle/${vehicleId}/inspection?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/inspection/vehicle/${vehicleId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { vehicleDemoData } from "@/demodata/vehicle";
|
||||
|
||||
export const useVehicleStore = defineStore("vehicle", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
},
|
||||
actions: {
|
||||
fetchVehicles(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.vehicles = vehicleDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.vehicles.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.vehicles = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -68,9 +63,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
});
|
||||
},
|
||||
fetchVehicleByActiveId() {
|
||||
this.activeVehicleObj = vehicleDemoData.find((e) => e.id == this.activeVehicle) as VehicleViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/vehicle/${this.activeVehicle}`)
|
||||
|
@ -87,14 +79,22 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
},
|
||||
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/vehicle`, {
|
||||
// TODO: data
|
||||
vehicleTypeId: vehicle.vehicleTypeId,
|
||||
name: vehicle.name,
|
||||
code: vehicle.code,
|
||||
location: vehicle.location,
|
||||
commissioned: vehicle.commissioned,
|
||||
});
|
||||
this.fetchVehicles();
|
||||
return result;
|
||||
},
|
||||
async updateActiveVehicle(vehicle: UpdateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/vehicle/${vehicle.id}`, {
|
||||
// TODO: data
|
||||
name: vehicle.name,
|
||||
code: vehicle.code,
|
||||
location: vehicle.location,
|
||||
commissioned: vehicle.commissioned,
|
||||
decommissioned: vehicle.decommissioned,
|
||||
});
|
||||
this.fetchVehicles();
|
||||
return result;
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
import { defineStore } from "pinia";
|
||||
import type {
|
||||
VehicleTypeViewModel,
|
||||
CreateVehicleTypeViewModel,
|
||||
UpdateVehicleTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { vehicleTypeDemoData } from "@/demodata/vehicleType";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||
import { useVehicleTypeStore } from "./vehicleType";
|
||||
|
||||
export const useVehicleTypeInspectionPlanStore = defineStore("vehicleTypeInspectionPlan", {
|
||||
|
@ -22,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";
|
||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
|||
VehicleTypeViewModel,
|
||||
CreateVehicleTypeViewModel,
|
||||
UpdateVehicleTypeViewModel,
|
||||
} from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
||||
} from "@/viewmodels/admin/unit/vehicle/vehicleType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { vehicleTypeDemoData } from "@/demodata/vehicleType";
|
||||
|
||||
export const useVehicleTypeStore = defineStore("vehicleType", {
|
||||
state: () => {
|
||||
|
@ -21,17 +20,13 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
|||
},
|
||||
actions: {
|
||||
fetchVehicleTypes(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.vehicleTypes = vehicleTypeDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.vehicleTypes.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.vehicleTypes = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(`/admin/vehicleType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
result.data.vehicles
|
||||
result.data.vehicleTypes
|
||||
.filter((elem: VehicleTypeViewModel) => this.vehicleTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||
.map((elem: VehicleTypeViewModel, index: number): VehicleTypeViewModel & { tab_pos: number } => {
|
||||
return {
|
||||
|
@ -50,20 +45,15 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
|||
},
|
||||
async getAllVehicleTypes(): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/vehicleType?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.vehicles };
|
||||
return { ...res, data: res.data.vehicleTypes };
|
||||
});
|
||||
},
|
||||
async searchVehicleTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/vehicleType?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.vehicles };
|
||||
return { ...res, data: res.data.vehicleTypes };
|
||||
});
|
||||
},
|
||||
fetchVehicleTypeByActiveId() {
|
||||
this.activeVehicleTypeObj = vehicleTypeDemoData.find(
|
||||
(e) => e.id == this.activeVehicleType
|
||||
) as VehicleTypeViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/vehicleType/${this.activeVehicleType}`)
|
||||
|
@ -80,14 +70,16 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
|||
},
|
||||
async createVehicleType(vehicleType: CreateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/vehicleType`, {
|
||||
// TODO: data
|
||||
type: vehicleType.type,
|
||||
description: vehicleType.description,
|
||||
});
|
||||
this.fetchVehicleTypes();
|
||||
return result;
|
||||
},
|
||||
async updateActiveVehicleType(vehicleType: UpdateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/vehicleType/${vehicleType.id}`, {
|
||||
// TODO: data
|
||||
type: vehicleType.type,
|
||||
description: vehicleType.description,
|
||||
});
|
||||
this.fetchVehicleTypes();
|
||||
return result;
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { http } from "@/serverCom";
|
||||
import { useWearableStore } from "./wearable";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||
|
||||
export const useWearableDamageReportStore = defineStore("wearableDamageReport", {
|
||||
state: () => {
|
||||
|
@ -15,17 +14,11 @@ export const useWearableDamageReportStore = defineStore("wearableDamageReport",
|
|||
actions: {
|
||||
fetchDamageReportForWearable(offset = 0, count = 25, search = "", clear = false) {
|
||||
const wearableId = useWearableStore().activeWearable;
|
||||
this.damageReports = damageReportDemoData
|
||||
.filter((drdd) => drdd.relatedId == wearableId)
|
||||
.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.damageReports.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.damageReports = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
.get(
|
||||
`/admin/wearable/${wearableId}/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
`/admin/damagereport/wearable/${wearableId}?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
||||
)
|
||||
.then((result) => {
|
||||
this.totalCount = result.data.total;
|
||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/wearable/wearable.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { wearableDemoData } from "@/demodata/wearable";
|
||||
|
||||
export const useWearableStore = defineStore("wearable", {
|
||||
state: () => {
|
||||
|
@ -21,10 +20,6 @@ export const useWearableStore = defineStore("wearable", {
|
|||
},
|
||||
actions: {
|
||||
fetchWearables(offset = 0, count = 25, search = "", clear = false) {
|
||||
this.wearables = wearableDemoData.map((e, i) => ({ ...e, tab_pos: i }));
|
||||
this.totalCount = this.wearables.length;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
if (clear) this.wearables = [];
|
||||
this.loading = "loading";
|
||||
http
|
||||
|
@ -68,9 +63,6 @@ export const useWearableStore = defineStore("wearable", {
|
|||
});
|
||||
},
|
||||
fetchWearableByActiveId() {
|
||||
this.activeWearableObj = wearableDemoData.find((e) => e.id == this.activeWearable) as WearableViewModel;
|
||||
this.loadingActive = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/wearable/${this.activeWearable}`)
|
||||
|
@ -87,14 +79,24 @@ export const useWearableStore = defineStore("wearable", {
|
|||
},
|
||||
async createWearable(wearable: CreateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/wearable`, {
|
||||
// TODO: data
|
||||
wearableTypeId: wearable.wearableTypeId,
|
||||
name: wearable.name,
|
||||
code: wearable.code,
|
||||
location: wearable.location,
|
||||
commissioned: wearable.commissioned,
|
||||
wearerId: wearable.wearerId,
|
||||
});
|
||||
this.fetchWearables();
|
||||
return result;
|
||||
},
|
||||
async updateActiveWearable(wearable: UpdateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/wearable/${wearable.id}`, {
|
||||
// TODO: data
|
||||
name: wearable.name,
|
||||
code: wearable.code,
|
||||
location: wearable.location,
|
||||
commissioned: wearable.commissioned,
|
||||
decommissioned: wearable.decommissioned,
|
||||
wearerId: wearable.wearerId,
|
||||
});
|
||||
this.fetchWearables();
|
||||
return result;
|
||||
|
|
|
@ -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<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/wearableType?noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.wearables };
|
||||
return { ...res, data: res.data.wearableTypes };
|
||||
});
|
||||
},
|
||||
async searchWearableTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/wearableType?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.wearables };
|
||||
return { ...res, data: res.data.wearableTypes };
|
||||
});
|
||||
},
|
||||
fetchWearableTypeById(id: string) {
|
||||
|
@ -60,14 +55,16 @@ export const useWearableTypeStore = defineStore("wearableType", {
|
|||
},
|
||||
async createWearableType(wearableType: CreateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/wearableType`, {
|
||||
// TODO: data
|
||||
type: wearableType.type,
|
||||
description: wearableType.description,
|
||||
});
|
||||
this.fetchWearableTypes();
|
||||
return result;
|
||||
},
|
||||
async updateWearableType(wearableType: UpdateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.patch(`/admin/wearableType/${wearableType.id}`, {
|
||||
// TODO: data
|
||||
type: wearableType.type,
|
||||
description: wearableType.description,
|
||||
});
|
||||
this.fetchWearableTypes();
|
||||
return result;
|
||||
|
|
|
@ -34,6 +34,6 @@ export interface InspectionPointResultViewModel {
|
|||
inspectionId: string;
|
||||
inspectionVersionedPlanId: string;
|
||||
inspectionPointId: string;
|
||||
inspectionPoint: InspectionPointViewModel;
|
||||
inspectionPoint?: InspectionPointViewModel;
|
||||
value: string;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -51,14 +51,7 @@ export default defineComponent({
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(useEquipmentStore, ["activeEquipmentObj"]),
|
||||
...mapState(useAbilityStore, ["can"]),
|
||||
},
|
||||
mounted() {
|
||||
this.fetchEquipmentByActiveId();
|
||||
},
|
||||
methods: {
|
||||
...mapActions(useEquipmentStore, ["fetchEquipmentByActiveId"]),
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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)"
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue