feat(groups): kids groups with an adult in charge
- Add the `kidsGroups` plan feature (Pro) and `Group.audience` (ADULTS | KIDS); creating or switching a group to KIDS requires the feature, existing KIDS groups keep working after a downgrade. - Model the adult in charge as a Person linked through `person_guardians`; migrate the old guardian_name/guardian_phone columns and drop them. - Kids quick add: kid + guardian form, guardian lookup by phone to pick an existing kid or add a sibling; backend rejects KIDS adds without guardian. - Attendee page: "Adulto a cargo" section with siblings, editable via PATCH /groups/:gid/attendees/:aid/guardian. - Contact phone (WhatsApp jobs, attention, student access invite, students at risk, attendee actions) prefers the guardian's phone. - Edit group screen (PATCH /groups/:gid, owner only); switching back to ADULTS is blocked while kids have no phone of their own. - Hide bulk import in KIDS groups until it carries guardian data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import type {
|
||||
CreateAttendee,
|
||||
CreateAttendeeResult,
|
||||
CreateGroupWaitlistEntry,
|
||||
GroupAudience,
|
||||
GroupWaitlistEntryDto,
|
||||
GroupWaitlistList,
|
||||
} from '@gruperly/shared'
|
||||
@@ -38,6 +39,8 @@ export type AddAttendeeTab = 'quick' | 'bulk'
|
||||
type AddAttendeeContextValue = {
|
||||
groupId: string
|
||||
groupName: string | undefined
|
||||
/** KIDS: cada alta es un chico con su adulto a cargo. */
|
||||
groupAudience: GroupAudience
|
||||
groupPending: boolean
|
||||
attendeesTotal: number
|
||||
capacity: number | null
|
||||
@@ -262,6 +265,7 @@ export function AddAttendeeProvider({ groupId, children }: { groupId: string; ch
|
||||
const value: AddAttendeeContextValue = {
|
||||
groupId,
|
||||
groupName: group?.name,
|
||||
groupAudience: group?.audience ?? 'ADULTS',
|
||||
groupPending: groupQuery.isPending,
|
||||
attendeesTotal,
|
||||
capacity,
|
||||
@@ -296,7 +300,14 @@ export function AddAttendeeProvider({ groupId, children }: { groupId: string; ch
|
||||
},
|
||||
submitWaitlistEntry: () => {
|
||||
if (pendingCapacityPayload) {
|
||||
addToWaitlistMutation.mutate({ ...pendingCapacityPayload })
|
||||
// Un chico entra a la lista de espera con el teléfono del adulto a cargo
|
||||
// (la lista de espera de grupos de chicos se completa en otra entrega).
|
||||
const { guardian, personId: _personId, ...entry } = pendingCapacityPayload
|
||||
addToWaitlistMutation.mutate({
|
||||
...entry,
|
||||
phone: entry.phone || guardian?.phone || '',
|
||||
email: entry.email || guardian?.email || undefined,
|
||||
})
|
||||
}
|
||||
},
|
||||
requestBulkImport,
|
||||
|
||||
Reference in New Issue
Block a user