feat(attendee-detail): enhance attendee detail view with payment and notes sections

- Added payment presentation logic to display payment status and due dates.
- Introduced AttendeeNotesSection and AttendeePaymentsSection components for managing notes and payments.
- Implemented forms for editing contact information and notes with validation.
- Updated API to support attendee updates and added corresponding tests.
- Improved attendance summary logic to reflect all visible sessions.
- Enhanced UI with loading states and error handling for better user experience.
This commit is contained in:
Jose Selesan
2026-10-01 18:41:55 -03:00
parent 6d120f4b1f
commit faf949fc9b
31 changed files with 1129 additions and 225 deletions

View File

@@ -1,21 +1,13 @@
import { useEffect, useId, useRef, useState } from 'react'
import type { KeyboardEvent, RefObject } from 'react'
import { Ellipsis, UserMinus } from 'lucide-react'
import { Ellipsis, MoveRight, Pause, Pencil, UserMinus } from 'lucide-react'
import { useToast } from '../../components/ui'
import { useAttendeeDetail } from './AttendeeDetailProvider'
const ITEM_CLASS =
'flex min-h-11 w-full items-center gap-2.5 rounded-lg px-3 text-left text-sm font-medium text-primary transition-colors hover:bg-danger-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent'
'flex min-h-11 w-full items-center gap-2.5 rounded-lg px-3 text-left text-sm font-medium text-primary transition-colors hover:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent'
/** "⋯" menu on the attendee detail page.
*
* For now it only holds "Quitar del grupo": the backend has no way to
* regenerate the absence token, so the option is not shown before that
* endpoint exists (see `apps/backend/prisma/models/domain.prisma`, field
* `notifyToken`). Once it does, it is one more `<button role="menuitem">` in
* the list below.
*
* The label goes in `text-primary` and the icon carries the `text-danger`: the
* `danger` red on white sits at 3.7:1 and does not reach AA for normal text. */
/** Accessible "⋯" menu for member-level actions. */
export function AttendeeActionsMenu({
triggerRef,
}: {
@@ -23,7 +15,8 @@ export function AttendeeActionsMenu({
* when it closes. */
triggerRef: RefObject<HTMLButtonElement | null>
}) {
const { openRemoveDialog } = useAttendeeDetail()
const { beginContactEdit, openRemoveDialog } = useAttendeeDetail()
const toast = useToast()
const [isOpen, setIsOpen] = useState(false)
const menuRef = useRef<HTMLDivElement>(null)
const itemRef = useRef<HTMLButtonElement>(null)
@@ -76,6 +69,18 @@ export function AttendeeActionsMenu({
items[next]?.focus()
}
const showPendingChangeGroup = () => {
close()
// TODO(miembros): navegar al selector cuando se confirmen las reglas y exista el endpoint.
toast.info('Cambiar de grupo estará disponible cuando se confirme el flujo de traspaso.')
}
const showPendingPause = () => {
close()
// TODO(miembros): conectar la pausa cuando se defina su efecto sobre cupos y cobros.
toast.info('Pausar la membresía estará disponible cuando se confirme su lógica de negocio.')
}
return (
<div className="relative shrink-0">
<button
@@ -105,12 +110,46 @@ export function AttendeeActionsMenu({
type="button"
role="menuitem"
className={ITEM_CLASS}
onClick={showPendingChangeGroup}
>
<MoveRight className="size-4 shrink-0 text-secondary" aria-hidden="true" />
Cambiar de grupo
</button>
<button
type="button"
role="menuitem"
className={ITEM_CLASS}
onClick={() => {
close()
beginContactEdit()
requestAnimationFrame(() => {
document.getElementById('attendee-contact')?.scrollIntoView({ behavior: 'smooth' })
})
}}
>
<Pencil className="size-4 shrink-0 text-secondary" aria-hidden="true" />
Editar contacto
</button>
<button
type="button"
role="menuitem"
className={ITEM_CLASS}
onClick={showPendingPause}
>
<Pause className="size-4 shrink-0 text-secondary" aria-hidden="true" />
Pausar membresía
</button>
<div className="my-1 border-t border-border/70" aria-hidden="true" />
<button
type="button"
role="menuitem"
className={`${ITEM_CLASS} text-danger-fg hover:bg-danger-soft`}
onClick={() => {
close()
openRemoveDialog()
}}
>
<UserMinus className="size-4 shrink-0 text-danger" aria-hidden="true" />
<UserMinus className="size-4 shrink-0" aria-hidden="true" />
Quitar del grupo
</button>
</div>