diff --git a/CHANGELOG.md b/CHANGELOG.md index 678e76c28..b5e903f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,31 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie --- +## [1.1.164] – 2025-05-23 + +### 🐞 Fixed + +- POI-Typ wurde beim Öffnen des Modals nicht korrekt im Dropdown angezeigt + - Ursache: `idPoiTyp` fehlte in `marker.options` + - Lösung: `idPoiTyp` im `setupPOIs.js` an Marker übergeben und in `handleEditPoi()` verwendet + +### ✅ Clean + +- `poiUtils.js` und `setupPOIs.js` um konsistente Übergabe von Marker-Metadaten erweitert +- Berechtigungsprüfung in `handleEditPoi()` auf `.some(r => r.IdRight === 56)` umgestellt +- `PoiUpdateModal.js` vollständig refaktoriert mit klarer Zustandstrennung + +### 🧠 Architektur + +- POI-Typ Auswahl basiert nun vollständig auf Redux-Daten (`poiTypSlice`) +- keine hartcodierten Dropdown-Initialwerte mehr – vollständig datengetrieben + +### 🔧 Version + +- 📦 Version erhöht auf **1.1.164** + +--- + ## [1.1.162] – 2025-05-23 ### ♻️ Refactor diff --git a/config/appVersion.js b/config/appVersion.js index 8db9b2f3b..f0d66b638 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.164"; +export const APP_VERSION = "1.1.165"; diff --git a/utils/poiUtils.js b/utils/poiUtils.js index 0cf4acc58..beedf88da 100644 --- a/utils/poiUtils.js +++ b/utils/poiUtils.js @@ -113,10 +113,12 @@ export const handleEditPoi = ( name: marker.options.name, description: marker.options.description, idLD: marker.options.idLD, + idPoiTyp: marker.options.idPoiTyp, }); fetchPoiData(marker.options.id); setShowPoiUpdateModal(true); + console.log("POI option idPoiTyp:", marker.options.idPoiTyp); }; //------------------------------------------------------------------- diff --git a/utils/setupPOIs.js b/utils/setupPOIs.js index 1c3f79f0b..20dbdba17 100644 --- a/utils/setupPOIs.js +++ b/utils/setupPOIs.js @@ -15,7 +15,7 @@ import { useDispatch } from "react-redux"; export const setupPOIs = async ( map, - locations, + pois, poiData, poiTypMap, userRights, @@ -39,13 +39,13 @@ export const setupPOIs = async ( map.removeLayer(poiLayerRef.current); poiLayerRef.current = new L.LayerGroup().addTo(map); - for (const location of locations) { + for (const poi of pois) { try { - const { latitude, longitude } = parsePoint(location.position); - const poiTypName = poiTypMap.get(location.idPoiTyp) || "Unbekannt"; + const { latitude, longitude } = parsePoint(poi.position); + const poiTypName = poiTypMap.get(poi.idPoiTyp) || "Unbekannt"; const canDrag = userRights ? userRights.some((r) => r.IdRight === 56) : false; - const matchingIcon = poiData.find((poi) => poi.idPoi === location.idPoi); + const matchingIcon = poiData.find((poi) => poi.idPoi === poi.idPoi); const iconUrl = matchingIcon ? `/img/icons/pois/${matchingIcon.path}` : "/img/icons/pois/default-icon.png"; const marker = L.marker([latitude, longitude], { @@ -56,11 +56,12 @@ export const setupPOIs = async ( popupAnchor: [1, -34], }), draggable: canDrag, - id: location.idPoi, - name: location.name, - description: location.description, - idLD: location.idLD, - link: location.link, + id: poi.idPoi, + name: poi.name, + description: poi.description, + idLD: poi.idLD, + idPoiTyp: poi.idPoiTyp, + link: poi.link, }); // Nur das Kontextmenü "POI Bearbeiten" hinzufügen, wenn editMode true ist @@ -80,7 +81,7 @@ export const setupPOIs = async ( marker.bindPopup(`