@sprucelabs/spruce-appointment-utils 5.2.5 → 6.0.0
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.
|
@@ -17,7 +17,7 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
17
17
|
ActiveRecordCard(row) {
|
|
18
18
|
return this.Controller('activeRecordCard', buildActiveRecordCard({
|
|
19
19
|
id: row.id,
|
|
20
|
-
columnWidths: ['fill'],
|
|
20
|
+
columnWidths: ['content', 'fill'],
|
|
21
21
|
shouldRenderRowDividers: true,
|
|
22
22
|
header: {
|
|
23
23
|
title: row.name,
|
|
@@ -29,26 +29,36 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
31
|
buildRow(service) {
|
|
32
|
-
var _a, _b, _c, _d;
|
|
32
|
+
var _a, _b, _c, _d, _e, _f;
|
|
33
33
|
const serviceCapability = (_a = this.capabilities) === null || _a === void 0 ? void 0 : _a.find((r) => r.serviceId === service.id);
|
|
34
34
|
return {
|
|
35
35
|
id: service.id,
|
|
36
36
|
onClick: () => __awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
yield this.handleEdit(service, serviceCapability);
|
|
38
38
|
}),
|
|
39
|
+
isEnabled: (_b = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _b !== void 0 ? _b : true,
|
|
39
40
|
cells: [
|
|
41
|
+
{
|
|
42
|
+
checkboxInput: {
|
|
43
|
+
name: 'isEnabled',
|
|
44
|
+
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c : true,
|
|
45
|
+
onChange: (value) => {
|
|
46
|
+
this.getListVc().getRowVc(service.id).setIsEnabled(value);
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
40
50
|
{
|
|
41
51
|
text: {
|
|
42
52
|
content: service.name,
|
|
43
53
|
},
|
|
44
54
|
subText: {
|
|
45
|
-
content: `$${(
|
|
55
|
+
content: `$${(_d = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.price) !== null && _d !== void 0 ? _d : service.price} - ${this.calculateDuration((_e = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.timeBlocks) !== null && _e !== void 0 ? _e : service.timeBlocks)}`,
|
|
46
56
|
},
|
|
47
57
|
},
|
|
48
58
|
{
|
|
49
59
|
toggleInput: {
|
|
50
|
-
name: '
|
|
51
|
-
value: (
|
|
60
|
+
name: 'doesOffer',
|
|
61
|
+
value: (_f = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.doesOffer) !== null && _f !== void 0 ? _f : false,
|
|
52
62
|
onChange: (value) => __awaiter(this, void 0, void 0, function* () {
|
|
53
63
|
yield this.handleToggleChange(service, value !== null && value !== void 0 ? value : false, serviceCapability);
|
|
54
64
|
}),
|
|
@@ -91,7 +101,7 @@ export default class AbstractCapabilityCardViewController extends AbstractViewCo
|
|
|
91
101
|
var _a;
|
|
92
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
93
103
|
(_a = this.onUpdateHasCapability) === null || _a === void 0 ? void 0 : _a.call(this, service, value);
|
|
94
|
-
const newCapability = yield this.insertOrUpdateCapability(service.id, { isEnabled: value }, capability);
|
|
104
|
+
const newCapability = yield this.insertOrUpdateCapability(service.id, { isEnabled: true, doesOffer: value }, capability);
|
|
95
105
|
if (newCapability) {
|
|
96
106
|
this.upsertCapabilities(newCapability, service);
|
|
97
107
|
}
|
|
@@ -57,7 +57,7 @@ export default class RolesCardViewController extends AbstractCapabilityCardViewC
|
|
|
57
57
|
organizationId: (_b = this.organizationId) !== null && _b !== void 0 ? _b : 'org id',
|
|
58
58
|
roleId: this.role.id,
|
|
59
59
|
},
|
|
60
|
-
payload: Object.assign({ serviceId, isEnabled: true }, values),
|
|
60
|
+
payload: Object.assign({ serviceId, doesOffer: true, isEnabled: true }, values),
|
|
61
61
|
});
|
|
62
62
|
return capability;
|
|
63
63
|
}
|
|
@@ -10,7 +10,7 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
10
10
|
ActiveRecordCard(row) {
|
|
11
11
|
return this.Controller('activeRecordCard', (0, heartwood_view_controllers_1.buildActiveRecordCard)({
|
|
12
12
|
id: row.id,
|
|
13
|
-
columnWidths: ['fill'],
|
|
13
|
+
columnWidths: ['content', 'fill'],
|
|
14
14
|
shouldRenderRowDividers: true,
|
|
15
15
|
header: {
|
|
16
16
|
title: row.name,
|
|
@@ -22,26 +22,36 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
24
|
buildRow(service) {
|
|
25
|
-
var _a, _b, _c, _d;
|
|
25
|
+
var _a, _b, _c, _d, _e, _f;
|
|
26
26
|
const serviceCapability = (_a = this.capabilities) === null || _a === void 0 ? void 0 : _a.find((r) => r.serviceId === service.id);
|
|
27
27
|
return {
|
|
28
28
|
id: service.id,
|
|
29
29
|
onClick: async () => {
|
|
30
30
|
await this.handleEdit(service, serviceCapability);
|
|
31
31
|
},
|
|
32
|
+
isEnabled: (_b = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _b !== void 0 ? _b : true,
|
|
32
33
|
cells: [
|
|
34
|
+
{
|
|
35
|
+
checkboxInput: {
|
|
36
|
+
name: 'isEnabled',
|
|
37
|
+
value: (_c = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.isEnabled) !== null && _c !== void 0 ? _c : true,
|
|
38
|
+
onChange: (value) => {
|
|
39
|
+
this.getListVc().getRowVc(service.id).setIsEnabled(value);
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
33
43
|
{
|
|
34
44
|
text: {
|
|
35
45
|
content: service.name,
|
|
36
46
|
},
|
|
37
47
|
subText: {
|
|
38
|
-
content: `$${(
|
|
48
|
+
content: `$${(_d = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.price) !== null && _d !== void 0 ? _d : service.price} - ${this.calculateDuration((_e = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.timeBlocks) !== null && _e !== void 0 ? _e : service.timeBlocks)}`,
|
|
39
49
|
},
|
|
40
50
|
},
|
|
41
51
|
{
|
|
42
52
|
toggleInput: {
|
|
43
|
-
name: '
|
|
44
|
-
value: (
|
|
53
|
+
name: 'doesOffer',
|
|
54
|
+
value: (_f = serviceCapability === null || serviceCapability === void 0 ? void 0 : serviceCapability.doesOffer) !== null && _f !== void 0 ? _f : false,
|
|
45
55
|
onChange: async (value) => {
|
|
46
56
|
await this.handleToggleChange(service, value !== null && value !== void 0 ? value : false, serviceCapability);
|
|
47
57
|
},
|
|
@@ -81,7 +91,7 @@ class AbstractCapabilityCardViewController extends heartwood_view_controllers_1.
|
|
|
81
91
|
async handleToggleChange(service, value, capability) {
|
|
82
92
|
var _a;
|
|
83
93
|
(_a = this.onUpdateHasCapability) === null || _a === void 0 ? void 0 : _a.call(this, service, value);
|
|
84
|
-
const newCapability = await this.insertOrUpdateCapability(service.id, { isEnabled: value }, capability);
|
|
94
|
+
const newCapability = await this.insertOrUpdateCapability(service.id, { isEnabled: true, doesOffer: value }, capability);
|
|
85
95
|
if (newCapability) {
|
|
86
96
|
this.upsertCapabilities(newCapability, service);
|
|
87
97
|
}
|
|
@@ -48,7 +48,7 @@ class RolesCardViewController extends AbstractCapabilityCardViewController_1.def
|
|
|
48
48
|
organizationId: (_b = this.organizationId) !== null && _b !== void 0 ? _b : 'org id',
|
|
49
49
|
roleId: this.role.id,
|
|
50
50
|
},
|
|
51
|
-
payload: Object.assign({ serviceId, isEnabled: true }, values),
|
|
51
|
+
payload: Object.assign({ serviceId, doesOffer: true, isEnabled: true }, values),
|
|
52
52
|
});
|
|
53
53
|
return capability;
|
|
54
54
|
}
|