diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 9ffa50c..0c6f04e 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -36,7 +36,9 @@ declare module '@vue/runtime-core' { KnotenLageForm: typeof import('./src/components/zaehlung/form/KnotenLageForm.vue')['default'] KontaktForm: typeof import('./src/components/zaehlung/form/KontaktForm.vue')['default'] LhmTextField: typeof import('./src/components/common/LhmTextField.vue')['default'] - MessstelleInfo: typeof import('./src/components/MessstelleInfo.vue')['default'] + MessquerschnittForm: typeof import('./src/components/messstelle/MessquerschnittForm.vue')['default'] + MessstelleForm: typeof import('./src/components/messstelle/MessstelleForm.vue')['default'] + MessstelleInfo: typeof import('./src/components/messstelle/MessstelleInfo.vue')['default'] MiniMap: typeof import('./src/components/map/MiniMap.vue')['default'] OpenZaehlungPanel: typeof import('./src/components/zaehlung/OpenZaehlungPanel.vue')['default'] QuelleIcon: typeof import('./src/components/icons/QuelleIcon.vue')['default'] @@ -46,6 +48,8 @@ declare module '@vue/runtime-core' { TheSnackbar: typeof import('./src/components/common/TheSnackbar.vue')['default'] TooltipWithIcon: typeof import('./src/components/icons/TooltipWithIcon.vue')['default'] UnreadMessages: typeof import('./src/components/app/UnreadMessages.vue')['default'] + UpdateMessstelleDialog: typeof import('./src/components/messstelle/UpdateMessstelleDialog.vue')['default'] + UpdateMessstelleDialogForm: typeof import('./src/components/messstelle/UpdateMessstelleDialogForm.vue')['default'] UpdateZaehlstelleDialog: typeof import('./src/components/zaehlstelle/UpdateZaehlstelleDialog.vue')['default'] UpdateZaehlstelleForm: typeof import('./src/components/zaehlstelle/UpdateZaehlstelleForm.vue')['default'] VApp: typeof import('vuetify/lib')['VApp'] diff --git a/frontend/src/api/service/MessstelleService.ts b/frontend/src/api/service/MessstelleService.ts index 4fa0a71..5996db6 100644 --- a/frontend/src/api/service/MessstelleService.ts +++ b/frontend/src/api/service/MessstelleService.ts @@ -1,64 +1,30 @@ -import MessstelleDTO from "@/domain/dto/MessstelleDTO"; +import MessstelleEditDTO from "@/domain/dto/messstelle/MessstelleEditDTO"; +import FetchService from "@/api/service/FetchService"; +import BackendIdDTO from "@/domain/dto/bearbeiten/BackendIdDTO"; +import MessstelleInfoDTO from "@/domain/dto/messstelle/MessstelleInfoDTO"; export default class MessstelleService { - static getMessstelleById(id: string): MessstelleDTO { - switch (id) { - case "randomID": - return { - createdTime: "heute", - entityVersion: 0, - id: "randomID", - mstId: "MSTID1", - name: "Messstelle 1", - stadtbezirkNummer: 13, - lat: 48.1887227, - lng: 11.4290655, - customSuchwoerter: ["suchwort1", "suchwort2"], - kommentar: "string", - sichtbarDatenportal: true, - }; - case "randomID2": - return { - createdTime: "heute", - entityVersion: 0, - mstId: "MSTID2", - id: "randomID2", - name: "Messstelle 2", - stadtbezirkNummer: 13, - lat: 48.1316995, - lng: 11.6227731, - customSuchwoerter: ["suchwort1", "suchwort2"], - kommentar: "string", - sichtbarDatenportal: true, - }; - case "randomID3": - return { - createdTime: "heute", - entityVersion: 0, - id: "randomID3", - mstId: "MSTID3", - name: "Messstelle 3", - stadtbezirkNummer: 13, - lat: 48.1315995, - lng: 11.6217731, - customSuchwoerter: ["suchwort1", "suchwort2"], - kommentar: "string", - sichtbarDatenportal: true, - }; - default: - return { - createdTime: "error", - entityVersion: 0, - id: "error", - mstId: "error", - name: "error", - stadtbezirkNummer: 13, - lat: 48.1315995, - lng: 11.6217731, - customSuchwoerter: ["error", "error2"], - kommentar: "error", - sichtbarDatenportal: true, - }; - } + private static readonly ENDPOINT: string = + "api/dave-backend-service/messstelle"; + static getMessstelleInfo(id: string): Promise { + return FetchService.getData( + `${this.ENDPOINT}/info?id=${id}`, + "Beim Laden der Messstellen-Info ist ein Fehler aufgetreten." + ); + } + + static getMessstelleToEdit(id: string): Promise { + return FetchService.getData( + `${this.ENDPOINT}/edit?id=${id}`, + "Beim Laden der Messstellen ist ein Fehler aufgetreten." + ); + } + + static saveMessstelle(data: MessstelleEditDTO): Promise { + return FetchService.patchData( + data, + `${this.ENDPOINT}/update`, + "Beim Aktualisieren der Daten ist ein Fehler aufgetreten. Bitte Daten kontrollieren." + ); } } diff --git a/frontend/src/components/MessstelleInfo.vue b/frontend/src/components/MessstelleInfo.vue deleted file mode 100644 index 479fb6a..0000000 --- a/frontend/src/components/MessstelleInfo.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/frontend/src/components/map/ZaehlstelleMap.vue b/frontend/src/components/map/ZaehlstelleMap.vue index f621cc5..e4871d7 100644 --- a/frontend/src/components/map/ZaehlstelleMap.vue +++ b/frontend/src/components/map/ZaehlstelleMap.vue @@ -177,7 +177,7 @@ import markerIconDiamondViolet from "@/assets/cards-diamond-violet.png"; import markerIconDiamondRed from "@/assets/cards-diamond-red.png"; import TooltipMessstelleDTO from "@/domain/dto/TooltipMessstelleDTO"; import AnzeigeKarteDTO from "@/domain/dto/AnzeigeKarteDTO"; -import MessstelleKarteDTO from "@/domain/dto/MessstelleKarteDTO"; +import MessstelleKarteDTO from "@/domain/dto/messstelle/MessstelleKarteDTO"; /* eslint-enable no-unused-vars */ @Component({ @@ -490,7 +490,11 @@ export default class ZaehlstelleMap extends Vue { } let tooltip = "
"; if (tooltipDto.mstId) { - tooltip = `${tooltip}Messstelle: ${tooltipDto.mstId}
`; + tooltip = `${tooltip}Messstelle: ${tooltipDto.mstId}`; + if (tooltipDto.detektierteVerkehrsarten) { + tooltip = `${tooltip} (${tooltipDto.detektierteVerkehrsarten})`; + } + tooltip = `${tooltip}
`; } if (tooltipDto.standort) { tooltip = `${tooltip}${tooltipDto.standort}
`; @@ -511,9 +515,6 @@ export default class ZaehlstelleMap extends Vue { if (tooltipDto.abbaudatum) { tooltip = `${tooltip}Abbau: ${tooltipDto.abbaudatum}
`; } - if (tooltipDto.detektierteVerkehrsarten) { - tooltip = `${tooltip}Verkehrsarten: ${tooltipDto.detektierteVerkehrsarten}
`; - } if (tooltipDto.datumLetztePlausibleMessung) { tooltip = `${tooltip}Letzte plausible Messung: ${tooltipDto.datumLetztePlausibleMessung}
`; } diff --git a/frontend/src/components/messstelle/MessquerschnittForm.vue b/frontend/src/components/messstelle/MessquerschnittForm.vue new file mode 100644 index 0000000..066a852 --- /dev/null +++ b/frontend/src/components/messstelle/MessquerschnittForm.vue @@ -0,0 +1,141 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/messstelle/MessstelleForm.vue b/frontend/src/components/messstelle/MessstelleForm.vue new file mode 100644 index 0000000..655cc3f --- /dev/null +++ b/frontend/src/components/messstelle/MessstelleForm.vue @@ -0,0 +1,267 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/messstelle/MessstelleInfo.vue b/frontend/src/components/messstelle/MessstelleInfo.vue new file mode 100644 index 0000000..c969d47 --- /dev/null +++ b/frontend/src/components/messstelle/MessstelleInfo.vue @@ -0,0 +1,34 @@ + + + diff --git a/frontend/src/components/messstelle/UpdateMessstelleDialog.vue b/frontend/src/components/messstelle/UpdateMessstelleDialog.vue new file mode 100644 index 0000000..df2c52e --- /dev/null +++ b/frontend/src/components/messstelle/UpdateMessstelleDialog.vue @@ -0,0 +1,49 @@ + + + diff --git a/frontend/src/components/messstelle/UpdateMessstelleDialogForm.vue b/frontend/src/components/messstelle/UpdateMessstelleDialogForm.vue new file mode 100644 index 0000000..ff15f81 --- /dev/null +++ b/frontend/src/components/messstelle/UpdateMessstelleDialogForm.vue @@ -0,0 +1,122 @@ + + + \ No newline at end of file diff --git a/frontend/src/domain/dto/MessstelleDTO.ts b/frontend/src/domain/dto/MessstelleDTO.ts deleted file mode 100644 index d39673a..0000000 --- a/frontend/src/domain/dto/MessstelleDTO.ts +++ /dev/null @@ -1,12 +0,0 @@ -import BaseEntity from "@/domain/BaseEntity"; - -export default interface MessstelleDTO extends BaseEntity { - mstId: string; - name: string; - stadtbezirkNummer: number; - lat: number; - lng: number; - customSuchwoerter: string[]; - kommentar: string; - sichtbarDatenportal: boolean; -} diff --git a/frontend/src/domain/dto/messstelle/MessquerschnittEditDTO.ts b/frontend/src/domain/dto/messstelle/MessquerschnittEditDTO.ts new file mode 100644 index 0000000..f2cb5fd --- /dev/null +++ b/frontend/src/domain/dto/messstelle/MessquerschnittEditDTO.ts @@ -0,0 +1,16 @@ +import BaseEntity from "@/domain/BaseEntity"; + +export default interface MessquerschnittEditDTO extends BaseEntity { + mqId: string; + strassenname: string; + lageMessquerschnitt: string; + fahrtrichtung: string; + latitude: number; + longitude: number; + anzahlFahrspuren: number; + fahrzeugKlassen: string; + detektierteVerkehrsarten: string; + hersteller: string; + anzahlDetektoren: number; + standort: string; +} diff --git a/frontend/src/domain/dto/messstelle/MessstelleEditDTO.ts b/frontend/src/domain/dto/messstelle/MessstelleEditDTO.ts new file mode 100644 index 0000000..a0e548f --- /dev/null +++ b/frontend/src/domain/dto/messstelle/MessstelleEditDTO.ts @@ -0,0 +1,24 @@ +import BaseEntity from "@/domain/BaseEntity"; +import MessquerschnittEditDTO from "@/domain/dto/messstelle/MessquerschnittEditDTO"; + +export default interface MessstelleEditDTO extends BaseEntity { + mstId: string; + name: string; + status: string; + stadtbezirk: string; + stadtbezirkNummer: string; + bemerkung: string; + latitude: number; + longitude: number; + realisierungsdatum: string; + abbaudatum: string; + datumLetztePlausibleMessung: string; + + customSuchwoerter: string[]; + kommentar: string; + standort: string; + geprueft: boolean; + sichtbarDatenportal: boolean; + + messquerschnitte: Array; +} diff --git a/frontend/src/domain/dto/messstelle/MessstelleInfoDTO.ts b/frontend/src/domain/dto/messstelle/MessstelleInfoDTO.ts new file mode 100644 index 0000000..cfc7154 --- /dev/null +++ b/frontend/src/domain/dto/messstelle/MessstelleInfoDTO.ts @@ -0,0 +1,9 @@ +import BaseEntity from "@/domain/BaseEntity"; + +export default interface MessstelleInfoDTO extends BaseEntity { + mstId: string; + stadtbezirk: string; + stadtbezirkNummer: string; + latitude: number; + longitude: number; +} diff --git a/frontend/src/domain/dto/MessstelleKarteDTO.ts b/frontend/src/domain/dto/messstelle/MessstelleKarteDTO.ts similarity index 100% rename from frontend/src/domain/dto/MessstelleKarteDTO.ts rename to frontend/src/domain/dto/messstelle/MessstelleKarteDTO.ts diff --git a/frontend/src/util/DefaultObjectCreator.ts b/frontend/src/util/DefaultObjectCreator.ts index b4129d2..d82dc42 100644 --- a/frontend/src/util/DefaultObjectCreator.ts +++ b/frontend/src/util/DefaultObjectCreator.ts @@ -8,6 +8,8 @@ import Status from "@/domain/enums/Status"; import HochrechnungsfaktorDTO from "@/domain/dto/HochrechnungsfaktorDTO"; import DienstleisterDTO from "@/domain/dto/DienstleisterDTO"; import EmailAddressDTO from "@/domain/dto/EmailAddressDTO"; +import MessstelleEditDTO from "@/domain/dto/messstelle/MessstelleEditDTO"; +import MessstelleInfoDTO from "@/domain/dto/messstelle/MessstelleInfoDTO"; export default class DefaultObjectCreator { private static readonly MUNICH_CENTER_LATITUDE: number = 48.137227; @@ -51,6 +53,18 @@ export default class DefaultObjectCreator { return zaehlstelle; } + public static createDefaultMessstelleEditDTO(): MessstelleEditDTO { + const messstelle: MessstelleEditDTO = {} as MessstelleEditDTO; + messstelle.sichtbarDatenportal = false; + messstelle.customSuchwoerter = []; + messstelle.messquerschnitte = []; + return messstelle; + } + + public static createDefaultMessstelleInfoDTO(): MessstelleInfoDTO { + return {} as MessstelleInfoDTO; + } + public static createDefaultHochrechnungsfaktor(): HochrechnungsfaktorDTO { const faktor: HochrechnungsfaktorDTO = {} as HochrechnungsfaktorDTO; faktor.matrix = ""; diff --git a/frontend/src/util/useStore.ts b/frontend/src/util/useStore.ts new file mode 100644 index 0000000..6e96253 --- /dev/null +++ b/frontend/src/util/useStore.ts @@ -0,0 +1,9 @@ +import { getCurrentInstance } from "vue"; + +export function useStore() { + const instance = getCurrentInstance(); + if (!instance) { + throw new Error(`useStore should be called in setup().`); + } + return instance.proxy.$store; +} diff --git a/frontend/src/views/MessstelleView.vue b/frontend/src/views/MessstelleView.vue index 1ae8bb0..82826f1 100644 --- a/frontend/src/views/MessstelleView.vue +++ b/frontend/src/views/MessstelleView.vue @@ -12,14 +12,14 @@ class="d-flex flex-column" > - - + @@ -30,27 +30,38 @@ :height="headerHeightVh" :minheight="headerHeightVh" show-marker="true" - :reload="reloadMessstelle" + :reload="reloadMessstelleMap" width="100%" /> + +