demo data
This commit is contained in:
parent
5faa4b7906
commit
36ca3d90a7
29 changed files with 304 additions and 99 deletions
|
@ -1,8 +1,5 @@
|
|||
<template>
|
||||
<RouterLink
|
||||
:to="{ name: 'admin-unit-damage_report-overview', params: { damageReportId: damageReport.id } }"
|
||||
class="flex flex-col h-fit w-full border border-primary rounded-md"
|
||||
>
|
||||
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
|
||||
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
|
||||
<p>
|
||||
{{ damageReport.affectedEquipment.name }}
|
||||
|
@ -12,7 +9,7 @@
|
|||
<p v-if="damageReport.affectedEquipment">Code: {{ damageReport.affectedEquipment.code }}</p>
|
||||
<p v-if="damageReport.description">Beschreibung: {{ damageReport.description }}</p>
|
||||
</div>
|
||||
</RouterLink>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
|
14
src/demodata/damageReport.ts
Normal file
14
src/demodata/damageReport.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import type { DamageReportViewModel } from "../viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { equipmentDemoData } from "./equipment";
|
||||
|
||||
export const damageReportDemoData: Array<DamageReportViewModel> = [
|
||||
{
|
||||
id: "sdfgh",
|
||||
reported: new Date(),
|
||||
status: "",
|
||||
done: false,
|
||||
description: "knjgljna g",
|
||||
affectedEquipmentId: equipmentDemoData[0].id,
|
||||
affectedEquipment: equipmentDemoData[0],
|
||||
},
|
||||
];
|
13
src/demodata/equipment.ts
Normal file
13
src/demodata/equipment.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import type { EquipmentViewModel } from "../viewmodels/admin/unit/equipment/equipment.models";
|
||||
import { equipmentTypeDemoData } from "./equipmentType";
|
||||
|
||||
export const equipmentDemoData: Array<EquipmentViewModel> = [
|
||||
{
|
||||
id: "abc",
|
||||
code: "0456984224498",
|
||||
name: "B-Schlauch",
|
||||
location: "HLF",
|
||||
equipmentTypeId: equipmentTypeDemoData[0].id,
|
||||
equipmentType: equipmentTypeDemoData[0],
|
||||
},
|
||||
];
|
10
src/demodata/equipmentType.ts
Normal file
10
src/demodata/equipmentType.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import type { EquipmentTypeViewModel } from "../viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
|
||||
export const equipmentTypeDemoData: Array<EquipmentTypeViewModel> = [
|
||||
{
|
||||
id: "xyz",
|
||||
type: "B-Schlauch",
|
||||
description: "Shläuche vom Typ B",
|
||||
inspectionInterval: "1m",
|
||||
},
|
||||
];
|
10
src/demodata/respiratoryGear.ts
Normal file
10
src/demodata/respiratoryGear.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import type { RespiratoryGearViewModel } from "../viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
||||
import { equipmentDemoData } from "./equipment";
|
||||
|
||||
export const respiratoryGearDemoData: Array<RespiratoryGearViewModel> = [
|
||||
{
|
||||
id: "adfsg",
|
||||
equipmentId: equipmentDemoData[0].id,
|
||||
equipment: equipmentDemoData[0],
|
||||
},
|
||||
];
|
11
src/demodata/respiratoryMission.ts
Normal file
11
src/demodata/respiratoryMission.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import type { RespiratoryMissionViewModel } from "../viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
||||
import { equipmentDemoData } from "./equipment";
|
||||
|
||||
export const respiratoryMissionDemoData: Array<RespiratoryMissionViewModel> = [
|
||||
{
|
||||
id: "adfsg",
|
||||
date: new Date(),
|
||||
title: "B5",
|
||||
description: "B5 Einsatz",
|
||||
},
|
||||
];
|
17
src/demodata/respiratoryWearer.ts
Normal file
17
src/demodata/respiratoryWearer.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import type { RespiratoryWearerViewModel } from "../viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
||||
|
||||
export const respiratoryWearerDemoData: Array<RespiratoryWearerViewModel> = [
|
||||
{
|
||||
id: "dfghj",
|
||||
memberId: "9469991d-fa22-4899-82ce-b1ba5de990dc",
|
||||
member: {
|
||||
id: "9469991d-fa22-4899-82ce-b1ba5de990dc",
|
||||
salutation: { id: 3, salutation: "Herr" },
|
||||
firstname: "Julian",
|
||||
lastname: "Krauser",
|
||||
nameaffix: "",
|
||||
birthdate: new Date("2003-09-20"),
|
||||
internalId: "1312",
|
||||
},
|
||||
},
|
||||
];
|
14
src/demodata/vehicle.ts
Normal file
14
src/demodata/vehicle.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import type { VehicleViewModel } from "../viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
|
||||
export const vehicleDemoData: Array<VehicleViewModel> = [
|
||||
{
|
||||
id: "kjhb",
|
||||
name: "HLF",
|
||||
type: "HLF 20/10",
|
||||
},
|
||||
{
|
||||
id: "kjhb",
|
||||
name: "LF",
|
||||
type: "LF 8/6",
|
||||
},
|
||||
];
|
|
@ -1,7 +1,7 @@
|
|||
import { useNewsletterStore } from "@/stores/admin/club/newsletter/newsletter";
|
||||
import { useNewsletterDatesStore } from "@/stores/admin/club/newsletter/newsletterDates";
|
||||
import { useNewsletterRecipientsStore } from "@/stores/admin/club/newsletter/newsletterRecipients";
|
||||
import { useNewsletterPrintoutStore } from "../stores/admin/club/newsletter/newsletterPrintout";
|
||||
import { useNewsletterPrintoutStore } from "../../stores/admin/club/newsletter/newsletterPrintout";
|
||||
|
||||
export async function setNewsletterId(to: any, from: any, next: any) {
|
||||
const newsletter = useNewsletterStore();
|
|
@ -3,7 +3,7 @@ import { useProtocolAgendaStore } from "@/stores/admin/club/protocol/protocolAge
|
|||
import { useProtocolDecisionStore } from "@/stores/admin/club/protocol/protocolDecision";
|
||||
import { useProtocolPresenceStore } from "@/stores/admin/club/protocol/protocolPresence";
|
||||
import { useProtocolVotingStore } from "@/stores/admin/club/protocol/protocolVoting";
|
||||
import { useProtocolPrintoutStore } from "../stores/admin/club/protocol/protocolPrintout";
|
||||
import { useProtocolPrintoutStore } from "../../stores/admin/club/protocol/protocolPrintout";
|
||||
|
||||
export async function setProtocolId(to: any, from: any, next: any) {
|
||||
const protocol = useProtocolStore();
|
|
@ -6,11 +6,17 @@ import { loadAccountData } from "./accountGuard";
|
|||
import { isSetup } from "./setupGuard";
|
||||
import { abilityAndNavUpdate } from "./adminGuard";
|
||||
import type { PermissionType, PermissionSection, PermissionModule } from "@/types/permissionTypes";
|
||||
import { resetMemberStores, setMemberId } from "./memberGuard";
|
||||
import { resetProtocolStores, setProtocolId } from "./protocolGuard";
|
||||
import { resetNewsletterStores, setNewsletterId } from "./newsletterGuard";
|
||||
import { resetMemberStores, setMemberId } from "./club/memberGuard";
|
||||
import { resetProtocolStores, setProtocolId } from "./club/protocolGuard";
|
||||
import { resetNewsletterStores, setNewsletterId } from "./club/newsletterGuard";
|
||||
import { config } from "../config";
|
||||
import { setBackupPage } from "./backupGuard";
|
||||
import { setBackupPage } from "./management/backupGuard";
|
||||
import { resetEquipmentTypeStores, setEquipmentTypeId } from "./unit/equipmentType";
|
||||
import { resetEquipmentStores, setEquipmentId } from "./unit/equipment";
|
||||
import { resetVehicleStores, setVehicleId } from "./unit/vehicle";
|
||||
import { resetRespiratoryGearStores, setRespiratoryGearId } from "./unit/respiratoryGear";
|
||||
import { resetRespiratoryWearerStores, setRespiratoryWearerId } from "./unit/respiratoryWearer";
|
||||
import { resetRespiratoryMissionStores, setRespiratoryMissionId } from "./unit/respiratoryMission";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
|
@ -329,12 +335,13 @@ const router = createRouter({
|
|||
path: "",
|
||||
name: "admin-unit-equipment",
|
||||
component: () => import("@/views/admin/unit/equipment/Equipment.vue"),
|
||||
beforeEnter: [resetEquipmentStores],
|
||||
},
|
||||
{
|
||||
path: ":equipmentId",
|
||||
name: "admin-unit-equipment-routing",
|
||||
component: () => import("@/views/admin/unit/equipment/EquipmentRouting.vue"),
|
||||
beforeEnter: [] /** set equipment ID */,
|
||||
beforeEnter: [setEquipmentId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
|
@ -372,12 +379,13 @@ const router = createRouter({
|
|||
path: "",
|
||||
name: "admin-unit-vehicle",
|
||||
component: () => import("@/views/admin/unit/vehicle/Vehicle.vue"),
|
||||
beforeEnter: [resetVehicleStores],
|
||||
},
|
||||
{
|
||||
path: ":vehicleId",
|
||||
name: "admin-unit-vehicle-routing",
|
||||
component: () => import("@/views/admin/unit/vehicle/VehicleRouting.vue"),
|
||||
beforeEnter: [] /** set vehicle ID */,
|
||||
beforeEnter: [setVehicleId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
|
@ -415,12 +423,13 @@ const router = createRouter({
|
|||
path: "",
|
||||
name: "admin-unit-respiratory_gear",
|
||||
component: () => import("@/views/admin/unit/respiratoryGear/RespiratoryGear.vue"),
|
||||
beforeEnter: [resetRespiratoryGearStores],
|
||||
},
|
||||
{
|
||||
path: ":respiratoryGearId",
|
||||
name: "admin-unit-respiratory_gear-routing",
|
||||
component: () => import("@/views/admin/unit/respiratoryGear/RespiratoryGearRouting.vue"),
|
||||
beforeEnter: [] /** set respiratory_gear ID */,
|
||||
beforeEnter: [setRespiratoryGearId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
|
@ -458,12 +467,13 @@ const router = createRouter({
|
|||
path: "",
|
||||
name: "admin-unit-respiratory_wearer",
|
||||
component: () => import("@/views/admin/unit/respiratoryWearer/RespiratoryWearer.vue"),
|
||||
beforeEnter: [resetRespiratoryWearerStores],
|
||||
},
|
||||
{
|
||||
path: ":respiratoryWearerId",
|
||||
name: "admin-unit-respiratory_wearer-routing",
|
||||
component: () => import("@/views/admin/unit/respiratoryWearer/RespiratoryWearerRouting.vue"),
|
||||
beforeEnter: [] /** set respiratory_wearer ID */,
|
||||
beforeEnter: [setRespiratoryWearerId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
|
@ -501,12 +511,13 @@ const router = createRouter({
|
|||
path: "",
|
||||
name: "admin-unit-respiratory_mission",
|
||||
component: () => import("@/views/admin/unit/respiratoryMission/RespiratoryMission.vue"),
|
||||
beforeEnter: [resetRespiratoryMissionStores],
|
||||
},
|
||||
{
|
||||
path: ":respiratoryMissionId",
|
||||
name: "admin-unit-respiratory_mission-routing",
|
||||
component: () => import("@/views/admin/unit/respiratoryMission/RespiratoryMissionRouting.vue"),
|
||||
beforeEnter: [] /** set respiratory_mission ID */,
|
||||
beforeEnter: [setRespiratoryMissionId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
|
@ -558,12 +569,13 @@ const router = createRouter({
|
|||
path: "",
|
||||
name: "admin-unit-equipment_type",
|
||||
component: () => import("@/views/admin/unit/equipmentType/EquipmentType.vue"),
|
||||
beforeEnter: [resetEquipmentTypeStores],
|
||||
},
|
||||
{
|
||||
path: ":equipmentTypeId",
|
||||
name: "admin-unit-equipment_type-routing",
|
||||
component: () => import("@/views/admin/unit/equipmentType/EquipmentTypeRouting.vue"),
|
||||
beforeEnter: [] /** set equipment_type ID */,
|
||||
beforeEnter: [setEquipmentTypeId],
|
||||
props: true,
|
||||
children: [
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { useBackupStore } from "../stores/admin/management/backup";
|
||||
import { useBackupStore } from "@/stores/admin/management/backup";
|
||||
|
||||
export async function setBackupPage(to: any, from: any, next: any) {
|
||||
const backup = useBackupStore();
|
20
src/router/unit/equipment.ts
Normal file
20
src/router/unit/equipment.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { useEquipmentStore } from "@/stores/admin/unit/equipment/equipment";
|
||||
|
||||
export async function setEquipmentId(to: any, from: any, next: any) {
|
||||
const EquipmentStore = useEquipmentStore();
|
||||
EquipmentStore.activeEquipment = to.params?.equipmentId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetEquipmentStores(to: any, from: any, next: any) {
|
||||
const EquipmentStore = useEquipmentStore();
|
||||
EquipmentStore.activeEquipment = null;
|
||||
EquipmentStore.activeEquipmentObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
20
src/router/unit/equipmentType.ts
Normal file
20
src/router/unit/equipmentType.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { useEquipmentTypeStore } from "@/stores/admin/unit/equipmentType/equipmentType";
|
||||
|
||||
export async function setEquipmentTypeId(to: any, from: any, next: any) {
|
||||
const equipmentTypeStore = useEquipmentTypeStore();
|
||||
equipmentTypeStore.activeEquipmentType = to.params?.equipmentTypeId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetEquipmentTypeStores(to: any, from: any, next: any) {
|
||||
const equipmentTypeStore = useEquipmentTypeStore();
|
||||
equipmentTypeStore.activeEquipmentType = null;
|
||||
equipmentTypeStore.activeEquipmentTypeObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
20
src/router/unit/respiratoryGear.ts
Normal file
20
src/router/unit/respiratoryGear.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { useRespiratoryGearStore } from "@/stores/admin/unit/respiratoryGear/respiratoryGear";
|
||||
|
||||
export async function setRespiratoryGearId(to: any, from: any, next: any) {
|
||||
const RespiratoryGearStore = useRespiratoryGearStore();
|
||||
RespiratoryGearStore.activeRespiratoryGear = to.params?.respiratoryGearId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetRespiratoryGearStores(to: any, from: any, next: any) {
|
||||
const RespiratoryGearStore = useRespiratoryGearStore();
|
||||
RespiratoryGearStore.activeRespiratoryGear = null;
|
||||
RespiratoryGearStore.activeRespiratoryGearObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
20
src/router/unit/respiratoryMission.ts
Normal file
20
src/router/unit/respiratoryMission.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { useRespiratoryMissionStore } from "@/stores/admin/unit/respiratoryMission/respiratoryMission";
|
||||
|
||||
export async function setRespiratoryMissionId(to: any, from: any, next: any) {
|
||||
const RespiratoryMissionStore = useRespiratoryMissionStore();
|
||||
RespiratoryMissionStore.activeRespiratoryMission = to.params?.respiratoryMissionId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetRespiratoryMissionStores(to: any, from: any, next: any) {
|
||||
const RespiratoryMissionStore = useRespiratoryMissionStore();
|
||||
RespiratoryMissionStore.activeRespiratoryMission = null;
|
||||
RespiratoryMissionStore.activeRespiratoryMissionObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
20
src/router/unit/respiratoryWearer.ts
Normal file
20
src/router/unit/respiratoryWearer.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { useRespiratoryWearerStore } from "@/stores/admin/unit/respiratoryWearer/respiratoryWearer";
|
||||
|
||||
export async function setRespiratoryWearerId(to: any, from: any, next: any) {
|
||||
const RespiratoryWearerStore = useRespiratoryWearerStore();
|
||||
RespiratoryWearerStore.activeRespiratoryWearer = to.params?.respiratoryWearerId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetRespiratoryWearerStores(to: any, from: any, next: any) {
|
||||
const RespiratoryWearerStore = useRespiratoryWearerStore();
|
||||
RespiratoryWearerStore.activeRespiratoryWearer = null;
|
||||
RespiratoryWearerStore.activeRespiratoryWearerObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
20
src/router/unit/vehicle.ts
Normal file
20
src/router/unit/vehicle.ts
Normal file
|
@ -0,0 +1,20 @@
|
|||
import { useVehicleStore } from "@/stores/admin/unit/vehicle/vehicle";
|
||||
|
||||
export async function setVehicleId(to: any, from: any, next: any) {
|
||||
const VehicleStore = useVehicleStore();
|
||||
VehicleStore.activeVehicle = to.params?.vehicleId ?? null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
||||
|
||||
export async function resetVehicleStores(to: any, from: any, next: any) {
|
||||
const VehicleStore = useVehicleStore();
|
||||
VehicleStore.activeVehicle = null;
|
||||
VehicleStore.activeVehicleObj = null;
|
||||
|
||||
//useXYStore().$reset();
|
||||
|
||||
next();
|
||||
}
|
|
@ -6,6 +6,8 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/damageReport/damageReport.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import type { VehicleViewModel } from "../../../../viewmodels/admin/unit/vehicle/vehicle.models";
|
||||
import { damageReportDemoData } from "../../../../demodata/damageReport";
|
||||
|
||||
export const useDamageReportStore = defineStore("damageReport", {
|
||||
state: () => {
|
||||
|
@ -13,11 +15,14 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
damageReports: [] as Array<DamageReportViewModel & { tab_pos: number }>,
|
||||
totalCount: 0 as number,
|
||||
loading: "loading" as "loading" | "fetched" | "failed",
|
||||
loadingActive: "loading" as "loading" | "fetched" | "failed",
|
||||
};
|
||||
},
|
||||
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";
|
||||
http
|
||||
|
@ -63,9 +68,6 @@ export const useDamageReportStore = defineStore("damageReport", {
|
|||
fetchDamageReportById(id: string) {
|
||||
return http.get(`/admin/damageReport/${id}`);
|
||||
},
|
||||
fetchDamageReportStatisticsById(id: string) {
|
||||
return http.get(`/admin/damageReport/${id}/statistics`);
|
||||
},
|
||||
async createDamageReport(damageReport: CreateDamageReportViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/damageReport`, {
|
||||
// TODO: data
|
||||
|
|
|
@ -6,6 +6,7 @@ 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: () => {
|
||||
|
@ -20,6 +21,10 @@ 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
|
||||
|
@ -63,6 +68,9 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
});
|
||||
},
|
||||
fetchEquipmentByActiveId() {
|
||||
this.activeEquipmentObj = equipmentDemoData.find((e) => e.id == this.activeEquipment) as EquipmentViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipment/${this.activeEquipment}`)
|
||||
|
@ -77,14 +85,6 @@ export const useEquipmentStore = defineStore("equipment", {
|
|||
fetchEquipmentById(id: string) {
|
||||
return http.get(`/admin/equipment/${id}`);
|
||||
},
|
||||
async printEquipmentByActiveId() {
|
||||
return http.get(`/admin/equipment/${this.activeEquipment}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchEquipmentStatisticsById(id: string) {
|
||||
return http.get(`/admin/equipment/${id}/statistics`);
|
||||
},
|
||||
async createEquipment(equipment: CreateEquipmentViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/equipment`, {
|
||||
// TODO: data
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/equipmentType/equipmentType.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { equipmentTypeDemoData } from "../../../../demodata/equipmentType";
|
||||
|
||||
export const useEquipmentTypeStore = defineStore("equipmentType", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ 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
|
||||
|
@ -48,21 +53,17 @@ export const useEquipmentTypeStore = defineStore("equipmentType", {
|
|||
return { ...res, data: res.data.equipments };
|
||||
});
|
||||
},
|
||||
async getEquipmentTypesByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/equipmentType/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.equipments };
|
||||
});
|
||||
},
|
||||
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 };
|
||||
});
|
||||
},
|
||||
fetchEquipmentTypeByActiveId() {
|
||||
this.activeEquipmentTypeObj = equipmentTypeDemoData.find(
|
||||
(e) => e.id == this.activeEquipmentType
|
||||
) as EquipmentTypeViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/equipmentType/${this.activeEquipmentType}`)
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/respiratoryGear/respiratoryGear.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryGearDemoData } from "../../../../demodata/respiratoryGear";
|
||||
|
||||
export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ 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
|
||||
|
@ -48,21 +53,17 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
return { ...res, data: res.data.respiratoryGears };
|
||||
});
|
||||
},
|
||||
async getRespiratoryGearsByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/respiratoryGear/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.respiratoryGears };
|
||||
});
|
||||
},
|
||||
async searchRespiratoryGears(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/respiratoryGear?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.respiratoryGears };
|
||||
});
|
||||
},
|
||||
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}`)
|
||||
|
@ -77,14 +78,6 @@ export const useRespiratoryGearStore = defineStore("respiratoryGear", {
|
|||
fetchRespiratoryGearById(id: string) {
|
||||
return http.get(`/admin/respiratoryGear/${id}`);
|
||||
},
|
||||
async printRespiratoryGearByActiveId() {
|
||||
return http.get(`/admin/respiratoryGear/${this.activeRespiratoryGear}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchRespiratoryGearStatisticsById(id: string) {
|
||||
return http.get(`/admin/respiratoryGear/${id}/statistics`);
|
||||
},
|
||||
async createRespiratoryGear(respiratoryGear: CreateRespiratoryGearViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/respiratoryGear`, {
|
||||
// TODO: data
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/respiratoryMission/respiratoryMission.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryMissionDemoData } from "../../../../demodata/respiratoryMission";
|
||||
|
||||
export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ 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
|
||||
|
@ -52,21 +57,17 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
return { ...res, data: res.data.respiratoryMissions };
|
||||
});
|
||||
},
|
||||
async getRespiratoryMissionsByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/respiratoryMission/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.respiratoryMissions };
|
||||
});
|
||||
},
|
||||
async searchRespiratoryMissions(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/respiratoryMission?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.respiratoryMissions };
|
||||
});
|
||||
},
|
||||
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}`)
|
||||
|
@ -81,14 +82,6 @@ export const useRespiratoryMissionStore = defineStore("respiratoryMission", {
|
|||
fetchRespiratoryMissionById(id: string) {
|
||||
return http.get(`/admin/respiratoryMission/${id}`);
|
||||
},
|
||||
async printRespiratoryMissionByActiveId() {
|
||||
return http.get(`/admin/respiratoryMission/${this.activeRespiratoryMission}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchRespiratoryMissionStatisticsById(id: string) {
|
||||
return http.get(`/admin/respiratoryMission/${id}/statistics`);
|
||||
},
|
||||
async createRespiratoryMission(
|
||||
respiratoryMission: CreateRespiratoryMissionViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
} from "@/viewmodels/admin/unit/respiratoryWearer/respiratoryWearer.models";
|
||||
import { http } from "@/serverCom";
|
||||
import type { AxiosResponse } from "axios";
|
||||
import { respiratoryWearerDemoData } from "../../../../demodata/respiratoryWearer";
|
||||
|
||||
export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
||||
state: () => {
|
||||
|
@ -20,6 +21,10 @@ 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
|
||||
|
@ -52,21 +57,17 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
return { ...res, data: res.data.respiratoryWearers };
|
||||
});
|
||||
},
|
||||
async getRespiratoryWearersByIds(ids: Array<string>): Promise<AxiosResponse<any, any>> {
|
||||
return await http
|
||||
.post(`/admin/respiratoryWearer/ids`, {
|
||||
ids,
|
||||
})
|
||||
.then((res) => {
|
||||
return { ...res, data: res.data.respiratoryWearers };
|
||||
});
|
||||
},
|
||||
async searchRespiratoryWearers(search: string): Promise<AxiosResponse<any, any>> {
|
||||
return await http.get(`/admin/respiratoryWearer?search=${search}&noLimit=true`).then((res) => {
|
||||
return { ...res, data: res.data.respiratoryWearers };
|
||||
});
|
||||
},
|
||||
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}`)
|
||||
|
@ -81,14 +82,6 @@ export const useRespiratoryWearerStore = defineStore("respiratoryWearer", {
|
|||
fetchRespiratoryWearerById(id: string) {
|
||||
return http.get(`/admin/respiratoryWearer/${id}`);
|
||||
},
|
||||
async printRespiratoryWearerByActiveId() {
|
||||
return http.get(`/admin/respiratoryWearer/${this.activeRespiratoryWearer}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchRespiratoryWearerStatisticsById(id: string) {
|
||||
return http.get(`/admin/respiratoryWearer/${id}/statistics`);
|
||||
},
|
||||
async createRespiratoryWearer(
|
||||
respiratoryWearer: CreateRespiratoryWearerViewModel
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
|
|
|
@ -6,6 +6,7 @@ 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: () => {
|
||||
|
@ -20,6 +21,10 @@ 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
|
||||
|
@ -63,6 +68,9 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
});
|
||||
},
|
||||
fetchVehicleByActiveId() {
|
||||
this.activeVehicleObj = vehicleDemoData.find((e) => e.id == this.activeVehicle) as VehicleViewModel;
|
||||
this.loading = "fetched";
|
||||
return;
|
||||
this.loadingActive = "loading";
|
||||
http
|
||||
.get(`/admin/vehicle/${this.activeVehicle}`)
|
||||
|
@ -77,14 +85,6 @@ export const useVehicleStore = defineStore("vehicle", {
|
|||
fetchVehicleById(id: string) {
|
||||
return http.get(`/admin/vehicle/${id}`);
|
||||
},
|
||||
async printVehicleByActiveId() {
|
||||
return http.get(`/admin/vehicle/${this.activeVehicle}/print`, {
|
||||
responseType: "blob",
|
||||
});
|
||||
},
|
||||
fetchVehicleStatisticsById(id: string) {
|
||||
return http.get(`/admin/vehicle/${id}/statistics`);
|
||||
},
|
||||
async createVehicle(vehicle: CreateVehicleViewModel): Promise<AxiosResponse<any, any>> {
|
||||
const result = await http.post(`/admin/vehicle`, {
|
||||
// TODO: data
|
||||
|
|
|
@ -4,6 +4,7 @@ export interface DamageReportViewModel {
|
|||
id: string;
|
||||
reported: Date;
|
||||
status: string;
|
||||
done: boolean;
|
||||
description: string;
|
||||
affectedEquipmentId: string;
|
||||
affectedEquipment: EquipmentViewModel;
|
||||
|
@ -17,4 +18,5 @@ export interface CreateDamageReportViewModel {
|
|||
export interface UpdateDamageReportViewModel {
|
||||
id: string;
|
||||
status: string;
|
||||
done: boolean;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
export interface VehicleViewModel {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface CreateVehicleViewModel {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface UpdateVehicleViewModel {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<template #topBar>
|
||||
<div class="flex flex-row gap-2 items-center justify-between pt-5 pb-3 px-7">
|
||||
<h1 class="font-bold text-xl h-8 min-h-fit grow">
|
||||
{{ activeVehicleObj?.lastname }}, {{ activeVehicleObj?.firstname }}
|
||||
{{ activeVehicleObj?.name }}
|
||||
</h1>
|
||||
|
||||
<RouterLink v-if="can('update', 'unit', 'vehicle')" :to="{ name: 'admin-unit-vehicle-edit' }">
|
||||
|
|
Loading…
Add table
Reference in a new issue