Solve lint errors
This commit is contained in:
@@ -23,13 +23,20 @@ const sidebarItems = [
|
||||
{ name: 'Termine', path: '/termine', icon: Calendar },
|
||||
{ name: 'Ressourcen', path: '/ressourcen', icon: Boxes },
|
||||
{ name: 'Raumgruppen', path: '/infoscr_groups', icon: MonitorDotIcon },
|
||||
{ name: 'Infoscreens', path: '/clients', icon: Monitor },
|
||||
{ name: 'Infoscreen-Clients', path: '/clients', icon: Monitor },
|
||||
{ name: 'Erweiterungsmodus', path: '/setup', icon: Wrench },
|
||||
{ name: 'Medien', path: '/medien', icon: Image },
|
||||
{ name: 'Benutzer', path: '/benutzer', icon: User },
|
||||
{ name: 'Einstellungen', path: '/einstellungen', icon: Settings },
|
||||
];
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { fetchClientsWithoutDescription } from './apiClients';
|
||||
|
||||
// ENV aus .env holen (Platzhalter, im echten Projekt über process.env oder API)
|
||||
const ENV = import.meta.env.VITE_ENV || 'development';
|
||||
|
||||
const Layout: React.FC = () => {
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
|
||||
@@ -121,12 +128,6 @@ const Layout: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
import { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { fetchClientsWithoutDescription } from './apiClients';
|
||||
|
||||
// ENV aus .env holen (Platzhalter, im echten Projekt über process.env oder API)
|
||||
const ENV = import.meta.env.VITE_ENV || 'development';
|
||||
|
||||
function useLoginCheck() {
|
||||
const [isLoggedIn, setIsLoggedIn] = useState(false);
|
||||
|
||||
@@ -77,7 +77,7 @@ const SetupMode: React.FC = () => {
|
||||
<ColumnDirective
|
||||
headerText="Beschreibung"
|
||||
width="220"
|
||||
template={props => (
|
||||
template={(props: Client) => (
|
||||
<TextBoxComponent
|
||||
value={descriptions[props.uuid] || ''}
|
||||
placeholder="Beschreibung eingeben"
|
||||
@@ -88,7 +88,7 @@ const SetupMode: React.FC = () => {
|
||||
<ColumnDirective
|
||||
headerText="Aktion"
|
||||
width="120"
|
||||
template={props => (
|
||||
template={(props: Client) => (
|
||||
<ButtonComponent
|
||||
content="Speichern"
|
||||
disabled={!descriptions[props.uuid]}
|
||||
|
||||
@@ -103,10 +103,8 @@ const Appointments: React.FC = () => {
|
||||
useEffect(() => {
|
||||
fetchGroups()
|
||||
.then(data => {
|
||||
// Nur Gruppen mit id berücksichtigen (nicht zugeordnet ignorieren)
|
||||
const filtered = Array.isArray(data)
|
||||
? data.filter(g => g.id && g.name && g.name !== 'nicht zugeordnet')
|
||||
: [];
|
||||
// Nur Gruppen mit id != 1 berücksichtigen (nicht zugeordnet ignorieren)
|
||||
const filtered = Array.isArray(data) ? data.filter(g => g.id && g.name && g.id !== 1) : [];
|
||||
setGroups(filtered);
|
||||
if (filtered.length > 0) setSelectedGroupId(filtered[0].id);
|
||||
})
|
||||
@@ -167,13 +165,13 @@ const Appointments: React.FC = () => {
|
||||
<CustomEventModal
|
||||
open={modalOpen}
|
||||
onClose={() => setModalOpen(false)}
|
||||
onSave={async eventData => {
|
||||
onSave={async () => {
|
||||
setModalOpen(false);
|
||||
console.log('onSave wird aufgerufen');
|
||||
if (selectedGroupId) {
|
||||
const data = await fetchEvents(selectedGroupId);
|
||||
console.log('Events nach Save:', data);
|
||||
const mapped: Event[] = data.map(e => ({
|
||||
const mapped: Event[] = data.map((e: RawEvent) => ({
|
||||
Id: e.Id,
|
||||
Subject: e.Subject,
|
||||
StartTime: new Date(e.StartTime.endsWith('Z') ? e.StartTime : e.StartTime + 'Z'),
|
||||
@@ -229,7 +227,7 @@ const Appointments: React.FC = () => {
|
||||
if (selectedGroupId) {
|
||||
fetchEvents(selectedGroupId)
|
||||
.then((data: RawEvent[]) => {
|
||||
const mapped: Event[] = data.map(e => ({
|
||||
const mapped: Event[] = data.map((e: RawEvent) => ({
|
||||
Id: e.Id,
|
||||
Subject: e.Subject,
|
||||
StartTime: new Date(e.StartTime),
|
||||
|
||||
@@ -22,9 +22,9 @@ type CustomEventData = {
|
||||
type CustomEventModalProps = {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onSave: (eventData: any) => void;
|
||||
initialData?: any;
|
||||
groupName: string | { id: string | null; name: string }; // <- angepasst
|
||||
onSave: (eventData: CustomEventData) => void;
|
||||
initialData?: Partial<CustomEventData>;
|
||||
groupName: string | { id: string | null; name: string };
|
||||
};
|
||||
|
||||
const weekdayOptions = [
|
||||
@@ -128,7 +128,7 @@ const CustomEventModal: React.FC<CustomEventModalProps> = ({
|
||||
const group_id = typeof groupName === 'object' && groupName !== null ? groupName.id : groupName;
|
||||
|
||||
// Daten für das Backend zusammenstellen
|
||||
const payload: any = {
|
||||
const payload: CustomEventData & { [key: string]: unknown } = {
|
||||
group_id,
|
||||
title,
|
||||
description,
|
||||
@@ -152,6 +152,14 @@ const CustomEventModal: React.FC<CustomEventModalProps> = ({
|
||||
endTime.getMinutes()
|
||||
).toISOString()
|
||||
: null,
|
||||
type,
|
||||
startDate,
|
||||
startTime,
|
||||
endTime,
|
||||
repeat,
|
||||
weekdays,
|
||||
repeatUntil,
|
||||
skipHolidays,
|
||||
event_type: type,
|
||||
is_active: 1,
|
||||
created_by: 1,
|
||||
@@ -173,7 +181,7 @@ const CustomEventModal: React.FC<CustomEventModalProps> = ({
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
if (res.ok) {
|
||||
onSave(payload); // <--- HIER ergänzen!
|
||||
onSave(payload);
|
||||
onClose();
|
||||
} else {
|
||||
const err = await res.json();
|
||||
|
||||
Reference in New Issue
Block a user