Aktualisierung der PoI ind der Modal-Fenster ist done!, Dropdown menu müssen noch gemacht werden
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// pages/api/poiUpdateModal.js
|
// pages/api/poiUpdateModal.js
|
||||||
//
|
//
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
@@ -42,8 +42,6 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Beim Öffnen des Modals die Geräte-ID basierend auf dem Gerätenamen abrufen, wenn vorhanden
|
// Beim Öffnen des Modals die Geräte-ID basierend auf dem Gerätenamen abrufen, wenn vorhanden
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchDeviceId = async () => {
|
const fetchDeviceId = async () => {
|
||||||
@@ -112,8 +110,10 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
|||||||
//console.log("Standort- und Gerätedaten:", data);
|
//console.log("Standort- und Gerätedaten:", data);
|
||||||
setLocationDeviceData(data);
|
setLocationDeviceData(data);
|
||||||
if (poiData && poiData.idLD) {
|
if (poiData && poiData.idLD) {
|
||||||
const selectedDevice = data.find(device => device.id === poiData.idLD);
|
const selectedDevice = data.find(
|
||||||
setDeviceName(selectedDevice ? selectedDevice.id : data[0].id); // Hier wird die ID als initialer Zustand gesetzt
|
(device) => device.id === poiData.idLD
|
||||||
|
);
|
||||||
|
setDeviceName(selectedDevice ? selectedDevice.id : data[0].id); // Hier wird die ID als initialer Zustand gesetzt
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(
|
console.error(
|
||||||
@@ -146,7 +146,7 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
|||||||
name: name,
|
name: name,
|
||||||
description: description,
|
description: description,
|
||||||
idPoiTyp: poiTypeId,
|
idPoiTyp: poiTypeId,
|
||||||
idLD: deviceName,
|
idLD: idLD,
|
||||||
//idLD: parseInt(deviceName, 10), // Konvertieren in eine Ganzzahl
|
//idLD: parseInt(deviceName, 10), // Konvertieren in eine Ganzzahl
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@@ -166,11 +166,6 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit} className="m-0 p-2 w-full">
|
<form onSubmit={handleSubmit} className="m-0 p-2 w-full">
|
||||||
<div className="flex items-center mb-4">
|
<div className="flex items-center mb-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user