# Customer group registrations

## Signup payment step

After successful one-time or recurring enrollment, the existing account page opens
on the selected participant and booking. Bookings beyond the overview's 14-day
window open their page in the future list, using the same time/ID ordering and
ten-row pagination. The shared one-time Flash modal offers payment for the participant's nearest active booked occurrence,
the pass selection in the group pricing page, and Classic 4 for the selected
participant/group when eligible. Classic requires recurring membership, at least
four upcoming active occurrences, pass acceptance and no existing upcoming Classic
coverage. Its selection page filters the account's memberships by both participant
and group; it still requires the existing POST/CSRF order confirmation.
Flex remains participant-specific and is not restricted to the enrolled group.

If an active paid pass with available entries can settle the nearest booked term,
the confirmation offers only the shared cancellation shortcut (when available)
and the standard OK/close control. It does not offer payment, pass purchase, cash
or deferred payment. `Pass::findChargeableForOccurrence` is shared with
`UserEventOccurence::chargeUser`: eligibility uses the participant, full occurrence
timestamp (`valid_from <= start < valid_to`), pass acceptance and remaining entries.
The existing order is section pass for section groups, matching CLASSIC, technical
pass, then FLEX 4/8/Open. CLASSIC also requires group membership and that exact
occurrence in its chargeable window. Unpaid, inactive, exhausted, wrong-participant,
wrong-group and date-ineligible passes do not simplify the confirmation.
This check is read-only: it neither consumes nor reserves entries nor marks the
booking paid. It reports current settlement eligibility for the nearest term,
not guaranteed coverage of all future recurring bookings. Actual settlement
continues to recheck eligibility and consume the pass at its existing time.

The payment message explicitly states that enrollment reserves a place and creates
a payment obligation, even without attendance. It explains online payment,
cash with the instructor, existing pass settlement, cancellation via the account
within `HOURS_FOR_CANCELLATION`, absence limits and collection of unpaid debt.
Cash and deferred-payment choices open the selected participant's account page;
they do not mark a booking paid, record a cash payment or cancel any reservation.
For bookings requiring a payment choice, no generic OK, close icon, Escape or
backdrop dismissal bypasses that choice. Covered confirmations allow normal closing.
Other Flash modals retain their normal dismissal. Flash consumes this message
once, so refreshing the destination does not redisplay it.
The entire payment dialog scrolls together, including its header, content and
action footer; the footer does not remain fixed over longer content.

An additional “Anuluję – wycofaj ten zapis” choice appears only while the selected
booking can be cancelled under existing policy. It references the existing
`group-cancel-{id_user_event_occurence}-once` or `-group` form on the account page;
there is no separate withdrawal route, screen, form or confirmation wording.
The shared confirmation modal uses the account's submit button, summary, CSRF,
date/signature and existing POST cancellation endpoints. The payment modal hides
while this confirmation is open; cancelling confirmation restores the payment
choices without changing the booking. Missing forms (for example after a stale
signup redirect) suppress the shortcut. One-time
withdrawal cancels the selected occurrence; recurring withdrawal ends membership
and all cancellable future reservations, including earlier one-time reservations
converted into the group enrollment. The shortcut is unavailable when a recurring
withdrawal would retain any imminent term. It respects attendance, active state,
the deadline and (for a single term under recurring membership) absence limits.
The existing scope signature/date validation rejects changes between preview and
submission; server-side cancellation rechecks ownership and policy under locks.

Before confirming either signup type, a warning appears when the nearest
occurrence is less than `HOURS_FOR_CANCELLATION` away or has already begun. It
identifies that term and states that it cannot be cancelled and remains payable.
Exactly the configured number of hours remains cancellable. This is explanatory
UI; enrollment and cancellation rules have not changed.

For child-only groups, signed-in accounts without children see a green shared
infobox immediately below the signup card heading, explaining that a child must
be added. The infobox and its add-child/parent-help buttons use the theme's
`secondary` color. Buttons appear on a separate row with spacing; the no-children
empty state has its own top margin. Accounts with children omit this guidance
and show their signup choices.

Already paid and zero-price nearest occurrences do not offer duplicate or
unnecessary single payment. Uncovered sports-section enrollment links to section payments.
Course signup continues to redirect with HTTP 303 directly to its existing
`konto/platnosc_online_start/p/{id_user_course}` checkout.
Historical records are unchanged; no migration, new configuration or external
file operation is required. Modal header/footer separators use the same theme
color and transparency as horizontal rules. The deployment workflow builds the
stylesheet from the SCSS sources; local compilation remains optional.
The existing account pages remain `noindex, nofollow`
and outside the sitemap. Existing public pricing/FAQ SEO remains appropriate to its content.

Verify parent/child payment targets, one-time versus recurring Classic choices,
all six actions, short/restricted/paid/free/section groups, cash/deferred choices,
FLEX/CLASSIC/technical coverage, exact validity boundaries, unpaid/inactive/exhausted
passes, participant/group mismatch, read-only preview and actual settlement priority,
single and recurring withdrawal, expired deadlines, changed signatures, foreign
participants, cancellation limits and the exact deadline boundary. Render the
late warning for both signup types and check mobile modal scrolling. Run
`tests/group_signup_payment_test.php` on an isolated test schema plus the existing
signup interface, signup workflow, registration and shared-message checks.

