@sprucelabs/spruce-appointment-utils 8.4.3 → 8.4.6
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/build/addingServices/DurationCard.vc.d.ts +4 -5
- package/build/addingServices/DurationCard.vc.js +3 -6
- package/build/addingServices/DurationList.vc.d.ts +3 -4
- package/build/addingServices/DurationList.vc.js +14 -18
- package/build/addingServices/EditOverrideDetailsCard.vc.d.ts +19 -21
- package/build/addingServices/EditOverrideDetailsCard.vc.js +16 -17
- package/build/esm/addingServices/DurationCard.vc.d.ts +4 -5
- package/build/esm/addingServices/DurationCard.vc.js +3 -6
- package/build/esm/addingServices/DurationList.vc.d.ts +3 -4
- package/build/esm/addingServices/DurationList.vc.js +16 -18
- package/build/esm/addingServices/EditOverrideDetailsCard.vc.d.ts +19 -21
- package/build/esm/addingServices/EditOverrideDetailsCard.vc.js +16 -17
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpruceSchemas as SpruceSchemasCalendarUtils } from '@sprucelabs/calendar-utils';
|
|
2
|
-
import { AbstractViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { AbstractViewController, CardViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
3
3
|
import DurationListViewController from './DurationList.vc';
|
|
4
4
|
export declare type EventTimeBlock = Omit<SpruceSchemasCalendarUtils.CalendarUtils.v2021_05_19.EventTimeBlock, 'durationMinutes'> & {
|
|
5
5
|
durationMinutes?: number;
|
|
@@ -8,17 +8,15 @@ declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
|
8
8
|
export declare type DurationCardViewControllerOptions = ViewControllerOptions;
|
|
9
9
|
export default class DurationCardViewController extends AbstractViewController<Card> {
|
|
10
10
|
static id: string;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
protected listVc: DurationListViewController;
|
|
12
|
+
protected cardVc: CardViewController;
|
|
13
13
|
constructor(options: DurationCardViewControllerOptions);
|
|
14
14
|
private CardVc;
|
|
15
15
|
load(timeBlocks?: EventTimeBlock[]): void;
|
|
16
16
|
setValues(timeBlocks?: EventTimeBlock[]): void;
|
|
17
17
|
private handleClickAddTimeBlock;
|
|
18
18
|
private ListVc;
|
|
19
|
-
getEditTitleFormVc(): import("./EditTimeBlockTitleCard.vc").FormVc | undefined;
|
|
20
19
|
payAttentionToMe(): void;
|
|
21
|
-
getDurationListVc(): DurationListViewController;
|
|
22
20
|
getTimeBlocks(): {
|
|
23
21
|
title?: string | null | undefined;
|
|
24
22
|
isBusy: boolean;
|
|
@@ -28,6 +26,7 @@ export default class DurationCardViewController extends AbstractViewController<C
|
|
|
28
26
|
durationMinutes?: number | undefined;
|
|
29
27
|
id: string;
|
|
30
28
|
}[];
|
|
29
|
+
getDurationListVc(): DurationListViewController;
|
|
31
30
|
render(): SpruceSchemasCalendarUtils.HeartwoodViewControllers.v2021_02_11.Card;
|
|
32
31
|
}
|
|
33
32
|
export {};
|
|
@@ -49,18 +49,15 @@ class DurationCardViewController extends heartwood_view_controllers_1.AbstractVi
|
|
|
49
49
|
ListVc() {
|
|
50
50
|
return this.Controller('appointments.duration-list', {});
|
|
51
51
|
}
|
|
52
|
-
getEditTitleFormVc() {
|
|
53
|
-
return this.listVc.getEditTitleFormVc();
|
|
54
|
-
}
|
|
55
52
|
payAttentionToMe() {
|
|
56
53
|
this.cardVc.payAttentionToMe();
|
|
57
54
|
}
|
|
58
|
-
getDurationListVc() {
|
|
59
|
-
return this.listVc;
|
|
60
|
-
}
|
|
61
55
|
getTimeBlocks() {
|
|
62
56
|
return this.listVc.getTimeBlocks();
|
|
63
57
|
}
|
|
58
|
+
getDurationListVc() {
|
|
59
|
+
return this.listVc;
|
|
60
|
+
}
|
|
64
61
|
render() {
|
|
65
62
|
return this.cardVc.render();
|
|
66
63
|
}
|
|
@@ -2,9 +2,6 @@ import { AbstractViewController, ListViewController, SpruceSchemas, ViewControll
|
|
|
2
2
|
import { EventTimeBlock } from './DurationCard.vc';
|
|
3
3
|
import { FormVc } from './EditTimeBlockTitleCard.vc';
|
|
4
4
|
declare type List = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.List;
|
|
5
|
-
declare type TimeBlockWithId = EventTimeBlock & {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
5
|
export declare type DurationListViewControllerOptions = ViewControllerOptions;
|
|
9
6
|
export default class DurationListViewController extends AbstractViewController<List> {
|
|
10
7
|
static id: string;
|
|
@@ -12,6 +9,7 @@ export default class DurationListViewController extends AbstractViewController<L
|
|
|
12
9
|
private timeBlocksWithId;
|
|
13
10
|
private timeBlockRowIdx;
|
|
14
11
|
private editTitleFormVc?;
|
|
12
|
+
private hasAlertedAboutBusy;
|
|
15
13
|
constructor(options: DurationListViewControllerOptions);
|
|
16
14
|
private ListVc;
|
|
17
15
|
setValues(timeBlocks: EventTimeBlock[] | undefined): void;
|
|
@@ -28,8 +26,9 @@ export default class DurationListViewController extends AbstractViewController<L
|
|
|
28
26
|
id: string;
|
|
29
27
|
}[];
|
|
30
28
|
private buildRow;
|
|
29
|
+
private alertOnFirstBusyToggle;
|
|
31
30
|
addNewTimeBlock(): void;
|
|
32
|
-
handleClickEditTitle
|
|
31
|
+
private handleClickEditTitle;
|
|
33
32
|
private handleClickDelete;
|
|
34
33
|
getEditTitleFormVc(): FormVc | undefined;
|
|
35
34
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.List;
|
|
@@ -17,6 +17,7 @@ class DurationListViewController extends heartwood_view_controllers_1.AbstractVi
|
|
|
17
17
|
super(options);
|
|
18
18
|
this.timeBlocksWithId = [];
|
|
19
19
|
this.timeBlockRowIdx = 0;
|
|
20
|
+
this.hasAlertedAboutBusy = false;
|
|
20
21
|
this.listVc = this.ListVc();
|
|
21
22
|
}
|
|
22
23
|
ListVc() {
|
|
@@ -67,16 +68,12 @@ class DurationListViewController extends heartwood_view_controllers_1.AbstractVi
|
|
|
67
68
|
button: {
|
|
68
69
|
id: 'edit-title',
|
|
69
70
|
lineIcon: 'edit-line',
|
|
71
|
+
label: (_a = timeBlock.title) !== null && _a !== void 0 ? _a : 'Duration',
|
|
70
72
|
onClick: async () => {
|
|
71
73
|
await this.handleClickEditTitle(timeBlockWithId);
|
|
72
74
|
},
|
|
73
75
|
},
|
|
74
76
|
},
|
|
75
|
-
{
|
|
76
|
-
text: {
|
|
77
|
-
content: (_a = timeBlock.title) !== null && _a !== void 0 ? _a : 'Duration',
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
77
|
{
|
|
81
78
|
textInput: {
|
|
82
79
|
name: 'durationMinutes',
|
|
@@ -103,20 +100,9 @@ class DurationListViewController extends heartwood_view_controllers_1.AbstractVi
|
|
|
103
100
|
toggleInput: {
|
|
104
101
|
name: 'isBusy',
|
|
105
102
|
value: (_b = timeBlock === null || timeBlock === void 0 ? void 0 : timeBlock.isBusy) !== null && _b !== void 0 ? _b : true,
|
|
106
|
-
onChange: (value) => {
|
|
103
|
+
onChange: async (value) => {
|
|
107
104
|
timeBlockWithId.isBusy = value !== null && value !== void 0 ? value : false;
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
button: {
|
|
113
|
-
lineIcon: 'help-circle',
|
|
114
|
-
onClick: async () => {
|
|
115
|
-
await this.alert({
|
|
116
|
-
style: 'info',
|
|
117
|
-
title: 'Mark time as busy?',
|
|
118
|
-
message: `This toggle is how you set this time to be marked as busy or not. If the time is busy, nobody can book the provider during this time. If the time is not busy, people can book over this time.`,
|
|
119
|
-
});
|
|
105
|
+
await this.alertOnFirstBusyToggle();
|
|
120
106
|
},
|
|
121
107
|
},
|
|
122
108
|
},
|
|
@@ -133,6 +119,16 @@ class DurationListViewController extends heartwood_view_controllers_1.AbstractVi
|
|
|
133
119
|
],
|
|
134
120
|
};
|
|
135
121
|
}
|
|
122
|
+
async alertOnFirstBusyToggle() {
|
|
123
|
+
if (!this.hasAlertedAboutBusy) {
|
|
124
|
+
this.hasAlertedAboutBusy = true;
|
|
125
|
+
await this.alert({
|
|
126
|
+
style: 'info',
|
|
127
|
+
title: 'Mark time as busy?',
|
|
128
|
+
message: `This toggle is how you set this time to be marked as busy or not. If the time is busy, nobody can book the provider during this time. If the time is not busy, people can book over this time.`,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
136
132
|
addNewTimeBlock() {
|
|
137
133
|
const timeBlock = {
|
|
138
134
|
id: this.generateBlockId(),
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import { AbstractViewController, FormViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { AbstractViewController, Card, FormViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import DurationListViewController from './DurationList.vc';
|
|
3
|
+
export default class EditOverrideDetailsCardViewController extends AbstractViewController<Card> {
|
|
4
|
+
static id: string;
|
|
5
|
+
private cardVc;
|
|
6
|
+
private formVc;
|
|
7
|
+
private durationListVc;
|
|
8
|
+
private submitHandler;
|
|
9
|
+
private cancelHandler;
|
|
10
|
+
private service;
|
|
11
|
+
private serviceRoleCapability;
|
|
12
|
+
constructor(options: EditOverrideDetailsCardViewControllerOptions);
|
|
13
|
+
private FormVc;
|
|
14
|
+
getDurationListVc(): DurationListViewController;
|
|
15
|
+
private handleClickAddTimeBlock;
|
|
16
|
+
private CardVc;
|
|
17
|
+
getFormVc(): FormVc;
|
|
18
|
+
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
19
|
+
}
|
|
4
20
|
declare const schema: {
|
|
5
21
|
id: string;
|
|
6
22
|
fields: {
|
|
@@ -20,22 +36,4 @@ interface EditOverrideDetailsOptions {
|
|
|
20
36
|
onSubmit: SubmitHandler;
|
|
21
37
|
}
|
|
22
38
|
export declare type EditOverrideDetailsCardViewControllerOptions = ViewControllerOptions & EditOverrideDetailsOptions;
|
|
23
|
-
export default class EditOverrideDetailsCardViewController extends AbstractViewController<Card> {
|
|
24
|
-
static id: string;
|
|
25
|
-
private cardVc;
|
|
26
|
-
private formVc;
|
|
27
|
-
private durationVc;
|
|
28
|
-
private durationListVc;
|
|
29
|
-
private submitHandler;
|
|
30
|
-
private cancelHandler;
|
|
31
|
-
private service;
|
|
32
|
-
private serviceRoleCapability;
|
|
33
|
-
constructor(options: EditOverrideDetailsCardViewControllerOptions);
|
|
34
|
-
private FormVc;
|
|
35
|
-
private handleClickAddTimeBlock;
|
|
36
|
-
private CardVc;
|
|
37
|
-
getFormVc(): FormVc;
|
|
38
|
-
getDurationVc(): DurationCardViewController;
|
|
39
|
-
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
40
|
-
}
|
|
41
39
|
export {};
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
4
4
|
const schema_1 = require("@sprucelabs/schema");
|
|
5
|
-
const schema = (0, schema_1.buildSchema)({
|
|
6
|
-
id: 'priceSchema',
|
|
7
|
-
fields: {
|
|
8
|
-
price: {
|
|
9
|
-
type: 'number',
|
|
10
|
-
label: 'Price',
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
5
|
class EditOverrideDetailsCardViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
15
6
|
constructor(options) {
|
|
16
7
|
var _a, _b, _c;
|
|
@@ -20,9 +11,8 @@ class EditOverrideDetailsCardViewController extends heartwood_view_controllers_1
|
|
|
20
11
|
this.serviceRoleCapability = options === null || options === void 0 ? void 0 : options.serviceRoleCapability;
|
|
21
12
|
this.submitHandler = options.onSubmit;
|
|
22
13
|
this.cancelHandler = options.onCancel;
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
this.durationListVc = this.durationVc.getDurationListVc();
|
|
14
|
+
this.durationListVc = this.Controller('appointments.duration-list', {});
|
|
15
|
+
this.durationListVc.setValues((_b = (_a = this.serviceRoleCapability) === null || _a === void 0 ? void 0 : _a.timeBlocks) !== null && _b !== void 0 ? _b : (_c = this.service) === null || _c === void 0 ? void 0 : _c.timeBlocks);
|
|
26
16
|
this.formVc = this.FormVc();
|
|
27
17
|
this.cardVc = this.CardVc();
|
|
28
18
|
}
|
|
@@ -33,7 +23,7 @@ class EditOverrideDetailsCardViewController extends heartwood_view_controllers_1
|
|
|
33
23
|
schema,
|
|
34
24
|
shouldShowCancelButton: false,
|
|
35
25
|
onSubmit: ({ values }) => {
|
|
36
|
-
this.submitHandler(values.price, this.
|
|
26
|
+
this.submitHandler(values.price, this.durationListVc.getTimeBlocks());
|
|
37
27
|
},
|
|
38
28
|
onCancel: () => {
|
|
39
29
|
this.cancelHandler();
|
|
@@ -50,7 +40,7 @@ class EditOverrideDetailsCardViewController extends heartwood_view_controllers_1
|
|
|
50
40
|
},
|
|
51
41
|
{
|
|
52
42
|
title: 'Duration',
|
|
53
|
-
list: this.
|
|
43
|
+
list: this.durationListVc.render(),
|
|
54
44
|
},
|
|
55
45
|
],
|
|
56
46
|
footer: {
|
|
@@ -69,6 +59,9 @@ class EditOverrideDetailsCardViewController extends heartwood_view_controllers_1
|
|
|
69
59
|
},
|
|
70
60
|
}));
|
|
71
61
|
}
|
|
62
|
+
getDurationListVc() {
|
|
63
|
+
return this.durationListVc;
|
|
64
|
+
}
|
|
72
65
|
handleClickAddTimeBlock() {
|
|
73
66
|
this.durationListVc.addNewTimeBlock();
|
|
74
67
|
}
|
|
@@ -86,12 +79,18 @@ class EditOverrideDetailsCardViewController extends heartwood_view_controllers_1
|
|
|
86
79
|
getFormVc() {
|
|
87
80
|
return this.formVc;
|
|
88
81
|
}
|
|
89
|
-
getDurationVc() {
|
|
90
|
-
return this.durationVc;
|
|
91
|
-
}
|
|
92
82
|
render() {
|
|
93
83
|
return this.cardVc.render();
|
|
94
84
|
}
|
|
95
85
|
}
|
|
96
86
|
exports.default = EditOverrideDetailsCardViewController;
|
|
97
87
|
EditOverrideDetailsCardViewController.id = 'edit-override-details-card';
|
|
88
|
+
const schema = (0, schema_1.buildSchema)({
|
|
89
|
+
id: 'priceSchema',
|
|
90
|
+
fields: {
|
|
91
|
+
price: {
|
|
92
|
+
type: 'number',
|
|
93
|
+
label: 'Price',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SpruceSchemas as SpruceSchemasCalendarUtils } from '@sprucelabs/calendar-utils';
|
|
2
|
-
import { AbstractViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { AbstractViewController, CardViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
3
3
|
import DurationListViewController from './DurationList.vc';
|
|
4
4
|
export declare type EventTimeBlock = Omit<SpruceSchemasCalendarUtils.CalendarUtils.v2021_05_19.EventTimeBlock, 'durationMinutes'> & {
|
|
5
5
|
durationMinutes?: number;
|
|
@@ -8,17 +8,15 @@ declare type Card = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
|
8
8
|
export declare type DurationCardViewControllerOptions = ViewControllerOptions;
|
|
9
9
|
export default class DurationCardViewController extends AbstractViewController<Card> {
|
|
10
10
|
static id: string;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
protected listVc: DurationListViewController;
|
|
12
|
+
protected cardVc: CardViewController;
|
|
13
13
|
constructor(options: DurationCardViewControllerOptions);
|
|
14
14
|
private CardVc;
|
|
15
15
|
load(timeBlocks?: EventTimeBlock[]): void;
|
|
16
16
|
setValues(timeBlocks?: EventTimeBlock[]): void;
|
|
17
17
|
private handleClickAddTimeBlock;
|
|
18
18
|
private ListVc;
|
|
19
|
-
getEditTitleFormVc(): import("./EditTimeBlockTitleCard.vc").FormVc | undefined;
|
|
20
19
|
payAttentionToMe(): void;
|
|
21
|
-
getDurationListVc(): DurationListViewController;
|
|
22
20
|
getTimeBlocks(): {
|
|
23
21
|
title?: string | null | undefined;
|
|
24
22
|
subtitle?: string | null | undefined;
|
|
@@ -28,6 +26,7 @@ export default class DurationCardViewController extends AbstractViewController<C
|
|
|
28
26
|
durationMinutes?: number | undefined;
|
|
29
27
|
id: string;
|
|
30
28
|
}[];
|
|
29
|
+
getDurationListVc(): DurationListViewController;
|
|
31
30
|
render(): SpruceSchemasCalendarUtils.HeartwoodViewControllers.v2021_02_11.Card;
|
|
32
31
|
}
|
|
33
32
|
export {};
|
|
@@ -56,18 +56,15 @@ export default class DurationCardViewController extends AbstractViewController {
|
|
|
56
56
|
ListVc() {
|
|
57
57
|
return this.Controller('appointments.duration-list', {});
|
|
58
58
|
}
|
|
59
|
-
getEditTitleFormVc() {
|
|
60
|
-
return this.listVc.getEditTitleFormVc();
|
|
61
|
-
}
|
|
62
59
|
payAttentionToMe() {
|
|
63
60
|
this.cardVc.payAttentionToMe();
|
|
64
61
|
}
|
|
65
|
-
getDurationListVc() {
|
|
66
|
-
return this.listVc;
|
|
67
|
-
}
|
|
68
62
|
getTimeBlocks() {
|
|
69
63
|
return this.listVc.getTimeBlocks();
|
|
70
64
|
}
|
|
65
|
+
getDurationListVc() {
|
|
66
|
+
return this.listVc;
|
|
67
|
+
}
|
|
71
68
|
render() {
|
|
72
69
|
return this.cardVc.render();
|
|
73
70
|
}
|
|
@@ -2,9 +2,6 @@ import { AbstractViewController, ListViewController, SpruceSchemas, ViewControll
|
|
|
2
2
|
import { EventTimeBlock } from './DurationCard.vc';
|
|
3
3
|
import { FormVc } from './EditTimeBlockTitleCard.vc';
|
|
4
4
|
declare type List = SpruceSchemas.HeartwoodViewControllers.v2021_02_11.List;
|
|
5
|
-
declare type TimeBlockWithId = EventTimeBlock & {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
5
|
export declare type DurationListViewControllerOptions = ViewControllerOptions;
|
|
9
6
|
export default class DurationListViewController extends AbstractViewController<List> {
|
|
10
7
|
static id: string;
|
|
@@ -12,6 +9,7 @@ export default class DurationListViewController extends AbstractViewController<L
|
|
|
12
9
|
private timeBlocksWithId;
|
|
13
10
|
private timeBlockRowIdx;
|
|
14
11
|
private editTitleFormVc?;
|
|
12
|
+
private hasAlertedAboutBusy;
|
|
15
13
|
constructor(options: DurationListViewControllerOptions);
|
|
16
14
|
private ListVc;
|
|
17
15
|
setValues(timeBlocks: EventTimeBlock[] | undefined): void;
|
|
@@ -28,8 +26,9 @@ export default class DurationListViewController extends AbstractViewController<L
|
|
|
28
26
|
id: string;
|
|
29
27
|
}[];
|
|
30
28
|
private buildRow;
|
|
29
|
+
private alertOnFirstBusyToggle;
|
|
31
30
|
addNewTimeBlock(): void;
|
|
32
|
-
handleClickEditTitle
|
|
31
|
+
private handleClickEditTitle;
|
|
33
32
|
private handleClickDelete;
|
|
34
33
|
getEditTitleFormVc(): FormVc | undefined;
|
|
35
34
|
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.List;
|
|
@@ -24,6 +24,7 @@ export default class DurationListViewController extends AbstractViewController {
|
|
|
24
24
|
super(options);
|
|
25
25
|
this.timeBlocksWithId = [];
|
|
26
26
|
this.timeBlockRowIdx = 0;
|
|
27
|
+
this.hasAlertedAboutBusy = false;
|
|
27
28
|
this.listVc = this.ListVc();
|
|
28
29
|
}
|
|
29
30
|
ListVc() {
|
|
@@ -74,16 +75,12 @@ export default class DurationListViewController extends AbstractViewController {
|
|
|
74
75
|
button: {
|
|
75
76
|
id: 'edit-title',
|
|
76
77
|
lineIcon: 'edit-line',
|
|
78
|
+
label: (_a = timeBlock.title) !== null && _a !== void 0 ? _a : 'Duration',
|
|
77
79
|
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
78
80
|
yield this.handleClickEditTitle(timeBlockWithId);
|
|
79
81
|
}),
|
|
80
82
|
},
|
|
81
83
|
},
|
|
82
|
-
{
|
|
83
|
-
text: {
|
|
84
|
-
content: (_a = timeBlock.title) !== null && _a !== void 0 ? _a : 'Duration',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
84
|
{
|
|
88
85
|
textInput: {
|
|
89
86
|
name: 'durationMinutes',
|
|
@@ -110,20 +107,9 @@ export default class DurationListViewController extends AbstractViewController {
|
|
|
110
107
|
toggleInput: {
|
|
111
108
|
name: 'isBusy',
|
|
112
109
|
value: (_b = timeBlock === null || timeBlock === void 0 ? void 0 : timeBlock.isBusy) !== null && _b !== void 0 ? _b : true,
|
|
113
|
-
onChange: (value) => {
|
|
110
|
+
onChange: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
114
111
|
timeBlockWithId.isBusy = value !== null && value !== void 0 ? value : false;
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
button: {
|
|
120
|
-
lineIcon: 'help-circle',
|
|
121
|
-
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
yield this.alert({
|
|
123
|
-
style: 'info',
|
|
124
|
-
title: 'Mark time as busy?',
|
|
125
|
-
message: `This toggle is how you set this time to be marked as busy or not. If the time is busy, nobody can book the provider during this time. If the time is not busy, people can book over this time.`,
|
|
126
|
-
});
|
|
112
|
+
yield this.alertOnFirstBusyToggle();
|
|
127
113
|
}),
|
|
128
114
|
},
|
|
129
115
|
},
|
|
@@ -140,6 +126,18 @@ export default class DurationListViewController extends AbstractViewController {
|
|
|
140
126
|
],
|
|
141
127
|
};
|
|
142
128
|
}
|
|
129
|
+
alertOnFirstBusyToggle() {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
if (!this.hasAlertedAboutBusy) {
|
|
132
|
+
this.hasAlertedAboutBusy = true;
|
|
133
|
+
yield this.alert({
|
|
134
|
+
style: 'info',
|
|
135
|
+
title: 'Mark time as busy?',
|
|
136
|
+
message: `This toggle is how you set this time to be marked as busy or not. If the time is busy, nobody can book the provider during this time. If the time is not busy, people can book over this time.`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
143
141
|
addNewTimeBlock() {
|
|
144
142
|
const timeBlock = {
|
|
145
143
|
id: this.generateBlockId(),
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import { AbstractViewController, FormViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { AbstractViewController, Card, FormViewController, SpruceSchemas, ViewControllerOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import DurationListViewController from './DurationList.vc';
|
|
3
|
+
export default class EditOverrideDetailsCardViewController extends AbstractViewController<Card> {
|
|
4
|
+
static id: string;
|
|
5
|
+
private cardVc;
|
|
6
|
+
private formVc;
|
|
7
|
+
private durationListVc;
|
|
8
|
+
private submitHandler;
|
|
9
|
+
private cancelHandler;
|
|
10
|
+
private service;
|
|
11
|
+
private serviceRoleCapability;
|
|
12
|
+
constructor(options: EditOverrideDetailsCardViewControllerOptions);
|
|
13
|
+
private FormVc;
|
|
14
|
+
getDurationListVc(): DurationListViewController;
|
|
15
|
+
private handleClickAddTimeBlock;
|
|
16
|
+
private CardVc;
|
|
17
|
+
getFormVc(): FormVc;
|
|
18
|
+
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
19
|
+
}
|
|
4
20
|
declare const schema: {
|
|
5
21
|
id: string;
|
|
6
22
|
fields: {
|
|
@@ -20,22 +36,4 @@ interface EditOverrideDetailsOptions {
|
|
|
20
36
|
onSubmit: SubmitHandler;
|
|
21
37
|
}
|
|
22
38
|
export declare type EditOverrideDetailsCardViewControllerOptions = ViewControllerOptions & EditOverrideDetailsOptions;
|
|
23
|
-
export default class EditOverrideDetailsCardViewController extends AbstractViewController<Card> {
|
|
24
|
-
static id: string;
|
|
25
|
-
private cardVc;
|
|
26
|
-
private formVc;
|
|
27
|
-
private durationVc;
|
|
28
|
-
private durationListVc;
|
|
29
|
-
private submitHandler;
|
|
30
|
-
private cancelHandler;
|
|
31
|
-
private service;
|
|
32
|
-
private serviceRoleCapability;
|
|
33
|
-
constructor(options: EditOverrideDetailsCardViewControllerOptions);
|
|
34
|
-
private FormVc;
|
|
35
|
-
private handleClickAddTimeBlock;
|
|
36
|
-
private CardVc;
|
|
37
|
-
getFormVc(): FormVc;
|
|
38
|
-
getDurationVc(): DurationCardViewController;
|
|
39
|
-
render(): SpruceSchemas.HeartwoodViewControllers.v2021_02_11.Card;
|
|
40
|
-
}
|
|
41
39
|
export {};
|
|
@@ -9,15 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { AbstractViewController, buildForm, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
11
|
import { assertOptions, buildSchema } from '@sprucelabs/schema';
|
|
12
|
-
const schema = buildSchema({
|
|
13
|
-
id: 'priceSchema',
|
|
14
|
-
fields: {
|
|
15
|
-
price: {
|
|
16
|
-
type: 'number',
|
|
17
|
-
label: 'Price',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
12
|
export default class EditOverrideDetailsCardViewController extends AbstractViewController {
|
|
22
13
|
constructor(options) {
|
|
23
14
|
var _a, _b, _c;
|
|
@@ -27,9 +18,8 @@ export default class EditOverrideDetailsCardViewController extends AbstractViewC
|
|
|
27
18
|
this.serviceRoleCapability = options === null || options === void 0 ? void 0 : options.serviceRoleCapability;
|
|
28
19
|
this.submitHandler = options.onSubmit;
|
|
29
20
|
this.cancelHandler = options.onCancel;
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
this.durationListVc = this.durationVc.getDurationListVc();
|
|
21
|
+
this.durationListVc = this.Controller('appointments.duration-list', {});
|
|
22
|
+
this.durationListVc.setValues((_b = (_a = this.serviceRoleCapability) === null || _a === void 0 ? void 0 : _a.timeBlocks) !== null && _b !== void 0 ? _b : (_c = this.service) === null || _c === void 0 ? void 0 : _c.timeBlocks);
|
|
33
23
|
this.formVc = this.FormVc();
|
|
34
24
|
this.cardVc = this.CardVc();
|
|
35
25
|
}
|
|
@@ -40,7 +30,7 @@ export default class EditOverrideDetailsCardViewController extends AbstractViewC
|
|
|
40
30
|
schema,
|
|
41
31
|
shouldShowCancelButton: false,
|
|
42
32
|
onSubmit: ({ values }) => {
|
|
43
|
-
this.submitHandler(values.price, this.
|
|
33
|
+
this.submitHandler(values.price, this.durationListVc.getTimeBlocks());
|
|
44
34
|
},
|
|
45
35
|
onCancel: () => {
|
|
46
36
|
this.cancelHandler();
|
|
@@ -57,7 +47,7 @@ export default class EditOverrideDetailsCardViewController extends AbstractViewC
|
|
|
57
47
|
},
|
|
58
48
|
{
|
|
59
49
|
title: 'Duration',
|
|
60
|
-
list: this.
|
|
50
|
+
list: this.durationListVc.render(),
|
|
61
51
|
},
|
|
62
52
|
],
|
|
63
53
|
footer: {
|
|
@@ -76,6 +66,9 @@ export default class EditOverrideDetailsCardViewController extends AbstractViewC
|
|
|
76
66
|
},
|
|
77
67
|
}));
|
|
78
68
|
}
|
|
69
|
+
getDurationListVc() {
|
|
70
|
+
return this.durationListVc;
|
|
71
|
+
}
|
|
79
72
|
handleClickAddTimeBlock() {
|
|
80
73
|
this.durationListVc.addNewTimeBlock();
|
|
81
74
|
}
|
|
@@ -93,11 +86,17 @@ export default class EditOverrideDetailsCardViewController extends AbstractViewC
|
|
|
93
86
|
getFormVc() {
|
|
94
87
|
return this.formVc;
|
|
95
88
|
}
|
|
96
|
-
getDurationVc() {
|
|
97
|
-
return this.durationVc;
|
|
98
|
-
}
|
|
99
89
|
render() {
|
|
100
90
|
return this.cardVc.render();
|
|
101
91
|
}
|
|
102
92
|
}
|
|
103
93
|
EditOverrideDetailsCardViewController.id = 'edit-override-details-card';
|
|
94
|
+
const schema = buildSchema({
|
|
95
|
+
id: 'priceSchema',
|
|
96
|
+
fields: {
|
|
97
|
+
price: {
|
|
98
|
+
type: 'number',
|
|
99
|
+
label: 'Price',
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
});
|