@sprucelabs/spruce-appointment-utils 7.7.0 → 7.7.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.
- package/build/esm/viewControllers/AbstractCapabilityCardViewController.d.ts +1 -0
- package/build/esm/viewControllers/AbstractCapabilityCardViewController.js +13 -4
- package/build/viewControllers/AbstractCapabilityCardViewController.d.ts +1 -0
- package/build/viewControllers/AbstractCapabilityCardViewController.js +10 -3
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export default abstract class AbstractCapabilityCardViewController extends Abstr
|
|
|
18
18
|
private handleEdit;
|
|
19
19
|
private upsertCapabilities;
|
|
20
20
|
private handleToggleChange;
|
|
21
|
+
private handleEnableChange;
|
|
21
22
|
protected loadVc(organizationId: string): Promise<void>;
|
|
22
23
|
private calculateDuration;
|
|
23
24
|
getCardVc(): import("@sprucelabs/heartwood-view-controllers").CardViewController;
|
|
@@ -42,9 +42,10 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
42
42
|
checkboxInput: {
|
|
43
43
|
name: 'isEnabled',
|
|
44
44
|
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c : false,
|
|
45
|
-
onChange: (value) => {
|
|
45
|
+
onChange: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
46
46
|
this.getListVc().getRowVc(service.id).setIsEnabled(value);
|
|
47
|
-
|
|
47
|
+
yield this.handleEnableChange(service, value !== null && value !== void 0 ? value : false, serviceCapability);
|
|
48
|
+
}),
|
|
48
49
|
},
|
|
49
50
|
},
|
|
50
51
|
{
|
|
@@ -74,7 +75,7 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
74
75
|
onCancel: () => { },
|
|
75
76
|
onSubmit: (price, timeBlocks, serviceRow, serviceRoleCapability) => __awaiter(this, void 0, void 0, function* () {
|
|
76
77
|
yield dlgVc.hide();
|
|
77
|
-
const newServiceCapability = yield this.insertOrUpdateCapability(serviceRow.id, { price, timeBlocks
|
|
78
|
+
const newServiceCapability = yield this.insertOrUpdateCapability(serviceRow.id, { price, timeBlocks }, serviceRoleCapability);
|
|
78
79
|
if (newServiceCapability) {
|
|
79
80
|
this.upsertCapabilities(newServiceCapability, serviceRow);
|
|
80
81
|
}
|
|
@@ -103,7 +104,15 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
103
104
|
var _a;
|
|
104
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
106
|
(_a = this.onUpdateHasCapability) === null || _a === void 0 ? void 0 : _a.call(this, service, value);
|
|
106
|
-
const newCapability = yield this.insertOrUpdateCapability(service.id, {
|
|
107
|
+
const newCapability = yield this.insertOrUpdateCapability(service.id, { doesOffer: value }, capability);
|
|
108
|
+
if (newCapability) {
|
|
109
|
+
this.upsertCapabilities(newCapability, service);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
handleEnableChange(service, value, capability) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const newCapability = yield this.insertOrUpdateCapability(service.id, { isEnabled: value }, capability);
|
|
107
116
|
if (newCapability) {
|
|
108
117
|
this.upsertCapabilities(newCapability, service);
|
|
109
118
|
}
|
|
@@ -18,6 +18,7 @@ export default abstract class AbstractCapabilityCardViewController extends Abstr
|
|
|
18
18
|
private handleEdit;
|
|
19
19
|
private upsertCapabilities;
|
|
20
20
|
private handleToggleChange;
|
|
21
|
+
private handleEnableChange;
|
|
21
22
|
protected loadVc(organizationId: string): Promise<void>;
|
|
22
23
|
private calculateDuration;
|
|
23
24
|
getCardVc(): import("@sprucelabs/heartwood-view-controllers").CardViewController;
|
|
@@ -35,8 +35,9 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
35
35
|
checkboxInput: {
|
|
36
36
|
name: 'isEnabled',
|
|
37
37
|
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c : false,
|
|
38
|
-
onChange: (value) => {
|
|
38
|
+
onChange: async (value) => {
|
|
39
39
|
this.getListVc().getRowVc(service.id).setIsEnabled(value);
|
|
40
|
+
await this.handleEnableChange(service, value !== null && value !== void 0 ? value : false, serviceCapability);
|
|
40
41
|
},
|
|
41
42
|
},
|
|
42
43
|
},
|
|
@@ -66,7 +67,7 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
66
67
|
onCancel: () => { },
|
|
67
68
|
onSubmit: async (price, timeBlocks, serviceRow, serviceRoleCapability) => {
|
|
68
69
|
await dlgVc.hide();
|
|
69
|
-
const newServiceCapability = await this.insertOrUpdateCapability(serviceRow.id, { price, timeBlocks
|
|
70
|
+
const newServiceCapability = await this.insertOrUpdateCapability(serviceRow.id, { price, timeBlocks }, serviceRoleCapability);
|
|
70
71
|
if (newServiceCapability) {
|
|
71
72
|
this.upsertCapabilities(newServiceCapability, serviceRow);
|
|
72
73
|
}
|
|
@@ -93,7 +94,13 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
93
94
|
async handleToggleChange(service, value, capability) {
|
|
94
95
|
var _a;
|
|
95
96
|
(_a = this.onUpdateHasCapability) === null || _a === void 0 ? void 0 : _a.call(this, service, value);
|
|
96
|
-
const newCapability = await this.insertOrUpdateCapability(service.id, {
|
|
97
|
+
const newCapability = await this.insertOrUpdateCapability(service.id, { doesOffer: value }, capability);
|
|
98
|
+
if (newCapability) {
|
|
99
|
+
this.upsertCapabilities(newCapability, service);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async handleEnableChange(service, value, capability) {
|
|
103
|
+
const newCapability = await this.insertOrUpdateCapability(service.id, { isEnabled: value }, capability);
|
|
97
104
|
if (newCapability) {
|
|
98
105
|
this.upsertCapabilities(newCapability, service);
|
|
99
106
|
}
|