Skip to content

Commit

Permalink
logik zur befuellung der MessstellenOverview eingebaut
Browse files Browse the repository at this point in the history
  • Loading branch information
Der-Alex-K committed Jan 15, 2024
1 parent 898424f commit 3167331
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 12 deletions.
5 changes: 4 additions & 1 deletion frontend/src/components/messstelle/MessstelleForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
md="4"
>
<lhm-text-field
:text="editMessstelle.status"
:text="
messstelleStatusText.get(editMessstelle.status)
"
caption="Status"
/>
</v-col>
Expand Down Expand Up @@ -190,6 +192,7 @@ import { computed, ComputedRef, ref, Ref } from "vue";
import MessstelleEditDTO from "@/domain/dto/messstelle/MessstelleEditDTO";
import LhmTextField from "@/components/common/LhmTextField.vue";
import _ from "lodash";
import { messstelleStatusText } from "@/domain/enums/MessstelleStatus";
/* eslint-enable no-unused-vars */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<v-spacer />
<v-btn
color="secondary"
:disabled="isMessstelleInPlanung"
@click="save()"
>
Speichern
Expand All @@ -63,12 +64,13 @@
import MessstelleEditDTO from "@/domain/dto/messstelle/MessstelleEditDTO";
import MessstelleForm from "@/components/messstelle/MessstelleForm.vue";
import MessquerschnittForm from "@/components/messstelle/MessquerschnittForm.vue";
import { onMounted, ref, Ref } from "vue";
import { computed, ComputedRef, onMounted, ref, Ref } from "vue";
import MessstelleService from "@/api/service/MessstelleService";
import { ApiError, Levels } from "@/api/error";
import { useStore } from "@/util/useStore";
import { useRoute } from "vue-router/composables";
import DefaultObjectCreator from "@/util/DefaultObjectCreator";
import { MessstelleStatus } from "@/domain/enums/MessstelleStatus";
const SHEETHEIGHT: Ref<string> = ref("600px");
const activeTab: Ref<number> = ref(0);
Expand All @@ -84,6 +86,10 @@ const emits = defineEmits<{
(e: "saved"): void;
}>();
const isMessstelleInPlanung: ComputedRef<boolean> = computed(() => {
return messstelle.value.status === MessstelleStatus.IN_PLANUNG;
});
onMounted(() => {
loadMessstelle();
});
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/domain/dto/messstelle/MessstelleEditDTO.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import BaseEntity from "@/domain/BaseEntity";
import MessquerschnittEditDTO from "@/domain/dto/messstelle/MessquerschnittEditDTO";
import { MessstelleStatus } from "@/domain/enums/MessstelleStatus";

