fix: TypeScript build errors in frontend

- Fix CFDI type errors (ivaTraslado, tipoCambio, id types)
- Fix sidebar navigation type errors (Role vs literal tuples)
- Fix user invite type errors (UserInvite['role'])
- Fix login page PlatformRole type cast
This commit is contained in:
Horux Dev
2026-04-28 04:51:52 +00:00
parent 2896eea4f2
commit 2ac8e4d055
9 changed files with 33 additions and 31 deletions

View File

@@ -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<string, { label: string; icon: React.ElementType; color: string }> = {
@@ -25,7 +25,7 @@ const legacyRoleLabels: Record<string, { label: string; icon: React.ElementType;
visor: { label: 'Visor', icon: Eye, color: 'text-muted-foreground' },
};
const legacyInviteRoles: { value: string; label: string }[] = [
const legacyInviteRoles: { value: string; label: string; description?: string }[] = [
{ value: 'contador', label: 'Contador' },
{ value: 'visor', label: 'Visor' },
{ value: 'auxiliar', label: 'Auxiliar' },
@@ -39,7 +39,7 @@ const despachoRoleLabels: Record<string, { label: string; icon: React.ElementTyp
cliente: { label: 'Cliente', icon: Building2, color: 'text-muted-foreground' },
};
const despachoInviteRoles: { value: string; label: string; description: string }[] = [
const despachoInviteRoles: { value: string; label: string; description?: string }[] = [
{
value: 'supervisor',
label: 'Supervisor',
@@ -83,10 +83,10 @@ export default function UsuariosPage() {
const isAdmin = currentUser?.role === 'owner' || currentUser?.role === 'cfo';
const [showInvite, setShowInvite] = useState(false);
const [inviteForm, setInviteForm] = useState<{ email: string; nombre: string; role: Role; supervisorUserId?: string }>({
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<string[]>([]);
@@ -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() {
<Label htmlFor="role">Rol</Label>
<Select
value={inviteForm.role}
onValueChange={(v) => { setInviteForm({ ...inviteForm, role: v as Role, supervisorUserId: undefined }); if (v !== 'cliente') setSelectedRfcIds([]); }}
onValueChange={(v) => { setInviteForm({ ...inviteForm, role: v as UserInvite['role'], supervisorUserId: undefined }); if (v !== 'cliente') setSelectedRfcIds([]); }}
>
<SelectTrigger>
<SelectValue />