diff --git a/client/src/pages/meeting-detail.html b/client/src/pages/meeting-detail.html index e7df113..873792c 100644 --- a/client/src/pages/meeting-detail.html +++ b/client/src/pages/meeting-detail.html @@ -534,23 +534,64 @@ `).join(''); } + // Save current form values to currentMeeting before re-rendering + function syncConclusionsFromDOM() { + document.querySelectorAll('.conclusion-content').forEach(textarea => { + const index = parseInt(textarea.dataset.index); + if (currentMeeting.conclusions && currentMeeting.conclusions[index]) { + currentMeeting.conclusions[index].content = textarea.value; + } + }); + } + + function syncActionsFromDOM() { + document.querySelectorAll('.action-content').forEach(textarea => { + const index = parseInt(textarea.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].content = textarea.value; + } + }); + document.querySelectorAll('.action-owner').forEach(input => { + const index = parseInt(input.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].owner = input.value; + } + }); + document.querySelectorAll('.action-due').forEach(input => { + const index = parseInt(input.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].due_date = input.value || null; + } + }); + document.querySelectorAll('.action-status').forEach(select => { + const index = parseInt(select.dataset.index); + if (currentMeeting.actions && currentMeeting.actions[index]) { + currentMeeting.actions[index].status = select.value; + } + }); + } + window.removeConclusion = function(index) { + syncConclusionsFromDOM(); currentMeeting.conclusions.splice(index, 1); renderConclusions(); }; window.removeAction = function(index) { + syncActionsFromDOM(); currentMeeting.actions.splice(index, 1); renderActions(); }; addConclusionBtn.addEventListener('click', () => { + syncConclusionsFromDOM(); if (!currentMeeting.conclusions) currentMeeting.conclusions = []; currentMeeting.conclusions.push({ content: '' }); renderConclusions(); }); addActionBtn.addEventListener('click', () => { + syncActionsFromDOM(); if (!currentMeeting.actions) currentMeeting.actions = []; currentMeeting.actions.push({ content: '', owner: '', due_date: null, status: 'Open' }); renderActions();