diff --git a/components/DataSheet.js b/components/DataSheet.js index 892ff01dc..da5723b0b 100644 --- a/components/DataSheet.js +++ b/components/DataSheet.js @@ -24,6 +24,7 @@ function DataSheet() { const setZoomTrigger = useSetRecoilState(zoomTriggerState); const [polylineVisible, setPolylineVisible] = useRecoilState(polylineLayerVisibleState); // Zustand für Polylines const [bereicheVisible, setBereicheVisible] = useState(false); // NEU: Bereiche-Status + const [standordVisible, setStandorteVisible] = useState(false); // NEU: Standorte-Status useEffect(() => { // LocalStorage Werte laden const storedPoiVisible = localStorage.getItem("poiVisible"); @@ -153,6 +154,12 @@ function DataSheet() { setBereicheVisible(checked); localStorage.setItem("bereicheVisible", checked); }; + const handleStandorteCheckboxChange = (event) => { + if (editMode) return; + const { checked } = event.target; + setStandorteVisible(checked); + localStorage.setItem("standorteVisible", checked); + }; //--------------------------- return ( @@ -223,6 +230,14 @@ function DataSheet() { Bereiche + + {/* Standorte */} +
+ + +
diff --git a/hooks/layers/useBereicheMarkersLayer.js b/hooks/layers/useBereicheMarkersLayer.js index 21c258a92..aa0ef624e 100644 --- a/hooks/layers/useBereicheMarkersLayer.js +++ b/hooks/layers/useBereicheMarkersLayer.js @@ -55,8 +55,11 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => { // Tooltip statt Popup marker.bindTooltip( - `ID Location: ${item.idLocation}
- ID Map: ${item.idMaps}`, + ` + Bereich: ${item.location_name}
+ Standort: ${item.area_name}
+ + `, { permanent: false, // Tooltip wird nur bei Mouseover angezeigt direction: "top", // Position des Tooltips relativ zum Marker @@ -115,8 +118,10 @@ const useBereicheMarkersLayer = (map, oms, apiUrl) => { // Tooltip marker.bindTooltip( - `ID Location: ${item.idLocation}
- ID Map: ${item.idMaps}`, + ` + locatin_name: ${item.location_name}
+ area_name: ${item.area_name}
+ `, { permanent: false, direction: "top", diff --git a/pages/api/talas_v5_DB/bereich/readBereich.js b/pages/api/talas_v5_DB/bereich/readBereich.js index e9c244a42..1861d8acf 100644 --- a/pages/api/talas_v5_DB/bereich/readBereich.js +++ b/pages/api/talas_v5_DB/bereich/readBereich.js @@ -13,7 +13,45 @@ export default async function handler(req, res) { return res.status(400).json({ error: "idMaps (Parameter 'm') ist erforderlich" }); } - let query = "SELECT * FROM location_coordinates WHERE idMaps = ?"; + //let query = "SELECT * FROM location_coordinates WHERE idMaps = ?"; + /* let query = ` + SELECT + l.name, + l.shortname, + lc.idMaps + FROM + talas_v5.location l + JOIN + talas_v5.location_coordinates lc + ON + l.idlocation = lc.idlocation + WHERE + lc.idMap = ? + `; */ + /* let query = ` + SELECT * FROM talas_v5.location l JOIN talas_v5.location_coordinates lc ON l.idlocation = lc.idlocation WHERE lc.idMaps=?; +`; */ + + let query = ` +SELECT + l.idlocation, + l.name AS location_name, + lc.idMaps, + a.name AS area_name, + lc.x, + lc.y +FROM + talas_v5.location l +JOIN + talas_v5.location_coordinates lc + ON l.idlocation = lc.idlocation +JOIN + talas_v5.area a + ON l.idarea = a.idarea +WHERE + lc.idMaps = ?; +`; + const queryParams = [idMaps]; if (idLocation) { @@ -32,10 +70,12 @@ export default async function handler(req, res) { if (results.length > 0) { // Ergebnisse formatieren und zurückgeben const formattedResults = results.map((row) => ({ - idLocation: row.idLocation, + idLocation: row.idlocation, // Prüfe hier auf korrekten Spaltennamen x: row.x, y: row.y, idMaps: row.idMaps, + location_name: row.location_name, // Hinzufügen des Alias aus der SQL-Abfrage + area_name: row.area_name, // Hinzufügen des Alias aus der SQL-Abfrage })); res.status(200).json(formattedResults); diff --git a/public/img/standort.svg b/public/img/standort.svg new file mode 100644 index 000000000..417fce52f --- /dev/null +++ b/public/img/standort.svg @@ -0,0 +1 @@ + \ No newline at end of file