diff --git a/components/DataSheet.js b/components/DataSheet.js index 41aba4398..429e88066 100644 --- a/components/DataSheet.js +++ b/components/DataSheet.js @@ -15,17 +15,35 @@ function DataSheet() { const GisSystemStatic = useRecoilValue(gisSystemStaticState); useEffect(() => { - // Filter unique areas + // Identify allowed system IDs + const allowedSystems = new Set( + GisSystemStatic.filter((system) => system.Allow === 1).map( + (system) => system.IdSystem + ) + ); + + // Filter unique areas that belong to allowed systems const seenNames = new Set(); const filteredAreas = GisStationsStaticDistrict.filter((item) => { - const isUnique = !seenNames.has(item.Area_Name); + const isUnique = + !seenNames.has(item.Area_Name) && allowedSystems.has(item.System); if (isUnique) { seenNames.add(item.Area_Name); + console.log("Unique area:", item.Area_Name); } return isUnique; }); + console.log("GisStationsStaticDistrict:", GisStationsStaticDistrict); - // Filter unique systems where Allow is 1 + // Set the station listings + setStationListing( + filteredAreas.map((area, index) => ({ + id: index + 1, + name: area.Area_Name, + })) + ); + + // Prepare system listings as before const seenSystemNames = new Set(); const filteredSystems = GisSystemStatic.filter((item) => { const isUnique = !seenSystemNames.has(item.Name) && item.Allow === 1; @@ -35,13 +53,6 @@ function DataSheet() { return isUnique; }); - setStationListing( - filteredAreas.map((area, index) => ({ - id: index + 1, - name: area.Area_Name, - })) - ); - setSystemListing( filteredSystems.map((system, index) => ({ id: index + 1, diff --git a/config/config.js b/config/config.js index b9dfb72d9..99ea75628 100644 --- a/config/config.js +++ b/config/config.js @@ -28,7 +28,7 @@ if (typeof window !== "undefined") { url_string = window.location.href; // Die vollständige URL als String url = new URL(url_string); // Die URL als URL-Objekt, um Teile der URL einfacher zu handhaben c = url.searchParams.get("m") || "10"; // Ein Parameter aus der URL, Standardwert ist '10' - user = url.searchParams.get("u") || "484"; // Ein weiterer Parameter aus der URL, Standardwert ist '487 oder 484 oder 485 zu testen von Stationen ausblenden und einblenden in der Card' + user = url.searchParams.get("u") || "484"; // Ein weiterer Parameter aus der URL, Standardwert ist '484 admin zu testen von Stationen ausblenden und einblenden in der Card' // Konstruktion von URLs, die auf spezifische Ressourcen auf dem Server zeigen mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${c}&idUser=${user}`;