Littwin config
This commit is contained in:
@@ -22,6 +22,7 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
setPoiTypeId(poiData.idPoiTyp);
|
||||
|
||||
setDescription(poiData.description);
|
||||
setDeviceName(poiData.idLD);
|
||||
console.log("Loaded POI Data for editing:", poiData);
|
||||
console.log("POI ID:", poiData.idPoi);
|
||||
console.log("POI Name:", poiData.name);
|
||||
@@ -110,8 +111,9 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
const data = await response.json();
|
||||
//console.log("Standort- und Gerätedaten:", data);
|
||||
setLocationDeviceData(data);
|
||||
if (data.length > 0) {
|
||||
setDeviceName(data[0].name); // Set initial device name
|
||||
if (poiData && poiData.idLD) {
|
||||
const selectedDevice = data.find(device => device.id === poiData.idLD);
|
||||
setDeviceName(selectedDevice ? selectedDevice.id : data[0].id); // Hier wird die ID als initialer Zustand gesetzt
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
@@ -144,7 +146,7 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
name: name,
|
||||
description: description,
|
||||
idPoiTyp: poiTypeId,
|
||||
idLD: idLD,
|
||||
idLD: deviceName,
|
||||
//idLD: parseInt(deviceName, 10), // Konvertieren in eine Ganzzahl
|
||||
}),
|
||||
});
|
||||
@@ -198,7 +200,7 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
className="block p-2 w-full border-2 border-gray-200 rounded-md text-sm"
|
||||
>
|
||||
{locationDeviceData.map((device, index) => (
|
||||
<option key={index} value={device.name}>
|
||||
<option key={index} value={device.id}>
|
||||
{device.name}
|
||||
</option>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user