@saltcorn/reservable 0.1.0 → 0.1.1

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.
@@ -0,0 +1,495 @@
1
+ {
2
+ "tables": [
3
+ {
4
+ "name": "hairdressers",
5
+ "min_role_read": 1,
6
+ "min_role_write": 1,
7
+ "versioned": false,
8
+ "fields": [
9
+ {
10
+ "name": "id",
11
+ "label": "ID",
12
+ "is_unique": true,
13
+ "calculated": false,
14
+ "stored": false,
15
+ "expression": null,
16
+ "type": "Integer",
17
+ "attributes": {},
18
+ "required": true,
19
+ "primary_key": true,
20
+ "description": ""
21
+ },
22
+ {
23
+ "name": "name",
24
+ "label": "name",
25
+ "is_unique": false,
26
+ "calculated": false,
27
+ "stored": false,
28
+ "expression": null,
29
+ "type": "String",
30
+ "attributes": {
31
+ "regexp": "",
32
+ "options": "",
33
+ "max_length": null,
34
+ "min_length": null,
35
+ "re_invalid_error": ""
36
+ },
37
+ "required": false,
38
+ "primary_key": false,
39
+ "description": ""
40
+ }
41
+ ],
42
+ "triggers": [],
43
+ "constraints": [],
44
+ "ownership_field_name": null
45
+ },
46
+ {
47
+ "name": "reservations",
48
+ "min_role_read": 1,
49
+ "min_role_write": 1,
50
+ "versioned": false,
51
+ "fields": [
52
+ {
53
+ "name": "date",
54
+ "label": "date",
55
+ "is_unique": false,
56
+ "calculated": false,
57
+ "stored": false,
58
+ "expression": null,
59
+ "type": "Date",
60
+ "attributes": {},
61
+ "required": false,
62
+ "primary_key": false,
63
+ "description": ""
64
+ },
65
+ {
66
+ "name": "duration",
67
+ "label": "duration",
68
+ "is_unique": false,
69
+ "calculated": false,
70
+ "stored": false,
71
+ "expression": null,
72
+ "type": "Integer",
73
+ "attributes": { "max": null, "min": null },
74
+ "required": false,
75
+ "primary_key": false,
76
+ "description": ""
77
+ },
78
+ {
79
+ "name": "hairdresser",
80
+ "label": "hairdresser",
81
+ "is_unique": false,
82
+ "calculated": false,
83
+ "stored": false,
84
+ "expression": null,
85
+ "type": "Key",
86
+ "reftable_name": "hairdressers",
87
+ "attributes": { "summary_field": "name" },
88
+ "required": true,
89
+ "primary_key": false,
90
+ "reftype": "Integer",
91
+ "refname": "id",
92
+ "description": ""
93
+ },
94
+ {
95
+ "name": "id",
96
+ "label": "ID",
97
+ "is_unique": true,
98
+ "calculated": false,
99
+ "stored": false,
100
+ "expression": null,
101
+ "type": "Integer",
102
+ "attributes": {},
103
+ "required": true,
104
+ "primary_key": true,
105
+ "description": ""
106
+ },
107
+ {
108
+ "name": "name",
109
+ "label": "name",
110
+ "is_unique": false,
111
+ "calculated": false,
112
+ "stored": false,
113
+ "expression": null,
114
+ "type": "String",
115
+ "attributes": {
116
+ "regexp": "",
117
+ "options": "",
118
+ "max_length": null,
119
+ "min_length": null,
120
+ "re_invalid_error": ""
121
+ },
122
+ "required": false,
123
+ "primary_key": false,
124
+ "description": ""
125
+ }
126
+ ],
127
+ "triggers": [],
128
+ "constraints": [],
129
+ "ownership_field_name": null
130
+ }
131
+ ],
132
+ "views": [
133
+ {
134
+ "name": "editreservation",
135
+ "viewtemplate": "Edit",
136
+ "configuration": {
137
+ "fixed": {
138
+ "date": null,
139
+ "duration": null,
140
+ "hairdresser": null,
141
+ "preset_date": ""
142
+ },
143
+ "layout": {
144
+ "above": [
145
+ {
146
+ "widths": [2, 10],
147
+ "besides": [
148
+ {
149
+ "above": [
150
+ null,
151
+ {
152
+ "type": "blank",
153
+ "block": false,
154
+ "contents": "name",
155
+ "labelFor": "name",
156
+ "isFormula": {},
157
+ "textStyle": ""
158
+ }
159
+ ]
160
+ },
161
+ {
162
+ "above": [
163
+ null,
164
+ {
165
+ "type": "field",
166
+ "fieldview": "edit",
167
+ "textStyle": "",
168
+ "field_name": "name",
169
+ "configuration": {}
170
+ }
171
+ ]
172
+ }
173
+ ],
174
+ "breakpoints": ["", ""]
175
+ },
176
+ { "type": "line_break" },
177
+ {
178
+ "type": "action",
179
+ "block": false,
180
+ "rndid": "a95628",
181
+ "minRole": 10,
182
+ "isFormula": {},
183
+ "action_icon": "",
184
+ "action_name": "Save",
185
+ "action_size": "",
186
+ "action_label": "Reserve now",
187
+ "action_style": "btn-primary",
188
+ "configuration": {}
189
+ }
190
+ ]
191
+ },
192
+ "columns": [
193
+ {
194
+ "type": "Field",
195
+ "fieldview": "edit",
196
+ "textStyle": "",
197
+ "field_name": "name",
198
+ "configuration": {}
199
+ },
200
+ {
201
+ "type": "Action",
202
+ "rndid": "a95628",
203
+ "minRole": 10,
204
+ "isFormula": {},
205
+ "action_icon": "",
206
+ "action_name": "Save",
207
+ "action_size": "",
208
+ "action_label": "Reserve now",
209
+ "action_style": "btn-primary",
210
+ "configuration": {}
211
+ }
212
+ ],
213
+ "viewname": "editreservation",
214
+ "exttable_name": null,
215
+ "view_when_done": "reserve"
216
+ },
217
+ "min_role": 1,
218
+ "table": "reservations",
219
+ "default_render_page": ""
220
+ },
221
+ {
222
+ "name": "PickHairdresser",
223
+ "viewtemplate": "Filter",
224
+ "configuration": {
225
+ "layout": {
226
+ "type": "dropdown_filter",
227
+ "block": false,
228
+ "field_name": "hairdresser",
229
+ "full_width": false,
230
+ "neutral_label": ""
231
+ },
232
+ "columns": [
233
+ {
234
+ "type": "DropDownFilter",
235
+ "block": false,
236
+ "field_name": "hairdresser",
237
+ "full_width": false,
238
+ "neutral_label": ""
239
+ }
240
+ ],
241
+ "viewname": "PickHairdresser",
242
+ "exttable_name": null
243
+ },
244
+ "min_role": 4,
245
+ "table": "reservations",
246
+ "default_render_page": ""
247
+ },
248
+ {
249
+ "name": "reserve",
250
+ "viewtemplate": "Reserve",
251
+ "configuration": {
252
+ "services": [{ "title": "haircut", "duration": "30" }],
253
+ "viewname": "reserve",
254
+ "start_field": "date",
255
+ "availability": [
256
+ { "to": "17", "day": "Mon-Fri", "from": "9" },
257
+ { "to": "16", "day": "Saturday", "from": "10" },
258
+ { "to": "18", "day": "Sunday", "from": "12" }
259
+ ],
260
+ "exttable_name": null,
261
+ "duration_field": "duration",
262
+ "view_to_create": "editreservation",
263
+ "confirmation_view": "showreserve",
264
+ "reservable_entity_key": "hairdresser"
265
+ },
266
+ "min_role": 1,
267
+ "table": "reservations",
268
+ "menu_label": "reserve",
269
+ "default_render_page": "reserve_page"
270
+ },
271
+ {
272
+ "name": "showreserve",
273
+ "viewtemplate": "Show",
274
+ "configuration": {
275
+ "layout": {
276
+ "above": [
277
+ {
278
+ "widths": [2, 10],
279
+ "besides": [
280
+ {
281
+ "above": [
282
+ null,
283
+ {
284
+ "type": "blank",
285
+ "block": false,
286
+ "contents": "date",
287
+ "labelFor": "",
288
+ "isFormula": {},
289
+ "textStyle": ""
290
+ }
291
+ ]
292
+ },
293
+ {
294
+ "above": [
295
+ null,
296
+ {
297
+ "type": "field",
298
+ "fieldview": "show",
299
+ "textStyle": "",
300
+ "field_name": "date",
301
+ "configuration": {}
302
+ }
303
+ ]
304
+ }
305
+ ],
306
+ "breakpoints": ["", ""]
307
+ },
308
+ { "type": "line_break" },
309
+ {
310
+ "widths": [2, 10],
311
+ "besides": [
312
+ {
313
+ "above": [
314
+ null,
315
+ {
316
+ "type": "blank",
317
+ "block": false,
318
+ "contents": "duration",
319
+ "labelFor": "",
320
+ "isFormula": {},
321
+ "textStyle": ""
322
+ }
323
+ ]
324
+ },
325
+ {
326
+ "above": [
327
+ null,
328
+ {
329
+ "type": "field",
330
+ "fieldview": "show",
331
+ "textStyle": "",
332
+ "field_name": "duration",
333
+ "configuration": {}
334
+ }
335
+ ]
336
+ }
337
+ ],
338
+ "breakpoints": ["", ""]
339
+ },
340
+ { "type": "line_break" },
341
+ {
342
+ "widths": [2, 10],
343
+ "besides": [
344
+ {
345
+ "above": [
346
+ null,
347
+ {
348
+ "type": "blank",
349
+ "block": false,
350
+ "contents": "hairdresser",
351
+ "labelFor": "",
352
+ "isFormula": {},
353
+ "textStyle": ""
354
+ }
355
+ ]
356
+ },
357
+ {
358
+ "above": [
359
+ null,
360
+ {
361
+ "type": "join_field",
362
+ "block": false,
363
+ "textStyle": "",
364
+ "join_field": "hairdresser.name"
365
+ }
366
+ ]
367
+ }
368
+ ],
369
+ "breakpoints": ["", ""]
370
+ },
371
+ { "type": "line_break" },
372
+ {
373
+ "widths": [2, 10],
374
+ "besides": [
375
+ {
376
+ "above": [
377
+ null,
378
+ {
379
+ "type": "blank",
380
+ "block": false,
381
+ "contents": "name",
382
+ "labelFor": "",
383
+ "isFormula": {},
384
+ "textStyle": ""
385
+ }
386
+ ]
387
+ },
388
+ {
389
+ "above": [
390
+ null,
391
+ {
392
+ "type": "field",
393
+ "fieldview": "as_text",
394
+ "textStyle": "",
395
+ "field_name": "name",
396
+ "configuration": {}
397
+ }
398
+ ]
399
+ }
400
+ ],
401
+ "breakpoints": ["", ""]
402
+ },
403
+ { "type": "line_break" }
404
+ ]
405
+ },
406
+ "columns": [
407
+ {
408
+ "type": "Field",
409
+ "fieldview": "show",
410
+ "textStyle": "",
411
+ "field_name": "date",
412
+ "configuration": {}
413
+ },
414
+ {
415
+ "type": "Field",
416
+ "fieldview": "show",
417
+ "textStyle": "",
418
+ "field_name": "duration",
419
+ "configuration": {}
420
+ },
421
+ {
422
+ "type": "JoinField",
423
+ "block": false,
424
+ "textStyle": "",
425
+ "join_field": "hairdresser.name"
426
+ },
427
+ {
428
+ "type": "Field",
429
+ "fieldview": "as_text",
430
+ "textStyle": "",
431
+ "field_name": "name",
432
+ "configuration": {}
433
+ }
434
+ ],
435
+ "viewname": "showreserve",
436
+ "page_title": "",
437
+ "exttable_name": null,
438
+ "page_title_formula": false
439
+ },
440
+ "min_role": 1,
441
+ "table": "reservations",
442
+ "default_render_page": ""
443
+ }
444
+ ],
445
+ "plugins": [
446
+ {
447
+ "name": "reservable",
448
+ "source": "npm",
449
+ "location": "@saltcorn/reservable",
450
+ "configuration": null,
451
+ "deploy_private_key": null
452
+ }
453
+ ],
454
+ "pages": [
455
+ {
456
+ "name": "reserve_page",
457
+ "title": "reserve",
458
+ "description": "",
459
+ "min_role": 4,
460
+ "layout": {
461
+ "above": [
462
+ {
463
+ "widths": [6, 6],
464
+ "besides": [
465
+ {
466
+ "icon": "",
467
+ "type": "blank",
468
+ "block": false,
469
+ "contents": "Hairdresser",
470
+ "labelFor": "",
471
+ "isFormula": {},
472
+ "textStyle": ""
473
+ },
474
+ {
475
+ "name": "2f424c",
476
+ "type": "view",
477
+ "view": "PickHairdresser",
478
+ "state": "shared"
479
+ }
480
+ ],
481
+ "breakpoints": ["sm", "sm"]
482
+ },
483
+ {
484
+ "name": "3d986d",
485
+ "type": "view",
486
+ "view": "reserve",
487
+ "state": "shared"
488
+ }
489
+ ]
490
+ },
491
+ "fixed_states": {},
492
+ "root_page_for_roles": []
493
+ }
494
+ ]
495
+ }
package/index.js CHANGED
@@ -428,7 +428,9 @@ const getReservationForm = async ({ table, viewname, config, body, req }) => {
428
428
  throw new InvalidConfiguration("View to create reservation does not exist");
429
429
  const { columns, layout } = view.configuration;
430
430
  const form = await getForm(table, viewname, columns, layout, null, req);
431
- form.hidden(start_field, duration_field, reservable_entity_key, "step");
431
+ form.hidden(start_field, duration_field, "step");
432
+ if (reservable_entity_key) form.hidden(reservable_entity_key);
433
+
432
434
  return form;
433
435
  };
434
436
  const makeReservation = async ({ table, viewname, config, body, req, res }) => {
@@ -492,7 +494,6 @@ const runPost = async (
492
494
  req,
493
495
  });
494
496
  const startDate = new Date(body.date);
495
- console.log({ startDate, body });
496
497
  form.values = {
497
498
  [config.start_field]: startDate.toISOString(),
498
499
  [config.duration_field]: config.services[+body.serviceIx].duration,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/reservable",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Reservable resources",
5
5
  "main": "index.js",
6
6
  "dependencies": {