@composable-os/pack-programs 0.0.0-stage → 0.1.0-beta.10
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/LICENSE +109 -0
- package/dist/authoring.d.ts +47 -0
- package/dist/authoring.js +493 -0
- package/dist/blocks/programs-bank/exercise-bank.d.ts +4 -0
- package/dist/blocks/programs-bank/exercise-bank.js +68 -0
- package/dist/blocks/programs-builder/program-builder.d.ts +26 -0
- package/dist/blocks/programs-builder/program-builder.js +295 -0
- package/dist/blocks/programs-class-today/class-today.d.ts +6 -0
- package/dist/blocks/programs-class-today/class-today.js +15 -0
- package/dist/blocks/programs-coach-client/coach-client.d.ts +5 -0
- package/dist/blocks/programs-coach-client/coach-client.js +10 -0
- package/dist/blocks/programs-native-class-today/class-today-screen.d.ts +6 -0
- package/dist/blocks/programs-native-class-today/class-today-screen.js +14 -0
- package/dist/blocks/programs-native-coach-client/coach-client-screen.d.ts +7 -0
- package/dist/blocks/programs-native-coach-client/coach-client-screen.js +9 -0
- package/dist/blocks/programs-native-progress/progress-screen.d.ts +5 -0
- package/dist/blocks/programs-native-progress/progress-screen.js +31 -0
- package/dist/blocks/programs-native-session/session-screen.d.ts +7 -0
- package/dist/blocks/programs-native-session/session-screen.js +130 -0
- package/dist/blocks/programs-native-today/today-screen.d.ts +7 -0
- package/dist/blocks/programs-native-today/today-screen.js +11 -0
- package/dist/blocks/programs-progress/progress.d.ts +10 -0
- package/dist/blocks/programs-progress/progress.js +40 -0
- package/dist/blocks/programs-session/session-view.d.ts +9 -0
- package/dist/blocks/programs-session/session-view.js +116 -0
- package/dist/blocks/programs-today/today.d.ts +7 -0
- package/dist/blocks/programs-today/today.js +16 -0
- package/dist/client/index.d.ts +1723 -0
- package/dist/client/index.js +779 -0
- package/dist/dashboards.d.ts +5 -0
- package/dist/dashboards.js +145 -0
- package/dist/index.d.ts +1181 -0
- package/dist/index.js +610 -0
- package/dist/layout.d.ts +88 -0
- package/dist/layout.js +268 -0
- package/dist/tools.d.ts +344 -0
- package/dist/tools.js +930 -0
- package/package.json +36 -4
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,610 @@
|
|
|
1
|
+
// Programs (stage 41): one bank of exercises, programs built from it, published as versions,
|
|
2
|
+
// assigned to a person or to a class type as dated sessions, and a log of every set done
|
|
3
|
+
// against its target. Any product can turn it on (`packs` in its product.ts); a product that
|
|
4
|
+
// does not list it has none of this.
|
|
5
|
+
//
|
|
6
|
+
// Everything that is a rule is the host's, declared here as behaviours (ADR 0404):
|
|
7
|
+
// - a program's layout is one document checked against LAYOUT_SCHEMA on every write
|
|
8
|
+
// (`document`, ADR 0445), and its sessions' plans against SESSION_PLAN_SCHEMA;
|
|
9
|
+
// - a program has a working copy and published versions (`publishable`, ADR 0446): coaches
|
|
10
|
+
// edit freely, a person with the publish permission publishes, and an assignment pins one;
|
|
11
|
+
// - a person's assignments, sessions and logs are theirs (`customer`), and a class type's are
|
|
12
|
+
// read by every signed-in member (`signedIn`, ADR 0447); the bank and the class types are
|
|
13
|
+
// read by every signed-in member; a member writes a log only against a session they can see;
|
|
14
|
+
// - an assignment and a session move through fixed states (`states`), each move made from a
|
|
15
|
+
// current read (ADR 0437).
|
|
16
|
+
// The tools in tools.ts compose the host's operations and add no rules of their own.
|
|
17
|
+
import { defineExtension } from "@composable-os/sdk";
|
|
18
|
+
import { programsDashboards } from "./dashboards.js";
|
|
19
|
+
import { LAYOUT_SCHEMA, SESSION_PLAN_SCHEMA } from "./layout.js";
|
|
20
|
+
import { assign, classToday, draft, history, importText, logAdd, logUpdate, progress, sessionComplete, sessionGet, today, } from "./tools.js";
|
|
21
|
+
const kind = {
|
|
22
|
+
type: "select",
|
|
23
|
+
label: "For",
|
|
24
|
+
readOnly: true,
|
|
25
|
+
description: "A person's own, or a class type's (read by every signed-in member).",
|
|
26
|
+
options: [
|
|
27
|
+
{ value: "personal", label: "A person" },
|
|
28
|
+
{ value: "class", label: "A class type" },
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
export default defineExtension({
|
|
32
|
+
id: "programs",
|
|
33
|
+
version: "0.1.0",
|
|
34
|
+
contractVersion: 1,
|
|
35
|
+
label: "Programs",
|
|
36
|
+
description: "An exercise bank, programs built from it as one layout (weeks, sessions, blocks, items, " +
|
|
37
|
+
"levels, typed sets), published versions, assignments to a person or a class type as dated " +
|
|
38
|
+
"sessions, and a log of every set against its target.",
|
|
39
|
+
permissions: {
|
|
40
|
+
// person.get: the name an assignment is titled with.
|
|
41
|
+
read: ["person"],
|
|
42
|
+
modules: ["ops", "ai"],
|
|
43
|
+
},
|
|
44
|
+
objects: {
|
|
45
|
+
exercise: {
|
|
46
|
+
label: "Exercise",
|
|
47
|
+
plural: "Exercises",
|
|
48
|
+
icon: "dumbbell",
|
|
49
|
+
titleField: "name",
|
|
50
|
+
description: "One exercise of the bank every program is built from.",
|
|
51
|
+
navigation: "main",
|
|
52
|
+
navigationOrder: 20,
|
|
53
|
+
fields: {
|
|
54
|
+
name: { type: "text", label: "Name", required: true },
|
|
55
|
+
video: { type: "url", label: "Demo video" },
|
|
56
|
+
cues: { type: "longText", label: "Coaching cues" },
|
|
57
|
+
theme: {
|
|
58
|
+
type: "select",
|
|
59
|
+
label: "Theme",
|
|
60
|
+
editableOptions: true,
|
|
61
|
+
options: [
|
|
62
|
+
{ value: "mobility", label: "Mobility" },
|
|
63
|
+
{ value: "strength", label: "Strength" },
|
|
64
|
+
{ value: "handstands", label: "Handstands" },
|
|
65
|
+
{ value: "skill", label: "Skill" },
|
|
66
|
+
{ value: "conditioning", label: "Conditioning" },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
level: {
|
|
70
|
+
type: "select",
|
|
71
|
+
label: "Level",
|
|
72
|
+
options: [
|
|
73
|
+
{ value: "beginner", label: "Beginner" },
|
|
74
|
+
{ value: "intermediate", label: "Intermediate" },
|
|
75
|
+
{ value: "advanced", label: "Advanced" },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
equipment: {
|
|
79
|
+
type: "multiSelect",
|
|
80
|
+
label: "Equipment",
|
|
81
|
+
editableOptions: true,
|
|
82
|
+
options: [
|
|
83
|
+
{ value: "none", label: "None" },
|
|
84
|
+
{ value: "rings", label: "Rings" },
|
|
85
|
+
{ value: "bar", label: "Bar" },
|
|
86
|
+
{ value: "parallettes", label: "Parallettes" },
|
|
87
|
+
{ value: "kettlebell", label: "Kettlebell" },
|
|
88
|
+
{ value: "dumbbell", label: "Dumbbell" },
|
|
89
|
+
{ value: "barbell", label: "Barbell" },
|
|
90
|
+
{ value: "band", label: "Band" },
|
|
91
|
+
{ value: "box", label: "Box" },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
bodyAreas: {
|
|
95
|
+
type: "multiSelect",
|
|
96
|
+
label: "Body areas",
|
|
97
|
+
editableOptions: true,
|
|
98
|
+
options: [
|
|
99
|
+
{ value: "shoulders", label: "Shoulders" },
|
|
100
|
+
{ value: "wrists", label: "Wrists" },
|
|
101
|
+
{ value: "spine", label: "Spine" },
|
|
102
|
+
{ value: "hips", label: "Hips" },
|
|
103
|
+
{ value: "legs", label: "Legs" },
|
|
104
|
+
{ value: "core", label: "Core" },
|
|
105
|
+
{ value: "upper", label: "Upper body" },
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
measure: {
|
|
109
|
+
type: "select",
|
|
110
|
+
label: "Measured by",
|
|
111
|
+
required: true,
|
|
112
|
+
default: "reps",
|
|
113
|
+
description: "What one set of it records.",
|
|
114
|
+
options: [
|
|
115
|
+
{ value: "weight_reps", label: "Weight and reps" },
|
|
116
|
+
{ value: "reps", label: "Reps" },
|
|
117
|
+
{ value: "time", label: "Time" },
|
|
118
|
+
{ value: "hold", label: "Hold" },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
easier: {
|
|
122
|
+
type: "relation",
|
|
123
|
+
label: "Easier versions",
|
|
124
|
+
to: "programs.exercise",
|
|
125
|
+
many: true,
|
|
126
|
+
},
|
|
127
|
+
harder: {
|
|
128
|
+
type: "relation",
|
|
129
|
+
label: "Harder versions",
|
|
130
|
+
to: "programs.exercise",
|
|
131
|
+
many: true,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
// Every signed-in member reads the bank a program of theirs is built from.
|
|
135
|
+
signedIn: {
|
|
136
|
+
read: [
|
|
137
|
+
"name",
|
|
138
|
+
"video",
|
|
139
|
+
"cues",
|
|
140
|
+
"theme",
|
|
141
|
+
"level",
|
|
142
|
+
"equipment",
|
|
143
|
+
"bodyAreas",
|
|
144
|
+
"measure",
|
|
145
|
+
"easier",
|
|
146
|
+
"harder",
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
indexes: [["theme"], ["measure"]],
|
|
150
|
+
},
|
|
151
|
+
program: {
|
|
152
|
+
label: "Program",
|
|
153
|
+
plural: "Programs",
|
|
154
|
+
icon: "clipboard-list",
|
|
155
|
+
titleField: "title",
|
|
156
|
+
description: "A plan of weeks of sessions, built from the bank: a class program, a client's own, or " +
|
|
157
|
+
"the sessions of an online course. Coaches edit the working copy; people are given a " +
|
|
158
|
+
"published version.",
|
|
159
|
+
navigation: "main",
|
|
160
|
+
navigationOrder: 21,
|
|
161
|
+
fields: {
|
|
162
|
+
title: { type: "text", label: "Title", required: true },
|
|
163
|
+
kind: {
|
|
164
|
+
type: "select",
|
|
165
|
+
label: "Kind",
|
|
166
|
+
required: true,
|
|
167
|
+
default: "client",
|
|
168
|
+
options: [
|
|
169
|
+
{ value: "class", label: "Class" },
|
|
170
|
+
{ value: "client", label: "Client" },
|
|
171
|
+
{ value: "course", label: "Course" },
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
theme: { type: "text", label: "Theme" },
|
|
175
|
+
guidance: {
|
|
176
|
+
type: "longText",
|
|
177
|
+
label: "Guidance for coaches",
|
|
178
|
+
description: "For whoever runs it. Never shown to members.",
|
|
179
|
+
},
|
|
180
|
+
layout: {
|
|
181
|
+
type: "document",
|
|
182
|
+
label: "Layout",
|
|
183
|
+
required: true,
|
|
184
|
+
description: "Weeks of sessions of blocks of items, each item bank exercises with typed sets, " +
|
|
185
|
+
"or up to five levels; notes for coaches unless marked as shown to members.",
|
|
186
|
+
schema: LAYOUT_SCHEMA,
|
|
187
|
+
maxBytes: 524_288,
|
|
188
|
+
paths: { weekCount: { label: "Weeks", path: "weeks", count: true } },
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
publishable: { content: ["title", "kind", "theme", "guidance", "layout"] },
|
|
192
|
+
indexes: [["kind"]],
|
|
193
|
+
},
|
|
194
|
+
classtype: {
|
|
195
|
+
label: "Class type",
|
|
196
|
+
plural: "Class types",
|
|
197
|
+
icon: "users",
|
|
198
|
+
titleField: "name",
|
|
199
|
+
description: "A kind of class (Mobility, Handstands): what a class program is assigned to.",
|
|
200
|
+
navigation: "settings",
|
|
201
|
+
fields: {
|
|
202
|
+
name: { type: "text", label: "Name", required: true },
|
|
203
|
+
order: { type: "number", label: "Order" },
|
|
204
|
+
},
|
|
205
|
+
signedIn: { read: ["name", "order"] },
|
|
206
|
+
},
|
|
207
|
+
assignment: {
|
|
208
|
+
label: "Assignment",
|
|
209
|
+
plural: "Assignments",
|
|
210
|
+
icon: "calendar-range",
|
|
211
|
+
titleField: "title",
|
|
212
|
+
description: "A published version of a program given to a person or to a class type from a start " +
|
|
213
|
+
"date: its dated sessions are made from that version and keep it.",
|
|
214
|
+
navigation: "main",
|
|
215
|
+
navigationOrder: 22,
|
|
216
|
+
fields: {
|
|
217
|
+
title: { type: "text", label: "Title", required: true },
|
|
218
|
+
program: { type: "relation", label: "Program", to: "programs.program", required: true },
|
|
219
|
+
programVersion: {
|
|
220
|
+
type: "number",
|
|
221
|
+
label: "Version",
|
|
222
|
+
readOnly: true,
|
|
223
|
+
description: "The program's published version this follows.",
|
|
224
|
+
},
|
|
225
|
+
kind,
|
|
226
|
+
person: { type: "relation", label: "Person", to: "person" },
|
|
227
|
+
classType: { type: "relation", label: "Class type", to: "programs.classtype" },
|
|
228
|
+
startDate: { type: "date", label: "Starts", required: true },
|
|
229
|
+
endDate: { type: "date", label: "Ends" },
|
|
230
|
+
sessionCount: { type: "number", label: "Sessions", readOnly: true, min: 0, step: 1 },
|
|
231
|
+
state: {
|
|
232
|
+
type: "select",
|
|
233
|
+
label: "State",
|
|
234
|
+
track: "timeline",
|
|
235
|
+
options: [
|
|
236
|
+
{ value: "generating", label: "Making sessions" },
|
|
237
|
+
{ value: "active", label: "Active" },
|
|
238
|
+
{ value: "ended", label: "Ended" },
|
|
239
|
+
{ value: "cancelled", label: "Cancelled" },
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
assignedBy: { type: "user", label: "Assigned by" },
|
|
243
|
+
assignedByName: { type: "text", label: "Assigned by (name)" },
|
|
244
|
+
},
|
|
245
|
+
requireOneOf: [["person", "classType"]],
|
|
246
|
+
states: {
|
|
247
|
+
field: "state",
|
|
248
|
+
initial: "generating",
|
|
249
|
+
moves: [
|
|
250
|
+
{ from: "generating", to: "active", by: ["staff"] },
|
|
251
|
+
{ from: "active", to: "ended", by: ["staff"], final: true },
|
|
252
|
+
{ from: ["generating", "active"], to: "cancelled", by: ["staff"], final: true },
|
|
253
|
+
],
|
|
254
|
+
},
|
|
255
|
+
customer: {
|
|
256
|
+
field: "person",
|
|
257
|
+
read: ["title", "programVersion", "kind", "classType", "startDate", "endDate", "state"],
|
|
258
|
+
write: [],
|
|
259
|
+
},
|
|
260
|
+
signedIn: {
|
|
261
|
+
read: ["title", "programVersion", "kind", "classType", "startDate", "endDate", "state"],
|
|
262
|
+
when: { field: "kind", in: ["class"] },
|
|
263
|
+
},
|
|
264
|
+
timelineLinks: ["person"],
|
|
265
|
+
// A member reads their own (person) or the shared (kind): one index for each side of the OR.
|
|
266
|
+
indexes: [["person", "state"], ["kind", "state"], ["classType", "state"], ["program"]],
|
|
267
|
+
},
|
|
268
|
+
session: {
|
|
269
|
+
label: "Session",
|
|
270
|
+
plural: "Sessions",
|
|
271
|
+
icon: "calendar-check",
|
|
272
|
+
titleField: "name",
|
|
273
|
+
description: "One dated session of an assignment: its plan as the assigned version had it, and " +
|
|
274
|
+
"whether it was done.",
|
|
275
|
+
navigation: "none",
|
|
276
|
+
fields: {
|
|
277
|
+
name: { type: "text", label: "Name", required: true },
|
|
278
|
+
assignment: {
|
|
279
|
+
type: "relation",
|
|
280
|
+
label: "Assignment",
|
|
281
|
+
to: "programs.assignment",
|
|
282
|
+
required: true,
|
|
283
|
+
},
|
|
284
|
+
program: { type: "relation", label: "Program", to: "programs.program" },
|
|
285
|
+
programVersion: { type: "number", label: "Version", readOnly: true },
|
|
286
|
+
kind,
|
|
287
|
+
person: { type: "relation", label: "Person", to: "person" },
|
|
288
|
+
classType: { type: "relation", label: "Class type", to: "programs.classtype" },
|
|
289
|
+
programTitle: {
|
|
290
|
+
type: "text",
|
|
291
|
+
label: "Program",
|
|
292
|
+
readOnly: true,
|
|
293
|
+
description: "The program's title in the assigned version, so a member reads it with the session.",
|
|
294
|
+
},
|
|
295
|
+
classTypeName: { type: "text", label: "Class type (name)", readOnly: true },
|
|
296
|
+
date: { type: "date", label: "Date", required: true },
|
|
297
|
+
week: { type: "number", label: "Week", readOnly: true, min: 1, max: 52, step: 1 },
|
|
298
|
+
day: { type: "number", label: "Day of the week", readOnly: true, min: 1, max: 7, step: 1 },
|
|
299
|
+
position: {
|
|
300
|
+
type: "number",
|
|
301
|
+
label: "Place in its week",
|
|
302
|
+
readOnly: true,
|
|
303
|
+
description: "The session's index in its week of the layout, from 0.",
|
|
304
|
+
},
|
|
305
|
+
key: {
|
|
306
|
+
type: "text",
|
|
307
|
+
label: "Key",
|
|
308
|
+
readOnly: true,
|
|
309
|
+
description: "Assignment, week and place: one session per place.",
|
|
310
|
+
},
|
|
311
|
+
focus: { type: "text", label: "Focus" },
|
|
312
|
+
plan: {
|
|
313
|
+
type: "document",
|
|
314
|
+
label: "Plan",
|
|
315
|
+
readOnly: true,
|
|
316
|
+
description: "The session of the layout, as the assigned version had it.",
|
|
317
|
+
schema: SESSION_PLAN_SCHEMA,
|
|
318
|
+
maxBytes: 65_536,
|
|
319
|
+
},
|
|
320
|
+
state: {
|
|
321
|
+
type: "select",
|
|
322
|
+
label: "State",
|
|
323
|
+
options: [
|
|
324
|
+
{ value: "planned", label: "Planned" },
|
|
325
|
+
{ value: "done", label: "Done" },
|
|
326
|
+
{ value: "skipped", label: "Skipped" },
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
completedAt: { type: "datetime", label: "Marked at" },
|
|
330
|
+
completedBy: { type: "user", label: "Marked by" },
|
|
331
|
+
completedByName: { type: "text", label: "Marked by (name)" },
|
|
332
|
+
},
|
|
333
|
+
states: {
|
|
334
|
+
field: "state",
|
|
335
|
+
initial: "planned",
|
|
336
|
+
moves: [
|
|
337
|
+
{ from: "planned", to: "done", by: ["staff", "customer"] },
|
|
338
|
+
{ from: "planned", to: "skipped", by: ["staff", "customer"] },
|
|
339
|
+
{ from: ["done", "skipped"], to: "planned", by: ["staff", "customer"] },
|
|
340
|
+
],
|
|
341
|
+
},
|
|
342
|
+
customer: {
|
|
343
|
+
field: "person",
|
|
344
|
+
read: [
|
|
345
|
+
"name",
|
|
346
|
+
"assignment",
|
|
347
|
+
// Stage 42: which program it is, so a course's session lesson finds the student's own.
|
|
348
|
+
"program",
|
|
349
|
+
"programVersion",
|
|
350
|
+
"kind",
|
|
351
|
+
"classType",
|
|
352
|
+
"programTitle",
|
|
353
|
+
"classTypeName",
|
|
354
|
+
"date",
|
|
355
|
+
"week",
|
|
356
|
+
"day",
|
|
357
|
+
"position",
|
|
358
|
+
"focus",
|
|
359
|
+
"plan",
|
|
360
|
+
"state",
|
|
361
|
+
"completedAt",
|
|
362
|
+
],
|
|
363
|
+
write: [],
|
|
364
|
+
},
|
|
365
|
+
// A class type's sessions are read by every signed-in member; marking one done is not theirs.
|
|
366
|
+
signedIn: {
|
|
367
|
+
read: [
|
|
368
|
+
"name",
|
|
369
|
+
"assignment",
|
|
370
|
+
"programVersion",
|
|
371
|
+
"kind",
|
|
372
|
+
"classType",
|
|
373
|
+
"programTitle",
|
|
374
|
+
"classTypeName",
|
|
375
|
+
"date",
|
|
376
|
+
"week",
|
|
377
|
+
"day",
|
|
378
|
+
"position",
|
|
379
|
+
"focus",
|
|
380
|
+
"plan",
|
|
381
|
+
],
|
|
382
|
+
when: { field: "kind", in: ["class"] },
|
|
383
|
+
},
|
|
384
|
+
indexes: [
|
|
385
|
+
["person", "date"],
|
|
386
|
+
["kind", "date"],
|
|
387
|
+
["classType", "date"],
|
|
388
|
+
["assignment", "week"],
|
|
389
|
+
["key"],
|
|
390
|
+
],
|
|
391
|
+
},
|
|
392
|
+
log: {
|
|
393
|
+
label: "Logged set",
|
|
394
|
+
plural: "Logged sets",
|
|
395
|
+
icon: "list-checks",
|
|
396
|
+
titleField: "label",
|
|
397
|
+
description: "One set someone did: the exercise, the target and what was done, how hard it felt, " +
|
|
398
|
+
"the level taken, and who recorded it. The table training data comes from.",
|
|
399
|
+
navigation: "main",
|
|
400
|
+
navigationOrder: 23,
|
|
401
|
+
fields: {
|
|
402
|
+
label: { type: "text", label: "Set", required: true },
|
|
403
|
+
person: { type: "relation", label: "Person", to: "person", required: true },
|
|
404
|
+
session: { type: "relation", label: "Session", to: "programs.session", required: true },
|
|
405
|
+
assignment: { type: "relation", label: "Assignment", to: "programs.assignment" },
|
|
406
|
+
exercise: { type: "relation", label: "Exercise", to: "programs.exercise", required: true },
|
|
407
|
+
exerciseName: {
|
|
408
|
+
type: "text",
|
|
409
|
+
label: "Exercise (name)",
|
|
410
|
+
description: "The exercise's name when the set was logged, so a member reads it with the set.",
|
|
411
|
+
},
|
|
412
|
+
item: { type: "text", label: "Item", description: "The item's label: A1." },
|
|
413
|
+
setNumber: { type: "number", label: "Set number", min: 1, max: 30, step: 1 },
|
|
414
|
+
level: { type: "number", label: "Level taken", min: 1, max: 5, step: 1 },
|
|
415
|
+
date: { type: "date", label: "Date", required: true },
|
|
416
|
+
targetReps: { type: "number", label: "Target reps", min: 0, max: 999, step: 1 },
|
|
417
|
+
targetSeconds: { type: "number", label: "Target seconds", min: 0, max: 7200, step: 1 },
|
|
418
|
+
targetLoad: { type: "number", label: "Target load (kg)", min: 0, max: 1000, step: 0.25 },
|
|
419
|
+
actualReps: { type: "number", label: "Reps", min: 0, max: 999, step: 1 },
|
|
420
|
+
actualSeconds: { type: "number", label: "Seconds", min: 0, max: 7200, step: 1 },
|
|
421
|
+
actualLoad: { type: "number", label: "Load (kg)", min: 0, max: 1000, step: 0.25 },
|
|
422
|
+
rpe: {
|
|
423
|
+
type: "number",
|
|
424
|
+
label: "Effort (RPE)",
|
|
425
|
+
description: "1 to 10, in halves.",
|
|
426
|
+
min: 1,
|
|
427
|
+
max: 10,
|
|
428
|
+
step: 0.5,
|
|
429
|
+
},
|
|
430
|
+
note: { type: "text", label: "Note" },
|
|
431
|
+
recordedAs: {
|
|
432
|
+
type: "select",
|
|
433
|
+
label: "Recorded by",
|
|
434
|
+
options: [
|
|
435
|
+
{ value: "self", label: "Themselves" },
|
|
436
|
+
{ value: "staff", label: "A coach" },
|
|
437
|
+
],
|
|
438
|
+
},
|
|
439
|
+
recordedBy: { type: "user", label: "Recorded by (coach)" },
|
|
440
|
+
recordedByName: { type: "text", label: "Recorded by (name)" },
|
|
441
|
+
},
|
|
442
|
+
customer: {
|
|
443
|
+
field: "person",
|
|
444
|
+
read: [
|
|
445
|
+
"label",
|
|
446
|
+
"session",
|
|
447
|
+
"assignment",
|
|
448
|
+
"exercise",
|
|
449
|
+
"exerciseName",
|
|
450
|
+
"item",
|
|
451
|
+
"setNumber",
|
|
452
|
+
"level",
|
|
453
|
+
"date",
|
|
454
|
+
"targetReps",
|
|
455
|
+
"targetSeconds",
|
|
456
|
+
"targetLoad",
|
|
457
|
+
"actualReps",
|
|
458
|
+
"actualSeconds",
|
|
459
|
+
"actualLoad",
|
|
460
|
+
"rpe",
|
|
461
|
+
"note",
|
|
462
|
+
"recordedAs",
|
|
463
|
+
"recordedByName",
|
|
464
|
+
],
|
|
465
|
+
write: ["actualReps", "actualSeconds", "actualLoad", "rpe", "note"],
|
|
466
|
+
},
|
|
467
|
+
timelineLinks: ["person"],
|
|
468
|
+
indexes: [
|
|
469
|
+
["person", "exercise", "date"],
|
|
470
|
+
["session"],
|
|
471
|
+
["exercise", "date"],
|
|
472
|
+
["person", "date"],
|
|
473
|
+
],
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
views: {
|
|
477
|
+
bankByTheme: {
|
|
478
|
+
label: "Bank by theme",
|
|
479
|
+
object: "programs.exercise",
|
|
480
|
+
type: "board",
|
|
481
|
+
groupBy: "theme",
|
|
482
|
+
cardFields: ["measure", "level", "equipment"],
|
|
483
|
+
},
|
|
484
|
+
programsPublished: {
|
|
485
|
+
label: "Published programs",
|
|
486
|
+
object: "programs.program",
|
|
487
|
+
filter: { field: "publishedVersion", op: "is_not_null" },
|
|
488
|
+
sort: { field: "publishedAt", direction: "desc" },
|
|
489
|
+
columns: ["title", "kind", "weekCount", "publishedVersion", "publishedAt"],
|
|
490
|
+
},
|
|
491
|
+
activeAssignments: {
|
|
492
|
+
label: "Active assignments",
|
|
493
|
+
object: "programs.assignment",
|
|
494
|
+
filter: { field: "state", op: "eq", value: "active" },
|
|
495
|
+
sort: { field: "startDate", direction: "desc" },
|
|
496
|
+
columns: ["title", "kind", "person", "classType", "startDate", "endDate", "sessionCount"],
|
|
497
|
+
},
|
|
498
|
+
sessionsThisWeek: {
|
|
499
|
+
label: "Sessions this week",
|
|
500
|
+
object: "programs.session",
|
|
501
|
+
filter: {
|
|
502
|
+
and: [
|
|
503
|
+
{ field: "date", op: "gte", value: { $relative: "startOfWeek" } },
|
|
504
|
+
{ field: "date", op: "lt", value: { $relative: "startOfNextWeek" } },
|
|
505
|
+
],
|
|
506
|
+
},
|
|
507
|
+
sort: { field: "date", direction: "asc" },
|
|
508
|
+
columns: ["name", "date", "kind", "person", "classType", "state"],
|
|
509
|
+
},
|
|
510
|
+
sessionsCalendar: {
|
|
511
|
+
label: "Sessions calendar",
|
|
512
|
+
object: "programs.session",
|
|
513
|
+
type: "calendar",
|
|
514
|
+
dateField: "date",
|
|
515
|
+
mode: "week",
|
|
516
|
+
cardFields: ["person", "classType", "state"],
|
|
517
|
+
},
|
|
518
|
+
setsThisWeek: {
|
|
519
|
+
label: "Sets logged this week",
|
|
520
|
+
object: "programs.log",
|
|
521
|
+
filter: {
|
|
522
|
+
and: [
|
|
523
|
+
{ field: "date", op: "gte", value: { $relative: "startOfWeek" } },
|
|
524
|
+
{ field: "date", op: "lt", value: { $relative: "startOfNextWeek" } },
|
|
525
|
+
],
|
|
526
|
+
},
|
|
527
|
+
sort: { field: "date", direction: "desc" },
|
|
528
|
+
columns: [
|
|
529
|
+
"person",
|
|
530
|
+
"exercise",
|
|
531
|
+
"label",
|
|
532
|
+
"level",
|
|
533
|
+
"targetReps",
|
|
534
|
+
"actualReps",
|
|
535
|
+
"targetLoad",
|
|
536
|
+
"actualLoad",
|
|
537
|
+
"actualSeconds",
|
|
538
|
+
"rpe",
|
|
539
|
+
"recordedAs",
|
|
540
|
+
],
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
dashboards: programsDashboards,
|
|
544
|
+
// A client's Person page: their sets (the Training tab), their assignments and their sessions.
|
|
545
|
+
recordTabs: {
|
|
546
|
+
personTraining: {
|
|
547
|
+
label: "Training",
|
|
548
|
+
on: "person",
|
|
549
|
+
view: {
|
|
550
|
+
type: "table",
|
|
551
|
+
object: "programs.log",
|
|
552
|
+
relation: "person",
|
|
553
|
+
columns: [
|
|
554
|
+
"date",
|
|
555
|
+
"exercise",
|
|
556
|
+
"label",
|
|
557
|
+
"level",
|
|
558
|
+
"targetReps",
|
|
559
|
+
"actualReps",
|
|
560
|
+
"targetLoad",
|
|
561
|
+
"actualLoad",
|
|
562
|
+
"actualSeconds",
|
|
563
|
+
"rpe",
|
|
564
|
+
"recordedAs",
|
|
565
|
+
],
|
|
566
|
+
sort: { field: "date", direction: "desc" },
|
|
567
|
+
},
|
|
568
|
+
order: 40,
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
recordPanels: {
|
|
572
|
+
personAssignments: {
|
|
573
|
+
label: "Programs",
|
|
574
|
+
on: "person",
|
|
575
|
+
view: {
|
|
576
|
+
type: "table",
|
|
577
|
+
object: "programs.assignment",
|
|
578
|
+
relation: "person",
|
|
579
|
+
columns: ["title", "startDate", "endDate", "state"],
|
|
580
|
+
sort: { field: "startDate", direction: "desc" },
|
|
581
|
+
},
|
|
582
|
+
order: 40,
|
|
583
|
+
},
|
|
584
|
+
personSessions: {
|
|
585
|
+
label: "Sessions",
|
|
586
|
+
on: "person",
|
|
587
|
+
view: {
|
|
588
|
+
type: "table",
|
|
589
|
+
object: "programs.session",
|
|
590
|
+
relation: "person",
|
|
591
|
+
columns: ["name", "date", "state"],
|
|
592
|
+
sort: { field: "date", direction: "desc" },
|
|
593
|
+
},
|
|
594
|
+
order: 41,
|
|
595
|
+
},
|
|
596
|
+
},
|
|
597
|
+
tools: {
|
|
598
|
+
assign,
|
|
599
|
+
today,
|
|
600
|
+
sessionGet,
|
|
601
|
+
classToday,
|
|
602
|
+
logAdd,
|
|
603
|
+
logUpdate,
|
|
604
|
+
sessionComplete,
|
|
605
|
+
history,
|
|
606
|
+
progress,
|
|
607
|
+
draft,
|
|
608
|
+
importText,
|
|
609
|
+
},
|
|
610
|
+
});
|