On the public group page, when no next occurrence is available, the signup panel
offers a button linking to the calendar filtered by the group's category and the
standard `Tagger::tag('event_category', ...)` linking to that category's description.
These links are available to guests and signed-in users,
including groups with online signup disabled. The calendar link uses its default
season and does not retain the old group's season, location, or instructor.
Existing signup rules and historical records are unchanged.

The account overview shows the selected participant's active occurrences from
75 minutes before now until midnight at the start of day 15 (today plus 14 days).
Later occurrences use `konto/moje_zajecia_przyszle/{id_child}/?page=N`.
Recent history uses `history_page=N#historia`: the last seven rolling days plus
older outstanding group fees. Full history uses the existing
`konto/moje_zajecia_wszystkie/{id_child}/?page=N` route. History ends at now minus
75 minutes, so upcoming and historical lists do not overlap. All three paginated
lists use ten rows, a database count/limit, deterministic time/ID ordering, and
clamp page numbers to the available range. The near-term list is not paginated.

Only active enrollment, occurrence and group records are listed, retaining the
legacy historical presence/cutoff rules. Old unpaid entries use the existing
payment tracking cutoff and a positive group price (or the group's location
price). No historical payment snapshots are modified. Full account debt remains
calculated independently by `User::calculateBalance`, including children and
individual lessons. The overview shows the debt box and its whole-balance payment action above upcoming classes; full history retains the same action. Unpaid historical rows with a positive fee also link to payment of the entire account balance when that balance is positive. Upcoming
occurrences retain their individual payment action.

## Cancellation

`UserEvent::getParticipantOccurrencesPage` supplies the account lists for group
occurrences, including one-time bookings. `UserEvent` also supplies customer
cancellation context and performs policy
checks under a transaction. `HOURS_FOR_CANCELLATION` is the configurable deadline;
exactly that many hours before start is allowed. `MAX_NO_ABSENCES` remains the
quarterly reported-absence allowance, with the existing sports-section exemption.
The shared confirmation modal first offers a scope, then a separate confirmation.
The interface uses compact rows separated by standard blue horizontal rules and filled action buttons; outline styling remains
reserved for descriptive tags and the icon-only group information link. The family badge sits above group tags, payment is
aligned right beside enrollment actions, and equipment controls appear only when
an order exists or can be created.
One-time enrollment offers only its specific occurrence. Recurring withdrawal opens the unselected scope choice. The absence button
submits the same occurrence form through a direct confirmation, without scope
selection or a back button leading to that selection. An exhausted allowance
disables this direct button. After the deadline only group withdrawal remains.

Group withdrawal ends membership immediately, regardless of the card selected.
The confirmation names the first cancellable occurrence and any imminent retained
occurrences, distinguishing paid from still-payable bookings. A scope signature
rejects changed recurring cancellation plans instead of silently accepting new
consequences. The server rechecks actor/child ownership, active enrollment,
attendance, the deadline and the allowance. Repeated submissions cannot report
success. Administrative cancellation retains its separate policy.

Cancellation delegates to the existing refund, class-order and notification
workflow with a shared database connection. Related enrollment, membership,
payment, pass, order and queued notification updates participate in the transaction.
The Classic pass rules and refunds are unchanged; see `group-management.md`.

No migration, configuration change, historical backfill, external file operation
or deployment is required. Bootstrap utility markup needs no new stylesheet rules. The Sass watcher may be
run explicitly by the operator; it is not a deployment prerequisite for this change.

## Verification

Check zero/ten/eleven results, invalid/last pages, selected children, the 14-day
and seven-day boundaries, old unpaid versus old paid/free entries and the shared
75-minute boundary. Verify one-time/recurring cancellation, exhausted allowance,
sports section, paid/refunded occurrences, no later term, immediate withdrawal
from a distant card, stale confirmation, repeated requests, CSRF and foreign
participants. Confirm mobile layout, keyboard access and shared-modal back/confirm
behavior. Run isolated database and template tests, never against customer data.

## Account navigation and section payments

`konto/sekcja/{id_child}/` contains section payment periods grouped by plan,
using existing availability, paid status and variant rules. `User::getSectionChildren`
selects only active children of the signed-in owner with `is_sekcja = 1`.
The account navigation exposes Sekcja only when this set is nonempty. The page
selects the first eligible child by default and rejects other explicit child IDs.
Group bookings provide only a shortcut; their former section payment list is removed.
The existing `SEKCJA_SELFPAYMENT_ENABLED` setting controls online payment versus
bank transfer instructions. No payment rules or historical records change.

The overview restores cancellation guidance using `HOURS_FOR_CANCELLATION` and
`MAX_NO_ABSENCES`, and offers class/category/instructor/location links when empty.
Instructor substitutions and occurrence locations differing from the group's
location appear together after the group information icon under `W tym terminie zmiana na:`,
with an orange warning icon and tags for changed values only. The main location
tag shows the group's original location; confirmation dialogs retain the actual
occurrence location.
Verify section navigation with no eligible children, an active section child,
an inactive child, an unmarked child and another owner's child. Check child
selection, payment status and the existing payment flow.

Section single-payment actions now depend on the participant's explicit per-class
permission. Period-paying participants see section-period actions instead;
participants with neither permission do not receive a single-payment link.
Section groups cannot be configured for CLASSIC, and FLEX/OPEN/technical passes
cannot settle their bookings. Full account debt remains visible; balance checkout
selects eligible items separately. See [section payment modes](section-payments.md).
