feat: app de alumnos sin contraseña (invitación de un solo uso, avisos de falta y pagos informados)
- Acceso del alumno o tutor con link de un solo uso (hash SHA-256, consumo atómico, el GET no consume), sesión propia de 90 días deslizante, passkeys opcionales (SimpleWebAuthn) y mail de recuperación con rate limit. - Lado alumno (/i/:token, /acceso, /alumno/*): inicio, clases, avisar falta, pagos, informar pago con comprobante (S3 privado, magic bytes) y perfil. - Lado profe: acceso a la app en la ficha del alumno (invitar/reinvitar), "Pagos para verificar" en Cobros con badge, faltas avisadas en la ficha de grupo y datos para transferir en Ajustes. - "Requiere atención" y el recordatorio de WhatsApp excluyen cuotas informadas. - Zona horaria por defecto: Buenos Aires. - Migración add_student_access, tests contra Postgres real (test:db) y docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
47
apps/web/src/features/student-app/FeeCard.tsx
Normal file
47
apps/web/src/features/student-app/FeeCard.tsx
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Link } from '@tanstack/react-router'
|
||||
import type { StudentFee } from '@gruperly/shared'
|
||||
import { Receipt } from 'lucide-react'
|
||||
import { Badge } from '../../components/ui'
|
||||
import { formatPrice } from '../../lib/format'
|
||||
import { feeLabel } from './format'
|
||||
import { FeeStatusBadge } from './FeeStatusBadge'
|
||||
|
||||
/* "Tu cuota": only while there is something unpaid. */
|
||||
export function FeeCard({ fees }: { fees: StudentFee[] }) {
|
||||
if (fees.length === 0) return null
|
||||
const first = fees[0] as StudentFee
|
||||
const toReport = fees.filter((fee) => fee.status !== 'reported')
|
||||
const total = toReport.reduce((sum, fee) => sum + fee.amount, 0)
|
||||
|
||||
return (
|
||||
<article className="rounded-2xl border border-border bg-surface p-5">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="min-w-0">
|
||||
<p className="text-xs font-semibold uppercase tracking-wide text-secondary">Tu cuota</p>
|
||||
<h2 className="mt-1 truncate text-lg font-bold text-primary">
|
||||
{fees.length === 1 ? feeLabel(first) : `${fees.length} cuotas sin pagar`}
|
||||
</h2>
|
||||
<p className="mt-1 text-2xl font-bold text-primary">
|
||||
{formatPrice(toReport.length > 0 ? total : first.amount, first.currency)}
|
||||
</p>
|
||||
</div>
|
||||
{fees.length === 1 ? (
|
||||
<FeeStatusBadge status={first.status} />
|
||||
) : toReport.some((fee) => fee.status === 'overdue') ? (
|
||||
<Badge variant="warning">Hay vencidas</Badge>
|
||||
) : null}
|
||||
</div>
|
||||
{toReport.length > 0 ? (
|
||||
<Link
|
||||
to="/alumno/informar-pago"
|
||||
className="mt-4 flex min-h-12 items-center justify-center gap-2 rounded-xl bg-accent font-semibold text-on-accent hover:bg-accent-strong"
|
||||
>
|
||||
<Receipt className="size-5" aria-hidden="true" />
|
||||
Informar pago
|
||||
</Link>
|
||||
) : (
|
||||
<p className="mt-3 text-sm text-secondary">Tu profe tiene que confirmar el pago que informaste.</p>
|
||||
)}
|
||||
</article>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user