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

@@ -26,6 +26,7 @@ import { useCurrentTenant } from '../../../../stores/tenant.store';
import { useAuthUser } from '../../../../stores/auth.store';
import { OrderFormModal } from '../../../../components/domain/orders';
import { useTranslation } from 'react-i18next';
import { useTenantCurrency } from '../../../../hooks/useTenantCurrency';
const OrdersPage: React.FC = () => {
const [activeTab, setActiveTab] = useState<'orders' | 'customers'>('orders');
@@ -44,6 +45,7 @@ const OrdersPage: React.FC = () => {
const user = useAuthUser();
const tenantId = currentTenant?.id || user?.tenant_id || '';
const { t } = useTranslation(['orders', 'common']);
const { currencySymbol } = useTenantCurrency();
// API hooks for orders
const {
@@ -374,7 +376,7 @@ const OrdersPage: React.FC = () => {
primaryValueLabel="artículos"
secondaryInfo={{
label: 'Total',
value: `${formatters.compact(order.total_amount)}`
value: `${currencySymbol}${formatters.compact(order.total_amount)}`
}}
metadata={[
`Pedido: ${new Date(order.order_date).toLocaleDateString('es-ES', { day: '2-digit', month: '2-digit' })}`,
@@ -422,7 +424,7 @@ const OrdersPage: React.FC = () => {
primaryValueLabel="pedidos"
secondaryInfo={{
label: 'Total',
value: `${formatters.compact(customer.total_spent || 0)}`
value: `${currencySymbol}${formatters.compact(customer.total_spent || 0)}`
}}
metadata={[
`${customer.customer_code}`,

View File

@@ -6,6 +6,7 @@ import { LoadingSpinner } from '../../../../components/ui';
import { formatters } from '../../../../components/ui/Stats/StatsPresets';
import { useIngredients } from '../../../../api/hooks/inventory';
import { useTenantId } from '../../../../hooks/useTenantId';
import { useTenantCurrency } from '../../../../hooks/useTenantCurrency';
import { ProductType, ProductCategory, IngredientResponse } from '../../../../api/types/inventory';
import { showToast } from '../../../../utils/toast';
import { usePOSConfigurationData, usePOSConfigurationManager, usePOSTransactions, usePOSTransactionsDashboard, usePOSTransaction } from '../../../../api/hooks/pos';
@@ -548,7 +549,7 @@ const POSPage: React.FC = () => {
const [testingConnection, setTestingConnection] = useState<string | null>(null);
const tenantId = useTenantId();
const { currencySymbol } = useTenantCurrency();
// POS Configuration hooks
const posData = usePOSConfigurationData(tenantId);
@@ -780,7 +781,7 @@ const POSPage: React.FC = () => {
}
setCart([]);
showToast.success(`Venta procesada exitosamente: ${total.toFixed(2)}`);
showToast.success(`Venta procesada exitosamente: ${currencySymbol}${total.toFixed(2)}`);
} catch (error: any) {
console.error('Error processing payment:', error);
showToast.error(error.response?.data?.detail || 'Error al procesar la venta');

View File

@@ -18,8 +18,11 @@ import type { PurchaseOrderStatus, PurchaseOrderPriority, PurchaseOrderDetail }
import { useTenantStore } from '../../../../stores/tenant.store';
import { useUserById } from '../../../../api/hooks/user';
import { showToast } from '../../../../utils/toast';
import { useTenantCurrency } from '../../../../hooks/useTenantCurrency';
const ProcurementPage: React.FC = () => {
const { currencySymbol } = useTenantCurrency();
// State
const [searchTerm, setSearchTerm] = useState('');
const [statusFilter, setStatusFilter] = useState<PurchaseOrderStatus | ''>('');
@@ -500,7 +503,7 @@ const ProcurementPage: React.FC = () => {
title={String(po.po_number || 'Sin número')}
subtitle={String(po.supplier_name || po.supplier?.name || 'Proveedor desconocido')}
statusIndicator={statusConfig}
primaryValue={`${totalAmount}`}
primaryValue={`${currencySymbol}${totalAmount}`}
primaryValueLabel="Total"
metadata={[
`Prioridad: ${priorityText}`,

View File

@@ -7,6 +7,7 @@ import { PageHeader } from '../../../../components/layout';
import { useRecipes, useCreateRecipe, useUpdateRecipe, useDeleteRecipe, useArchiveRecipe } from '../../../../api/hooks/recipes';
import { recipesService } from '../../../../api/services/recipes';
import { useCurrentTenant } from '../../../../stores/tenant.store';
import { useTenantCurrency } from '../../../../hooks/useTenantCurrency';
import type { RecipeResponse, RecipeCreate } from '../../../../api/types/recipes';
import { MeasurementUnit } from '../../../../api/types/recipes';
import { useIngredients } from '../../../../api/hooks/inventory';
@@ -273,6 +274,7 @@ const RecipesPage: React.FC = () => {
const currentTenant = useCurrentTenant();
const tenantId = currentTenant?.id || '';
const { currencySymbol } = useTenantCurrency();
const queryClient = useQueryClient();
// Mutations
@@ -1520,7 +1522,7 @@ const RecipesPage: React.FC = () => {
primaryValueLabel="ingredientes"
secondaryInfo={{
label: 'Margen',
value: `${formatters.compact(price - cost)}`
value: `${currencySymbol}${formatters.compact(price - cost)}`
}}
progress={{
label: 'Margen de beneficio',

View File

@@ -8,6 +8,7 @@ import { useSuppliers, useSupplierStatistics, useCreateSupplier, useUpdateSuppli
import { useCurrentTenant } from '../../../../stores/tenant.store';
import { useAuthUser } from '../../../../stores/auth.store';
import { useTranslation } from 'react-i18next';
import { useTenantCurrency } from '../../../../hooks/useTenantCurrency';
import { statusColors } from '../../../../styles/colors';
import { DeleteSupplierModal, SupplierPriceListViewModal, PriceListModal } from '../../../../components/domain/suppliers';
import { useQueryClient } from '@tanstack/react-query';
@@ -35,6 +36,7 @@ const SuppliersPage: React.FC = () => {
const currentTenant = useCurrentTenant();
const user = useAuthUser();
const tenantId = currentTenant?.id || user?.tenant_id || '';
const { currencySymbol } = useTenantCurrency();
// API hooks
const {
@@ -299,7 +301,7 @@ const SuppliersPage: React.FC = () => {
primaryValueLabel="días entrega"
secondaryInfo={{
label: 'Pedido Min.',
value: `${formatters.compact(supplier.minimum_order_amount || 0)}`
value: `${currencySymbol}${formatters.compact(supplier.minimum_order_amount || 0)}`
}}
metadata={[
supplier.contact_person || 'Sin contacto',