Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint 4 #34

Merged
merged 7 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 46 additions & 5 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@
<v-icon small>mdi-counter</v-icon>
{{ item.text }}
</v-list-item-title>
<v-list-item-title
v-if="item.type === suggestionTypeMessstelle"
@click="showMessstelle(item)"
>
<v-icon small>mdi-cards-diamond</v-icon>
{{ item.text }}
</v-list-item-title>
</v-list-item-content>
</template>
</v-autocomplete>
Expand Down Expand Up @@ -94,6 +101,7 @@
...)<br />
* Straßen- / Platzname (Rosenheimerplatz, Dachauer Straße,
...)<br />
* Messstellennummer / -name (4203,...)<br />
<!-- Es fehlt noch: Wetter, Schulzeit, (erweiterte) Zählsituation-->
</span>
</v-tooltip>
Expand Down Expand Up @@ -194,6 +202,7 @@ import SucheWordSuggestDTO from "@/domain/dto/suche/SucheWordSuggestDTO";
import SucheComplexSuggestsDTO from "@/domain/dto/suche/SucheComplexSuggestsDTO";
import SucheZaehlungSuggestDTO from "@/domain/dto/suche/SucheZaehlungSuggestDTO";
import SucheZaehlstelleSuggestDTO from "@/domain/dto/suche/SucheZaehlstelleSuggestDTO";
import SucheMessstelleSuggestDTO from "@/domain/dto/suche/SucheMessstelleSuggestDTO";
import DefaultObjectCreator from "@/util/DefaultObjectCreator";
import BaseUrlProvider from "@/api/util/BaseUrlProvider";
/* eslint-enable no-unused-vars */
Expand All @@ -207,6 +216,9 @@ export default class App extends Vue {
private static readonly SUGGESTION_TYPE_ZAEHLSTELLE: string = "zaehlstelle";
private static readonly SUGGESTION_TYPE_ZAEHLUNG: string = "zaehlung";
private static readonly SUGGESTION_TYPE_MESSSTELLE: string = "messstelle";
private static readonly URL_HANDBUCH_LINK: string =
"https://wilma.muenchen.de/web/senders/af10dc2a-8da5-4d24-815a-b6a9df4c686b/documents/54ddf065-d01f-4965-9bdf-c66ea47927c8";
Expand Down Expand Up @@ -256,6 +268,10 @@ export default class App extends Vue {
return App.SUGGESTION_TYPE_ZAEHLUNG;
}
get suggestionTypeMessstelle(): string {
return App.SUGGESTION_TYPE_MESSSTELLE;
}
// Lifecycle hook
created() {
SsoUserInfoService.getUserInfo()
Expand All @@ -270,12 +286,10 @@ export default class App extends Vue {
return false;
});
this.getFrontendVersion().then((version: string) => {
console.info("Frontend Version: ", version);
this.frontendVersion = version;
});
this.getBackendVersion().then((version: string) => {
console.info("Backend Version: ", version);
this.backendVersion = version;
});
}
Expand Down Expand Up @@ -313,6 +327,7 @@ export default class App extends Vue {
word.text,
this.suggestionTypeVorschlag,
"",
"",
""
)
);
Expand All @@ -326,7 +341,8 @@ export default class App extends Vue {
zaehlung.text,
this.suggestionTypeZaehlung,
zaehlung.zaehlstelleId,
zaehlung.id
zaehlung.id,
""
)
);
}
Expand All @@ -339,11 +355,26 @@ export default class App extends Vue {
zaehlstelle.text,
this.suggestionTypeZaehlstelle,
zaehlstelle.id,
"",
""
)
);
}
);
suggestions.messstellenSuggests.forEach(
(messstelle: SucheMessstelleSuggestDTO) => {
this.suggestions.push(
new Suggest(
messstelle.text,
this.suggestionTypeMessstelle,
"",
"",
messstelle.id
)
);
}
);
})
.catch((error) =>
this.$store.dispatch("snackbar/showError", error)
Expand Down Expand Up @@ -390,11 +421,15 @@ export default class App extends Vue {
}
this.$store.commit("search/lastSearchQuery", this.searchQuery);
if (this.$route.name === "zaehlstelle" && this.searchQuery !== "") {
if (
(this.$route.name === "zaehlstelle" ||
this.$route.name === "messstelle") &&
this.searchQuery !== ""
) {
this.$router.push(`/`);
}
SucheService.searchZaehlstelle(this.searchQuery)
SucheService.searchErhebungsstelle(this.searchQuery)
.then((result) => {
this.$store.commit("search/result", result);
})
Expand Down Expand Up @@ -422,6 +457,12 @@ export default class App extends Vue {
);
}
showMessstelle(item: Suggest) {
this.selectedSuggestion =
DefaultObjectCreator.createDefaultSuggestion();
this.$router.push(`/messstelle/${item.mstId}`);
}
updateSearchQuery(itemIndex: number) {
if (itemIndex > -1) {
this.searchQuery = this.getSuggestions[itemIndex].text;
Expand Down
59 changes: 4 additions & 55 deletions frontend/src/api/service/SucheService.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import FetchService from "@/api/service/FetchService";
import SucheComplexSuggestsDTO from "@/domain/dto/suche/SucheComplexSuggestsDTO";
import ZaehlstelleKarteDTO from "@/domain/dto/ZaehlstelleKarteDTO";
import MessstelleKarteDTO from "@/domain/dto/MessstelleKarteDTO";
import AnzeigeKarteDTO from "@/domain/dto/AnzeigeKarteDTO";

export default class SucheService {
Expand All @@ -16,61 +14,12 @@ export default class SucheService {
);
}

static searchZaehlstelle(query: string): Promise<Array<AnzeigeKarteDTO>> {
static searchErhebungsstelle(
query: string
): Promise<Array<AnzeigeKarteDTO>> {
return FetchService.getData(
`${this.ENDPOINT}/search?nofilter=true&query=${query}`,
"Beim Suchen von Zählstellen ist ein Fehler aufgetreten."
"Beim Suchen von Zähl-/Messstellen ist ein Fehler aufgetreten."
);
}
static getMockMessstelleKarte(): AnzeigeKarteDTO[] {
const mstOne: MessstelleKarteDTO = {
type: "messstelle",
id: "randomID",
latitude: 48.1887227,
longitude: 11.4290655,
tooltip: {
mstId: "MSTID1",
standortDatenportal: "StandortDatenportal1",
stadtbezirk: 13,
realisierungsdatum: "01.01.2023",
abbaudatum: "01.02.2023",
datumLetzteMessung: "15.01.2023",
kfz: true,
},
};

const msttwo: MessstelleKarteDTO = {
type: "messstelle",
id: "randomID2",
latitude: 48.1316995,
longitude: 11.6227731,
tooltip: {
mstId: "MSTID2",
standortDatenportal: "StandortDatenportal2",
stadtbezirk: 13,
realisierungsdatum: "02.01.2020",
abbaudatum: "04.04.2020",
datumLetzteMessung: "31.03.2020",
kfz: true,
},
};

const mstthree: MessstelleKarteDTO = {
type: "messstelle",
id: "randomID3",
latitude: 48.1315995,
longitude: 11.6217731,
tooltip: {
mstId: "MSTID3",
standortDatenportal: "StandortDatenportal3",
stadtbezirk: 13,
realisierungsdatum: "01.01.2023",
abbaudatum: "01.01.2023",
datumLetzteMessung: "01.03.2023",
kfz: true,
},
};

return [mstOne, msttwo, mstthree];
}
}
Loading
Loading