Improve UI

This commit is contained in:
Urtzi Alfaro
2025-12-30 14:40:20 +01:00
parent e494ea8635
commit c07df124fb
71 changed files with 647 additions and 265 deletions

View File

@@ -24,6 +24,7 @@ import type { InventoryDashboardSummary } from '../types/inventory';
import { useSalesAnalytics } from './sales';
import { useProcurementDashboard } from './procurement';
import { useOrdersDashboard } from './orders';
import { useTenantCurrency } from '../../hooks/useTenantCurrency';
// ============================================================================
// Helper Functions
@@ -355,6 +356,7 @@ export const useDepartmentPerformance = (tenantId: string, period: TimePeriod =
const { data: inventory, isLoading: inventoryLoading } = useInventoryPerformance(tenantId);
const { data: sales, isLoading: salesLoading } = useSalesPerformance(tenantId, period);
const { data: procurement, isLoading: procurementLoading } = useProcurementPerformance(tenantId);
const { currencySymbol } = useTenantCurrency();
// Extract primitive values before useMemo to prevent unnecessary recalculations
const productionEfficiency = production?.efficiency || 0;
@@ -408,7 +410,7 @@ export const useDepartmentPerformance = (tenantId: string, period: TimePeriod =
primary_metric: {
label: 'Ingresos totales',
value: salesTotalRevenue,
unit: '€',
unit: currencySymbol,
},
secondary_metric: {
label: 'Transacciones',
@@ -418,7 +420,7 @@ export const useDepartmentPerformance = (tenantId: string, period: TimePeriod =
tertiary_metric: {
label: 'Valor promedio',
value: salesAvgTransactionValue,
unit: '€',
unit: currencySymbol,
},
},
},