Der Name von POI lesen und in Aktualisierung-Popup einfügen
This commit is contained in:
@@ -39,12 +39,30 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||
const [currentPoiData, setCurrentPoiData] = useState(null);
|
||||
|
||||
const handleEditPoi = (marker) => {
|
||||
console.log("Gewählte Marker ID (idPoi):", marker.options.id);
|
||||
// Setzen der aktuellen POI-Daten für die Übergabe an das Modal
|
||||
console.log("Selected Marker ID (idPoi):", marker.options.idPoi);
|
||||
console.log("Selected Marker Description:", marker.options.description);
|
||||
|
||||
setCurrentPoiData({
|
||||
idPoi: marker.options.id,
|
||||
//name: marker.options.name, // Angenommen, name ist ebenfalls in options gespeichert
|
||||
// Weitere relevante Markerdaten können hier hinzugefügt werden
|
||||
name: marker.options.name,
|
||||
description: marker.options.description,
|
||||
});
|
||||
fetchPoiData(marker.options.id);
|
||||
|
||||
setShowPoiUpdateModal(true);
|
||||
};
|
||||
|
||||
const fetchPoiData = async (idPoi) => {
|
||||
const response = await fetch(`/api/getPoiById?idPoi=${idPoi}`);
|
||||
if (!response.ok) {
|
||||
console.error("Fehler beim Abrufen der POI-Daten");
|
||||
return;
|
||||
}
|
||||
const data = await response.json();
|
||||
setCurrentPoiData({
|
||||
idPoi,
|
||||
name: data.name,
|
||||
description: data.description,
|
||||
});
|
||||
setShowPoiUpdateModal(true);
|
||||
};
|
||||
@@ -877,8 +895,10 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||
locations.forEach((location) => {
|
||||
const { latitude, longitude } = parsePoint(location.position);
|
||||
const poiTypName = poiTypMap.get(location.idPoiTyp) || "Unbekannt ";
|
||||
//console.log("poiTypName:", poiTypName);
|
||||
//console.log("location.idPoiTyp:", location.idPoiTyp);
|
||||
console.log("poiTypName in poiLayer:", poiTypName);
|
||||
//console.log("location.idPoiTyp poiLayer:", location.idPoiTyp);
|
||||
console.log("location.idPoiTyp poiLayer:", location);
|
||||
|
||||
const marker = L.marker([latitude, longitude], {
|
||||
icon: L.icon({
|
||||
iconUrl: `/img/icons/pois/poi-marker-icon-${location.idPoiTyp}.png`,
|
||||
@@ -900,7 +920,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||
},
|
||||
],
|
||||
});
|
||||
//console.log("location.idPoi:", location.idPoi);
|
||||
console.log("location.idPoi:", location);
|
||||
|
||||
// Popup konfigurieren
|
||||
marker.bindPopup(`
|
||||
|
||||
Reference in New Issue
Block a user