fix: fechaPagoP pipe timestamp, admin redirects, despacho plans, CSF parsing

This commit is contained in:
Horux Dev
2026-04-28 22:24:30 +00:00
parent 3eb0f33f3b
commit 066ba7deda
10 changed files with 322 additions and 118 deletions

View File

@@ -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, type PlatformRole } from '@horux/shared';
export default function LoginPage() {
const router = useRouter();
@@ -30,13 +30,7 @@ export default function LoginPage() {
setUser(response.user);
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?: PlatformRole[] }).platformRoles;
const isGlobalAdmin = isGlobalAdminRfc(response.user?.tenantRfc, userRole, platformRoles);
if (isGlobalAdmin) {
router.push('/clientes');
} else if (userRole === 'cliente' || userRole === 'auxiliar' || userRole === 'supervisor') {
if (userRole === 'cliente' || userRole === 'auxiliar' || userRole === 'supervisor') {
// Clients and roles without onboarding go straight to dashboard
router.push('/dashboard');
} else {