Fix: Brug korrekt funktion og setup til at vise specifik time entry i wizard

This commit is contained in:
Christian 2026-01-02 16:17:46 +01:00
parent 1356c251e9
commit 26fda2e419

View File

@ -398,13 +398,34 @@
const entry = await response.json(); const entry = await response.json();
currentEntry = entry;
currentCaseId = entry.case_id;
// Fetch ALL pending timelogs in this case
if (entry.case_id) {
const caseResponse = await fetch(`/api/v1/timetracking/wizard/case/${entry.case_id}/entries`);
if (caseResponse.ok) {
window.currentCaseEntries = await caseResponse.json();
} else {
window.currentCaseEntries = [entry];
}
} else {
window.currentCaseEntries = [entry];
}
// Show the entry // Show the entry
displayTimeEntry({ displayCaseEntries({
time_entry: entry, time_entry: entry,
has_next: true, // Assume there might be more has_next: true,
remaining_count: 1 remaining_count: 1
}); });
await loadCustomerContext();
await loadCaseContext();
document.getElementById('loading-state').classList.add('d-none');
document.getElementById('time-entry-container').classList.remove('d-none');
} catch (error) { } catch (error) {
console.error('Error loading specific entry:', error); console.error('Error loading specific entry:', error);
showToast('Kunne ikke indlæse tidsregistrering', 'danger'); showToast('Kunne ikke indlæse tidsregistrering', 'danger');