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 }}
|
{{ equipmentType.type }}
|
||||||
</p>
|
</p>
|
||||||
</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">{{ equipmentType.description }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
{{ vehicleType.type }}
|
{{ vehicleType.type }}
|
||||||
</p>
|
</p>
|
||||||
</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">{{ vehicleType.description }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,23 @@
|
||||||
<p>
|
<p>
|
||||||
{{ wearableType.type }}
|
{{ wearableType.type }}
|
||||||
</p>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -25,5 +42,14 @@ export default defineComponent({
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(useModalStore, ["openModal"]),
|
||||||
|
openDeleteModal() {
|
||||||
|
this.openModal(
|
||||||
|
markRaw(defineAsyncComponent(() => import("@/components/admin/unit/wearableType/DeleteWearableTypeModal.vue"))),
|
||||||
|
this.wearableType.id
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
<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>
|
||||||
<span
|
<span
|
||||||
v-if="selected"
|
v-if="selected"
|
||||||
|
|
|
@ -105,7 +105,7 @@ export default defineComponent({
|
||||||
emits: ["update:model-value"],
|
emits: ["update:model-value"],
|
||||||
watch: {
|
watch: {
|
||||||
modelValue() {
|
modelValue() {
|
||||||
if (this.initialLoaded) return;
|
//if (this.initialLoaded) return;
|
||||||
this.initialLoaded = true;
|
this.initialLoaded = true;
|
||||||
this.loadMemberInitial();
|
this.loadMemberInitial();
|
||||||
},
|
},
|
||||||
|
@ -162,7 +162,7 @@ export default defineComponent({
|
||||||
return this.filtered.find((f) => f.id == id);
|
return this.filtered.find((f) => f.id == id);
|
||||||
},
|
},
|
||||||
loadMemberInitial() {
|
loadMemberInitial() {
|
||||||
if (this.modelValue == "") return;
|
if (this.modelValue == "" || this.modelValue == null) return;
|
||||||
this.fetchMemberById(this.modelValue)
|
this.fetchMemberById(this.modelValue)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.chosen = res.data;
|
this.chosen = res.data;
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<span class="block truncate" :class="{ 'font-medium': selected, 'font-normal': !selected }">
|
<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>
|
||||||
<span
|
<span
|
||||||
v-if="selected"
|
v-if="selected"
|
||||||
|
|
|
@ -17,12 +17,9 @@ export const useDamageReportStore = defineStore("damageReport", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchDamageReports(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.damageReports = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
|
//TODO enable fetch of done reports
|
||||||
http
|
http
|
||||||
.get(`/admin/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
.get(`/admin/damageReport?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
@ -66,13 +63,6 @@ export const useDamageReportStore = defineStore("damageReport", {
|
||||||
fetchDamageReportById(id: string) {
|
fetchDamageReportById(id: string) {
|
||||||
return http.get(`/admin/damageReport/${id}`);
|
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>> {
|
async updateDamageReport(damageReport: UpdateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/damageReport/${damageReport.id}`, {
|
const result = await http.patch(`/admin/damageReport/${damageReport.id}`, {
|
||||||
// TODO: data
|
// TODO: data
|
||||||
|
@ -80,10 +70,5 @@ export const useDamageReportStore = defineStore("damageReport", {
|
||||||
this.fetchDamageReports();
|
this.fetchDamageReports();
|
||||||
return result;
|
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: {
|
actions: {
|
||||||
fetchDamageReportForEquipment(offset = 0, count = 25, search = "", clear = false) {
|
fetchDamageReportForEquipment(offset = 0, count = 25, search = "", clear = false) {
|
||||||
const equipmentId = useEquipmentStore().activeEquipment;
|
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 = [];
|
if (clear) this.damageReports = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(
|
.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) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
||||||
} from "@/viewmodels/admin/unit/equipment/equipment.models";
|
} from "@/viewmodels/admin/unit/equipment/equipment.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { equipmentDemoData } from "@/demodata/equipment";
|
|
||||||
|
|
||||||
export const useEquipmentStore = defineStore("equipment", {
|
export const useEquipmentStore = defineStore("equipment", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,10 +20,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchEquipments(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.equipments = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
|
@ -68,9 +63,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchEquipmentByActiveId() {
|
fetchEquipmentByActiveId() {
|
||||||
this.activeEquipmentObj = equipmentDemoData.find((e) => e.id == this.activeEquipment) as EquipmentViewModel;
|
|
||||||
this.loadingActive = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/equipment/${this.activeEquipment}`)
|
.get(`/admin/equipment/${this.activeEquipment}`)
|
||||||
|
@ -87,14 +79,22 @@ export const useEquipmentStore = defineStore("equipment", {
|
||||||
},
|
},
|
||||||
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/equipment`, {
|
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();
|
this.fetchEquipments();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateActiveEquipment(equipment: UpdateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveEquipment(equipment: UpdateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/equipment/${equipment.id}`, {
|
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();
|
this.fetchEquipments();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
|
||||||
import { useEquipmentStore } from "./equipment";
|
import { useEquipmentStore } from "./equipment";
|
||||||
|
|
||||||
export const useEquipmentInspectionStore = defineStore("equipmentInspection", {
|
export const useEquipmentInspectionStore = defineStore("equipmentInspection", {
|
||||||
|
@ -13,20 +12,12 @@ export const useEquipmentInspectionStore = defineStore("equipmentInspection", {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchInspectionForEquipment(offset = 0, count = 25, search = "", clear = false) {
|
fetchInspectionForEquipment(offset = 0, count = 25, clear = false) {
|
||||||
const equipmentId = useEquipmentStore().activeEquipment;
|
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 = [];
|
if (clear) this.inspections = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(
|
.get(`/admin/inspection/equipment/${equipmentId}?offset=${offset}&count=${count}`)
|
||||||
`/admin/equipment/${equipmentId}/inspection?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`
|
|
||||||
)
|
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
result.data.inspections
|
result.data.inspections
|
||||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
||||||
EquipmentTypeViewModel,
|
EquipmentTypeViewModel,
|
||||||
CreateEquipmentTypeViewModel,
|
CreateEquipmentTypeViewModel,
|
||||||
UpdateEquipmentTypeViewModel,
|
UpdateEquipmentTypeViewModel,
|
||||||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
} from "@/viewmodels/admin/unit/equipment/equipmentType.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { equipmentTypeDemoData } from "@/demodata/equipmentType";
|
|
||||||
|
|
||||||
export const useEquipmentTypeStore = defineStore("equipmentType", {
|
export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,17 +20,13 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchEquipmentTypes(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.equipmentTypes = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/equipmentType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
.get(`/admin/equipmentType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
result.data.equipments
|
result.data.equipmentTypes
|
||||||
.filter((elem: EquipmentTypeViewModel) => this.equipmentTypes.findIndex((m) => m.id == elem.id) == -1)
|
.filter((elem: EquipmentTypeViewModel) => this.equipmentTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||||
.map((elem: EquipmentTypeViewModel, index: number): EquipmentTypeViewModel & { tab_pos: number } => {
|
.map((elem: EquipmentTypeViewModel, index: number): EquipmentTypeViewModel & { tab_pos: number } => {
|
||||||
return {
|
return {
|
||||||
|
@ -50,20 +45,15 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||||
},
|
},
|
||||||
async getAllEquipmentTypes(): Promise<AxiosResponse<any, any>> {
|
async getAllEquipmentTypes(): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/equipmentType?noLimit=true`).then((res) => {
|
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>> {
|
async searchEquipmentTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/equipmentType?search=${search}&noLimit=true`).then((res) => {
|
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() {
|
fetchEquipmentTypeByActiveId() {
|
||||||
this.activeEquipmentTypeObj = equipmentTypeDemoData.find(
|
|
||||||
(e) => e.id == this.activeEquipmentType
|
|
||||||
) as EquipmentTypeViewModel;
|
|
||||||
this.loadingActive = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/equipmentType/${this.activeEquipmentType}`)
|
.get(`/admin/equipmentType/${this.activeEquipmentType}`)
|
||||||
|
@ -80,14 +70,16 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||||
},
|
},
|
||||||
async createEquipmentType(equipmentType: CreateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
async createEquipmentType(equipmentType: CreateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/equipmentType`, {
|
const result = await http.post(`/admin/equipmentType`, {
|
||||||
// TODO: data
|
type: equipmentType.type,
|
||||||
|
description: equipmentType.description,
|
||||||
});
|
});
|
||||||
this.fetchEquipmentTypes();
|
this.fetchEquipmentTypes();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateActiveEquipmentType(equipmentType: UpdateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveEquipmentType(equipmentType: UpdateEquipmentTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/equipmentType/${equipmentType.id}`, {
|
const result = await http.patch(`/admin/equipmentType/${equipmentType.id}`, {
|
||||||
// TODO: data
|
type: equipmentType.type,
|
||||||
|
description: equipmentType.description,
|
||||||
});
|
});
|
||||||
this.fetchEquipmentTypes();
|
this.fetchEquipmentTypes();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import type {
|
|
||||||
EquipmentTypeViewModel,
|
|
||||||
CreateEquipmentTypeViewModel,
|
|
||||||
UpdateEquipmentTypeViewModel,
|
|
||||||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||||
import { equipmentTypeDemoData } from "@/demodata/equipmentType";
|
|
||||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
|
||||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
|
||||||
import { useEquipmentTypeStore } from "./equipmentType";
|
import { useEquipmentTypeStore } from "./equipmentType";
|
||||||
|
|
||||||
export const useEquipmentTypeInspectionPlanStore = defineStore("equipmentTypeInspectionPlan", {
|
export const useEquipmentTypeInspectionPlanStore = defineStore("equipmentTypeInspectionPlan", {
|
||||||
|
@ -21,12 +13,9 @@ export const useEquipmentTypeInspectionPlanStore = defineStore("equipmentTypeIns
|
||||||
actions: {
|
actions: {
|
||||||
fetchInspectionPlanForEquipmentType() {
|
fetchInspectionPlanForEquipmentType() {
|
||||||
const equipmentTypeId = useEquipmentTypeStore().activeEquipmentType;
|
const equipmentTypeId = useEquipmentTypeStore().activeEquipmentType;
|
||||||
this.inspectionPlans = inspectionPlanDemoData.filter((ipdd) => ipdd.relatedId == equipmentTypeId);
|
|
||||||
this.loading = "fetched";
|
|
||||||
return;
|
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/equipmentType/${equipmentTypeId}/inspectionPlan`)
|
.get(`/admin/inspectionPlan/equipmentType/${equipmentTypeId}`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.inspectionPlans = result.data;
|
this.inspectionPlans = result.data;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
|
||||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||||
|
|
||||||
export const useInspectionStore = defineStore("inspection", {
|
export const useInspectionStore = defineStore("inspection", {
|
||||||
|
@ -14,10 +13,6 @@ export const useInspectionStore = defineStore("inspection", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchInspectionByActiveId() {
|
fetchInspectionByActiveId() {
|
||||||
this.loadingActive = "loading";
|
|
||||||
this.activeInspectionObj = inspectionDemoData.find((e) => e.id == this.activeInspection) as InspectionViewModel;
|
|
||||||
this.loadingActive = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/inspection/${this.activeInspection}`)
|
.get(`/admin/inspection/${this.activeInspection}`)
|
||||||
|
@ -34,14 +29,17 @@ export const useInspectionStore = defineStore("inspection", {
|
||||||
},
|
},
|
||||||
async createInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
async createInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/inspection`, {
|
const result = await http.post(`/admin/inspection`, {
|
||||||
// TODO: data
|
context: "",
|
||||||
|
inspectionPlanId: "",
|
||||||
|
relatedId: "",
|
||||||
|
assigned: "equipment|vehicle",
|
||||||
});
|
});
|
||||||
this.fetchInspectionByActiveId();
|
this.fetchInspectionByActiveId();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateActiveInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
async updateActiveInspection(inspection: any): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/inspection/${inspection.id}`, {
|
const result = await http.patch(`/admin/inspection/${inspection.id}`, {
|
||||||
// TODO: data
|
context: "",
|
||||||
});
|
});
|
||||||
this.fetchInspectionByActiveId();
|
this.fetchInspectionByActiveId();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
||||||
InspectionPlanViewModel,
|
InspectionPlanViewModel,
|
||||||
CreateInspectionPlanViewModel,
|
CreateInspectionPlanViewModel,
|
||||||
UpdateInspectionPlanViewModel,
|
UpdateInspectionPlanViewModel,
|
||||||
} from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
} from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
|
||||||
|
|
||||||
export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,10 +20,6 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchInspectionPlans(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.inspectionPlans = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
|
@ -53,26 +48,12 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
||||||
return { ...res, data: res.data.inspectionPlans };
|
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>> {
|
async searchInspectionPlans(search: string): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/inspectionPlan?search=${search}&noLimit=true`).then((res) => {
|
return await http.get(`/admin/inspectionPlan?search=${search}&noLimit=true`).then((res) => {
|
||||||
return { ...res, data: res.data.inspectionPlans };
|
return { ...res, data: res.data.inspectionPlans };
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchInspectionPlanByActiveId() {
|
fetchInspectionPlanByActiveId() {
|
||||||
this.activeInspectionPlanObj = inspectionPlanDemoData.find(
|
|
||||||
(e) => e.id == this.activeInspectionPlan
|
|
||||||
) as InspectionPlanViewModel;
|
|
||||||
this.loadingActive = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/inspectionPlan/${this.activeInspectionPlan}`)
|
.get(`/admin/inspectionPlan/${this.activeInspectionPlan}`)
|
||||||
|
@ -89,14 +70,20 @@ export const useInspectionPlanStore = defineStore("inspectionPlan", {
|
||||||
},
|
},
|
||||||
async createInspectionPlan(inspectionPlan: CreateInspectionPlanViewModel): Promise<AxiosResponse<any, any>> {
|
async createInspectionPlan(inspectionPlan: CreateInspectionPlanViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/inspectionPlan`, {
|
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();
|
this.fetchInspectionPlans();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateActiveInspectionPlan(inspectionPlan: UpdateInspectionPlanViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveInspectionPlan(inspectionPlan: UpdateInspectionPlanViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/inspectionPlan/${inspectionPlan.id}`, {
|
const result = await http.patch(`/admin/inspectionPlan/${inspectionPlan.id}`, {
|
||||||
// TODO: data
|
title: inspectionPlan.title,
|
||||||
|
inspectionInterval: inspectionPlan.inspectionInterval,
|
||||||
|
remindTime: inspectionPlan.remindTime,
|
||||||
});
|
});
|
||||||
this.fetchInspectionPlans();
|
this.fetchInspectionPlans();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
||||||
RespiratoryGearViewModel,
|
RespiratoryGearViewModel,
|
||||||
CreateRespiratoryGearViewModel,
|
CreateRespiratoryGearViewModel,
|
||||||
UpdateRespiratoryGearViewModel,
|
UpdateRespiratoryGearViewModel,
|
||||||
} from "@/viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
} from "@/viewmodels/admin/unit/respiratory/respiratoryGear.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { respiratoryGearDemoData } from "@/demodata/respiratoryGear";
|
|
||||||
|
|
||||||
export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,10 +20,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchRespiratoryGears(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.respiratoryGears = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
|
@ -59,11 +54,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchRespiratoryGearByActiveId() {
|
fetchRespiratoryGearByActiveId() {
|
||||||
this.activeRespiratoryGearObj = respiratoryGearDemoData.find(
|
|
||||||
(e) => e.id == this.activeRespiratoryGear
|
|
||||||
) as RespiratoryGearViewModel;
|
|
||||||
this.loading = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/respiratoryGear/${this.activeRespiratoryGear}`)
|
.get(`/admin/respiratoryGear/${this.activeRespiratoryGear}`)
|
||||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
||||||
RespiratoryMissionViewModel,
|
RespiratoryMissionViewModel,
|
||||||
CreateRespiratoryMissionViewModel,
|
CreateRespiratoryMissionViewModel,
|
||||||
UpdateRespiratoryMissionViewModel,
|
UpdateRespiratoryMissionViewModel,
|
||||||
} from "@/viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
} from "@/viewmodels/admin/unit/respiratory/respiratoryMission.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { respiratoryMissionDemoData } from "@/demodata/respiratoryMission";
|
|
||||||
|
|
||||||
export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,10 +20,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchRespiratoryMissions(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.respiratoryMissions = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
|
@ -63,11 +58,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchRespiratoryMissionByActiveId() {
|
fetchRespiratoryMissionByActiveId() {
|
||||||
this.activeRespiratoryMissionObj = this.respiratoryMissions.find(
|
|
||||||
(e) => e.id == this.activeRespiratoryMission
|
|
||||||
) as RespiratoryMissionViewModel;
|
|
||||||
this.loading = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/respiratoryMission/${this.activeRespiratoryMission}`)
|
.get(`/admin/respiratoryMission/${this.activeRespiratoryMission}`)
|
||||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
||||||
RespiratoryWearerViewModel,
|
RespiratoryWearerViewModel,
|
||||||
CreateRespiratoryWearerViewModel,
|
CreateRespiratoryWearerViewModel,
|
||||||
UpdateRespiratoryWearerViewModel,
|
UpdateRespiratoryWearerViewModel,
|
||||||
} from "@/viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
} from "@/viewmodels/admin/unit/respiratory/respiratoryWearer.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { respiratoryWearerDemoData } from "@/demodata/respiratoryWearer";
|
|
||||||
|
|
||||||
export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,10 +20,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchRespiratoryWearers(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.respiratoryWearers = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
|
@ -63,11 +58,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchRespiratoryWearerByActiveId() {
|
fetchRespiratoryWearerByActiveId() {
|
||||||
this.activeRespiratoryWearerObj = respiratoryWearerDemoData.find(
|
|
||||||
(e) => e.id == this.activeRespiratoryWearer
|
|
||||||
) as RespiratoryWearerViewModel;
|
|
||||||
this.loading = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/respiratoryWearer/${this.activeRespiratoryWearer}`)
|
.get(`/admin/respiratoryWearer/${this.activeRespiratoryWearer}`)
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import { useVehicleStore } from "./vehicle";
|
import { useVehicleStore } from "./vehicle";
|
||||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
|
||||||
|
|
||||||
export const useVehicleDamageReportStore = defineStore("vehicleDamageReport", {
|
export const useVehicleDamageReportStore = defineStore("vehicleDamageReport", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -15,17 +14,11 @@ export const useVehicleDamageReportStore = defineStore("vehicleDamageReport", {
|
||||||
actions: {
|
actions: {
|
||||||
fetchDamageReportForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
fetchDamageReportForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
||||||
const vehicleId = useVehicleStore().activeVehicle;
|
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 = [];
|
if (clear) this.damageReports = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(
|
.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) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
import type { InspectionViewModel } from "@/viewmodels/admin/unit/inspection/inspection.models";
|
||||||
import { inspectionDemoData } from "@/demodata/inspectionPlan";
|
|
||||||
import { useVehicleStore } from "./vehicle";
|
import { useVehicleStore } from "./vehicle";
|
||||||
|
|
||||||
export const useVehicleInspectionStore = defineStore("vehicleInspection", {
|
export const useVehicleInspectionStore = defineStore("vehicleInspection", {
|
||||||
|
@ -15,17 +14,11 @@ export const useVehicleInspectionStore = defineStore("vehicleInspection", {
|
||||||
actions: {
|
actions: {
|
||||||
fetchInspectionForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
fetchInspectionForVehicle(offset = 0, count = 25, search = "", clear = false) {
|
||||||
const vehicleId = useVehicleStore().activeVehicle;
|
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 = [];
|
if (clear) this.inspections = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(
|
.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) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
||||||
} from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
} from "@/viewmodels/admin/unit/vehicle/vehicle.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { vehicleDemoData } from "@/demodata/vehicle";
|
|
||||||
|
|
||||||
export const useVehicleStore = defineStore("vehicle", {
|
export const useVehicleStore = defineStore("vehicle", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,10 +20,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchVehicles(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.vehicles = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
|
@ -68,9 +63,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchVehicleByActiveId() {
|
fetchVehicleByActiveId() {
|
||||||
this.activeVehicleObj = vehicleDemoData.find((e) => e.id == this.activeVehicle) as VehicleViewModel;
|
|
||||||
this.loadingActive = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/vehicle/${this.activeVehicle}`)
|
.get(`/admin/vehicle/${this.activeVehicle}`)
|
||||||
|
@ -87,14 +79,22 @@ export const useVehicleStore = defineStore("vehicle", {
|
||||||
},
|
},
|
||||||
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/vehicle`, {
|
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();
|
this.fetchVehicles();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateActiveVehicle(vehicle: UpdateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveVehicle(vehicle: UpdateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/vehicle/${vehicle.id}`, {
|
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();
|
this.fetchVehicles();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import type {
|
|
||||||
VehicleTypeViewModel,
|
|
||||||
CreateVehicleTypeViewModel,
|
|
||||||
UpdateVehicleTypeViewModel,
|
|
||||||
} from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspection/inspectionPlan.models";
|
||||||
import { vehicleTypeDemoData } from "@/demodata/vehicleType";
|
|
||||||
import type { InspectionPlanViewModel } from "@/viewmodels/admin/unit/inspectionPlan/inspectionPlan.models";
|
|
||||||
import { inspectionPlanDemoData } from "@/demodata/inspectionPlan";
|
|
||||||
import { useVehicleTypeStore } from "./vehicleType";
|
import { useVehicleTypeStore } from "./vehicleType";
|
||||||
|
|
||||||
export const useVehicleTypeInspectionPlanStore = defineStore("vehicleTypeInspectionPlan", {
|
export const useVehicleTypeInspectionPlanStore = defineStore("vehicleTypeInspectionPlan", {
|
||||||
|
@ -22,12 +14,9 @@ export const useVehicleTypeInspectionPlanStore = defineStore("vehicleTypeInspect
|
||||||
actions: {
|
actions: {
|
||||||
fetchInspectionPlanForVehicleType() {
|
fetchInspectionPlanForVehicleType() {
|
||||||
const vehicleTypeId = useVehicleTypeStore().activeVehicleType;
|
const vehicleTypeId = useVehicleTypeStore().activeVehicleType;
|
||||||
this.inspectionPlans = inspectionPlanDemoData.filter((ipdd) => ipdd.relatedId == vehicleTypeId);
|
|
||||||
this.loading = "fetched";
|
|
||||||
return;
|
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/vehicleType/${vehicleTypeId}/inspectionPlan`)
|
.get(`/admin/inspectionPlan/vehicleType/${vehicleTypeId}`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.inspectionPlans = result.data;
|
this.inspectionPlans = result.data;
|
||||||
this.loading = "fetched";
|
this.loading = "fetched";
|
||||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
||||||
VehicleTypeViewModel,
|
VehicleTypeViewModel,
|
||||||
CreateVehicleTypeViewModel,
|
CreateVehicleTypeViewModel,
|
||||||
UpdateVehicleTypeViewModel,
|
UpdateVehicleTypeViewModel,
|
||||||
} from "@/viewmodels/admin/unit/vehicleType/vehicleType.models";
|
} from "@/viewmodels/admin/unit/vehicle/vehicleType.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { vehicleTypeDemoData } from "@/demodata/vehicleType";
|
|
||||||
|
|
||||||
export const useVehicleTypeStore = defineStore("vehicleType", {
|
export const useVehicleTypeStore = defineStore("vehicleType", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,17 +20,13 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchVehicleTypes(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.vehicleTypes = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/vehicleType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
.get(`/admin/vehicleType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
result.data.vehicles
|
result.data.vehicleTypes
|
||||||
.filter((elem: VehicleTypeViewModel) => this.vehicleTypes.findIndex((m) => m.id == elem.id) == -1)
|
.filter((elem: VehicleTypeViewModel) => this.vehicleTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||||
.map((elem: VehicleTypeViewModel, index: number): VehicleTypeViewModel & { tab_pos: number } => {
|
.map((elem: VehicleTypeViewModel, index: number): VehicleTypeViewModel & { tab_pos: number } => {
|
||||||
return {
|
return {
|
||||||
|
@ -50,20 +45,15 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
||||||
},
|
},
|
||||||
async getAllVehicleTypes(): Promise<AxiosResponse<any, any>> {
|
async getAllVehicleTypes(): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/vehicleType?noLimit=true`).then((res) => {
|
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>> {
|
async searchVehicleTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/vehicleType?search=${search}&noLimit=true`).then((res) => {
|
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() {
|
fetchVehicleTypeByActiveId() {
|
||||||
this.activeVehicleTypeObj = vehicleTypeDemoData.find(
|
|
||||||
(e) => e.id == this.activeVehicleType
|
|
||||||
) as VehicleTypeViewModel;
|
|
||||||
this.loadingActive = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/vehicleType/${this.activeVehicleType}`)
|
.get(`/admin/vehicleType/${this.activeVehicleType}`)
|
||||||
|
@ -80,14 +70,16 @@ export const useVehicleTypeStore = defineStore("vehicleType", {
|
||||||
},
|
},
|
||||||
async createVehicleType(vehicleType: CreateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
async createVehicleType(vehicleType: CreateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/vehicleType`, {
|
const result = await http.post(`/admin/vehicleType`, {
|
||||||
// TODO: data
|
type: vehicleType.type,
|
||||||
|
description: vehicleType.description,
|
||||||
});
|
});
|
||||||
this.fetchVehicleTypes();
|
this.fetchVehicleTypes();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateActiveVehicleType(vehicleType: UpdateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveVehicleType(vehicleType: UpdateVehicleTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/vehicleType/${vehicleType.id}`, {
|
const result = await http.patch(`/admin/vehicleType/${vehicleType.id}`, {
|
||||||
// TODO: data
|
type: vehicleType.type,
|
||||||
|
description: vehicleType.description,
|
||||||
});
|
});
|
||||||
this.fetchVehicleTypes();
|
this.fetchVehicleTypes();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import { useWearableStore } from "./wearable";
|
import { useWearableStore } from "./wearable";
|
||||||
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
import type { DamageReportViewModel } from "@/viewmodels/admin/unit/damageReport.models";
|
||||||
import { damageReportDemoData } from "@/demodata/damageReport";
|
|
||||||
|
|
||||||
export const useWearableDamageReportStore = defineStore("wearableDamageReport", {
|
export const useWearableDamageReportStore = defineStore("wearableDamageReport", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -15,17 +14,11 @@ export const useWearableDamageReportStore = defineStore("wearableDamageReport",
|
||||||
actions: {
|
actions: {
|
||||||
fetchDamageReportForWearable(offset = 0, count = 25, search = "", clear = false) {
|
fetchDamageReportForWearable(offset = 0, count = 25, search = "", clear = false) {
|
||||||
const wearableId = useWearableStore().activeWearable;
|
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 = [];
|
if (clear) this.damageReports = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(
|
.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) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import type {
|
||||||
} from "@/viewmodels/admin/unit/wearable/wearable.models";
|
} from "@/viewmodels/admin/unit/wearable/wearable.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { wearableDemoData } from "@/demodata/wearable";
|
|
||||||
|
|
||||||
export const useWearableStore = defineStore("wearable", {
|
export const useWearableStore = defineStore("wearable", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -21,10 +20,6 @@ export const useWearableStore = defineStore("wearable", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchWearables(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.wearables = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
|
@ -68,9 +63,6 @@ export const useWearableStore = defineStore("wearable", {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchWearableByActiveId() {
|
fetchWearableByActiveId() {
|
||||||
this.activeWearableObj = wearableDemoData.find((e) => e.id == this.activeWearable) as WearableViewModel;
|
|
||||||
this.loadingActive = "fetched";
|
|
||||||
return;
|
|
||||||
this.loadingActive = "loading";
|
this.loadingActive = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/wearable/${this.activeWearable}`)
|
.get(`/admin/wearable/${this.activeWearable}`)
|
||||||
|
@ -87,14 +79,24 @@ export const useWearableStore = defineStore("wearable", {
|
||||||
},
|
},
|
||||||
async createWearable(wearable: CreateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
async createWearable(wearable: CreateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/wearable`, {
|
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();
|
this.fetchWearables();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateActiveWearable(wearable: UpdateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
async updateActiveWearable(wearable: UpdateWearableViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/wearable/${wearable.id}`, {
|
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();
|
this.fetchWearables();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -3,10 +3,9 @@ import type {
|
||||||
WearableTypeViewModel,
|
WearableTypeViewModel,
|
||||||
CreateWearableTypeViewModel,
|
CreateWearableTypeViewModel,
|
||||||
UpdateWearableTypeViewModel,
|
UpdateWearableTypeViewModel,
|
||||||
} from "@/viewmodels/admin/unit/wearableType/wearableType.models";
|
} from "@/viewmodels/admin/unit/wearable/wearableType.models";
|
||||||
import { http } from "@/serverCom";
|
import { http } from "@/serverCom";
|
||||||
import type { AxiosResponse } from "axios";
|
import type { AxiosResponse } from "axios";
|
||||||
import { wearableTypeDemoData } from "@/demodata/wearableType";
|
|
||||||
|
|
||||||
export const useWearableTypeStore = defineStore("wearableType", {
|
export const useWearableTypeStore = defineStore("wearableType", {
|
||||||
state: () => {
|
state: () => {
|
||||||
|
@ -18,17 +17,13 @@ export const useWearableTypeStore = defineStore("wearableType", {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchWearableTypes(offset = 0, count = 25, search = "", clear = false) {
|
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 = [];
|
if (clear) this.wearableTypes = [];
|
||||||
this.loading = "loading";
|
this.loading = "loading";
|
||||||
http
|
http
|
||||||
.get(`/admin/wearableType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
.get(`/admin/wearableType?offset=${offset}&count=${count}${search != "" ? "&search=" + search : ""}`)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.totalCount = result.data.total;
|
this.totalCount = result.data.total;
|
||||||
result.data.wearables
|
result.data.wearableTypes
|
||||||
.filter((elem: WearableTypeViewModel) => this.wearableTypes.findIndex((m) => m.id == elem.id) == -1)
|
.filter((elem: WearableTypeViewModel) => this.wearableTypes.findIndex((m) => m.id == elem.id) == -1)
|
||||||
.map((elem: WearableTypeViewModel, index: number): WearableTypeViewModel & { tab_pos: number } => {
|
.map((elem: WearableTypeViewModel, index: number): WearableTypeViewModel & { tab_pos: number } => {
|
||||||
return {
|
return {
|
||||||
|
@ -47,12 +42,12 @@ export const useWearableTypeStore = defineStore("wearableType", {
|
||||||
},
|
},
|
||||||
async getAllWearableTypes(): Promise<AxiosResponse<any, any>> {
|
async getAllWearableTypes(): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/wearableType?noLimit=true`).then((res) => {
|
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>> {
|
async searchWearableTypes(search: string): Promise<AxiosResponse<any, any>> {
|
||||||
return await http.get(`/admin/wearableType?search=${search}&noLimit=true`).then((res) => {
|
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) {
|
fetchWearableTypeById(id: string) {
|
||||||
|
@ -60,14 +55,16 @@ export const useWearableTypeStore = defineStore("wearableType", {
|
||||||
},
|
},
|
||||||
async createWearableType(wearableType: CreateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
async createWearableType(wearableType: CreateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.post(`/admin/wearableType`, {
|
const result = await http.post(`/admin/wearableType`, {
|
||||||
// TODO: data
|
type: wearableType.type,
|
||||||
|
description: wearableType.description,
|
||||||
});
|
});
|
||||||
this.fetchWearableTypes();
|
this.fetchWearableTypes();
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
async updateWearableType(wearableType: UpdateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
async updateWearableType(wearableType: UpdateWearableTypeViewModel): Promise<AxiosResponse<any, any>> {
|
||||||
const result = await http.patch(`/admin/wearableType/${wearableType.id}`, {
|
const result = await http.patch(`/admin/wearableType/${wearableType.id}`, {
|
||||||
// TODO: data
|
type: wearableType.type,
|
||||||
|
description: wearableType.description,
|
||||||
});
|
});
|
||||||
this.fetchWearableTypes();
|
this.fetchWearableTypes();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -34,6 +34,6 @@ export interface InspectionPointResultViewModel {
|
||||||
inspectionId: string;
|
inspectionId: string;
|
||||||
inspectionVersionedPlanId: string;
|
inspectionVersionedPlanId: string;
|
||||||
inspectionPointId: string;
|
inspectionPointId: string;
|
||||||
inspectionPoint: InspectionPointViewModel;
|
inspectionPoint?: InspectionPointViewModel;
|
||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import type { InspectionPointEnum } from "@/enums/inspectionEnum";
|
import type { InspectionPointEnum } from "@/enums/inspectionEnum";
|
||||||
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
import type { EquipmentViewModel } from "../equipment/equipment.models";
|
||||||
import type { VehicleViewModel } from "../vehicle/vehicle.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 | "*"}`;
|
export type PlanTimeDefinition = `${number}-${"d" | "m" | "y"}` | `${number}/${number | "*"}`;
|
||||||
|
|
||||||
|
@ -16,11 +18,11 @@ export type InspectionPlanViewModel = {
|
||||||
} & (
|
} & (
|
||||||
| {
|
| {
|
||||||
assigned: "equipment";
|
assigned: "equipment";
|
||||||
related: EquipmentViewModel;
|
related: EquipmentTypeViewModel;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
assigned: "vehicle";
|
assigned: "vehicle";
|
||||||
related: VehicleViewModel;
|
related: VehicleTypeViewModel;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -51,14 +51,7 @@ export default defineComponent({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(useEquipmentStore, ["activeEquipmentObj"]),
|
|
||||||
...mapState(useAbilityStore, ["can"]),
|
...mapState(useAbilityStore, ["can"]),
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
this.fetchEquipmentByActiveId();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
...mapActions(useEquipmentStore, ["fetchEquipmentByActiveId"]),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
<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">
|
<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" />
|
<PencilSquareIcon v-if="!row.done" class="w-5 h-5" />
|
||||||
<PhotoIcon v-if="row.providedImage" class="w-5 h-5" />
|
<PhotoIcon v-if="row.imageCount != 0" class="w-5 h-5" />
|
||||||
<p>{{ row.reported }} - {{ row.status }}</p>
|
<p>{{ row.reportedAt }} - {{ row.status }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
|
<p v-if="row.reportedBy">gemeldet von: {{ row.reportedBy }}</p>
|
||||||
<p>Beschreibung: {{ row.description }}</p>
|
<p>Beschreibung: {{ row.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
>
|
>
|
||||||
<p class="mx-auto">Geräte-Typ bearbeiten</p>
|
<p class="mx-auto">Geräte-Typ bearbeiten</p>
|
||||||
<div>
|
<div>
|
||||||
<label for="name">Typ</label>
|
<label for="type">Typ</label>
|
||||||
<input type="text" id="name" required v-model="equipmentType.type" />
|
<input type="text" id="type" required v-model="equipmentType.type" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="location">Beschreibung</label>
|
<label for="description">Beschreibung</label>
|
||||||
<input type="text" id="location" v-model="equipmentType.description" />
|
<input type="text" id="description" v-model="equipmentType.description" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row justify-end gap-2">
|
<div class="flex flex-row justify-end gap-2">
|
||||||
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
<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">
|
<div v-for="point in points" :key="point.title">
|
||||||
<OkNotOk
|
<OkNotOk
|
||||||
v-if="point.type == 'iO-niO'"
|
v-if="point.type == InspectionPointEnum.oknok"
|
||||||
:inspectionPoint="point"
|
:inspectionPoint="point"
|
||||||
:modelValue="boolPointResult(point.id)"
|
:modelValue="boolPointResult(point.id)"
|
||||||
@update:model-value="(val) => updateCheckResult(point.id, val)"
|
@update:model-value="(val) => updateCheckResult(point.id, val)"
|
||||||
|
|
|
@ -147,8 +147,8 @@ export default defineComponent({
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
let createInspectionPlan: CreateInspectionPlanViewModel = {
|
let createInspectionPlan: CreateInspectionPlanViewModel = {
|
||||||
title: formData.name.value,
|
title: formData.name.value,
|
||||||
inspectionInterval: formData.name.value,
|
inspectionInterval: formData.interval.value,
|
||||||
remindTime: formData.name.value,
|
remindTime: formData.remind.value,
|
||||||
relatedId: this.selectedType,
|
relatedId: this.selectedType,
|
||||||
assigned: this.active,
|
assigned: this.active,
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
<input type="text" id="interval" :value="activeInspectionPlanObj.inspectionInterval" reaonly />
|
<input type="text" id="interval" :value="activeInspectionPlanObj.inspectionInterval" reaonly />
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<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
|
<div
|
||||||
v-for="point in activeInspectionPlanObj?.inspectionPoints"
|
v-for="point in activeInspectionPlanObj?.inspectionPoints"
|
||||||
class="flex flex-col h-fit w-full border border-primary rounded-md"
|
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" />
|
<input type="text" id="name" required v-model="inspectionPlan.title" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="interval">Intervall (optional)</label>
|
<label for="interval">Intervall</label>
|
||||||
<input type="text" id="interval" placeholder="<number>-(d|m|y) oder DD/MM" />
|
<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>
|
||||||
<div class="flex flex-row justify-end gap-2">
|
<div class="flex flex-row justify-end gap-2">
|
||||||
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
||||||
|
@ -95,7 +113,8 @@ export default defineComponent({
|
||||||
let updateInspectionPlan: UpdateInspectionPlanViewModel = {
|
let updateInspectionPlan: UpdateInspectionPlanViewModel = {
|
||||||
id: this.inspectionPlan.id,
|
id: this.inspectionPlan.id,
|
||||||
title: formData.name.value,
|
title: formData.name.value,
|
||||||
inspectionInterval: formData.location.value || null,
|
inspectionInterval: formData.interval.value,
|
||||||
|
remindTime: formData.remind.value,
|
||||||
};
|
};
|
||||||
this.status = "loading";
|
this.status = "loading";
|
||||||
this.updateActiveInspectionPlan(updateInspectionPlan)
|
this.updateActiveInspectionPlan(updateInspectionPlan)
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
<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">
|
<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" />
|
<PencilSquareIcon v-if="!row.done" class="w-5 h-5" />
|
||||||
<PhotoIcon v-if="row.providedImage" class="w-5 h-5" />
|
<PhotoIcon v-if="row.imageCount != 0" class="w-5 h-5" />
|
||||||
<p>{{ row.reported }} - {{ row.status }}</p>
|
<p>{{ row.reportedAt }} - {{ row.status }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
|
<p v-if="row.reportedBy">gemeldet von: {{ row.reportedBy }}</p>
|
||||||
<p>Beschreibung: {{ row.description }}</p>
|
<p>Beschreibung: {{ row.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
>
|
>
|
||||||
<p class="mx-auto">Fahrzeug-Typ bearbeiten</p>
|
<p class="mx-auto">Fahrzeug-Typ bearbeiten</p>
|
||||||
<div>
|
<div>
|
||||||
<label for="name">Typ</label>
|
<label for="type">Typ</label>
|
||||||
<input type="text" id="name" required v-model="vehicleType.type" />
|
<input type="text" id="type" required v-model="vehicleType.type" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="location">Beschreibung</label>
|
<label for="description">Beschreibung</label>
|
||||||
<input type="text" id="location" v-model="vehicleType.description" />
|
<input type="text" id="description" v-model="vehicleType.description" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row justify-end gap-2">
|
<div class="flex flex-row justify-end gap-2">
|
||||||
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<div class="flex flex-row gap-4">
|
<div class="flex flex-row gap-4">
|
||||||
<button v-if="can('create', 'unit', 'vehicle_type')" primary class="w-fit!" @click="openCreateModal">
|
<button v-if="can('create', 'unit', 'vehicle_type')" primary class="w-fit!" @click="openCreateModal">
|
||||||
Geräte-Typ erstellen
|
Fahrzeug-Typ erstellen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
<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">
|
<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" />
|
<PencilSquareIcon v-if="!row.done" class="w-5 h-5" />
|
||||||
<PhotoIcon v-if="row.providedImage" class="w-5 h-5" />
|
<PhotoIcon v-if="row.imageCount != 0" class="w-5 h-5" />
|
||||||
<p>{{ row.reported }} - {{ row.status }}</p>
|
<p>{{ row.reportedAt }} - {{ row.status }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
|
<p v-if="row.reportedBy">gemeldet von: {{ row.reportedBy }}</p>
|
||||||
<p>Beschreibung: {{ row.description }}</p>
|
<p>Beschreibung: {{ row.description }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<label for="location">Verortung (optional)</label>
|
<label for="location">Verortung (optional)</label>
|
||||||
<input type="text" id="location" v-model="wearable.location" />
|
<input type="text" id="location" v-model="wearable.location" />
|
||||||
</div>
|
</div>
|
||||||
<MemberSearchSelectMultiple title="Träger (optional)" />
|
<MemberSearchSelectSingle title="Träger (optional)" v-model="wearable.wearerId" />
|
||||||
<div>
|
<div>
|
||||||
<label for="commissioned">In-Betrieb-Nahme</label>
|
<label for="commissioned">In-Betrieb-Nahme</label>
|
||||||
<input type="date" id="commissioned" required v-model="wearable.commissioned" />
|
<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">
|
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
||||||
abbrechen
|
abbrechen
|
||||||
</button>
|
</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" />
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
|
@ -54,7 +56,7 @@ import FailureXMark from "@/components/FailureXMark.vue";
|
||||||
import ScanInput from "@/components/ScanInput.vue";
|
import ScanInput from "@/components/ScanInput.vue";
|
||||||
import isEqual from "lodash.isequal";
|
import isEqual from "lodash.isequal";
|
||||||
import cloneDeep from "lodash.clonedeep";
|
import cloneDeep from "lodash.clonedeep";
|
||||||
import MemberSearchSelectMultiple from "@/components/search/MemberSearchSelectMultiple.vue";
|
import MemberSearchSelectSingle from "@/components/search/MemberSearchSelectSingle.vue";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
@ -109,7 +111,8 @@ export default defineComponent({
|
||||||
name: formData.name.value,
|
name: formData.name.value,
|
||||||
location: formData.location.value,
|
location: formData.location.value,
|
||||||
commissioned: formData.commissioned.value,
|
commissioned: formData.commissioned.value,
|
||||||
decommissioned: formData.decommissioned.value ?? null,
|
decommissioned: formData.decommissioned.value || null,
|
||||||
|
wearerId: this.wearable.wearerId,
|
||||||
};
|
};
|
||||||
this.status = "loading";
|
this.status = "loading";
|
||||||
this.updateActiveWearable(updateWearable)
|
this.updateActiveWearable(updateWearable)
|
||||||
|
|
|
@ -1,37 +1,43 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col gap-2 h-full w-full overflow-y-auto">
|
<MainTemplate :title="`Kleidungs-Typ ${origin?.type} - Daten bearbeiten`">
|
||||||
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
<template #headerInsert>
|
||||||
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
<RouterLink to="../" class="text-primary">zurück zur Liste (abbrechen)</RouterLink>
|
||||||
<form
|
</template>
|
||||||
v-else-if="wearableType != null"
|
<template #main>
|
||||||
class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto"
|
<Spinner v-if="loading == 'loading'" class="mx-auto" />
|
||||||
@submit.prevent="triggerUpdate"
|
<p v-else-if="loading == 'failed'">laden fehlgeschlagen</p>
|
||||||
>
|
<form
|
||||||
<p class="mx-auto">Kleidungstyp bearbeiten</p>
|
v-else-if="wearableType != null"
|
||||||
<div>
|
class="flex flex-col gap-4 py-2 w-full max-w-xl mx-auto"
|
||||||
<label for="name">Bezeichnung</label>
|
@submit.prevent="triggerUpdate"
|
||||||
<input type="text" id="name" required v-model="wearableType.type" />
|
>
|
||||||
</div>
|
<p class="mx-auto">Kleidungstyp bearbeiten</p>
|
||||||
<div>
|
<div>
|
||||||
<label for="description">Beschreibung (optional)</label>
|
<label for="type">Bezeichnung</label>
|
||||||
<input type="text" id="description" v-model="wearableType.description" />
|
<input type="text" id="type" required v-model="wearableType.type" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-row justify-end gap-2">
|
<div>
|
||||||
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
<label for="description">Beschreibung (optional)</label>
|
||||||
abbrechen
|
<input type="text" id="description" v-model="wearableType.description" />
|
||||||
</button>
|
</div>
|
||||||
<button primary type="submit" class="w-fit!" :disabled="status == 'loading'">speichern</button>
|
<div class="flex flex-row justify-end gap-2">
|
||||||
<Spinner v-if="status == 'loading'" class="my-auto" />
|
<button primary-outline type="reset" class="w-fit!" :disabled="canSaveOrReset" @click="resetForm">
|
||||||
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
abbrechen
|
||||||
<FailureXMark v-else-if="status?.status == 'failed'" />
|
</button>
|
||||||
</div>
|
<button primary type="submit" class="w-fit!" :disabled="status == 'loading'">speichern</button>
|
||||||
</form>
|
<Spinner v-if="status == 'loading'" class="my-auto" />
|
||||||
</div>
|
<SuccessCheckmark v-else-if="status?.status == 'success'" />
|
||||||
|
<FailureXMark v-else-if="status?.status == 'failed'" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
</MainTemplate>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { mapActions, mapState } from "pinia";
|
import { mapActions, mapState } from "pinia";
|
||||||
|
import MainTemplate from "@/templates/Main.vue";
|
||||||
import { useWearableTypeStore } from "@/stores/admin/unit/wearableType/wearableType";
|
import { useWearableTypeStore } from "@/stores/admin/unit/wearableType/wearableType";
|
||||||
import type {
|
import type {
|
||||||
CreateWearableTypeViewModel,
|
CreateWearableTypeViewModel,
|
||||||
|
@ -93,7 +99,7 @@ export default defineComponent({
|
||||||
let formData = e.target.elements;
|
let formData = e.target.elements;
|
||||||
let updateWearableType: UpdateWearableTypeViewModel = {
|
let updateWearableType: UpdateWearableTypeViewModel = {
|
||||||
id: this.wearableType.id,
|
id: this.wearableType.id,
|
||||||
type: formData.name.value,
|
type: formData.type.value,
|
||||||
description: formData.description.value,
|
description: formData.description.value,
|
||||||
};
|
};
|
||||||
this.status = "loading";
|
this.status = "loading";
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<div class="flex flex-row gap-4">
|
<div class="flex flex-row gap-4">
|
||||||
<button v-if="can('create', 'unit', 'wearable_type')" primary class="w-fit!" @click="openCreateModal">
|
<button v-if="can('create', 'unit', 'wearable_type')" primary class="w-fit!" @click="openCreateModal">
|
||||||
Geräte-Typ erstellen
|
Kleidungs-Typ erstellen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue