diff --git a/dashboard/src/App.tsx b/dashboard/src/App.tsx index 7cc1929..f1a3e38 100644 --- a/dashboard/src/App.tsx +++ b/dashboard/src/App.tsx @@ -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); diff --git a/dashboard/src/SetupMode.tsx b/dashboard/src/SetupMode.tsx index 7a97e71..dc35718 100644 --- a/dashboard/src/SetupMode.tsx +++ b/dashboard/src/SetupMode.tsx @@ -77,7 +77,7 @@ const SetupMode: React.FC = () => { ( + template={(props: Client) => ( { ( + template={(props: Client) => ( { 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 = () => { 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), diff --git a/dashboard/src/components/CustomEventModal.tsx b/dashboard/src/components/CustomEventModal.tsx index ba4bfb1..1f5d483 100644 --- a/dashboard/src/components/CustomEventModal.tsx +++ b/dashboard/src/components/CustomEventModal.tsx @@ -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; + groupName: string | { id: string | null; name: string }; }; const weekdayOptions = [ @@ -128,7 +128,7 @@ const CustomEventModal: React.FC = ({ 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 = ({ 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 = ({ body: JSON.stringify(payload), }); if (res.ok) { - onSave(payload); // <--- HIER ergänzen! + onSave(payload); onClose(); } else { const err = await res.json();