@composable-os/pack-bookings 0.1.0-beta.10 → 0.1.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
- // Bookings (stage 31a, build step 3: the spine; ADR 0504): a gym's or studio's timetable and the
1
+ // Bookings (stage 31a, build steps 3 to 5 and 7: the spine, spending, the waitlist, and
2
+ // attendance, moves and cancelling a class; ADRs 0504, 0520 and 0553): a gym's or studio's
3
+ // timetable and the
2
4
  // bookings members make on it. Staff set a weekly timetable once (series), the host makes each
3
5
  // week's classes from it, and members book and cancel them on the web and in the app.
4
6
  //
@@ -18,10 +20,29 @@
18
20
  // - a booking entering `booked` spends a use of its Person's membership or pass and an in-time
19
21
  // cancel gives it back (`allowance`, ADRs 0493 and 0494), unless staff booked it paid at the
20
22
  // desk (`waived`, ADR 0506). The holders are the Memberships pack's (stage 32b);
21
- // - members read the timetable and how many places are left, never who is booked (decision 13).
23
+ // - a member joins a full class's waitlist, spending nothing; a place given back before the
24
+ // class type's "waitlist stops" time goes to the waitlist in the same batch, and the host
25
+ // moves the first waiter in, spending their use then, or passes them over when nothing they
26
+ // hold can pay (`claims.waitlist`, ADR 0520; step 5);
27
+ // - a visitor, or a member with nothing to spend, pays for one class on the web (a drop-in,
28
+ // decision 8): the host makes the booking held while its order is unpaid, priced from the
29
+ // class type's drop-in price or the organisation's, booked when the payment is verified and
30
+ // released when the order expires; a paid drop-in cancelled in time or by the gym owes the
31
+ // money back, which a person approves (`sellable.moves`, ADR 0560; step 8);
32
+ // - members read the timetable and how many places are left, never who is booked (decision 13);
33
+ // - a coach ticks names from an hour before the class (a window that binds staff, ADR 0551);
34
+ // of two ticks at once one is made (ADR 0437); 30 minutes after a class ends, the host makes
35
+ // its still-booked bookings no-shows, only if someone on it was ticked (`states.after`,
36
+ // ADR 0550). A no-show keeps its use;
37
+ // - staff move a booking to another class by making the new one (`movedFrom`): the old one is
38
+ // moved, its place given back and its use spent again on the new one, in one batch, refused
39
+ // whole when the new class is full or the use cannot be spent (ADRs 0493 and 0551);
40
+ // - staff cancel a class (a person's act, or a person approves an AI's request, ADR 0552), and
41
+ // every booked, waiting and held booking of it is cancelled in the same batch (ADR 0507);
42
+ // - the coach role (`roles`, ADR 0436): the day's classes, their lists, and ticking names.
22
43
  // The tools in tools.ts compose the host's operations and add no rules of their own.
23
44
  import { defineExtension } from "@composable-os/sdk";
24
- import { book, bookFor, cancel, cancelFor, classGet, classList, day, findPeople, mine, returnUse, timetable, } from "./tools.js";
45
+ import { book, bookFor, buy, cancel, cancelClass, cancelFor, classGet, classList, day, family, findPeople, leaveWaitlist, markAll, markAttended, markNoShow, mine, move, returnUse, roster, timetable, undoAttended, } from "./tools.js";
25
46
  /** Weekday values a series' `weekdays` uses (ADR 0500). */
