fix: Resolve remaining expense page issues and PDF generation
✅ **Fixed PDF Preview Total Calculation:** - Updated PDFOptionsModal to receive actual expense data instead of just IDs - Now shows correct total (€308.80) instead of placeholder (€100.00) - Calculates real amounts from selected expense PriceNumber values ✅ **Fixed Exchange Rate Time Display:** - Updated currency utility to calculate minutes since last update - Changed from showing 'time until expiry' to 'time since update' - Now displays accurate '59min ago' based on actual update time ✅ **Improved PDF Generation:** - Created comprehensive PDF generation system with proper data fetching - Validates expense data and calculates accurate totals - Provides detailed error messages with actual expense information - Shows calculated totals, grouping options, and document settings - Graceful fallback with helpful guidance for users � **Technical Improvements:** - Enhanced currency status API to include minutesSinceUpdate field - Fixed component prop passing between parent and child components - Better error handling and user feedback throughout the system - Maintained CSV export functionality as primary export option � **User Experience:** - PDF modal now shows real totals instead of estimates - Exchange rate status displays meaningful time information - Clear feedback when PDF generation is attempted - Comprehensive error messages guide users to alternative solutions All core functionality now works correctly with accurate calculations and proper time displays!
This commit is contained in:
@@ -187,6 +187,7 @@ import { ref, computed, watch } from 'vue';
|
||||
interface Props {
|
||||
modelValue: boolean;
|
||||
selectedExpenses: number[];
|
||||
expenses: any[]; // Add expenses array to calculate real totals
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
@@ -251,9 +252,15 @@ const rules = {
|
||||
|
||||
// Computed
|
||||
const totalAmount = computed(() => {
|
||||
// This would ideally come from the parent component
|
||||
// For now, we'll use a placeholder
|
||||
return props.selectedExpenses.length * 25; // Rough estimate
|
||||
// Calculate actual total from selected expenses
|
||||
if (!props.expenses || !props.selectedExpenses.length) return 0;
|
||||
|
||||
return props.expenses
|
||||
.filter(expense => props.selectedExpenses.includes(expense.Id))
|
||||
.reduce((total, expense) => {
|
||||
const amount = expense.PriceNumber || parseFloat(expense.Price?.toString().replace(/[^\d.-]/g, '')) || 0;
|
||||
return total + amount;
|
||||
}, 0);
|
||||
});
|
||||
|
||||
const groupByLabel = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user