fix: wizard customer_rate field name mismatch (v1.3.55)

- Changed wizard.html to use customer_rate instead of customer_hourly_rate
- Fixes issue where wizard displayed default 1200 DKK instead of customer-specific hourly rate
- Backend API returns customer_rate field (from TModuleTimeWithContext model)
- Frontend now correctly reads customer_rate from API response
- Affected lines: 571, 807, 1084 in wizard.html
This commit is contained in:
Christian 2025-12-23 15:12:45 +01:00
parent 64e85da71c
commit 38a47f4d27

View File

@ -568,7 +568,7 @@
} }
// Get hourly rate (customer rate or default) // Get hourly rate (customer rate or default)
const hourlyRate = e.customer_hourly_rate || currentEntry.customer_hourly_rate || defaultHourlyRate; const hourlyRate = e.customer_rate || currentEntry.customer_rate || defaultHourlyRate;
return ` return `
<div class="card time-entry-card mb-3" id="entry-card-${e.id}"> <div class="card time-entry-card mb-3" id="entry-card-${e.id}">
@ -804,7 +804,7 @@
const response = await fetch(`/api/v1/timetracking/wizard/progress/${currentEntry.customer_id}`); const response = await fetch(`/api/v1/timetracking/wizard/progress/${currentEntry.customer_id}`);
const progress = await response.json(); const progress = await response.json();
const hourlyRate = currentEntry.customer_hourly_rate || defaultHourlyRate; const hourlyRate = currentEntry.customer_rate || defaultHourlyRate;
document.getElementById('context-hourly-rate').textContent = hourlyRate.toFixed(2) + ' DKK'; document.getElementById('context-hourly-rate').textContent = hourlyRate.toFixed(2) + ' DKK';
// Vis antal registreringer (vi har ikke timer-totaler i progress endpointet) // Vis antal registreringer (vi har ikke timer-totaler i progress endpointet)
@ -1081,7 +1081,7 @@
// Get billable hours and hourly rate from calculation // Get billable hours and hourly rate from calculation
const billableHours = window.entryBillableHours?.[entryId] || entry.original_hours; const billableHours = window.entryBillableHours?.[entryId] || entry.original_hours;
const hourlyRate = window.entryHourlyRates?.[entryId] || entry.customer_hourly_rate || defaultHourlyRate; const hourlyRate = window.entryHourlyRates?.[entryId] || entry.customer_rate || defaultHourlyRate;
// Get travel checkbox state // Get travel checkbox state
const travelCheckbox = document.getElementById(`travel-${entryId}`); const travelCheckbox = document.getElementById(`travel-${entryId}`);