feat: implement chart modal with report functionality for cable monitoring

- Add chartTitle state management to kabelueberwachungChartSlice with "Messkurve"/"Meldungen" options
- Update IsoChartActionBar dropdown to show current chartTitle value with proper binding
- Implement conditional rendering in IsoChartView between IsoMeasurementChart and Report components
- Create Report.tsx component using same data structure as MeldungenView (Meldung type)
- Add slot-based message filtering for specific cable monitoring units (KÜ)
- Integrate getMessagesThunk for consistent data loading across components
- Style Report component with consistent table layout, German date formatting, and Littwin branding
- Enable seamless switching between measurement chart and filtered messages in modal
This commit is contained in:
ISA
2025-07-31 15:25:46 +02:00
parent 638b7bf519
commit cdd26931a1
9 changed files with 255 additions and 18 deletions

View File

@@ -9,9 +9,9 @@ import {
setSelectedMode,
setChartOpen,
setLoading,
setChartTitle,
} from "@/redux/slices/kabelueberwachungChartSlice";
import { setBrushRange } from "@/redux/slices/brushSlice";
import { setChartTitle } from "@/redux/slices/isoChartTypeSlice";
import { Listbox } from "@headlessui/react";
//-----------------------------------------------------------------------------------useIsoChartLoader
@@ -92,8 +92,14 @@ export const useIsoChartLoader = () => {
const IsoChartActionBar: React.FC = () => {
const dispatch = useDispatch();
const { vonDatum, bisDatum, selectedMode, slotNumber, isLoading } =
useSelector((state: RootState) => state.kabelueberwachungChartSlice);
const {
vonDatum,
bisDatum,
selectedMode,
slotNumber,
isLoading,
chartTitle,
} = useSelector((state: RootState) => state.kabelueberwachungChartSlice);
const formatDate = (dateString: string) => {
const [year, month, day] = dateString.split("-");
@@ -237,13 +243,47 @@ const IsoChartActionBar: React.FC = () => {
</div>
</Listbox>
{/* Platzhalter für "ISO starten" Button, nimmt weiterhin Platz ein, aber ist unsichtbar */}
<span
style={{ visibility: "hidden" }}
className="px-10 py-1 bg-littwin-blue text-white rounded text-sm"
{/* Dropdown für Auswahl zwischen "Messkurve" und "Meldungen" */}
<Listbox
value={chartTitle}
onChange={(value) => dispatch(setChartTitle(value))}
>
ISO starten
</span>
<div className="relative w-40">
<Listbox.Button className="w-full border px-3 py-1 rounded text-left bg-white flex justify-between items-center text-sm">
<span>{chartTitle}</span>
<svg
className="w-5 h-5 text-gray-400"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fillRule="evenodd"
d="M5.23 7.21a.75.75 0 011.06.02L10 10.585l3.71-3.355a.75.75 0 111.02 1.1l-4.25 3.85a.75.75 0 01-1.02 0l-4.25-3.85a.75.75 0 01.02-1.06z"
clipRule="evenodd"
/>
</svg>
</Listbox.Button>
<Listbox.Options className="absolute z-50 mt-1 w-full border rounded bg-white shadow max-h-60 overflow-auto text-sm">
{["Messkurve", "Meldungen"].map((option) => (
<Listbox.Option
key={option}
value={option}
className={({ selected, active }) =>
`px-4 py-1 cursor-pointer ${
selected
? "bg-littwin-blue text-white"
: active
? "bg-gray-200"
: ""
}`
}
>
{option}
</Listbox.Option>
))}
</Listbox.Options>
</div>
</Listbox>
<button
onClick={handleFetchData}