fix: parse customer_rate as float in wizard (v1.3.61)
- Fixed customer_rate being returned as string from DB (NUMERIC type) - Added parseFloat() when using customer_rate in calculations - Fixes customer stats showing '-' instead of actual hourly rate - Applied to loadCustomerContext(), displayCaseEntries(), and approveEntry()
This commit is contained in:
parent
097f0633f5
commit
d228362617
@ -567,8 +567,9 @@
|
||||
caseLink = 'Ingen case';
|
||||
}
|
||||
|
||||
// Get hourly rate (customer rate or default)
|
||||
const hourlyRate = e.customer_rate || currentEntry.customer_rate || defaultHourlyRate;
|
||||
// Get hourly rate (customer rate or default) - parse as float if string
|
||||
const rateValue = e.customer_rate || currentEntry.customer_rate || defaultHourlyRate;
|
||||
const hourlyRate = typeof rateValue === 'string' ? parseFloat(rateValue) : rateValue;
|
||||
|
||||
return `
|
||||
<div class="card time-entry-card mb-3" id="entry-card-${e.id}">
|
||||
@ -804,7 +805,9 @@
|
||||
const response = await fetch(`/api/v1/timetracking/wizard/progress/${currentEntry.customer_id}`);
|
||||
const progress = await response.json();
|
||||
|
||||
const hourlyRate = currentEntry.customer_rate || defaultHourlyRate;
|
||||
// Parse hourly rate as number (may be string from DB)
|
||||
const rateValue = currentEntry.customer_rate || defaultHourlyRate;
|
||||
const hourlyRate = typeof rateValue === 'string' ? parseFloat(rateValue) : rateValue;
|
||||
document.getElementById('context-hourly-rate').textContent = hourlyRate.toFixed(2) + ' DKK';
|
||||
|
||||
// Vis antal registreringer (vi har ikke timer-totaler i progress endpointet)
|
||||
@ -1081,7 +1084,8 @@
|
||||
|
||||
// Get billable hours and hourly rate from calculation
|
||||
const billableHours = window.entryBillableHours?.[entryId] || entry.original_hours;
|
||||
const hourlyRate = window.entryHourlyRates?.[entryId] || entry.customer_rate || defaultHourlyRate;
|
||||
const rateValue = window.entryHourlyRates?.[entryId] || entry.customer_rate || defaultHourlyRate;
|
||||
const hourlyRate = typeof rateValue === 'string' ? parseFloat(rateValue) : rateValue;
|
||||
|
||||
// Get travel checkbox state
|
||||
const travelCheckbox = document.getElementById(`travel-${entryId}`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user