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:
56
apps/web/src/features/groups/detail/AbsenceNoticesCard.tsx
Normal file
56
apps/web/src/features/groups/detail/AbsenceNoticesCard.tsx
Normal file
@@ -0,0 +1,56 @@
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import type { AbsenceReasonValue } from '@gruperly/shared'
|
||||
import { Avatar, Badge } from '../../../components/ui'
|
||||
import { getGroupAbsenceNotices } from '../../../lib/api'
|
||||
import { useGroupDetail } from './GroupDetailProvider'
|
||||
|
||||
const REASON_LABELS: Record<AbsenceReasonValue, string> = {
|
||||
health: 'Salud',
|
||||
travel: 'Viaje',
|
||||
work_study: 'Trabajo o estudio',
|
||||
other: 'Otro',
|
||||
}
|
||||
|
||||
function classLabel(iso: string): string {
|
||||
return new Date(iso)
|
||||
.toLocaleString('es-AR', { weekday: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', hourCycle: 'h23' })
|
||||
.replace(/\./g, '')
|
||||
}
|
||||
|
||||
/* "Faltas avisadas · esta semana": what students said from the app. Only shown
|
||||
when there is something to show, so it doesn't push the members list down. */
|
||||
export function AbsenceNoticesCard() {
|
||||
const { groupId } = useGroupDetail()
|
||||
const query = useQuery({
|
||||
queryKey: ['absence-notices', groupId],
|
||||
queryFn: () => getGroupAbsenceNotices(groupId),
|
||||
})
|
||||
const notices = query.data?.data ?? []
|
||||
if (notices.length === 0) return null
|
||||
|
||||
return (
|
||||
<section aria-labelledby="absence-notices-title" className="rounded-xl border border-border bg-surface">
|
||||
<h2 id="absence-notices-title" className="px-4 pt-4 text-sm font-semibold text-primary">
|
||||
Faltas avisadas · esta semana
|
||||
</h2>
|
||||
<ul className="divide-y divide-border">
|
||||
{notices.map((notice) => (
|
||||
<li key={notice.id} className="flex items-start gap-3 px-4 py-3">
|
||||
<Avatar name={notice.attendee.fullName} className="size-9 rounded-full bg-accent-soft text-accent-fg" />
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<p className="truncate text-sm font-medium text-primary">{notice.attendee.fullName}</p>
|
||||
<Badge variant="success">Justificada</Badge>
|
||||
</div>
|
||||
<p className="text-xs capitalize text-secondary">
|
||||
{classLabel(notice.startsAt)}
|
||||
{notice.reason ? ` · ${REASON_LABELS[notice.reason]}` : ''}
|
||||
</p>
|
||||
{notice.message ? <p className="mt-1 text-sm text-primary">“{notice.message}”</p> : null}
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import { PreRegistrationDetailModal } from './PreRegistrationDetailModal'
|
||||
import { RemoveAttendeeModal } from './RemoveAttendeeModal'
|
||||
import { useGroupDetail } from './GroupDetailProvider'
|
||||
import { WaitlistEntryDetailModal } from './WaitlistEntryDetailModal'
|
||||
import { AbsenceNoticesCard } from './AbsenceNoticesCard'
|
||||
|
||||
export function GroupDetailView() {
|
||||
const {
|
||||
@@ -70,6 +71,7 @@ export function GroupDetailView() {
|
||||
) : (
|
||||
<>
|
||||
<GroupInfoCard />
|
||||
<AbsenceNoticesCard />
|
||||
<GroupAutomationsCard />
|
||||
<MembersWaitlistSection />
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user