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";
|
||||
|
||||
@@ -42,8 +42,6 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Beim Öffnen des Modals die Geräte-ID basierend auf dem Gerätenamen abrufen, wenn vorhanden
|
||||
useEffect(() => {
|
||||
const fetchDeviceId = async () => {
|
||||
@@ -112,8 +110,10 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
//console.log("Standort- und Gerätedaten:", data);
|
||||
setLocationDeviceData(data);
|
||||
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
|
||||
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(
|
||||
@@ -146,7 +146,7 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
name: name,
|
||||
description: description,
|
||||
idPoiTyp: poiTypeId,
|
||||
idLD: deviceName,
|
||||
idLD: idLD,
|
||||
//idLD: parseInt(deviceName, 10), // Konvertieren in eine Ganzzahl
|
||||
}),
|
||||
});
|
||||
@@ -166,11 +166,6 @@ const PoiUpdateModal = ({ onClose, poiData }) => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="m-0 p-2 w-full">
|
||||
<div className="flex items-center mb-4">
|
||||
|
||||
Reference in New Issue
Block a user