26
47
  const WEEKDAYS = [
27
48
  { value: "mon", label: "Monday" },
@@ -47,6 +68,8 @@ const BOOKING_STATES = [
47
68
  { value: "moved", label: "Moved" },
48
69
  { value: "expired", label: "Expired" },
49
70
  ];
71
+ /** What a class the gym cancels cancels with it: every booking holding a place or a use. */
72
+ const FOLLOW_CANCEL = ["booked", "waiting", "pending", "attended", "no_show", "late_cancelled"];
50
73
  /** A booking that holds or takes a place, and so counts as the Person's one for its class. */
51
74
  const ACTIVE = ["pending", "booked", "waiting", "attended", "no_show"];
52
75
  /** When a customer may book, and when a cancel is late, from the class type or the org. */
@@ -63,6 +86,8 @@ const lateFrom = {
63
86
  at: "class.startsAt",
64
87
  minutesBefore: { field: "class.classType.lateMinutes", setting: "lateMinutes" },
65
88
  };
89
+ /** A class's list opens for ticking an hour before it starts (guess: people arrive early). */
90
+ const listOpens = { at: "class.startsAt", minutesBefore: 60 };
66
91
  // A booking rule is a person's to change (spec 31: "Change the booking rules: a person only"):
67
92
  // set by the assistant, an MCP client, an automation or extension code, it waits for a person's
68
93
  // approval (`personApproves`, ADR 0507).
@@ -92,7 +117,18 @@ export default defineExtension({
92
117
  // record.*, my.* and state.resolve are not listed: they are granted by object (Bookings'
93
118
  // own, and the read and write lists above), and a listed one would reach every object.
94
119
  // duplicate.check: a walk-in is checked against the People on file before one is made.
95
- operations: ["public.list", "public.get", "capacity.get", "duplicate.check"],
120
+ // waitlist.position: where a waiter stands in the queue (a member: their own only).
121
+ // me.family: the member's own id, and the children staff linked to them (ADR 0540).
122
+ // order.startHeld: a drop-in, the booking made with its order by the host (ADR 0560).
123
+ operations: [
124
+ "order.startHeld",
125
+ "public.list",
126
+ "public.get",
127
+ "capacity.get",
128
+ "duplicate.check",
129
+ "waitlist.position",
130
+ "me.family",
131
+ ],
96
132
  modules: ["ops"],
97
133
  },
98
134
  // Bookings' fields on Programs' class type: how it shows, and its booking rules when they
@@ -118,10 +154,20 @@ export default defineExtension({
118
154
  "Empty: the organisation's setting."),
119
155
  lateMinutes: minutes("Late cancel from (minutes before)", "A cancel this close to the start or closer is late and keeps the class it used. Empty: " +
120
156
  "the organisation's setting."),
121
- promotionMinutes: minutes("Waitlist stops (minutes before)", "Nobody is moved in from the waitlist after this. Empty: the organisation's setting. " +
122
- "(The waitlist comes in a later release.)"),
157
+ promotionMinutes: minutes("Waitlist stops (minutes before)", "Nobody is moved in from the waitlist after this: a place freed later goes to whoever " +
158
+ "books first. Empty: the organisation's setting."),
123
159
  reminderMinutes: minutes("Reminder (minutes before)", "When members are reminded of a class. Empty: the organisation's setting. (Reminders " +
124
160
  "come in a later release.)"),
161
+ dropInPrice: {
162
+ type: "number",
163
+ label: "Drop-in price",
164
+ description: "What one class costs someone paying for it on the website, in the organisation's " +
165
+ "currency. Empty: the organisation's setting; empty there too, no drop-ins.",
166
+ min: 0,
167
+ max: 100_000,
168
+ step: 0.01,
169
+ personApproves: true,
170
+ },
125
171
  staffOnly: {
126
172
  type: "boolean",
127
173
  label: "Booked by staff only",
@@ -281,7 +327,8 @@ export default defineExtension({
281
327
  required: true,
282
328
  },
283
329
  startsAt: { type: "datetime", label: "Starts", required: true },
284
- endsAt: { type: "datetime", label: "Ends" },
330
+ // Required (step 7): no-shows are written after it, and a class is cancelled only before.
331
+ endsAt: { type: "datetime", label: "Ends", required: true },
285
332
  // Left empty, the organisation's zone (ADR 0460): a class always has one.
286
333
  timezone: { type: "timezone", label: "Time zone", required: true },
287
334
  room: { type: "relation", label: "Room", to: "bookings.room" },
@@ -305,6 +352,12 @@ export default defineExtension({
305
352
  readOnly: true,
306
353
  description: "Edited by hand: its series no longer changes it.",
307
354
  },
355
+ cancelledReason: {
356
+ type: "longText",
357
+ label: "Why it was cancelled",
358
+ readOnly: true,
359
+ description: "The reason staff gave when they cancelled the class.",
360
+ },
308
361
  // A class that is not scheduled cannot be booked by a member (the booking's create rule).
309
362
  closed: {
310
363
  type: "formula",
@@ -316,10 +369,20 @@ export default defineExtension({
316
369
  field: "state",
317
370
  initial: "scheduled",
318
371
  moves: [
319
- // Only the host cancels a class at this step (a closure, a series ended, each confirmed
320
- // by a person, ADR 0500). Staff cancelling a class, with its bookings cancelled in the
321
- // same batch, is step 7's cascade.
322
- { from: "scheduled", to: "cancelled", by: ["host"], final: true },
372
+ // The host cancels a class (a closure, a series ended, each confirmed by a person, ADR
373
+ // 0500), and so does cancelClass: a person's act, or an AI's request a person approves
374
+ // (ADR 0552). No other staff write cancels one. Its bookings follow in the same batch.
375
+ // Only until the class ends (binding the tool's staff write; the host is not bound): a
376
+ // class that happened is not cancelled afterwards, so no-shows never sit on one.
377
+ {
378
+ from: "scheduled",
379
+ to: "cancelled",
380
+ by: ["host"],
381
+ tools: ["cancelClass"],
382
+ window: { until: "endsAt" },
383
+ bindsStaff: true,
384
+ final: true,
385
+ },
323
386
  { from: "scheduled", to: "done", by: ["staff", "host"], final: true },
324
387
  ],
325
388
  },
@@ -355,7 +418,13 @@ export default defineExtension({
355
418
  "state",
356
419
  ],
357
420
  },
358
- indexes: [["startsAt"], ["state", "startsAt"], ["series"], ["classType", "startsAt"]],
421
+ indexes: [
422
+ ["startsAt"],
423
+ ["state", "startsAt"],
424
+ ["series"],
425
+ ["classType", "startsAt"],
426
+ ["endsAt"],
427
+ ],
359
428
  },
360
429
  closure: {
361
430
  label: "Closure",
@@ -383,7 +452,9 @@ export default defineExtension({
383
452
  fields: {
384
453
  title: { type: "text", label: "Title" },
385
454
  class: { type: "relation", label: "Class", to: "bookings.class", required: true },
386
- person: { type: "relation", label: "Person", to: "person", required: true },
455
+ // Set on every booking but a guest's drop-in held while unpaid, which is nobody's until the
456
+ // payment is verified (`sellable.moves.guest`: the host keeps it set in every other state).
457
+ person: { type: "relation", label: "Person", to: "person" },
387
458
  state: { type: "select", label: "State", track: "timeline", options: BOOKING_STATES },
388
459
  holder: {
389
460
  type: "text",
@@ -412,17 +483,38 @@ export default defineExtension({
412
483
  },
413
484
  paidOtherwise: {
414
485
  type: "boolean",
415
- label: "Paid at the desk",
486
+ label: "Paid another way",
416
487
  readOnly: true,
417
- description: "Booked by staff for someone who paid another way (a walk-in at the desk): it " +
488
+ description: "Paid at the desk (a walk-in staff booked) or as a drop-in on the website: it " +
418
489
  "spends no use. Set when it is made.",
419
490
  },
491
+ // A drop-in (ADR 0560): what it cost and its order, written by the host at the buy.
492
+ dropInPrice: {
493
+ type: "number",
494
+ label: "Drop-in paid",
495
+ readOnly: true,
496
+ description: "What the drop-in cost, set by the host when it was bought.",
497
+ },
498
+ dropInOrder: {
499
+ type: "text",
500
+ label: "Drop-in order",
501
+ readOnly: true,
502
+ description: "The order that pays for this drop-in, set by the host.",
503
+ },
420
504
  bookedBy: {
421
505
  type: "user",
422
506
  label: "Booked by",
423
507
  readOnly: true,
424
508
  description: "The staff account that booked it. Empty when the member booked.",
425
509
  },
510
+ madeBy: {
511
+ type: "relation",
512
+ label: "Booked by (member)",
513
+ to: "person",
514
+ readOnly: true,
515
+ description: "The member who made it, set by the host: the person themselves, or the parent or " +
516
+ "guardian who booked for them. Empty when staff booked. Nobody edits it.",
517
+ },
426
518
  movedFrom: {
427
519
  type: "relation",
428
520
  label: "Moved from",
@@ -431,33 +523,81 @@ export default defineExtension({
431
523
  description: "The booking this one replaced when staff moved it to this class.",
432
524
  },
433
525
  note: { type: "longText", label: "Staff note" },
526
+ // Who ticked the name (or marked a no-show), and when (step 7): the coach who was first.
527
+ markedAt: {
528
+ type: "datetime",
529
+ label: "Attendance marked",
530
+ readOnly: true,
531
+ description: "When a coach ticked them as come, or marked them as not come.",
532
+ },
533
+ markedBy: {
534
+ type: "user",
535
+ label: "Marked by",
536
+ readOnly: true,
537
+ description: "The staff account that marked their attendance.",
538
+ },
539
+ markedByName: {
540
+ type: "text",
541
+ label: "Marked by (name)",
542
+ readOnly: true,
543
+ description: "That staff member's name as it was then.",
544
+ },
545
+ // The waitlist's record of what the host did (ADR 0520), for the class list and messages.
546
+ promotedAt: {
547
+ type: "datetime",
548
+ label: "Moved in from the waitlist",
549
+ readOnly: true,
550
+ description: "When the host moved them in from the waitlist.",
551
+ },
552
+ passedOverAt: {
553
+ type: "datetime",
554
+ label: "Passed over",
555
+ readOnly: true,
556
+ description: "When a place was free but nothing they hold could pay for it: they stay waiting.",
557
+ },
558
+ passedOverReason: {
559
+ type: "text",
560
+ label: "Why passed over",
561
+ readOnly: true,
562
+ description: "The host's reason (no_uses_left, ended, not_live, not_covered…).",
563
+ },
434
564
  },
435
565
  states: {
436
566
  field: "state",
437
567
  initial: "booked",
438
568
  create: {
439
- // Waiting (step 5) and held while paying (step 8) are not reachable by anyone but the
440
- // host yet: nothing a customer does lands a booking in them.
441
- in: { waiting: ["host"], pending: ["host"] },
569
+ // A member or staff join a full class's waitlist (ADR 0520: only while it is full,
570
+ // before the cut-off). Held while paying (step 8) is the host's alone.
571
+ in: { waiting: ["staff", "customer", "host"], pending: ["host"] },
442
572
  window: { from: opens, until: closes },
443
573
  // A class type booked by staff only (staff may book it).
444
574
  staffOnly: "class.classType.staffOnly",
445
575
  // A class that is not scheduled (cancelled or done): nobody books it, staff included.
446
576
  closed: "class.closed",
447
577
  },
448
- // A class the host cancels (a closure, a series changed, ended or trashed) cancels its
449
- // live bookings in the same batch: places released, uses given back (ADR 0507).
578
+ // A class the gym cancels (cancelClass, a closure, a series changed, ended or trashed)
579
+ // cancels every booking that holds a place or a use in the same batch: booked, ticked,
580
+ // marked not come and cancelled late included, each use given back once (ADRs 0507, 0553).
450
581
  follows: {
451
582
  relation: "class",
452
583
  when: { cancelled: "cancelled_by_us" },
453
- from: ["booked", "waiting", "pending"],
584
+ from: FOLLOW_CANCEL,
454
585
  },
455
586
  // A member asks to cancel; the host picks in time or late by its clock (ADR 0503).
456
587
  requests: { cancel: ["cancelled", "late_cancelled"] },
457
588
  moves: [
458
589
  { from: "pending", to: "booked", by: ["host"] },
459
590
  { from: "pending", to: "expired", by: ["host"], final: true },
460
- { from: "waiting", to: "booked", by: ["host"] },
591
+ // The host promotes (taking the waitlist's hold); a member waiting on a class with a
592
+ // free place (after the cut-off, say) takes it themselves, inside the booking window
593
+ // and the staff-only rule, never a place held for the queue (ADR 0520).
594
+ {
595
+ from: "waiting",
596
+ to: "booked",
597
+ by: ["host", "customer"],
598
+ window: { from: opens, until: closes },
599
+ staffOnly: "class.classType.staffOnly",
600
+ },
461
601
  { from: "waiting", to: "left", by: ["staff", "customer"], final: true },
462
602
  {
463
603
  from: "booked",
@@ -469,32 +609,111 @@ export default defineExtension({
469
609
  // person's own act, the move below.
470
610
  bindsStaff: true,
471
611
  },
612
+ // Not final: a class the gym cancels afterwards gives the kept use back (ADR 0553).
472
613
  {
473
614
  from: "booked",
474
615
  to: "late_cancelled",
475
616
  by: ["staff", "customer"],
476
- final: true,
477
617
  window: { from: lateFrom, until: "class.startsAt" },
478
618
  },
479
619
  // A person on the staff gives the use back whatever the time, with a reason, through
480
620
  // returnUse alone (ADR 0513's `tools`: humanOnly, with its permission).
481
621
  { from: "booked", to: "excused", by: ["host"], tools: ["returnUse"], final: true },
482
- { from: "booked", to: "attended", by: ["staff"] },
622
+ // A coach ticks a name from an hour before the class, and any time after it (a late
623
+ // correction), never days ahead (a window that binds staff, ADR 0551). Unticked, it is
624
+ // booked again; a no-show ticked is attended. Each keeps the use.
625
+ {
626
+ from: "booked",
627
+ to: "attended",
628
+ by: ["staff"],
629
+ window: { from: listOpens },
630
+ bindsStaff: true,
631
+ },
483
632
  { from: "attended", to: "booked", by: ["staff"] },
484
- { from: "booked", to: "no_show", by: ["staff", "host"] },
633
+ // Marked by a coach once the class has started; by the host after it (states.after).
634
+ {
635
+ from: "booked",
636
+ to: "no_show",
637
+ by: ["staff", "host"],
638
+ window: { from: "class.startsAt" },
639
+ bindsStaff: true,
640
+ },
485
641
  { from: "no_show", to: "attended", by: ["staff"] },
642
+ { from: FOLLOW_CANCEL, to: "cancelled_by_us", by: ["host"], final: true },
643
+ // A move to another class: made only by making the new booking (`movedFrom`), in its
644
+ // batch (ADR 0551), and only before the class starts; after it, giving the use back is a
645
+ // person's act (returnUse).
486
646
  {
487
- from: ["booked", "waiting", "pending"],
488
- to: "cancelled_by_us",
489
- by: ["host"],
647
+ from: "booked",
648
+ to: "moved",
649
+ by: ["staff"],
490
650
  final: true,
651
+ window: { until: "class.startsAt" },
652
+ bindsStaff: true,
653
+ },
654
+ ],
655
+ // 30 minutes after a class ends, a booking still booked is a no-show, only when someone
656
+ // on the class was marked (its list was taken): a forgotten list makes nobody a no-show
657
+ // (spec 31, decision 11; ADR 0550).
658
+ after: [
659
+ {
660
+ from: "booked",
661
+ to: "no_show",
662
+ at: "class.endsAt",
663
+ minutesAfter: 30,
664
+ ifAnyIn: ["attended", "no_show"],
491
665
  },
492
- { from: "booked", to: "moved", by: ["staff"], final: true },
493
666
  ],
494
667
  },
495
668
  // A place on the class while held, booked, attended or a no-show (ADR 0501).
496
- claims: { on: "class", held: ["pending"], confirmed: ["booked", "attended", "no_show"] },
669
+ // Its waitlist (ADR 0520): a place given back before the class type's "waitlist stops"
670
+ // time (else the organisation's) goes to the first waiter, whom the host moves in.
671
+ claims: {
672
+ on: "class",
673
+ held: ["pending"],
674
+ confirmed: ["booked", "attended", "no_show"],
675
+ waitlist: {
676
+ state: "waiting",
677
+ promote: "booked",
678
+ until: {
679
+ at: "class.startsAt",
680
+ minutesBefore: {
681
+ field: "class.classType.promotionMinutes",
682
+ setting: "promotionMinutes",
683
+ },
684
+ },
685
+ promotedAt: "promotedAt",
686
+ passedOverAt: "passedOverAt",
687
+ passedOverReason: "passedOverReason",
688
+ },
689
+ },
497
690
  unique: [{ fields: ["person", "class"], states: ACTIVE }],
691
+ // A drop-in (decision 8, ADR 0560): x.bookings.buy has the host make the booking held
692
+ // (`pending`, a place claimed) with its order, priced from the class type's drop-in price,
693
+ // else the organisation's. A verified payment books it; the order expiring or cancelled
694
+ // releases it (`expired`). A paid one cancelled in time, given back by a person, or
695
+ // cancelled by the gym owes its money back, which a person with orders:refund approves
696
+ // (decision 15). A late cancel and a no-show keep it (no fee, no refund).
697
+ sellable: {
698
+ price: "dropInPrice",
699
+ // Stripe's "Fee for Personal Training/Fitness Classes" (in-person group classes); a human
700
+ // admin may override it in Settings -> Orders.
701
+ tax: { code: "txcd_50021003" },
702
+ moves: {
703
+ held: "pending",
704
+ paid: "booked",
705
+ expired: "expired",
706
+ refund: ["cancelled", "excused", "cancelled_by_us"],
707
+ price: { field: "class.classType.dropInPrice", setting: "dropInPrice" },
708
+ title: "class.title",
709
+ order: "dropInOrder",
710
+ // A visitor is matched to no Person until they have paid (ADR 0560): their hold is
711
+ // nobody's, blocks nobody's own booking and says nothing about who has the address.
712
+ guest: true,
713
+ // How much of a class unpaid guest holds may take at once.
714
+ holdCap: { setting: "dropInHoldPercent" },
715
+ },
716
+ },
498
717
  // A spender of the Memberships pack's holders (stage 32b's ids, spec 32): booked spends,
499
718
  // an in-time cancel, a class the gym cancels and a move give back; a late cancel and a
500
719
  // no-show keep it. The period is the class's, and its type and local time are what a
@@ -513,13 +732,30 @@ export default defineExtension({
513
732
  waived: "paidOtherwise",
514
733
  },
515
734
  },
516
- // A member reads and changes only their own bookings; never anyone else's (decision 13).
735
+ // A member reads and changes only their own bookings, and a parent or guardian staff linked
736
+ // to a child the child's too (ADR 0540); never anyone else's (decision 13).
517
737
  customer: {
518
738
  field: "person",
519
- read: ["class", "state", "holder", "classType"],
739
+ read: [
740
+ "person",
741
+ "class",
742
+ "state",
743
+ "holder",
744
+ "classType",
745
+ "promotedAt",
746
+ "passedOverAt",
747
+ "passedOverReason",
748
+ "paidOtherwise",
749
+ "dropInPrice",
750
+ "dropInOrder",
751
+ ],
520
752
  write: ["class", "state", "holder"],
521
753
  // Which class and which holder are chosen when it is made, never after (ADR 0507).
522
754
  createOnly: ["class", "holder"],
755
+ // A guardian books, cancels and joins waitlists for a live dependant, under the same
756
+ // windows and rules, and reads their bookings (ADR 0540). The use is the child's: the
757
+ // allowance spends the booking's Person's holders only.
758
+ guardians: { write: true, madeBy: "madeBy" },
523
759
  },
524
760
  timelineLinks: ["person"],
525
761
  indexes: [["class", "state"], ["person", "state"], ["state"]],
@@ -557,6 +793,13 @@ export default defineExtension({
557
793
  sort: { field: "time", direction: "asc" },
558
794
  columns: ["title", "weekdays", "time", "length", "coach", "room", "places", "firstDate"],
559
795
  },
796
+ waitlists: {
797
+ label: "Waiting",
798
+ object: "bookings.booking",
799
+ filter: { field: "state", op: "eq", value: "waiting" },
800
+ sort: { field: "createdAt", direction: "asc" },
801
+ columns: ["title", "class", "person", "createdAt", "passedOverAt", "passedOverReason"],
802
+ },
560
803
  lateCancels: {
561
804
  label: "Late cancels",
562
805
  object: "bookings.booking",
@@ -574,7 +817,19 @@ export default defineExtension({
574
817
  type: "table",
575
818
  object: "bookings.booking",
576
819
  relation: "class",
577
- columns: ["person", "state", "holder", "paidOtherwise", "bookedBy", "createdAt"],
820
+ columns: [
821
+ "person",
822
+ "state",
823
+ "holder",
824
+ "paidOtherwise",
825
+ "dropInPrice",
826
+ "bookedBy",
827
+ "promotedAt",
828
+ "passedOverReason",
829
+ "markedAt",
830
+ "markedByName",
831
+ "createdAt",
832
+ ],
578
833
  sort: { field: "createdAt", direction: "asc" },
579
834
  },
580
835
  order: 10,
@@ -638,12 +893,32 @@ export default defineExtension({
638
893
  promotionMinutes: {
639
894
  type: "number",
640
895
  label: "Waitlist stops (minutes before)",
641
- description: "Nobody is moved in from the waitlist after this (a later release).",
896
+ description: "Nobody is moved in from the waitlist after this: a place freed later goes to whoever " +
897
+ "books first.",
642
898
  default: 120,
643
899
  min: 0,
644
900
  max: 10_080,
645
901
  personApproves: true,
646
902
  },
903
+ dropInPrice: {
904
+ type: "number",
905
+ label: "Drop-in price",
906
+ description: "What one class costs someone paying for it on the website, in the organisation's " +
907
+ "currency, unless its class type sets its own. Empty: no drop-ins.",
908
+ min: 0,
909
+ max: 100_000,
910
+ personApproves: true,
911
+ },
912
+ dropInHoldPercent: {
913
+ type: "number",
914
+ label: "Places held for unpaid drop-ins (percent)",
915
+ description: "At most this share of a class's places (at least one) may be held at once for visitors " +
916
+ "who have not paid yet. More are told to try again shortly.",
917
+ default: 50,
918
+ min: 0,
919
+ max: 100,
920
+ personApproves: true,
921
+ },
647
922
  reminderMinutes: {
648
923
  type: "number",
649
924
  label: "Reminder (minutes before)",
@@ -654,11 +929,32 @@ export default defineExtension({
654
929
  personApproves: true,
655
930
  },
656
931
  },
932
+ // The coach role (spec 31, decision 10; ADR 0436): the day's classes and their lists, and ticking
933
+ // names. Nothing else: no money (no holders, no desk payments, no orders), no people beyond the
934
+ // names on a list, no bookings made or cancelled, no settings.
935
+ roles: {
936
+ coach: {
937
+ label: "Coach",
938
+ description: "Sees the day's classes and each class's list, and ticks who came (or marks who did " +
939
+ "not). Nothing else: no money, no other people, no booking or cancelling, no settings.",
940
+ permissions: ["bookings:coach"],
941
+ read: ["bookings.class"],
942
+ // Today's classes and lists only (spec 31: "read today's classes and their lists"): a class
943
+ // starting today in its own zone, or running now (past midnight until it ends). Another
944
+ // day's corrections are the desk's.
945
+ today: {
946
+ "bookings.class": { at: "startsAt", until: "endsAt", zone: "timezone" },
947
+ "bookings.booking": { at: "class.startsAt", until: "class.endsAt", zone: "class.timezone" },
948
+ },
949
+ },
950
+ },
657
951
  tools: {
658
952
  timetable,
659
953
  classGet,
660
954
  book,
955
+ buy,
661
956
  cancel,
957
+ leaveWaitlist,
662
958
  mine,
663
959
  findPeople,
664
960
  bookFor,
@@ -666,5 +962,13 @@ export default defineExtension({
666
962
  returnUse,
667
963
  day,
668
964
  classList,
965
+ roster,
966
+ markAttended,
967
+ undoAttended,
968
+ markNoShow,
969
+ markAll,
970
+ move,
971
+ cancelClass,
972
+ family,
669
973
  },
670
974
  });