pgaes Verzeichnis Struktur verbessert

This commit is contained in:
Ismail Ali
2025-02-14 18:43:53 +01:00
parent 0910a36371
commit b1b4837968
11 changed files with 56 additions and 163 deletions

View File

@@ -4,6 +4,8 @@ import { useDispatch } from "react-redux";
import { setChartData } from "../../../../../../redux/slices/chartDataSlice";
const LoopChartActionBar: React.FC = () => {
const isolationswiderstand = 3;
const schleifenwiderstand = 4;
const dispatch = useDispatch();
const [showChart, setShowChart] = useState(false);
@@ -12,7 +14,7 @@ const LoopChartActionBar: React.FC = () => {
const apiUrl =
process.env.NODE_ENV === "development"
? "/mockData.json"
: "/CPL?seite.ACP&DIA1=2025;01;01;2025;07;31;2;4";
: `/CPL?seite.ACP&DIA1=2025;01;01;2025;07;31;${slotIndex};${schleifenwiderstand}`;
const response = await fetch(apiUrl);
const data = await response.json();

View File

@@ -23,6 +23,7 @@ import ChartSwitcher from "./Charts/ChartSwitcher";
import { setActiveMode } from "../../../../redux/slices/chartDataSlice";
import LoopMeasurementChart from "./Charts/LoopMeasurementChart/LoopMeasurementChart";
import TDRChart from "./Charts/TDRChart/TDRChart";
import handleButtonClick from "./kue705FO-Funktionen/handleButtonClick";
const Kue705FO: React.FC<Kue705FOProps> = ({
isolationswert,
@@ -100,24 +101,6 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
}
};
const handleButtonClick = (button: "Schleife" | "TDR") => {
if (button === "Schleife") {
setActiveButton("Schleife");
setloopTitleText("Schleifenwiderstand [kOhm]");
setLoopDisplayValue(schleifenwiderstand); // Setze den Wert auf schleifenwiderstand
dispatch(setActiveMode("Schleife")); // 🔥 Speichert den Modus in Redux
} else if (button === "TDR") {
setActiveButton("TDR");
setloopTitleText("Entfernung [Km]");
setLoopDisplayValue(
tdrLocation && tdrLocation[slotIndex] !== undefined
? tdrLocation[slotIndex]
: "0"
); // Setze den Wert auf tdrLocation oder "0" als Fallback
dispatch(setActiveMode("TDR")); // 🔥 Speichert den Modus in Redux
}
};
// Funktion aufrufen in handleRefreshClick
const handleRefreshClick = () => {
if (activeButton === "Schleife") {

View File

@@ -0,0 +1,32 @@
// components/main/kabelueberwachung/kue705FO/kue705FO-Funktionen/handleButtonClick.ts
import { Dispatch } from "react";
import { setActiveMode } from "../../../../../redux/slices/chartDataSlice";
const handleButtonClick = (
button: "Schleife" | "TDR",
setActiveButton: Dispatch<React.SetStateAction<"Schleife" | "TDR">>,
setLoopTitleText: Dispatch<React.SetStateAction<string>>,
setLoopDisplayValue: Dispatch<React.SetStateAction<number | string>>,
schleifenwiderstand: number,
tdrLocation: number[] | undefined,
slotIndex: number,
dispatch: Dispatch<any>
) => {
if (button === "Schleife") {
setActiveButton("Schleife");
setLoopTitleText("Schleifenwiderstand [kOhm]");
setLoopDisplayValue(schleifenwiderstand);
dispatch(setActiveMode("Schleife"));
} else if (button === "TDR") {
setActiveButton("TDR");
setLoopTitleText("Entfernung [Km]");
setLoopDisplayValue(
tdrLocation && tdrLocation[slotIndex] !== undefined
? tdrLocation[slotIndex]
: "0"
);
dispatch(setActiveMode("TDR"));
}
};
export default handleButtonClick;

View File

@@ -1,7 +1,7 @@
"use client";
"use client"; // pages/access.tsx
import React from "react";
function Access() {
function Zutrittskontrolle() {
return (
<div className="bg-gray-100 min-h-screen p-8">
<div className="bg-white rounded-lg shadow p-6 mb-8">
@@ -130,4 +130,4 @@ function Access() {
);
}
export default Access;
export default Zutrittskontrolle;

View File

@@ -26,8 +26,10 @@ const Navigation: React.FC<NavigationProps> = ({ className }) => {
{ name: "Kabelüberwachung", path: "/kabelueberwachung" },
{ name: "Ein- und Ausgänge", path: "/einausgaenge" },
{ name: "Analoge Eingänge", path: "/analogeEingaenge" },
{ name: "Meldungen", path: "/messages" },
{ name: "Einstellungen", path: "/settings" },
{ name: "Meldungen", path: "/meldungen" },
{ name: "Einstellungen", path: "/einstellungen" },
//{ name: "Zutriffskontrolle", path: "/zutrittskontrolle" },
// Weitere Menüpunkte hier
];

View File

@@ -6,5 +6,5 @@
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
*/
const webVersion = "1.6.49";
const webVersion = "1.6.50";
export default webVersion;

View File

@@ -1,135 +1,5 @@
"use client";
import React, { useState } from "react";
import React from "react";
function Meldungen() {
const [rowsPerPage, setRowsPerPage] = useState(25);
const [filter, setFilter] = useState("");
const [selectedMonth, setSelectedMonth] = useState("01");
const [selectedYear, setSelectedYear] = useState("23");
const [selectedDay, setSelectedDay] = useState("");
// Platzhalter für Meldungen
const messages = Array.from({ length: 50 }, (_, i) => ({
date: `2023-01-${String(i + 1).padStart(2, "0")}`,
message: `Meldung ${i + 1}`,
}));
const filteredMessages = messages.filter((msg) => {
const dayMatch = selectedDay
? msg.date.split("-")[2] === selectedDay.padStart(2, "0")
: true;
const monthMatch = msg.date.split("-")[1] === selectedMonth;
const yearMatch = msg.date.split("-")[0].substring(2) === selectedYear;
const filterMatch = msg.message
.toLowerCase()
.includes(filter.toLowerCase());
return dayMatch && monthMatch && yearMatch && filterMatch;
});
return (
<div className="flex flex-col h-full">
{/* Filterleiste */}
<div className="flex justify-between items-center bg-blue-500 p-4 text-white rounded-t">
<div className="flex items-center space-x-4">
<span>Interner Meldungsspeicher</span>
<select
value={selectedMonth}
onChange={(e) => setSelectedMonth(e.target.value)}
className="bg-white text-black p-1 rounded"
>
<option value="01">Januar</option>
<option value="02">Februar</option>
<option value="03">März</option>
<option value="04">April</option>
<option value="05">Mai</option>
<option value="06">Juni</option>
<option value="07">Juli</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">Oktober</option>
<option value="11">November</option>
<option value="12">Dezember</option>
</select>
<select
value={selectedYear}
onChange={(e) => setSelectedYear(e.target.value)}
className="bg-white text-black p-1 rounded"
>
<option value="22">2022</option>
<option value="23">2023</option>
<option value="24">2024</option>
<option value="25">2025</option>
<option value="26">2026</option>
</select>
<input
type="number"
value={selectedDay}
onChange={(e) => setSelectedDay(e.target.value)}
min="1"
max="31"
placeholder="Tag"
className="bg-white text-black p-1 rounded"
/>
</div>
<div className="flex items-center space-x-4">
<input
type="text"
value={filter}
onChange={(e) => setFilter(e.target.value)}
placeholder="Filter"
className="bg-white text-black p-1 rounded"
/>
<select
value={rowsPerPage}
onChange={(e) => setRowsPerPage(e.target.value)}
className="bg-white text-black p-1 rounded"
>
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
</select>
</div>
</div>
{/* Meldungen Tabelle */}
<div className="flex-grow overflow-auto mt-4">
<table className="min-w-full bg-white border border-gray-300">
<thead>
<tr className="bg-gray-200 text-gray-600 text-sm leading-normal">
<th className="py-3 px-4 text-left">Datum</th>
<th className="py-3 px-4 text-left">Meldung</th>
</tr>
</thead>
<tbody className="text-gray-600 text-sm">
{filteredMessages.slice(0, rowsPerPage).map((msg, index) => (
<tr key={index} className="border-b border-gray-200">
<td className="py-3 px-4">{msg.date}</td>
<td className="py-3 px-4">{msg.message}</td>
</tr>
))}
</tbody>
</table>
</div>
{/* Pagination */}
<div className="flex justify-center mt-4">
<ul className="flex space-x-2">
{Array.from(
{ length: Math.ceil(filteredMessages.length / rowsPerPage) },
(_, i) => (
<li
key={i}
className="cursor-pointer bg-blue-500 text-white p-2 rounded"
>
{i + 1}
</li>
)
)}
</ul>
</div>
</div>
);
export default function Messages() {
return <div>Messages</div>;
}
export default Meldungen;

View File

@@ -1,5 +0,0 @@
import React from "react";
export default function Messages() {
return <div>Messages</div>;
}

View File

@@ -0,0 +1,9 @@
"use client";
import React from "react";
import Zutrittskontrolle from "../components/main/zutrittskontrolle/Zutrittskontrolle"; // Neuer Name
export default function zutrittskontrollePage() {
// Klein geschrieben, falls du das willst
return <Zutrittskontrolle />;
}