diff --git a/templates/dashboard.html b/templates/dashboard.html index 7406094..3599f6b 100644 --- a/templates/dashboard.html +++ b/templates/dashboard.html @@ -127,13 +127,24 @@
+ Define specific contexts (e.g. Client A, Project X). You can pick one when starting the activity. +
These tasks will be created automatically every time you start this activity. @@ -224,6 +235,8 @@ // Global vars - MUST be declared before any functions that use them let currentActivityId = "{{ current_entry.activity_id if current_entry else '' }}"; let currentSubcategory = "{{ current_entry.subcategory if current_entry else '' }}"; + let newActivitySubcats = []; + let newActivityTasks = []; // Timer Logic let startTime = {% if current_entry %}{{ current_entry.start_time.timestamp() * 1000 }}{% else %}null{% endif %}; @@ -438,8 +451,43 @@ }); } - // New Task List Logic for Activity Creation form (Reusing existing script) - let newActivityTasks = []; + // Subcategory List Logic for Activity Creation form + function addNewSubcat() { + const input = document.getElementById('newSubcatInput'); + const val = input.value.trim(); + if (val) { + newActivitySubcats.push(val); + input.value = ''; + renderNewActivitySubcats(); + } + } + function removeNewSubcat(index) { + newActivitySubcats.splice(index, 1); + renderNewActivitySubcats(); + } + function renderNewActivitySubcats() { + const list = document.getElementById('newSubcatsListDisplay'); + list.innerHTML = ''; + newActivitySubcats.forEach((item, index) => { + const li = document.createElement('li'); + li.style.background = '#f7f7f5'; + li.style.border = '1px solid var(--border-dim)'; + li.style.margin = '5px 0'; + li.style.padding = '8px'; + li.style.borderRadius = '4px'; + li.style.display = 'flex'; + li.style.justifyContent = 'space-between'; + li.style.alignItems = 'center'; + li.style.fontSize = '0.9rem'; + li.innerHTML = `${item}×`; + list.appendChild(li); + }); + } + function prepareSubcatsList() { + document.getElementById('subcatsListData').value = newActivitySubcats.join(','); + } + + // New Task List Logic for Activity Creation form function addNewTask() { const input = document.getElementById('newTaskInput'); const val = input.value.trim();