diff --git a/js/app.js b/js/app.js index 08ecc9e..c6dedd5 100644 --- a/js/app.js +++ b/js/app.js @@ -8,7 +8,8 @@ const STORAGE_KEY = 'morning-planner-state'; export const state = { employees: [], calendar: { holidays: [], companyClosures: [] }, - history: [] + history: [], + settings: { moderatorsPerDay: 1 } }; // Load persisted state from localStorage on startup @@ -19,6 +20,10 @@ try { if (Array.isArray(parsed.employees)) state.employees = parsed.employees; if (parsed.calendar) state.calendar = parsed.calendar; if (Array.isArray(parsed.history)) state.history = parsed.history; + if (parsed.settings && Number.isInteger(parsed.settings.moderatorsPerDay) + && parsed.settings.moderatorsPerDay >= 1 && parsed.settings.moderatorsPerDay <= 5) { + state.settings = { moderatorsPerDay: parsed.settings.moderatorsPerDay }; + } } } catch { // Corrupt storage — start fresh @@ -30,7 +35,8 @@ export function saveState() { localStorage.setItem(STORAGE_KEY, JSON.stringify({ employees: state.employees, calendar: state.calendar, - history: state.history + history: state.history, + settings: state.settings })); } catch { // Storage full or unavailable — silently ignore diff --git a/js/history.js b/js/history.js index 4173383..49ff213 100644 --- a/js/history.js +++ b/js/history.js @@ -79,6 +79,7 @@ export function renderDataTab() { state.employees = loaded.employees; state.calendar = loaded.calendar; state.history = loaded.history; + state.settings = loaded.settings; saveState(); alert('Daten erfolgreich geladen.'); renderDataTab();