WIP: POI hinzufügen Modal
This commit is contained in:
@@ -75,6 +75,7 @@ import { useInitGisStationsStatusDistrict } from "./hooks/useInitGisStationsStat
|
||||
import { useInitGisStationsMeasurements } from "./hooks/useInitGisStationsMeasurements";
|
||||
import { useInitGisSystemStatic } from "./hooks/useInitGisSystemStatic";
|
||||
import { selectGisSystemStatic, setGisSystemStatic } from "../../redux/slices/webService/gisSystemStaticSlice";
|
||||
import ShowAddStationPopup from "../../components/ShowAddStationPopup";
|
||||
|
||||
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -102,6 +103,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const coordinates = `${e.latlng.lat.toFixed(5)}, ${e.latlng.lng.toFixed(5)}`;
|
||||
setCurrentCoordinates(coordinates);
|
||||
setIsPopupOpen(true);
|
||||
setPopupCoordinates(e.latlng);
|
||||
setPopupVisible(true);
|
||||
};
|
||||
|
||||
const closePopup = () => setIsPopupOpen(false);
|
||||
@@ -175,6 +178,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
lat: 52.52,
|
||||
lng: 13.405,
|
||||
});
|
||||
const [popupVisible, setPopupVisible] = useState(false);
|
||||
|
||||
const handleAddStation = (stationData) => {
|
||||
setAddPoiModalWindowState(false);
|
||||
@@ -626,6 +630,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (map) {
|
||||
console.log("map in MapComponent: ", map);
|
||||
const handleMapMoveEnd = (event) => {
|
||||
const newCenter = map.getCenter();
|
||||
const newZoom = map.getZoom();
|
||||
@@ -649,15 +654,15 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
//--------------------------------------------
|
||||
// Bereich in DataSheet ->dropdownmenu
|
||||
useEffect(() => {
|
||||
console.log("🔍 GisStationsStaticDistrict Inhalt:", GisStationsStaticDistrict);
|
||||
//console.log("🔍 GisStationsStaticDistrict Inhalt:", GisStationsStaticDistrict);
|
||||
|
||||
// Sicherstellen, dass `Points` existiert und ein Array ist
|
||||
const points = GisStationsStaticDistrict?.Points;
|
||||
if (!Array.isArray(points)) {
|
||||
console.warn("⚠️ GisStationsStaticDistrict.Points ist nicht vorhanden oder kein Array.", points);
|
||||
/* if (!Array.isArray(points)) {
|
||||
//console.warn("⚠️ GisStationsStaticDistrict.Points ist nicht vorhanden oder kein Array.", points);
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
if (selectedArea && map) {
|
||||
const station = points.find((s) => s.Area_Name === selectedArea);
|
||||
|
||||
@@ -1029,6 +1034,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{popupVisible && <ShowAddStationPopup latlng={popupCoordinates} onClose={() => setPopupVisible(false)} map={map} />}
|
||||
<ToastContainer />
|
||||
<div>{showPoiUpdateModal && <PoiUpdateModal onClose={() => setShowPoiUpdateModal(false)} poiData={currentPoiData} onSubmit={() => {}} latlng={popupCoordinates} />}</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user