digitale Ein- und Ausgänge , noch kein Invertierung
This commit is contained in:
@@ -20,6 +20,7 @@ function Navigation() {
|
|||||||
const menuItems = [
|
const menuItems = [
|
||||||
{ name: "Übersicht", path: "/dashboard" },
|
{ name: "Übersicht", path: "/dashboard" },
|
||||||
{ name: "Kabelüberwachung", path: "/kabelueberwachung" },
|
{ name: "Kabelüberwachung", path: "/kabelueberwachung" },
|
||||||
|
{ name: "Ein- und Ausgänge", path: "/einausgaenge" },
|
||||||
// Weitere Menüpunkte hier
|
// Weitere Menüpunkte hier
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,161 +1,160 @@
|
|||||||
"use client";
|
"use client"; // Falls notwendig
|
||||||
import React, { useState } from "react";
|
import React from "react";
|
||||||
|
import { Icon } from "@iconify/react";
|
||||||
|
|
||||||
function Einausgaenge() {
|
function EinAusgaenge() {
|
||||||
// Beispiel-Daten für Ein- und Ausgänge (kannst du durch deine Daten ersetzen)
|
const digitalInputs = [
|
||||||
const inputs = [
|
{ id: 1, status: "active", description: "100V-Ausfall" },
|
||||||
{
|
{ id: 2, status: "inactive", description: "DE2" },
|
||||||
id: 1,
|
{ id: 3, status: "active", description: "DE3" },
|
||||||
name: "Eingang 1",
|
{ id: 4, status: "inactive", description: "DE4" },
|
||||||
status: "Aktiv",
|
{ id: 5, status: "active", description: "DE5" },
|
||||||
description: "Beschreibung 1",
|
{ id: 6, status: "inactive", description: "DE6" },
|
||||||
},
|
{ id: 7, status: "active", description: "DE7" },
|
||||||
{
|
{ id: 8, status: "inactive", description: "DE8" },
|
||||||
id: 2,
|
{ id: 9, status: "active", description: "DE9" },
|
||||||
name: "Eingang 2",
|
{ id: 10, status: "inactive", description: "DE10" },
|
||||||
status: "Inaktiv",
|
{ id: 11, status: "active", description: "DE11" },
|
||||||
description: "Beschreibung 2",
|
{ id: 12, status: "inactive", description: "DE12" },
|
||||||
},
|
{ id: 13, status: "active", description: "DE13" },
|
||||||
{
|
{ id: 14, status: "inactive", description: "DE14" },
|
||||||
id: 3,
|
{ id: 15, status: "active", description: "DE15" },
|
||||||
name: "Eingang 3",
|
{ id: 16, status: "inactive", description: "DE16" },
|
||||||
status: "Aktiv",
|
{ id: 17, status: "active", description: "DE17" },
|
||||||
description: "Beschreibung 3",
|
{ id: 18, status: "inactive", description: "DE18" },
|
||||||
},
|
{ id: 19, status: "active", description: "DE19" },
|
||||||
{
|
{ id: 20, status: "inactive", description: "DE20" },
|
||||||
id: 4,
|
{ id: 21, status: "active", description: "DE21" },
|
||||||
name: "Eingang 4",
|
{ id: 22, status: "inactive", description: "DE22" },
|
||||||
status: "Inaktiv",
|
{ id: 23, status: "active", description: "DE23" },
|
||||||
description: "Beschreibung 4",
|
{ id: 24, status: "inactive", description: "DE24" },
|
||||||
},
|
{ id: 25, status: "active", description: "DE25" },
|
||||||
|
{ id: 26, status: "inactive", description: "DE26" },
|
||||||
|
{ id: 27, status: "active", description: "DE27" },
|
||||||
|
{ id: 28, status: "inactive", description: "DE28" },
|
||||||
|
{ id: 29, status: "active", description: "DE29" },
|
||||||
|
{ id: 30, status: "inactive", description: "DE30" },
|
||||||
|
{ id: 31, status: "active", description: "DE31" },
|
||||||
|
{ id: 32, status: "inactive", description: "DE32" },
|
||||||
];
|
];
|
||||||
|
|
||||||
const outputs = [
|
const digitalOutputs = [
|
||||||
{
|
{ id: 1, description: "Ausgang1", toggle: true },
|
||||||
id: 1,
|
{ id: 2, description: "Ausgang2", toggle: false },
|
||||||
name: "Ausgang 1",
|
{ id: 3, description: "Ausgang3", toggle: true },
|
||||||
status: "Aktiv",
|
{ id: 4, description: "Ausgang4", toggle: false },
|
||||||
description: "Beschreibung 1",
|
// Weitere Einträge
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: "Ausgang 2",
|
|
||||||
status: "Inaktiv",
|
|
||||||
description: "Beschreibung 2",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: "Ausgang 3",
|
|
||||||
status: "Aktiv",
|
|
||||||
description: "Beschreibung 3",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
name: "Ausgang 4",
|
|
||||||
status: "Inaktiv",
|
|
||||||
description: "Beschreibung 4",
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Zustand für aktiven Tab (Ein- oder Ausgänge)
|
// Aufteilen der Eingänge in zwei Gruppen
|
||||||
const [activeTab, setActiveTab] = useState("inputs");
|
const inputsGroup1 = digitalInputs.slice(0, 16);
|
||||||
|
const inputsGroup2 = digitalInputs.slice(16);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-gray-100 min-h-screen p-8">
|
<div className="p-4 ">
|
||||||
{/* Tabs für Ein- und Ausgänge */}
|
<h1 className="text-lg font-semibold mb-4">Ein- und Ausgänge</h1>
|
||||||
<ul className="flex border-b border-gray-200">
|
<div className="flex gap-4">
|
||||||
<li
|
{/* Digitale Eingänge */}
|
||||||
className={`mr-1 ${
|
<div className="bg-white shadow-md rounded-lg border border-gray-200 p-4 w-3/5 flex-grow flex flex-col">
|
||||||
activeTab === "inputs" ? "border-blue-500 text-blue-600" : ""
|
<h2 className="text-md font-bold mb-4 flex items-center">
|
||||||
}`}
|
<Icon icon="mdi:input" className="text-blue-500 mr-2 text-2xl" />
|
||||||
>
|
Digitale Eingänge
|
||||||
<button
|
</h2>
|
||||||
onClick={() => setActiveTab("inputs")}
|
<div className="grid grid-cols-2 gap-4">
|
||||||
className={`inline-block px-4 py-2 rounded-t-lg ${
|
{[inputsGroup1, inputsGroup2].map((group, index) => (
|
||||||
activeTab === "inputs"
|
<div key={index} className="flex-grow">
|
||||||
? "bg-blue-500 text-white"
|
<table className="w-full text-sm border-collapse bg-white rounded-lg">
|
||||||
: "bg-white text-black hover:bg-gray-200"
|
<thead className="bg-gray-100 border-b">
|
||||||
}`}
|
<tr>
|
||||||
>
|
<th className="px-2 py-1 text-left">Eingang</th>
|
||||||
Eingänge
|
<th className="px-2 py-1 text-left">Zustand</th>
|
||||||
</button>
|
<th className="px-2 py-1 text-left">Bezeichnung</th>
|
||||||
</li>
|
<th className="px-2 py-1 text-left">Aktion</th>
|
||||||
<li
|
</tr>
|
||||||
className={`mr-1 ${
|
</thead>
|
||||||
activeTab === "outputs" ? "border-blue-500 text-blue-600" : ""
|
<tbody>
|
||||||
}`}
|
{group.map((input) => (
|
||||||
>
|
<tr key={input.id} className="border-b ">
|
||||||
<button
|
<td className="flex p-2 xl:py-0 2xl:p-1">
|
||||||
onClick={() => setActiveTab("outputs")}
|
{" "}
|
||||||
className={`inline-block px-4 py-2 rounded-t-lg ${
|
<Icon
|
||||||
activeTab === "outputs"
|
icon="mdi:input"
|
||||||
? "bg-blue-500 text-white"
|
className="text-black-500 mr-2 text-xl"
|
||||||
: "bg-white text-black hover:bg-gray-200"
|
/>
|
||||||
}`}
|
{input.id}
|
||||||
>
|
</td>
|
||||||
Ausgänge
|
<td
|
||||||
</button>
|
className={`p-2 xl:py-0 ${
|
||||||
</li>
|
input.status === "active"
|
||||||
</ul>
|
? "text-green-500"
|
||||||
|
: "text-red-500"
|
||||||
{/* Inhalt für die aktiven Tabs */}
|
}`}
|
||||||
<div className="mt-4 p-4 bg-white rounded-lg shadow overflow-auto">
|
>
|
||||||
{activeTab === "inputs" && (
|
{input.status === "active" ? "●" : "⨉"}
|
||||||
<div>
|
</td>
|
||||||
<h2 className="text-lg font-bold mb-4">Eingänge</h2>
|
<td className="p-2 xl:py-0 ">{input.description}</td>
|
||||||
<table className="min-w-full bg-white border border-gray-300">
|
<td className="p-2 xl:py-0">
|
||||||
<thead>
|
<Icon
|
||||||
<tr className="w-full bg-gray-200 text-gray-600 uppercase text-sm leading-normal">
|
icon="mdi:settings"
|
||||||
<th className="py-3 px-4 text-left">ID</th>
|
className="text-gray-400 text-lg cursor-pointer"
|
||||||
<th className="py-3 px-4 text-left">Name</th>
|
/>
|
||||||
<th className="py-3 px-4 text-left">Status</th>
|
</td>
|
||||||
<th className="py-3 px-4 text-left">Beschreibung</th>
|
</tr>
|
||||||
</tr>
|
))}
|
||||||
</thead>
|
</tbody>
|
||||||
<tbody className="text-gray-600 text-sm">
|
</table>
|
||||||
{inputs.map((input) => (
|
</div>
|
||||||
<tr key={input.id} className="border-b border-gray-200">
|
))}
|
||||||
<td className="py-3 px-4 text-left">{input.id}</td>
|
|
||||||
<td className="py-3 px-4 text-left">{input.name}</td>
|
|
||||||
<td className="py-3 px-4 text-left">{input.status}</td>
|
|
||||||
<td className="py-3 px-4 text-left">{input.description}</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
|
||||||
{activeTab === "outputs" && (
|
{/* Digitale Ausgänge */}
|
||||||
<div>
|
<div className="bg-white shadow-md rounded-lg border border-gray-200 p-4 w-2/5 h-[fit-content]">
|
||||||
<h2 className="text-lg font-bold mb-4">Ausgänge</h2>
|
<h2 className="text-md font-bold mb-4 flex items-center">
|
||||||
<table className="min-w-full bg-white border border-gray-300">
|
<Icon icon="mdi:output" className="text-blue-500 mr-2 text-2xl" />
|
||||||
<thead>
|
Digitale Ausgänge
|
||||||
<tr className="w-full bg-gray-200 text-gray-600 uppercase text-sm leading-normal">
|
</h2>
|
||||||
<th className="py-3 px-4 text-left">ID</th>
|
<table className="w-full text-sm border-collapse bg-white rounded-lg">
|
||||||
<th className="py-3 px-4 text-left">Name</th>
|
<thead className="bg-gray-100 border-b">
|
||||||
<th className="py-3 px-4 text-left">Status</th>
|
<tr>
|
||||||
<th className="py-3 px-4 text-left">Beschreibung</th>
|
<th className="px-2 py-1 text-left">Ausgang</th>
|
||||||
|
<th className="px-2 py-1 text-left">Bezeichnung</th>
|
||||||
|
<th className="px-2 py-1 text-left">Schalter</th>
|
||||||
|
<th className="px-2 py-1 text-left">Aktion</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{digitalOutputs.map((output) => (
|
||||||
|
<tr key={output.id} className="border-b">
|
||||||
|
<td className="flex px-2 py-1">
|
||||||
|
<Icon
|
||||||
|
icon="mdi:output"
|
||||||
|
className="text-black-500 mr-2 text-xl"
|
||||||
|
/>
|
||||||
|
{output.id}
|
||||||
|
</td>
|
||||||
|
<td className="px-2 py-1">{output.description}</td>
|
||||||
|
<td className="px-2 py-1">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={output.toggle}
|
||||||
|
className="w-5 h-5"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
<td className="px-2 py-1">
|
||||||
|
<Icon
|
||||||
|
icon="mdi:settings"
|
||||||
|
className="text-gray-400 text-lg cursor-pointer"
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
))}
|
||||||
<tbody className="text-gray-600 text-sm">
|
</tbody>
|
||||||
{outputs.map((output) => (
|
</table>
|
||||||
<tr key={output.id} className="border-b border-gray-200">
|
</div>
|
||||||
<td className="py-3 px-4 text-left">{output.id}</td>
|
|
||||||
<td className="py-3 px-4 text-left">{output.name}</td>
|
|
||||||
<td className="py-3 px-4 text-left">{output.status}</td>
|
|
||||||
<td className="py-3 px-4 text-left">
|
|
||||||
{output.description}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Einausgaenge;
|
export default EinAusgaenge;
|
||||||
|
|||||||
Reference in New Issue
Block a user