@composable-os/pack-bookings 0.1.0-beta.11 → 0.1.0-beta.14
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/automations.d.ts +146 -0
- package/dist/automations.js +612 -0
- package/dist/blocks/bookings-class-list/class-list.d.ts +9 -0
- package/dist/blocks/bookings-class-list/class-list.js +27 -2
- package/dist/blocks/bookings-desk/desk.d.ts +7 -0
- package/dist/blocks/bookings-desk/desk.js +13 -1
- package/dist/blocks/bookings-drop-in/drop-in.d.ts +7 -1
- package/dist/blocks/bookings-drop-in/drop-in.js +105 -22
- package/dist/blocks/bookings-native-class-list/class-list-screen.d.ts +12 -0
- package/dist/blocks/bookings-native-class-list/class-list-screen.js +59 -0
- package/dist/blocks/bookings-native-timetable/timetable-screen.d.ts +6 -1
- package/dist/blocks/bookings-native-timetable/timetable-screen.js +82 -22
- package/dist/blocks/bookings-timetable/timetable.d.ts +6 -1
- package/dist/blocks/bookings-timetable/timetable.js +88 -30
- package/dist/client/index.d.ts +84 -44
- package/dist/client/index.js +32 -5
- package/dist/dashboards.d.ts +5 -0
- package/dist/dashboards.js +157 -0
- package/dist/index.d.ts +1769 -102
- package/dist/index.js +801 -40
- package/dist/routine-mail.d.ts +577 -0
- package/dist/routine-mail.js +443 -0
- package/dist/tools.d.ts +261 -2
- package/dist/tools.js +836 -135
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
// Bookings (stage 31a
|
|
2
|
-
// attendance, moves and cancelling a class; ADRs 0504, 0520 and 0553): a gym's or studio's
|
|
3
|
-
// timetable and the
|
|
1
|
+
// Bookings (stage 31a; ADRs 0504, 0520 and 0553): a gym's or studio's timetable and the
|
|
4
2
|
// bookings members make on it. Staff set a weekly timetable once (series), the host makes each
|
|
5
3
|
// week's classes from it, and members book and cancel them on the web and in the app.
|
|
6
4
|
//
|
|
7
5
|
// Everything that is a rule is the host's, declared here as behaviours (ADR 0404):
|
|
8
6
|
// - a series makes its classes ahead in local time across clock changes (`recurring`, ADR 0500),
|
|
9
7
|
// never less far ahead than the longest booking window a class type sets (`horizonAtLeast`),
|
|
10
|
-
// never on a closure's dates, and never over
|
|
8
|
+
// never on a closure's dates, and never over what staff changed by hand on a class (a coach
|
|
9
|
+
// swapped stays swapped while the series' new room or time still reaches it, ADR 0620);
|
|
11
10
|
// - a class has places (`capacity`), and a booking holds one by its state (`claims`, ADR 0501),
|
|
12
11
|
// refused by the database past the places, for every actor;
|
|
13
12
|
// - one live booking per Person per class (`unique`, ADR 0502);
|
|
@@ -39,10 +38,34 @@
|
|
|
39
38
|
// whole when the new class is full or the use cannot be spent (ADRs 0493 and 0551);
|
|
40
39
|
// - staff cancel a class (a person's act, or a person approves an AI's request, ADR 0552), and
|
|
41
40
|
// 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
|
|
43
|
-
//
|
|
41
|
+
// - the coach role (`roles`, ADR 0436): the day's classes, their lists, and ticking names;
|
|
42
|
+
// - a class is its coach's shift (`staffed`, stage 45, ADR 0621): one staff account is never
|
|
43
|
+
// on two overlapping shifts, refused by the database for every writer, and a write of a
|
|
44
|
+
// class answers its warnings (the coach away or not qualified, a class with no coach).
|
|
45
|
+
// - a class takes its room while it is on, when the room takes one booking at a time
|
|
46
|
+
// (`occupies`, stage 49, ADR 0765): a second class in it at an overlapping time is refused by
|
|
47
|
+
// the database for every writer; a series' date that would clash is made with no room.
|
|
48
|
+
// - appointments (stage 49 step 5, ADR 0764): one-to-one sessions of a service with a coach,
|
|
49
|
+
// booked by staff for a client. An appointment is its coach's shift (`staffed`), so a coach is
|
|
50
|
+
// never on a class, a duty and an appointment at once, the service's buffer kept free around
|
|
51
|
+
// it (claim margins, ADR 0760), and it must have a coach with a staff account (ADR 0760). It
|
|
52
|
+
// takes a private room the service needs (`occupies`, ADR 0765): the first free one, chosen
|
|
53
|
+
// by the host when staff name none. Its client is kept off the roster and the feed (ADR 0761).
|
|
54
|
+
// Booked, it spends a use of a pass or membership that covers the service, unless staff mark
|
|
55
|
+
// it paid at the desk (`allowance`, `waived`, ADR 0506); a cancel before the service's "late
|
|
56
|
+
// from" gives it back; a late cancel and a no-show keep it, with no fee (decision 1), until a
|
|
57
|
+
// person excuses it. 30 minutes after it ends, the host marks one nobody marked as attended.
|
|
58
|
+
// The tools in tools.ts compose the host's operations and add no rules of their own. The messages
|
|
59
|
+
// in automations.ts (step 9, ADR 0572) email members and their guardians through the email-send
|
|
60
|
+
// gatekeeper on what the host did: booked, moved in, passed over, a place free after the cut-off,
|
|
61
|
+
// a class changed or cancelled by the gym, the reminder before a class (a date-relative trigger
|
|
62
|
+
// in minutes, ADR 0570) with an add-to-calendar file (ADR 0571), a drop-in's refund made; and
|
|
63
|
+
// tell staff of a class whose list was not taken. They write nothing.
|
|
44
64
|
import { defineExtension } from "@composable-os/sdk";
|
|
45
|
-
import {
|
|
65
|
+
import { bookingsAutomations } from "./automations.js";
|
|
66
|
+
import { bookingsDashboards } from "./dashboards.js";
|
|
67
|
+
import { bookingsRoutineMail } from "./routine-mail.js";
|
|
68
|
+
import { book, bookAppointment, bookFor, buy, cancel, cancelAppointment, cancelAppointmentByUs, cancelClass, cancelFor, classGet, classList, coachDay, day, excuseAppointment, family, findPeople, leaveWaitlist, markAll, markAppointment, markAttended, markNoShow, mine, move, moveAppointment, reassignAppointment, returnUse, roster, timetable, undoAttended, } from "./tools.js";
|
|
46
69
|
/** Weekday values a series' `weekdays` uses (ADR 0500). */
|
|
47
70
|
const WEEKDAYS = [
|
|
48
71
|
{ value: "mon", label: "Monday" },
|
|
@@ -53,7 +76,7 @@ const WEEKDAYS = [
|
|
|
53
76
|
{ value: "sat", label: "Saturday" },
|
|
54
77
|
{ value: "sun", label: "Sunday" },
|
|
55
78
|
];
|
|
56
|
-
/** A booking's states (spec 31, "Booking states").
|
|
79
|
+
/** A booking's states (spec 31, "Booking states"). */
|
|
57
80
|
const BOOKING_STATES = [
|
|
58
81
|
{ value: "booked", label: "Booked" },
|
|
59
82
|
{ value: "pending", label: "Held while paying" },
|
|
@@ -68,9 +91,9 @@ const BOOKING_STATES = [
|
|
|
68
91
|
{ value: "moved", label: "Moved" },
|
|
69
92
|
{ value: "expired", label: "Expired" },
|
|
70
93
|
];
|
|
71
|
-
/**
|
|
94
|
+
/** Cancelled with a class the gym cancels: each booking holding a place or a use, or waiting. */
|
|
72
95
|
const FOLLOW_CANCEL = ["booked", "waiting", "pending", "attended", "no_show", "late_cancelled"];
|
|
73
|
-
/** A booking that holds or
|
|
96
|
+
/** A booking that holds or waits for a place, and so counts as the Person's one for its class. */
|
|
74
97
|
const ACTIVE = ["pending", "booked", "waiting", "attended", "no_show"];
|
|
75
98
|
/** When a customer may book, and when a cancel is late, from the class type or the org. */
|
|
76
99
|
const opens = {
|
|
@@ -88,6 +111,55 @@ const lateFrom = {
|
|
|
88
111
|
};
|
|
89
112
|
/** A class's list opens for ticking an hour before it starts (guess: people arrive early). */
|
|
90
113
|
const listOpens = { at: "class.startsAt", minutesBefore: 60 };
|
|
114
|
+
/** An appointment's states (stage 49, "Appointment states"). */
|
|
115
|
+
const APPOINTMENT_STATES = [
|
|
116
|
+
{ value: "booked", label: "Booked" },
|
|
117
|
+
{ value: "pending", label: "Held while paying" },
|
|
118
|
+
{ value: "unpaid", label: "Not paid yet" },
|
|
119
|
+
{ value: "cancelled", label: "Cancelled" },
|
|
120
|
+
{ value: "late_cancelled", label: "Cancelled late" },
|
|
121
|
+
{ value: "excused", label: "Cancelled, session given back" },
|
|
122
|
+
{ value: "attended", label: "Attended" },
|
|
123
|
+
{ value: "no_show", label: "No-show" },
|
|
124
|
+
{ value: "cancelled_by_us", label: "Cancelled by the business" },
|
|
125
|
+
{ value: "moved", label: "Moved" },
|
|
126
|
+
{ value: "expired", label: "Expired" },
|
|
127
|
+
];
|
|
128
|
+
/**
|
|
129
|
+
* An appointment takes its coach's time and its room in these states: held while paying, not paid
|
|
130
|
+
* yet, booked, and after it (a coach who waited for a no-show was there, and pay counts it).
|
|
131
|
+
*/
|
|
132
|
+
const APPOINTMENT_LIVE = ["pending", "unpaid", "booked", "attended", "no_show"];
|
|
133
|
+
/** When a customer may book an appointment, and when a cancel is late, from the service or org. */
|
|
134
|
+
const appointmentOpens = {
|
|
135
|
+
at: "startsAt",
|
|
136
|
+
daysBefore: { field: "service.opensDays", setting: "appointmentOpensDays" },
|
|
137
|
+
zone: "timezone",
|
|
138
|
+
};
|
|
139
|
+
const appointmentCloses = {
|
|
140
|
+
at: "startsAt",
|
|
141
|
+
minutesBefore: { field: "service.closesMinutes", setting: "appointmentClosesMinutes" },
|
|
142
|
+
};
|
|
143
|
+
// Counted from the appointment's anchor (ADR 0764): its own start, or, once moved, the start of the
|
|
144
|
+
// one it replaced, so a move never makes a late cancel in time again.
|
|
145
|
+
const appointmentLateFrom = {
|
|
146
|
+
at: "lateAnchor",
|
|
147
|
+
minutesBefore: { field: "service.lateMinutes", setting: "appointmentLateMinutes" },
|
|
148
|
+
};
|
|
149
|
+
/** Attended and no-show may be corrected, one into the other, for 7 days after the end. */
|
|
150
|
+
const correctable = { at: "endsAt", minutesBefore: -10_080 };
|
|
151
|
+
/** What a customer reads of a class: on the public timetable, and of a class they booked. */
|
|
152
|
+
const CLASS_READ = [
|
|
153
|
+
"title",
|
|
154
|
+
"classType",
|
|
155
|
+
"startsAt",
|
|
156
|
+
"endsAt",
|
|
157
|
+
"timezone",
|
|
158
|
+
"room",
|
|
159
|
+
"coach",
|
|
160
|
+
"notes",
|
|
161
|
+
"state",
|
|
162
|
+
];
|
|
91
163
|
// A booking rule is a person's to change (spec 31: "Change the booking rules: a person only"):
|
|
92
164
|
// set by the assistant, an MCP client, an automation or extension code, it waits for a person's
|
|
93
165
|
// approval (`personApproves`, ADR 0507).
|
|
@@ -110,7 +182,7 @@ export default defineExtension({
|
|
|
110
182
|
// The class type is Programs' (spec 31): the host installs Bookings only beside Programs.
|
|
111
183
|
requires: ["programs"],
|
|
112
184
|
permissions: {
|
|
113
|
-
// person.get / person.
|
|
185
|
+
// person.get / person.createWith: a booking's person on a class list, and a walk-in staff book.
|
|
114
186
|
// programs.classtype: a class type's name and booking rules on staff's day view.
|
|
115
187
|
read: ["person", "programs.classtype"],
|
|
116
188
|
write: ["person"],
|
|
@@ -120,6 +192,18 @@ export default defineExtension({
|
|
|
120
192
|
// waitlist.position: where a waiter stands in the queue (a member: their own only).
|
|
121
193
|
// me.family: the member's own id, and the children staff linked to them (ADR 0540).
|
|
122
194
|
// order.startHeld: a drop-in, the booking made with its order by the host (ADR 0560).
|
|
195
|
+
// The messages (automations.ts): order.get (whether a drop-in was paid), extensionSettings.list
|
|
196
|
+
// (the waiting list's cut-off), notification.send (staff told of a class whose list was not
|
|
197
|
+
// taken); person.link.list, a child's live guardians on staff's screens. routine-mail, the
|
|
198
|
+
// members' email (routine-mail.ts, ADR 0590: the host decides who it goes to and what it
|
|
199
|
+
// says), sent from the email-send connection a person binds to each automation; storage,
|
|
200
|
+
// which class changes are still to be told (several edits within two minutes make one email).
|
|
201
|
+
// staffing.free: who is free for a service at a time, for "any coach" when staff book an
|
|
202
|
+
// appointment (stage 49, ADR 0763); staffing.week: a coach's duties beside their classes and
|
|
203
|
+
// appointments on the coach's day (ADR 0626), as the roster shows them to the reader.
|
|
204
|
+
// agreement.listHealthNotes: the "health note" mark beside a name on a class list (stage 44,
|
|
205
|
+
// decision 18), a yes or no per Person on the class's bookings (the host reads them) and
|
|
206
|
+
// nothing of the form; the host gives it only when a person called the tool themselves.
|
|
123
207
|
operations: [
|
|
124
208
|
"order.startHeld",
|
|
125
209
|
"public.list",
|
|
@@ -128,8 +212,15 @@ export default defineExtension({
|
|
|
128
212
|
"duplicate.check",
|
|
129
213
|
"waitlist.position",
|
|
130
214
|
"me.family",
|
|
215
|
+
"person.link.list",
|
|
216
|
+
"order.get",
|
|
217
|
+
"extensionSettings.list",
|
|
218
|
+
"notification.send",
|
|
219
|
+
"agreement.listHealthNotes",
|
|
220
|
+
"staffing.free",
|
|
221
|
+
"staffing.week",
|
|
131
222
|
],
|
|
132
|
-
modules: ["ops"],
|
|
223
|
+
modules: ["ops", "routine-mail", "email-send", "storage"],
|
|
133
224
|
},
|
|
134
225
|
// Bookings' fields on Programs' class type: how it shows, and its booking rules when they
|
|
135
226
|
// differ from the organisation's (Settings → Extensions → Bookings). Empty: the organisation's.
|
|
@@ -156,8 +247,12 @@ export default defineExtension({
|
|
|
156
247
|
"the organisation's setting."),
|
|
157
248
|
promotionMinutes: minutes("Waitlist stops (minutes before)", "Nobody is moved in from the waitlist after this: a place freed later goes to whoever " +
|
|
158
249
|
"books first. Empty: the organisation's setting."),
|
|
159
|
-
reminderMinutes:
|
|
160
|
-
"
|
|
250
|
+
reminderMinutes: {
|
|
251
|
+
...minutes("Reminder (minutes before)", "When members booked into a class are emailed a reminder, at most two days before. " +
|
|
252
|
+
"Empty: the organisation's setting."),
|
|
253
|
+
// At most two days: the reminder's minute scan reads the classes this far ahead (ADR 0570).
|
|
254
|
+
max: 2_880,
|
|
255
|
+
},
|
|
161
256
|
dropInPrice: {
|
|
162
257
|
type: "number",
|
|
163
258
|
label: "Drop-in price",
|
|
@@ -174,6 +269,28 @@ export default defineExtension({
|
|
|
174
269
|
description: "Members cannot book its classes themselves; staff book them in.",
|
|
175
270
|
personApproves: true,
|
|
176
271
|
},
|
|
272
|
+
// Preparation and pack-down (stage 45 decision 19, ADR 0627): minutes added to the coach's
|
|
273
|
+
// pay hours for each class of this type. Pay only: they never make two classes clash.
|
|
274
|
+
rosterBeforeMinutes: {
|
|
275
|
+
type: "number",
|
|
276
|
+
label: "Set-up minutes (pay)",
|
|
277
|
+
description: "Minutes before each class counted in its coach's pay hours (set-up). Empty: none. " +
|
|
278
|
+
"They never stop a coach taking the class before.",
|
|
279
|
+
min: 0,
|
|
280
|
+
max: 240,
|
|
281
|
+
step: 1,
|
|
282
|
+
personApproves: true,
|
|
283
|
+
},
|
|
284
|
+
rosterAfterMinutes: {
|
|
285
|
+
type: "number",
|
|
286
|
+
label: "Pack-down minutes (pay)",
|
|
287
|
+
description: "Minutes after each class counted in its coach's pay hours (pack-down). Empty: none. " +
|
|
288
|
+
"They never stop a coach taking the class after.",
|
|
289
|
+
min: 0,
|
|
290
|
+
max: 240,
|
|
291
|
+
step: 1,
|
|
292
|
+
personApproves: true,
|
|
293
|
+
},
|
|
177
294
|
},
|
|
178
295
|
},
|
|
179
296
|
objects: {
|
|
@@ -193,6 +310,15 @@ export default defineExtension({
|
|
|
193
310
|
min: 0,
|
|
194
311
|
step: 1,
|
|
195
312
|
},
|
|
313
|
+
// A private room (stage 49, ADR 0765): one class at a time in it, refused by the host for
|
|
314
|
+
// every writer. Off for a shared floor many classes use at once.
|
|
315
|
+
exclusive: {
|
|
316
|
+
type: "boolean",
|
|
317
|
+
label: "One booking at a time",
|
|
318
|
+
description: "Nothing else can be booked in this room while a class is in it. Turning it on is " +
|
|
319
|
+
"refused while two classes still to come overlap in it.",
|
|
320
|
+
default: false,
|
|
321
|
+
},
|
|
196
322
|
notes: { type: "longText", label: "Notes" },
|
|
197
323
|
},
|
|
198
324
|
public: { read: ["name"] },
|
|
@@ -215,6 +341,9 @@ export default defineExtension({
|
|
|
215
341
|
},
|
|
216
342
|
active: { type: "boolean", label: "Active", default: true },
|
|
217
343
|
},
|
|
344
|
+
// One coach profile per staff account (stage 45, ADR 0621): the host writes the right
|
|
345
|
+
// profile when a shift changes hands, and an account's classes are its profile's.
|
|
346
|
+
unique: [{ fields: ["user"] }],
|
|
218
347
|
public: { read: ["name", "photo", "bio"] },
|
|
219
348
|
},
|
|
220
349
|
series: {
|
|
@@ -251,7 +380,9 @@ export default defineExtension({
|
|
|
251
380
|
step: 1,
|
|
252
381
|
},
|
|
253
382
|
room: { type: "relation", label: "Room", to: "bookings.room" },
|
|
254
|
-
|
|
383
|
+
// Who coaches is a person's to change (stage 45 step 4, ADR 0626): the assistant, an MCP
|
|
384
|
+
// client or code may ask, and a person applies it. It changes someone's working week.
|
|
385
|
+
coach: { type: "relation", label: "Coach", to: "bookings.coach", personApproves: true },
|
|
255
386
|
places: { type: "number", label: "Places", required: true, min: 0, step: 1 },
|
|
256
387
|
firstDate: { type: "date", label: "First date", required: true },
|
|
257
388
|
lastDate: { type: "date", label: "Last date", description: "Empty: ongoing." },
|
|
@@ -332,7 +463,8 @@ export default defineExtension({
|
|
|
332
463
|
// Left empty, the organisation's zone (ADR 0460): a class always has one.
|
|
333
464
|
timezone: { type: "timezone", label: "Time zone", required: true },
|
|
334
465
|
room: { type: "relation", label: "Room", to: "bookings.room" },
|
|
335
|
-
|
|
466
|
+
// A person's to change (ADR 0626), as the series' coach: an AI's swap waits for a person.
|
|
467
|
+
coach: { type: "relation", label: "Coach", to: "bookings.coach", personApproves: true },
|
|
336
468
|
// Required: a class is never unlimited by leaving its places empty.
|
|
337
469
|
places: { type: "number", label: "Places", required: true, min: 0, step: 1 },
|
|
338
470
|
notes: { type: "longText", label: "Notes for members" },
|
|
@@ -350,7 +482,9 @@ export default defineExtension({
|
|
|
350
482
|
type: "boolean",
|
|
351
483
|
label: "Changed from its series",
|
|
352
484
|
readOnly: true,
|
|
353
|
-
description: "
|
|
485
|
+
description: "Moved, or its state changed, by hand: its series no longer changes it. A field " +
|
|
486
|
+
"changed by hand alone (another coach that day) stays this class's own, and later " +
|
|
487
|
+
"changes to its series still reach the rest.",
|
|
354
488
|
},
|
|
355
489
|
cancelledReason: {
|
|
356
490
|
type: "longText",
|
|
@@ -388,35 +522,47 @@ export default defineExtension({
|
|
|
388
522
|
},
|
|
389
523
|
// Members see how many places are left (decision 13), never who has them.
|
|
390
524
|
capacity: { places: "places", show: "exact" },
|
|
525
|
+
// A class is a shift its coach works (stage 45, ADR 0621): the host refuses one staff
|
|
526
|
+
// account on two overlapping shifts (two classes, a class and a duty), for every writer, and
|
|
527
|
+
// answers a write with its warnings (the coach away or not qualified, a class with no
|
|
528
|
+
// coach). A coach profile with no account (a visiting coach) covers the class for members
|
|
529
|
+
// and claims nobody's time. A class done still counts (pay reads it); a cancelled one not.
|
|
530
|
+
staffed: {
|
|
531
|
+
who: { field: "coach", account: "user" },
|
|
532
|
+
starts: "startsAt",
|
|
533
|
+
ends: "endsAt",
|
|
534
|
+
zone: "timezone",
|
|
535
|
+
kind: "classType",
|
|
536
|
+
live: ["scheduled", "done"],
|
|
537
|
+
place: "room.name",
|
|
538
|
+
pattern: { link: "series", who: "coach" },
|
|
539
|
+
// Pay only (ADR 0627): the class type's set-up and pack-down minutes, and the evidence a
|
|
540
|
+
// class was run: its bookings, ticked by whoever took the list.
|
|
541
|
+
payBefore: { field: "classType.rosterBeforeMinutes" },
|
|
542
|
+
payAfter: { field: "classType.rosterAfterMinutes" },
|
|
543
|
+
evidence: { object: "booking", link: "class", by: "markedBy" },
|
|
544
|
+
},
|
|
545
|
+
// A class takes its room while it is on, when the room takes one booking at a time (stage
|
|
546
|
+
// 49, ADR 0765): the host refuses a second class (or, later, an appointment) in it at an
|
|
547
|
+
// overlapping time, for every writer. A shared room is never claimed. The room calendar
|
|
548
|
+
// shows it by its title (stage 57, ADR 0844).
|
|
549
|
+
occupies: {
|
|
550
|
+
thing: "room",
|
|
551
|
+
starts: "startsAt",
|
|
552
|
+
ends: "endsAt",
|
|
553
|
+
live: ["scheduled", "done"],
|
|
554
|
+
only: "exclusive",
|
|
555
|
+
title: "title",
|
|
556
|
+
},
|
|
391
557
|
public: {
|
|
392
|
-
read:
|
|
393
|
-
"title",
|
|
394
|
-
"classType",
|
|
395
|
-
"startsAt",
|
|
396
|
-
"endsAt",
|
|
397
|
-
"timezone",
|
|
398
|
-
"room",
|
|
399
|
-
"coach",
|
|
400
|
-
"notes",
|
|
401
|
-
"state",
|
|
402
|
-
],
|
|
558
|
+
read: CLASS_READ,
|
|
403
559
|
when: { field: "state", in: ["scheduled"] },
|
|
404
560
|
},
|
|
405
561
|
// A booking's member reads their class whatever its state (a cancelled one says so).
|
|
406
562
|
customerVia: {
|
|
407
563
|
from: "bookings.booking",
|
|
408
564
|
field: "class",
|
|
409
|
-
read:
|
|
410
|
-
"title",
|
|
411
|
-
"classType",
|
|
412
|
-
"startsAt",
|
|
413
|
-
"endsAt",
|
|
414
|
-
"timezone",
|
|
415
|
-
"room",
|
|
416
|
-
"coach",
|
|
417
|
-
"notes",
|
|
418
|
-
"state",
|
|
419
|
-
],
|
|
565
|
+
read: CLASS_READ,
|
|
420
566
|
},
|
|
421
567
|
indexes: [
|
|
422
568
|
["startsAt"],
|
|
@@ -665,6 +811,21 @@ export default defineExtension({
|
|
|
665
811
|
},
|
|
666
812
|
],
|
|
667
813
|
},
|
|
814
|
+
// A class's bookings are the list its coach reads (stage 44, ADR 0643): the host may mark a
|
|
815
|
+
// health note beside each Person on it, asked for by the class's id only.
|
|
816
|
+
healthNotes: { list: "class", person: "person" },
|
|
817
|
+
// Before a booking (stage 44, ADRs 0641 and 0644): checked when a caller makes one booked
|
|
818
|
+
// or waiting, or a waiter takes a free place, for the booking's Person; a drop-in at its
|
|
819
|
+
// order. The host's own moves (promotion, a paid drop-in) are not.
|
|
820
|
+
agreements: {
|
|
821
|
+
point: "booking",
|
|
822
|
+
label: "Before a booking",
|
|
823
|
+
suggests: ["waiver", "health", "guardian"],
|
|
824
|
+
enter: ["booked", "waiting"],
|
|
825
|
+
person: "person",
|
|
826
|
+
// The timetable and drop-in blocks show what is due and let a person agree (step 5).
|
|
827
|
+
inlineStep: true,
|
|
828
|
+
},
|
|
668
829
|
// A place on the class while held, booked, attended or a no-show (ADR 0501).
|
|
669
830
|
// Its waitlist (ADR 0520): a place given back before the class type's "waitlist stops"
|
|
670
831
|
// time (else the organisation's) goes to the first waiter, whom the host moves in.
|
|
@@ -713,6 +874,12 @@ export default defineExtension({
|
|
|
713
874
|
// How much of a class unpaid guest holds may take at once.
|
|
714
875
|
holdCap: { setting: "dropInHoldPercent" },
|
|
715
876
|
},
|
|
877
|
+
// In the finance reports (ADR 0792): earned when the class starts.
|
|
878
|
+
finance: {
|
|
879
|
+
category: { key: "drop_ins", label: "Drop-ins" },
|
|
880
|
+
earned: "at_date",
|
|
881
|
+
at: "class.startsAt",
|
|
882
|
+
},
|
|
716
883
|
},
|
|
717
884
|
// A spender of the Memberships pack's holders (stage 32b's ids, spec 32): booked spends,
|
|
718
885
|
// an in-time cancel, a class the gym cancels and a move give back; a late cancel and a
|
|
@@ -730,6 +897,10 @@ export default defineExtension({
|
|
|
730
897
|
movedFrom: { field: "movedFrom", state: "moved" },
|
|
731
898
|
paidBy: ["memberships.membership", "memberships.pass"],
|
|
732
899
|
waived: "paidOtherwise",
|
|
900
|
+
// A membership ended by its payer's cooling off (stage 44 step 7, ADR 0647): its
|
|
901
|
+
// bookings for classes not yet started are cancelled as the gym's, their places freed
|
|
902
|
+
// for the waiting list and their uses given back.
|
|
903
|
+
released: "cancelled_by_us",
|
|
733
904
|
},
|
|
734
905
|
},
|
|
735
906
|
// A member reads and changes only their own bookings, and a parent or guardian staff linked
|
|
@@ -760,6 +931,407 @@ export default defineExtension({
|
|
|
760
931
|
timelineLinks: ["person"],
|
|
761
932
|
indexes: [["class", "state"], ["person", "state"], ["state"]],
|
|
762
933
|
},
|
|
934
|
+
service: {
|
|
935
|
+
label: "Service",
|
|
936
|
+
plural: "Services",
|
|
937
|
+
icon: "user-check",
|
|
938
|
+
titleField: "title",
|
|
939
|
+
description: "A kind of one-to-one session the business offers (personal training, 60 minutes): its " +
|
|
940
|
+
"length, buffers, the rooms it may use and its booking rules. Who gives it is a " +
|
|
941
|
+
"qualification, not a list here.",
|
|
942
|
+
navigation: "settings",
|
|
943
|
+
fields: {
|
|
944
|
+
title: { type: "text", label: "Title", required: true },
|
|
945
|
+
description: { type: "longText", label: "Description" },
|
|
946
|
+
length: {
|
|
947
|
+
type: "number",
|
|
948
|
+
label: "Length (minutes)",
|
|
949
|
+
required: true,
|
|
950
|
+
min: 5,
|
|
951
|
+
max: 480,
|
|
952
|
+
step: 5,
|
|
953
|
+
},
|
|
954
|
+
// The buffer (stage 49, ADR 0760): minutes kept free in the coach's time and the room,
|
|
955
|
+
// never part of the appointment's own times or its pay.
|
|
956
|
+
bufferBefore: {
|
|
957
|
+
type: "number",
|
|
958
|
+
label: "Buffer before (minutes)",
|
|
959
|
+
description: "Minutes kept free before each session, for the coach and the room.",
|
|
960
|
+
min: 0,
|
|
961
|
+
max: 240,
|
|
962
|
+
step: 5,
|
|
963
|
+
},
|
|
964
|
+
bufferAfter: {
|
|
965
|
+
type: "number",
|
|
966
|
+
label: "Buffer after (minutes)",
|
|
967
|
+
description: "Minutes kept free after each session, for the coach and the room.",
|
|
968
|
+
min: 0,
|
|
969
|
+
max: 240,
|
|
970
|
+
step: 5,
|
|
971
|
+
},
|
|
972
|
+
price: {
|
|
973
|
+
type: "currency",
|
|
974
|
+
label: "Price per session",
|
|
975
|
+
description: "What one session costs when paid for on its own. Empty: not sold per session.",
|
|
976
|
+
personApproves: true,
|
|
977
|
+
},
|
|
978
|
+
rooms: {
|
|
979
|
+
type: "relation",
|
|
980
|
+
label: "Rooms it may use",
|
|
981
|
+
to: "bookings.room",
|
|
982
|
+
many: true,
|
|
983
|
+
description: "In the order they are offered: an appointment takes the first one free. Empty: it " +
|
|
984
|
+
"needs no room.",
|
|
985
|
+
},
|
|
986
|
+
step: {
|
|
987
|
+
type: "number",
|
|
988
|
+
label: "Start times every (minutes)",
|
|
989
|
+
description: "15, 30 or 60: start times on the hour and every this many minutes. Empty: 30.",
|
|
990
|
+
min: 15,
|
|
991
|
+
max: 60,
|
|
992
|
+
step: 15,
|
|
993
|
+
},
|
|
994
|
+
opensDays: {
|
|
995
|
+
type: "number",
|
|
996
|
+
label: "Booking opens (days before)",
|
|
997
|
+
description: "Clients may book this many days ahead. Empty: the organisation's setting.",
|
|
998
|
+
min: 0,
|
|
999
|
+
max: 365,
|
|
1000
|
+
step: 1,
|
|
1001
|
+
personApproves: true,
|
|
1002
|
+
},
|
|
1003
|
+
closesMinutes: minutes("Booking closes (minutes before)", "Clients may book until this many minutes before a session. Empty: the organisation's " +
|
|
1004
|
+
"setting."),
|
|
1005
|
+
lateMinutes: minutes("Late cancel from (minutes before)", "A cancel this close to the start or closer is late and keeps the session it used. " +
|
|
1006
|
+
"Empty: the organisation's setting."),
|
|
1007
|
+
whoBooks: {
|
|
1008
|
+
type: "select",
|
|
1009
|
+
label: "Who books it",
|
|
1010
|
+
default: "members_visitors",
|
|
1011
|
+
options: [
|
|
1012
|
+
{ value: "members_visitors", label: "Members and visitors" },
|
|
1013
|
+
{ value: "members", label: "Members only" },
|
|
1014
|
+
{ value: "staff", label: "Staff only" },
|
|
1015
|
+
],
|
|
1016
|
+
personApproves: true,
|
|
1017
|
+
},
|
|
1018
|
+
active: { type: "boolean", label: "Offered", default: true },
|
|
1019
|
+
// Booked by staff only: a customer cannot book it themselves (the create rule).
|
|
1020
|
+
staffOnly: {
|
|
1021
|
+
type: "formula",
|
|
1022
|
+
label: "Booked by staff only",
|
|
1023
|
+
expression: 'coalesce(whoBooks, "members_visitors") = "staff"',
|
|
1024
|
+
},
|
|
1025
|
+
// A service no longer offered: nobody books it, staff included (the create rule).
|
|
1026
|
+
closed: {
|
|
1027
|
+
type: "formula",
|
|
1028
|
+
label: "Not offered",
|
|
1029
|
+
expression: "not coalesce(active, true)",
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
indexes: [["active"]],
|
|
1033
|
+
},
|
|
1034
|
+
appointment: {
|
|
1035
|
+
label: "Appointment",
|
|
1036
|
+
plural: "Appointments",
|
|
1037
|
+
icon: "calendar-heart",
|
|
1038
|
+
titleField: "title",
|
|
1039
|
+
titleDefault: { from: ["service", "person"] },
|
|
1040
|
+
description: "One booked one-to-one session: a client, a coach, a service, a start and an end, and " +
|
|
1041
|
+
"the room it takes.",
|
|
1042
|
+
navigation: "main",
|
|
1043
|
+
navigationOrder: 33,
|
|
1044
|
+
fields: {
|
|
1045
|
+
title: { type: "text", label: "Title" },
|
|
1046
|
+
service: { type: "relation", label: "Service", to: "bookings.service", required: true },
|
|
1047
|
+
// Required when it is made (states.create.requires); not `required`, so erasing the client
|
|
1048
|
+
// keeps the appointment for pay and the business's books with the client cleared.
|
|
1049
|
+
person: { type: "relation", label: "Client", to: "person" },
|
|
1050
|
+
// Who gives it: a coach profile holding a staff account (account required, ADR 0760).
|
|
1051
|
+
// Empty only once a coach has left (uncovered): a manager gives it to another coach
|
|
1052
|
+
// (reassignAppointment, which an AI may only ask a person to do).
|
|
1053
|
+
coach: { type: "relation", label: "Coach", to: "bookings.coach" },
|
|
1054
|
+
room: {
|
|
1055
|
+
type: "relation",
|
|
1056
|
+
label: "Room",
|
|
1057
|
+
to: "bookings.room",
|
|
1058
|
+
description: "Left empty, the host gives it the first of the service's rooms free then.",
|
|
1059
|
+
},
|
|
1060
|
+
// Its times and service change only by a move (a new appointment, ADR 0764).
|
|
1061
|
+
startsAt: { type: "datetime", label: "Starts", required: true },
|
|
1062
|
+
endsAt: { type: "datetime", label: "Ends", required: true },
|
|
1063
|
+
timezone: { type: "timezone", label: "Time zone", required: true },
|
|
1064
|
+
lateAnchor: {
|
|
1065
|
+
type: "datetime",
|
|
1066
|
+
label: "Late cancel counted from",
|
|
1067
|
+
readOnly: true,
|
|
1068
|
+
description: "Set by the host: its start, or, when it was moved, the start of the appointment it " +
|
|
1069
|
+
"replaced. The late-cancel point is counted back from it.",
|
|
1070
|
+
},
|
|
1071
|
+
state: {
|
|
1072
|
+
type: "select",
|
|
1073
|
+
label: "State",
|
|
1074
|
+
track: "timeline",
|
|
1075
|
+
options: APPOINTMENT_STATES,
|
|
1076
|
+
},
|
|
1077
|
+
holder: {
|
|
1078
|
+
type: "text",
|
|
1079
|
+
label: "Paid from",
|
|
1080
|
+
description: "The pass or membership the appointment spent a session of (its id). Left empty, the " +
|
|
1081
|
+
"host chooses the one whose session would lapse first.",
|
|
1082
|
+
},
|
|
1083
|
+
// What a pass's or a membership's services and limits read, filled by the host.
|
|
1084
|
+
serviceId: {
|
|
1085
|
+
type: "text",
|
|
1086
|
+
label: "Service (for passes)",
|
|
1087
|
+
readOnly: true,
|
|
1088
|
+
description: "The service, copied by the host: what a pass's services are compared with.",
|
|
1089
|
+
},
|
|
1090
|
+
weekday: {
|
|
1091
|
+
type: "number",
|
|
1092
|
+
label: "Weekday",
|
|
1093
|
+
readOnly: true,
|
|
1094
|
+
description: "The local weekday (1 Monday to 7 Sunday), set by the host.",
|
|
1095
|
+
},
|
|
1096
|
+
minute: {
|
|
1097
|
+
type: "number",
|
|
1098
|
+
label: "Local minute",
|
|
1099
|
+
readOnly: true,
|
|
1100
|
+
description: "The local start, in minutes after midnight, set by the host.",
|
|
1101
|
+
},
|
|
1102
|
+
paidOtherwise: {
|
|
1103
|
+
type: "boolean",
|
|
1104
|
+
label: "Paid at the desk",
|
|
1105
|
+
readOnly: true,
|
|
1106
|
+
description: "Paid at the desk or another way: it spends no session. Set when it is made.",
|
|
1107
|
+
},
|
|
1108
|
+
bookedBy: {
|
|
1109
|
+
type: "user",
|
|
1110
|
+
label: "Booked by",
|
|
1111
|
+
readOnly: true,
|
|
1112
|
+
description: "The staff account that booked it.",
|
|
1113
|
+
},
|
|
1114
|
+
movedFrom: {
|
|
1115
|
+
type: "relation",
|
|
1116
|
+
label: "Moved from",
|
|
1117
|
+
to: "bookings.appointment",
|
|
1118
|
+
readOnly: true,
|
|
1119
|
+
description: "The appointment this one replaced when it was moved to another time.",
|
|
1120
|
+
},
|
|
1121
|
+
note: { type: "longText", label: "Staff note" },
|
|
1122
|
+
markedAt: {
|
|
1123
|
+
type: "datetime",
|
|
1124
|
+
label: "Attendance marked",
|
|
1125
|
+
readOnly: true,
|
|
1126
|
+
description: "When it was marked attended or not come.",
|
|
1127
|
+
},
|
|
1128
|
+
markedBy: {
|
|
1129
|
+
type: "user",
|
|
1130
|
+
label: "Marked by",
|
|
1131
|
+
readOnly: true,
|
|
1132
|
+
description: "The staff account that marked it. Empty when the host marked it attended.",
|
|
1133
|
+
},
|
|
1134
|
+
markedByName: {
|
|
1135
|
+
type: "text",
|
|
1136
|
+
label: "Marked by (name)",
|
|
1137
|
+
readOnly: true,
|
|
1138
|
+
description: "That staff member's name as it was then.",
|
|
1139
|
+
},
|
|
1140
|
+
cancelledReason: {
|
|
1141
|
+
type: "longText",
|
|
1142
|
+
label: "Why it was cancelled or given back",
|
|
1143
|
+
readOnly: true,
|
|
1144
|
+
},
|
|
1145
|
+
},
|
|
1146
|
+
states: {
|
|
1147
|
+
field: "state",
|
|
1148
|
+
initial: "booked",
|
|
1149
|
+
create: {
|
|
1150
|
+
// Held while paying (stage 49 step 8) and not paid yet (a standing series' date, step 9)
|
|
1151
|
+
// are the host's alone.
|
|
1152
|
+
in: { pending: ["host"], unpaid: ["host"] },
|
|
1153
|
+
window: { from: appointmentOpens, until: appointmentCloses },
|
|
1154
|
+
staffOnly: "service.staffOnly",
|
|
1155
|
+
// A service no longer offered: nobody books it, staff included.
|
|
1156
|
+
closed: "service.closed",
|
|
1157
|
+
// Made for a client, by everyone, the host included.
|
|
1158
|
+
requires: ["person"],
|
|
1159
|
+
},
|
|
1160
|
+
// A cancel is in time or late by the host's clock, for every caller (ADR 0503).
|
|
1161
|
+
requests: { cancel: ["cancelled", "late_cancelled"] },
|
|
1162
|
+
moves: [
|
|
1163
|
+
{ from: "pending", to: "booked", by: ["host"] },
|
|
1164
|
+
{ from: "pending", to: "expired", by: ["host"], final: true },
|
|
1165
|
+
// Not paid yet: staff book it (a session spent, or paid at the desk).
|
|
1166
|
+
{ from: "unpaid", to: "booked", by: ["staff"] },
|
|
1167
|
+
// In time, for everyone, staff included (ADR 0507): giving a session back later is a
|
|
1168
|
+
// person's own act (excuseAppointment), never a cancel's.
|
|
1169
|
+
{
|
|
1170
|
+
from: "booked",
|
|
1171
|
+
to: "cancelled",
|
|
1172
|
+
by: ["staff", "customer"],
|
|
1173
|
+
final: true,
|
|
1174
|
+
window: { until: appointmentLateFrom },
|
|
1175
|
+
bindsStaff: true,
|
|
1176
|
+
},
|
|
1177
|
+
// Late: the session is used, with no fee (decision 1). Not final: a person may excuse it.
|
|
1178
|
+
{
|
|
1179
|
+
from: "booked",
|
|
1180
|
+
to: "late_cancelled",
|
|
1181
|
+
by: ["staff", "customer"],
|
|
1182
|
+
window: { from: appointmentLateFrom, until: "startsAt" },
|
|
1183
|
+
},
|
|
1184
|
+
// A move to another time or coach: made only by making the new appointment
|
|
1185
|
+
// (`movedFrom`), in its batch (ADR 0551), before it starts; the session moves with it.
|
|
1186
|
+
{
|
|
1187
|
+
from: "booked",
|
|
1188
|
+
to: "moved",
|
|
1189
|
+
by: ["staff"],
|
|
1190
|
+
final: true,
|
|
1191
|
+
window: { until: "startsAt" },
|
|
1192
|
+
bindsStaff: true,
|
|
1193
|
+
},
|
|
1194
|
+
// Marked once it has started, by the coach or staff; attended by the host 30 minutes
|
|
1195
|
+
// after the end when nobody marked it (`after`). Each keeps the session.
|
|
1196
|
+
{
|
|
1197
|
+
from: "booked",
|
|
1198
|
+
to: "attended",
|
|
1199
|
+
by: ["staff", "host"],
|
|
1200
|
+
window: { from: "startsAt" },
|
|
1201
|
+
bindsStaff: true,
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
from: "booked",
|
|
1205
|
+
to: "no_show",
|
|
1206
|
+
by: ["staff", "host"],
|
|
1207
|
+
window: { from: "startsAt" },
|
|
1208
|
+
bindsStaff: true,
|
|
1209
|
+
},
|
|
1210
|
+
// A correction, one into the other, within 7 days of the end.
|
|
1211
|
+
{
|
|
1212
|
+
from: "attended",
|
|
1213
|
+
to: "no_show",
|
|
1214
|
+
by: ["staff"],
|
|
1215
|
+
window: { until: correctable },
|
|
1216
|
+
bindsStaff: true,
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
from: "no_show",
|
|
1220
|
+
to: "attended",
|
|
1221
|
+
by: ["staff"],
|
|
1222
|
+
window: { until: correctable },
|
|
1223
|
+
bindsStaff: true,
|
|
1224
|
+
},
|
|
1225
|
+
// A person on the staff gives the session back (decision 1), with a reason, through
|
|
1226
|
+
// excuseAppointment alone (ADR 0513).
|
|
1227
|
+
{
|
|
1228
|
+
from: ["late_cancelled", "no_show"],
|
|
1229
|
+
to: "excused",
|
|
1230
|
+
by: ["host"],
|
|
1231
|
+
tools: ["excuseAppointment"],
|
|
1232
|
+
final: true,
|
|
1233
|
+
},
|
|
1234
|
+
// The business cancels it, the session given back: the host (a membership cooled off;
|
|
1235
|
+
// later a closure or a provider leaving), and a person through cancelAppointmentByUs.
|
|
1236
|
+
{
|
|
1237
|
+
from: ["pending", "unpaid", "booked"],
|
|
1238
|
+
to: "cancelled_by_us",
|
|
1239
|
+
by: ["host"],
|
|
1240
|
+
tools: ["cancelAppointmentByUs"],
|
|
1241
|
+
final: true,
|
|
1242
|
+
},
|
|
1243
|
+
],
|
|
1244
|
+
// Nobody marked it: attended, 30 minutes after it ends (the spec's decision 9). The
|
|
1245
|
+
// session is kept either way, so this changes only reporting. Never one whose coach left
|
|
1246
|
+
// (no coach): nobody gave it.
|
|
1247
|
+
after: [
|
|
1248
|
+
{ from: "booked", to: "attended", at: "endsAt", minutesAfter: 30, ifSet: ["coach"] },
|
|
1249
|
+
],
|
|
1250
|
+
},
|
|
1251
|
+
// The coach's shift (stage 45, ADR 0621): one staff account is never on a class, a duty and
|
|
1252
|
+
// an appointment at once, the service's buffer included (ADR 0760), refused by the database
|
|
1253
|
+
// for every writer. A coach profile with no account cannot be booked (`account`). Its title
|
|
1254
|
+
// names the client, so the roster and the feed show it as its service (ADR 0761). Booked at
|
|
1255
|
+
// free times (ADRs 0762, 0763): the coach's open hours, the service's length, step and
|
|
1256
|
+
// rooms, the client's own appointments, the closures; staff are warned outside them.
|
|
1257
|
+
staffed: {
|
|
1258
|
+
who: { field: "coach", account: "user" },
|
|
1259
|
+
starts: "startsAt",
|
|
1260
|
+
ends: "endsAt",
|
|
1261
|
+
zone: "timezone",
|
|
1262
|
+
kind: "service",
|
|
1263
|
+
live: APPOINTMENT_LIVE,
|
|
1264
|
+
place: "room.name",
|
|
1265
|
+
claimBefore: { field: "service.bufferBefore" },
|
|
1266
|
+
claimAfter: { field: "service.bufferAfter" },
|
|
1267
|
+
account: "required",
|
|
1268
|
+
private: true,
|
|
1269
|
+
open: {
|
|
1270
|
+
length: { field: "service.length" },
|
|
1271
|
+
step: { field: "service.step" },
|
|
1272
|
+
rooms: { field: "service.rooms" },
|
|
1273
|
+
client: "person",
|
|
1274
|
+
closedBy: { object: "closure", from: "fromDate", until: "untilDate" },
|
|
1275
|
+
customer: true,
|
|
1276
|
+
},
|
|
1277
|
+
},
|
|
1278
|
+
// Its room while it is on, when the room takes one booking at a time (ADR 0765), the
|
|
1279
|
+
// service's buffer kept free in it too. The room calendar shows the service, not the client.
|
|
1280
|
+
occupies: {
|
|
1281
|
+
thing: "room",
|
|
1282
|
+
starts: "startsAt",
|
|
1283
|
+
ends: "endsAt",
|
|
1284
|
+
live: APPOINTMENT_LIVE,
|
|
1285
|
+
before: { field: "service.bufferBefore" },
|
|
1286
|
+
after: { field: "service.bufferAfter" },
|
|
1287
|
+
only: "exclusive",
|
|
1288
|
+
},
|
|
1289
|
+
// A spender of the Memberships pack's holders, as a class booking is: booked spends one
|
|
1290
|
+
// session of a pass or membership that covers the service; an in-time cancel, a move, an
|
|
1291
|
+
// excuse and the business's cancel give it back; a late cancel and a no-show keep it, with
|
|
1292
|
+
// no fee (decision 1). Staff may book it paid at the desk (`waived`, ADR 0506).
|
|
1293
|
+
allowance: {
|
|
1294
|
+
spends: {
|
|
1295
|
+
person: "person",
|
|
1296
|
+
holder: "holder",
|
|
1297
|
+
spendIn: ["booked"],
|
|
1298
|
+
returnIn: ["cancelled", "excused", "cancelled_by_us", "moved"],
|
|
1299
|
+
at: "startsAt",
|
|
1300
|
+
copy: { serviceId: "service.id" },
|
|
1301
|
+
local: { weekday: "weekday", minute: "minute", zone: "timezone" },
|
|
1302
|
+
// Its times and service change only by a move, and a moved one keeps the late point of
|
|
1303
|
+
// the one it replaced (ADR 0764): a used session never comes back by a change of time.
|
|
1304
|
+
movedFrom: {
|
|
1305
|
+
field: "movedFrom",
|
|
1306
|
+
state: "moved",
|
|
1307
|
+
fixed: ["startsAt", "endsAt", "service"],
|
|
1308
|
+
anchor: { field: "lateAnchor", from: "startsAt" },
|
|
1309
|
+
},
|
|
1310
|
+
paidBy: ["memberships.membership", "memberships.pass"],
|
|
1311
|
+
waived: "paidOtherwise",
|
|
1312
|
+
released: "cancelled_by_us",
|
|
1313
|
+
},
|
|
1314
|
+
},
|
|
1315
|
+
// Before an appointment (stage 44, ADRs 0641 and 0644): what the business attaches here is
|
|
1316
|
+
// due before the client's appointment is booked.
|
|
1317
|
+
agreements: {
|
|
1318
|
+
point: "appointment",
|
|
1319
|
+
label: "Before an appointment",
|
|
1320
|
+
suggests: ["waiver", "health", "guardian"],
|
|
1321
|
+
enter: ["booked"],
|
|
1322
|
+
person: "person",
|
|
1323
|
+
inlineStep: true,
|
|
1324
|
+
},
|
|
1325
|
+
timelineLinks: ["person"],
|
|
1326
|
+
indexes: [
|
|
1327
|
+
["startsAt"],
|
|
1328
|
+
["coach", "startsAt"],
|
|
1329
|
+
["person", "startsAt"],
|
|
1330
|
+
["state", "startsAt"],
|
|
1331
|
+
["service"],
|
|
1332
|
+
["endsAt"],
|
|
1333
|
+
],
|
|
1334
|
+
},
|
|
763
1335
|
},
|
|
764
1336
|
views: {
|
|
765
1337
|
todaysClasses: {
|
|
@@ -807,6 +1379,31 @@ export default defineExtension({
|
|
|
807
1379
|
sort: { field: "updatedAt", direction: "desc" },
|
|
808
1380
|
columns: ["title", "class", "person", "updatedAt"],
|
|
809
1381
|
},
|
|
1382
|
+
// Step 9's saved views: this month's, by when the booking last changed (became one).
|
|
1383
|
+
noShowsThisMonth: {
|
|
1384
|
+
label: "No-shows this month",
|
|
1385
|
+
object: "bookings.booking",
|
|
1386
|
+
filter: {
|
|
1387
|
+
and: [
|
|
1388
|
+
{ field: "state", op: "eq", value: "no_show" },
|
|
1389
|
+
{ field: "updatedAt", op: "gte", value: { $relative: "startOfMonth" } },
|
|
1390
|
+
],
|
|
1391
|
+
},
|
|
1392
|
+
sort: { field: "updatedAt", direction: "desc" },
|
|
1393
|
+
columns: ["title", "class", "person", "markedByName", "updatedAt"],
|
|
1394
|
+
},
|
|
1395
|
+
lateCancelsThisMonth: {
|
|
1396
|
+
label: "Late cancels this month",
|
|
1397
|
+
object: "bookings.booking",
|
|
1398
|
+
filter: {
|
|
1399
|
+
and: [
|
|
1400
|
+
{ field: "state", op: "eq", value: "late_cancelled" },
|
|
1401
|
+
{ field: "updatedAt", op: "gte", value: { $relative: "startOfMonth" } },
|
|
1402
|
+
],
|
|
1403
|
+
},
|
|
1404
|
+
sort: { field: "updatedAt", direction: "desc" },
|
|
1405
|
+
columns: ["title", "class", "person", "updatedAt"],
|
|
1406
|
+
},
|
|
810
1407
|
},
|
|
811
1408
|
recordTabs: {
|
|
812
1409
|
// A class's list: who is booked, on its record page.
|
|
@@ -858,6 +1455,51 @@ export default defineExtension({
|
|
|
858
1455
|
},
|
|
859
1456
|
order: 35,
|
|
860
1457
|
},
|
|
1458
|
+
// A client's appointments (stage 49), soonest last.
|
|
1459
|
+
personAppointments: {
|
|
1460
|
+
label: "Appointments",
|
|
1461
|
+
on: "person",
|
|
1462
|
+
view: {
|
|
1463
|
+
type: "table",
|
|
1464
|
+
object: "bookings.appointment",
|
|
1465
|
+
relation: "person",
|
|
1466
|
+
columns: ["service", "startsAt", "coach", "room", "state", "holder", "paidOtherwise"],
|
|
1467
|
+
sort: { field: "startsAt", direction: "desc" },
|
|
1468
|
+
},
|
|
1469
|
+
order: 36,
|
|
1470
|
+
},
|
|
1471
|
+
serviceAppointments: {
|
|
1472
|
+
label: "Appointments",
|
|
1473
|
+
on: "bookings.service",
|
|
1474
|
+
view: {
|
|
1475
|
+
type: "table",
|
|
1476
|
+
object: "bookings.appointment",
|
|
1477
|
+
relation: "service",
|
|
1478
|
+
columns: ["startsAt", "person", "coach", "room", "state"],
|
|
1479
|
+
sort: { field: "startsAt", direction: "desc" },
|
|
1480
|
+
},
|
|
1481
|
+
order: 10,
|
|
1482
|
+
},
|
|
1483
|
+
},
|
|
1484
|
+
// The members' email (ADR 0590): routine mail the host sends without a person's approval.
|
|
1485
|
+
routineMail: bookingsRoutineMail,
|
|
1486
|
+
// What a journey can start or stop on (stage 53, ADR 0802): the host records the last time each
|
|
1487
|
+
// person had each, in the write's batch. "Not seen for two weeks" is no `attended` for 14 days.
|
|
1488
|
+
// A tick taken back (attended to booked) is not a new booking.
|
|
1489
|
+
journeySignals: {
|
|
1490
|
+
booked: {
|
|
1491
|
+
label: "Class booked",
|
|
1492
|
+
description: "A place in a class is booked: made, taken from the waitlist, or paid for.",
|
|
1493
|
+
object: "booking",
|
|
1494
|
+
enters: ["booked"],
|
|
1495
|
+
from: ["pending", "waiting"],
|
|
1496
|
+
},
|
|
1497
|
+
attended: {
|
|
1498
|
+
label: "Class attended",
|
|
1499
|
+
description: "A coach ticks the person's name on a class's list.",
|
|
1500
|
+
object: "booking",
|
|
1501
|
+
enters: ["attended"],
|
|
1502
|
+
},
|
|
861
1503
|
},
|
|
862
1504
|
// The organisation's booking rules, which a class type's own values override. Changed by a
|
|
863
1505
|
// person with the extensions permission (Settings → Extensions → Bookings).
|
|
@@ -922,12 +1564,71 @@ export default defineExtension({
|
|
|
922
1564
|
reminderMinutes: {
|
|
923
1565
|
type: "number",
|
|
924
1566
|
label: "Reminder (minutes before)",
|
|
925
|
-
description: "When members
|
|
1567
|
+
description: "When members booked into a class are emailed a reminder, unless its class type sets " +
|
|
1568
|
+
"its own: at most two days (2,880 minutes) before.",
|
|
926
1569
|
default: 180,
|
|
927
1570
|
min: 0,
|
|
1571
|
+
max: 2_880,
|
|
1572
|
+
personApproves: true,
|
|
1573
|
+
},
|
|
1574
|
+
// Appointments' booking rules (stage 49), which a service's own values override.
|
|
1575
|
+
appointmentOpensDays: {
|
|
1576
|
+
type: "number",
|
|
1577
|
+
label: "Appointments: booking opens (days before)",
|
|
1578
|
+
description: "Clients may book a one-to-one session this many days ahead.",
|
|
1579
|
+
default: 28,
|
|
1580
|
+
min: 0,
|
|
1581
|
+
max: 365,
|
|
1582
|
+
personApproves: true,
|
|
1583
|
+
},
|
|
1584
|
+
appointmentClosesMinutes: {
|
|
1585
|
+
type: "number",
|
|
1586
|
+
label: "Appointments: booking closes (minutes before)",
|
|
1587
|
+
description: "Clients may book a session until this many minutes before it (720: 12 hours).",
|
|
1588
|
+
default: 720,
|
|
1589
|
+
min: 0,
|
|
1590
|
+
max: 10_080,
|
|
1591
|
+
personApproves: true,
|
|
1592
|
+
},
|
|
1593
|
+
appointmentLateMinutes: {
|
|
1594
|
+
type: "number",
|
|
1595
|
+
label: "Appointments: late cancel from (minutes before)",
|
|
1596
|
+
description: "A cancel this close to a session's start is late: the session is used, with no fee " +
|
|
1597
|
+
"(1,440: 24 hours). Staff can give it back.",
|
|
1598
|
+
default: 1_440,
|
|
1599
|
+
min: 0,
|
|
928
1600
|
max: 10_080,
|
|
929
1601
|
personApproves: true,
|
|
930
1602
|
},
|
|
1603
|
+
bookingsUrl: {
|
|
1604
|
+
type: "text",
|
|
1605
|
+
label: "Where members see their bookings",
|
|
1606
|
+
description: "The page on your site where a signed-in member sees their bookings (https), linked from " +
|
|
1607
|
+
"every booking email, when it is on your site (Settings → Routine email). Empty: the emails " +
|
|
1608
|
+
"say to sign in.",
|
|
1609
|
+
// The link every member email carries: a person's to change, as the booking rules are.
|
|
1610
|
+
personApproves: true,
|
|
1611
|
+
},
|
|
1612
|
+
// Feedback after a class (stage 29 step 5, decision 4; ADR 0723): which Forms form members
|
|
1613
|
+
// are asked to answer, and when. Who is asked and what they are sent is a person's choice.
|
|
1614
|
+
feedbackForm: {
|
|
1615
|
+
type: "text",
|
|
1616
|
+
label: "Feedback form (its address)",
|
|
1617
|
+
description: "The address of a Forms form answered by personal link (open, published, Who may answer: " +
|
|
1618
|
+
"By personal link) that members are asked to " +
|
|
1619
|
+
"answer after a class they came to, with a link that works once and for a week; at most " +
|
|
1620
|
+
"once a month each, a child's to their parent or guardian. Empty: nobody is asked.",
|
|
1621
|
+
personApproves: true,
|
|
1622
|
+
},
|
|
1623
|
+
feedbackMinutes: {
|
|
1624
|
+
type: "number",
|
|
1625
|
+
label: "Feedback asked (minutes after the tick)",
|
|
1626
|
+
description: "How long after a member is ticked as come the feedback email goes.",
|
|
1627
|
+
default: 180,
|
|
1628
|
+
min: 0,
|
|
1629
|
+
max: 2_880,
|
|
1630
|
+
personApproves: true,
|
|
1631
|
+
},
|
|
931
1632
|
},
|
|
932
1633
|
// The coach role (spec 31, decision 10; ADR 0436): the day's classes and their lists, and ticking
|
|
933
1634
|
// names. Nothing else: no money (no holders, no desk payments, no orders), no people beyond the
|
|
@@ -948,6 +1649,23 @@ export default defineExtension({
|
|
|
948
1649
|
},
|
|
949
1650
|
},
|
|
950
1651
|
},
|
|
1652
|
+
// The front desk's tools (ADR 0600): find people, book anyone (a walk-in too) into any class,
|
|
1653
|
+
// cancel for them, move them, give a use back, a class's full list and any day's classes. Any
|
|
1654
|
+
// member of staff holds them; an admin grants them to a coach, whose coach role they add to:
|
|
1655
|
+
// the coach's own list and ticks stay today's. Not cancelling a class (its own permission, and
|
|
1656
|
+
// a person's), not refunds (orders:refund), not people, orders, passes or memberships.
|
|
1657
|
+
// Appointments (stage 49, ADR 0764): `bookings:appointments` books, moves, cancels, marks and
|
|
1658
|
+
// reassigns one-to-one sessions, and reads any coach's day. Any member of staff holds it; an
|
|
1659
|
+
// admin grants it to a coach (a manager of the coaches).
|
|
1660
|
+
grantable: ["bookings:desk", "bookings:appointments"],
|
|
1661
|
+
grantableLabels: {
|
|
1662
|
+
"bookings:desk": "Front desk: find people; book, cancel and move classes and one-to-one sessions for " +
|
|
1663
|
+
"anyone; give a use back; mark sessions; see any day's classes and lists and every " +
|
|
1664
|
+
"coach's day with its clients. For a coach who also works the desk.",
|
|
1665
|
+
"bookings:appointments": "Appointments: book one-to-one sessions for clients, move, cancel and mark them, give a " +
|
|
1666
|
+
"session back, give a session to another coach, and see any coach's day. For a coach who " +
|
|
1667
|
+
"manages the others' sessions.",
|
|
1668
|
+
},
|
|
951
1669
|
tools: {
|
|
952
1670
|
timetable,
|
|
953
1671
|
classGet,
|
|
@@ -970,5 +1688,48 @@ export default defineExtension({
|
|
|
970
1688
|
move,
|
|
971
1689
|
cancelClass,
|
|
972
1690
|
family,
|
|
1691
|
+
bookAppointment,
|
|
1692
|
+
moveAppointment,
|
|
1693
|
+
cancelAppointment,
|
|
1694
|
+
cancelAppointmentByUs,
|
|
1695
|
+
markAppointment,
|
|
1696
|
+
excuseAppointment,
|
|
1697
|
+
reassignAppointment,
|
|
1698
|
+
coachDay,
|
|
1699
|
+
},
|
|
1700
|
+
automations: bookingsAutomations,
|
|
1701
|
+
dashboards: bookingsDashboards,
|
|
1702
|
+
// Staff screens in the product's admin (stage 47, ADR 0660): the front desk, and a class's list
|
|
1703
|
+
// (a tab on the class, and in the navigation for a coach, who opens today's classes there). Each
|
|
1704
|
+
// is gated by the tools that decide who may work it (its main read and the write it is for; the
|
|
1705
|
+
// host refuses the rest): the desk, any member of staff or a coach granted `bookings:desk`; the
|
|
1706
|
+
// list, the coach role or any member (a viewer cannot tick). Never a customer's tool.
|
|
1707
|
+
screens: {
|
|
1708
|
+
desk: {
|
|
1709
|
+
label: "Front desk",
|
|
1710
|
+
block: "bookings-desk",
|
|
1711
|
+
export: "FrontDesk",
|
|
1712
|
+
nav: { group: "Bookings", order: 10 },
|
|
1713
|
+
opens: ["findPeople", "bookFor"],
|
|
1714
|
+
},
|
|
1715
|
+
classList: {
|
|
1716
|
+
label: "Class list",
|
|
1717
|
+
block: "bookings-class-list",
|
|
1718
|
+
export: "TodayClassList",
|
|
1719
|
+
nav: { group: "Bookings", order: 20 },
|
|
1720
|
+
opens: ["roster", "markAttended"],
|
|
1721
|
+
record: { object: "bookings.class", as: "classId" },
|
|
1722
|
+
},
|
|
1723
|
+
},
|
|
1724
|
+
// Its section of My account (stage 48, ADR 0710): shown to a member with a booking, or whose child
|
|
1725
|
+
// linked to them has one (a booking opens to guardians), the timetable with their bookings.
|
|
1726
|
+
portal: {
|
|
1727
|
+
bookings: {
|
|
1728
|
+
label: "Bookings",
|
|
1729
|
+
web: { block: "bookings-timetable", export: "Timetable" },
|
|
1730
|
+
native: { block: "bookings-native-timetable", export: "TimetableScreen" },
|
|
1731
|
+
order: 10,
|
|
1732
|
+
has: ["bookings.booking"],
|
|
1733
|
+
},
|
|
973
1734
|
},
|
|
974
1735
|
});
|