diff --git a/app/timetracking/frontend/wizard.html b/app/timetracking/frontend/wizard.html index f676384..ab6a11a 100644 --- a/app/timetracking/frontend/wizard.html +++ b/app/timetracking/frontend/wizard.html @@ -385,6 +385,7 @@ // Load a specific time entry async function loadSpecificEntry(timeId) { + console.log('๐ฏ Loading specific entry:', timeId); document.getElementById('loading-state').classList.remove('d-none'); document.getElementById('time-entry-container').classList.add('d-none'); document.getElementById('completion-state').classList.add('d-none'); @@ -397,6 +398,7 @@ } const entry = await response.json(); + console.log('๐ฅ Loaded entry:', entry.id, 'Status:', entry.status, 'Date:', entry.worked_date); currentEntry = entry; currentCaseId = entry.case_id; @@ -404,19 +406,26 @@ // Only fetch other case entries if this entry is pending // Otherwise just show this single entry if (entry.status === 'pending' && entry.case_id) { + console.log('๐ Fetching other pending entries for case:', entry.case_id); const caseResponse = await fetch(`/api/v1/timetracking/wizard/case/${entry.case_id}/entries`); if (caseResponse.ok) { const caseEntries = await caseResponse.json(); + console.log('๐ Got', caseEntries.length, 'pending entries for case'); // Make sure our entry is in the list (it should be since it's pending) window.currentCaseEntries = caseEntries; } else { + console.log('โ ๏ธ Could not fetch case entries, showing single entry'); window.currentCaseEntries = [entry]; } } else { + console.log('โน๏ธ Entry is not pending or has no case - showing single entry only'); // Entry is not pending - just show this one entry window.currentCaseEntries = [entry]; } + console.log('โจ Current entry to display:', currentEntry.id); + console.log('๐ฆ All entries:', window.currentCaseEntries.map(e => e.id)); + // Show the entry displayCaseEntries({ time_entry: entry, @@ -431,7 +440,7 @@ document.getElementById('time-entry-container').classList.remove('d-none'); } catch (error) { - console.error('Error loading specific entry:', error); + console.error('โ Error loading specific entry:', error); showToast('Kunne ikke indlรฆse tidsregistrering', 'danger'); // Fall back to loading next entry setTimeout(() => loadNextEntry(), 1000); @@ -498,6 +507,9 @@ const entries = window.currentCaseEntries || []; const container = document.getElementById('time-entries-list'); + console.log('๐ผ๏ธ displayCaseEntries called with', entries.length, 'entries'); + console.log('๐ฏ currentEntry.id:', currentEntry?.id); + if (entries.length === 0) { container.innerHTML = '