export default interface MessstelleEditDTO extends BaseEntity {
mstId: string;
name: string;
status: string;
status: MessstelleStatus;
stadtbezirk: string;
stadtbezirkNummer: string;
bemerkung: string;
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/domain/dto/messstelle/MessstelleOverviewDTO.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import BaseEntity from "@/domain/BaseEntity";
import { MessstelleStatus } from "@/domain/enums/MessstelleStatus";

export default interface MessstelleOverviewDTO extends BaseEntity {
mstId: string;
name: string;
status: MessstelleStatus;
geprueft: boolean;
sichtbarDatenportal: boolean;
}
34 changes: 34 additions & 0 deletions frontend/src/domain/enums/MessstelleStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
export const enum MessstelleStatus {
/**
* In Planung
*/
IN_PLANUNG = "IN_PLANUNG",

/**
* In Bestand
*/
IN_BESTAND = "IN_BESTAND",

/**
* AUSSER_BETRIEB
*/
AUSSER_BETRIEB = "AUSSER_BETRIEB",

/**
* ABGEBAUT
*/
ABGEBAUT = "ABGEBAUT",

/**
* UNBEKANNT
*/
UNBEKANNT = "UNBEKANNT",
}

export const messstelleStatusText = new Map<string, string>([
[MessstelleStatus.IN_PLANUNG, "In Planung"],
[MessstelleStatus.IN_BESTAND, "In Bestand"],
[MessstelleStatus.AUSSER_BETRIEB, "Außer Betrieb"],
[MessstelleStatus.ABGEBAUT, "Abgebaut"],
[MessstelleStatus.UNBEKANNT, "unbekannt"],
]);
2 changes: 2 additions & 0 deletions frontend/src/util/DefaultObjectCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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";
import { MessstelleStatus } from "@/domain/enums/MessstelleStatus";

export default class DefaultObjectCreator {
private static readonly MUNICH_CENTER_LATITUDE: number = 48.137227;
Expand Down Expand Up @@ -56,6 +57,7 @@ export default class DefaultObjectCreator {
public static createDefaultMessstelleEditDTO(): MessstelleEditDTO {
const messstelle: MessstelleEditDTO = {} as MessstelleEditDTO;
messstelle.sichtbarDatenportal = false;
messstelle.status = MessstelleStatus.IN_PLANUNG;
messstelle.customSuchwoerter = [];
messstelle.messquerschnitte = [];
return messstelle;
Expand Down
34 changes: 25 additions & 9 deletions frontend/src/views/ErhebungsstellenOverView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,16 @@
focusable
>
<open-messstelle-panel
:header="neueMessstellenHeader"
:header="geplanteMessstellenHeader"
color="orange lighten-4"
icon="mdi-clipboard-clock-outline"
:messstellen="geplanteMessstellen"
/>
<open-messstelle-panel
:header="neuUmgesetzteMessstellenHeader"
color="blue lighten-4"
icon="mdi-clipboard-edit-outline"
:messstellen="neueMessstellen"
icon="mdi-clipboard-plus-outline"
:messstellen="neuUmgesetztMessstellen"
/>
<open-messstelle-panel
:header="nichtSichtbareMessstellenHeader"
Expand All @@ -87,6 +93,7 @@ import { useStore } from "@/util/useStore";
import OpenMessstellePanel from "@/components/messstelle/OpenMessstellePanel.vue";
import MessstelleService from "@/api/service/MessstelleService";
import MessstelleOverviewDTO from "@/domain/dto/messstelle/MessstelleOverviewDTO";
import { MessstelleStatus } from "@/domain/enums/MessstelleStatus";
const store = useStore();
Expand All @@ -105,7 +112,10 @@ const accomplishedZaehlungen: Ref<Array<OpenZaehlungDTO>> = ref(
const correctionZaehlungen: Ref<Array<OpenZaehlungDTO>> = ref(
[] as Array<OpenZaehlungDTO>
);
const neueMessstellen: Ref<Array<MessstelleOverviewDTO>> = ref(
const geplanteMessstellen: Ref<Array<MessstelleOverviewDTO>> = ref(
[] as Array<MessstelleOverviewDTO>
);
const neuUmgesetztMessstellen: Ref<Array<MessstelleOverviewDTO>> = ref(
[] as Array<MessstelleOverviewDTO>
);
const nichtSichtbareMessstellen: Ref<Array<MessstelleOverviewDTO>> = ref(
Expand Down Expand Up @@ -145,8 +155,11 @@ const getAccomplishedHeader: ComputedRef<string> = computed(() => {
const getCorrectionHeader: ComputedRef<string> = computed(() => {
return `Fehlerhafte Zählungen: ${correctionZaehlungen.value.length}`;
});
const neueMessstellenHeader: ComputedRef<string> = computed(() => {
return `Neue Messstellen: ${neueMessstellen.value.length}`;
const geplanteMessstellenHeader: ComputedRef<string> = computed(() => {
return `Geplante Messstellen: ${geplanteMessstellen.value.length}`;
});
const neuUmgesetzteMessstellenHeader: ComputedRef<string> = computed(() => {
return `Neu umgesetzte Messstellen: ${neuUmgesetztMessstellen.value.length}`;
});
const nichtSichtbareMessstellenHeader: ComputedRef<string> = computed(() => {
return `Nicht sichtbare Messstellen: ${nichtSichtbareMessstellen.value.length}`;
Expand Down Expand Up @@ -191,8 +204,11 @@ function loadOpenMessstellen(): void {
MessstelleService.getAllMessstellenForOverview()
.then((messstellen: Array<MessstelleOverviewDTO>) => {
messstellen.forEach((messstelle: MessstelleOverviewDTO) => {
if (!messstelle.geprueft) {
neueMessstellen.value.push(messstelle);
console.error(messstelle.status);
if (messstelle.status === MessstelleStatus.IN_PLANUNG) {
geplanteMessstellen.value.push(messstelle);
} else if (!messstelle.geprueft) {
neuUmgesetztMessstellen.value.push(messstelle);
} else if (!messstelle.sichtbarDatenportal) {
nichtSichtbareMessstellen.value.push(messstelle);
}
Expand All @@ -211,7 +227,7 @@ function sortDataArrays(): void {
accomplishedZaehlungen.value
);
correctionZaehlungen.value = sortByDatumDesc(correctionZaehlungen.value);
neueMessstellen.value = sortByMstId(neueMessstellen.value);
geplanteMessstellen.value = sortByMstId(geplanteMessstellen.value);
nichtSichtbareMessstellen.value = sortByMstId(
nichtSichtbareMessstellen.value
);
Expand Down

0 comments on commit 3167331

Please sign in to comment.