feat(programs): let a programme state its hours, its kit and its price without leaving the form
Four things the programme form could not say, all of which sent the desk
somewhere else or nowhere at all.
A timetable. Recording that a group trains Sunday and Tuesday from four to
half five required the visual grid, which demands a facility and a space —
so clubs that place nobody on a grid had no timetable at all, and the
proration and attendance engines had nothing to read. The form now writes
plain TrainingSchedule rows on the programme's default group with
facility_id null. Rows the grid HAS placed are left alone: clearing a
checkbox here must not strip a space reservation off a scheduled session.
A day dropped from the selection is deactivated rather than deleted,
because generated sessions hold a hard FK to the row and attendance hangs
off those sessions.
Renewal defaults. A new programme opened as manual_renew, so every one had
to be corrected by hand or quietly stopped billing. It now opens
auto_renew, monthly, on the first.
Kits. program_products already records 'this player must buy that thing',
but only for a single product; a kit sold as one thing could not be
required. program_kits is a separate pivot rather than a nullable kit_id
on program_products, whose product_id is NOT NULL and whose uniqueness is
(academy, programme, product). Nor is a kit expanded into its components:
the POS writes an invoice line carrying itemable_type = Kit, so a
programme requiring the parts would report every buyer as missing all of
them. The group roster flags a missing kit the way it flags a missing
product.
Prices. The programmes list showed no price, so comparing what two
programmes cost meant opening both. Both tiers now show, in one query for
the page, and a tier with no active base price reads 'غير محدد' rather
than 0 — the engine hard-fails there, so a zero would be a figure nobody
will ever be charged.
Co-Authored-By:
Claude Opus 5 (1M context) <noreply@anthropic.com>
Showing
This diff is collapsed.
Please register or sign in to comment