diff --git a/apps/web/app/(auth)/login/page.tsx b/apps/web/app/(auth)/login/page.tsx index ffa8bd4..3c880c8 100644 --- a/apps/web/app/(auth)/login/page.tsx +++ b/apps/web/app/(auth)/login/page.tsx @@ -7,7 +7,7 @@ import Image from 'next/image'; import { Button, Input, Label, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@horux/shared-ui'; import { login } from '@/lib/api/auth'; import { useAuthStore } from '@/stores/auth-store'; -import { isGlobalAdminRfc } from '@horux/shared'; +import { isGlobalAdminRfc, type PlatformRole } from '@horux/shared'; export default function LoginPage() { const router = useRouter(); @@ -32,7 +32,7 @@ export default function LoginPage() { const userRole = response.user?.role; // Admin global aterriza directo en `/clientes` — su home natural es la // gestión de tenants, no el dashboard operativo del despacho. - const platformRoles = (response.user as { platformRoles?: string[] }).platformRoles; + const platformRoles = (response.user as { platformRoles?: PlatformRole[] }).platformRoles; const isGlobalAdmin = isGlobalAdminRfc(response.user?.tenantRfc, userRole, platformRoles); if (isGlobalAdmin) { router.push('/clientes'); diff --git a/apps/web/app/(dashboard)/cfdi/page.tsx b/apps/web/app/(dashboard)/cfdi/page.tsx index 34480bd..ba75557 100644 --- a/apps/web/app/(dashboard)/cfdi/page.tsx +++ b/apps/web/app/(dashboard)/cfdi/page.tsx @@ -328,10 +328,11 @@ export default function CfdiPage() { const [cancelSubstitution, setCancelSubstitution] = useState(''); const [cancelling, setCancelling] = useState(false); - const handleViewCfdi = async (id: string) => { - setLoadingCfdi(id); + const handleViewCfdi = async (id: string | number) => { + const idStr = String(id); + setLoadingCfdi(idStr); try { - const cfdi = await getCfdiById(id); + const cfdi = await getCfdiById(idStr); setViewingCfdi(cfdi); } catch (error) { console.error('Error loading CFDI:', error); @@ -738,10 +739,11 @@ export default function CfdiPage() { setUploadProgress(prev => ({ ...prev, status: 'idle' })); }; - const handleDelete = async (id: string) => { + const handleDelete = async (id: string | number) => { + const idStr = String(id); if (confirm('¿Eliminar este CFDI?')) { try { - await deleteCfdi.mutateAsync(id); + await deleteCfdi.mutateAsync(idStr); } catch (error) { console.error('Error deleting CFDI:', error); } @@ -776,9 +778,9 @@ export default function CfdiPage() { const calculateTotal = () => { const subtotal = formData.subtotal || 0; const descuento = formData.descuento || 0; - const iva = formData.ivaTrasladoTraslado || 0; + const iva = formData.ivaTraslado || 0; const isrRetencion = formData.isrRetencion || 0; - const ivaRetencion = formData.ivaTrasladoRetencion || 0; + const ivaRetencion = formData.ivaRetencion || 0; return subtotal - descuento + iva - isrRetencion - ivaRetencion; }; @@ -1642,10 +1644,10 @@ export default function CfdiPage() { variant="ghost" size="icon" onClick={() => handleViewCfdi(cfdi.id)} - disabled={loadingCfdi === cfdi.id} + disabled={loadingCfdi === String(cfdi.id)} title="Ver factura" > - {loadingCfdi === cfdi.id ? ( + {loadingCfdi === String(cfdi.id) ? ( ) : ( diff --git a/apps/web/app/(dashboard)/configuracion/page.tsx b/apps/web/app/(dashboard)/configuracion/page.tsx index e6e19ab..317ba46 100644 --- a/apps/web/app/(dashboard)/configuracion/page.tsx +++ b/apps/web/app/(dashboard)/configuracion/page.tsx @@ -77,7 +77,7 @@ function RegimenesActivosSection() { useEffect(() => { if (activos && catalogo) { - const ids = new Set(activos.map(a => catalogo.find(c => c.clave === a.clave)?.id).filter(Boolean) as number[]); + const ids = new Set(activos.map((a: { clave: string }) => catalogo.find((c: { clave: string }) => c.clave === a.clave)?.id).filter(Boolean) as number[]); setSelected(ids); } }, [activos, catalogo]); diff --git a/apps/web/app/(dashboard)/usuarios/page.tsx b/apps/web/app/(dashboard)/usuarios/page.tsx index fb0d1ca..be5fe93 100644 --- a/apps/web/app/(dashboard)/usuarios/page.tsx +++ b/apps/web/app/(dashboard)/usuarios/page.tsx @@ -14,7 +14,7 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from ' import Link from 'next/link'; import { cn } from '@horux/shared-ui'; import { isDespachoTenant } from '@horux/shared'; -import type { Role } from '@horux/shared'; +import type { Role, UserInvite } from '@horux/shared'; // ── Horux360 legacy roles ───────────────────────────────────────────────────── const legacyRoleLabels: Record = { @@ -25,7 +25,7 @@ const legacyRoleLabels: Record({ + const [inviteForm, setInviteForm] = useState<{ email: string; nombre: string; role: UserInvite['role']; supervisorUserId?: string }>({ email: '', nombre: '', - role: defaultInviteRole as Role, + role: defaultInviteRole as UserInvite['role'], }); const [selectedRfcIds, setSelectedRfcIds] = useState([]); @@ -183,7 +183,7 @@ export default function UsuariosPage() { ); } setShowInvite(false); - setInviteForm({ email: '', nombre: '', role: defaultInviteRole as Role, supervisorUserId: undefined }); + setInviteForm({ email: '', nombre: '', role: defaultInviteRole as UserInvite['role'], supervisorUserId: undefined }); setSelectedRfcIds([]); } catch (error: any) { alert(error.response?.data?.message || 'Error al invitar usuario'); @@ -263,7 +263,7 @@ export default function UsuariosPage() {