@pisell/pisellos 0.0.27 → 0.0.29
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/dist/modules/AccountList/index.js +1 -0
- package/dist/solution/BookingByStep/index.d.ts +2 -1
- package/dist/solution/BookingByStep/index.js +55 -46
- package/dist/solution/BookingByStep/utils/resources.js +3 -0
- package/lib/modules/AccountList/index.js +1 -1
- package/lib/solution/BookingByStep/index.d.ts +2 -1
- package/lib/solution/BookingByStep/index.js +43 -44
- package/lib/solution/BookingByStep/utils/resources.js +3 -0
- package/package.json +1 -1
|
@@ -106,10 +106,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
106
106
|
timeSlots: any[];
|
|
107
107
|
selectedResource: any;
|
|
108
108
|
} | undefined;
|
|
109
|
-
autoSelectAccountResources({ holder_id, resources_code, timeSlots, }: {
|
|
109
|
+
autoSelectAccountResources({ holder_id, resources_code, timeSlots, countMap }: {
|
|
110
110
|
holder_id: string;
|
|
111
111
|
resources_code: string | number;
|
|
112
112
|
timeSlots?: TimeSliceItem;
|
|
113
|
+
countMap: Record<number, number>;
|
|
113
114
|
}): {
|
|
114
115
|
selectedResource: any;
|
|
115
116
|
timeSlots?: undefined;
|
|
@@ -479,16 +479,16 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
479
479
|
value: function () {
|
|
480
480
|
var _setLoginAccount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(accountId, accountInfo) {
|
|
481
481
|
var _this4 = this;
|
|
482
|
-
var account, cartItems;
|
|
482
|
+
var account, stateAccountId, cartItems;
|
|
483
483
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
484
484
|
while (1) switch (_context11.prev = _context11.next) {
|
|
485
485
|
case 0:
|
|
486
486
|
account = this.store.accountList.getAccount(accountId);
|
|
487
487
|
if (!account) {
|
|
488
|
-
_context11.next =
|
|
488
|
+
_context11.next = 9;
|
|
489
489
|
break;
|
|
490
490
|
}
|
|
491
|
-
|
|
491
|
+
stateAccountId = account.getId();
|
|
492
492
|
account.setAccountInfo(accountInfo);
|
|
493
493
|
// 然后去购物车,把原先关联了 holder_id 为 accountId 的商品,替换为 holder_id = accountInfo.id
|
|
494
494
|
cartItems = this.store.cart.getItems();
|
|
@@ -500,11 +500,12 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
500
500
|
});
|
|
501
501
|
}
|
|
502
502
|
});
|
|
503
|
-
|
|
503
|
+
this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
|
|
504
|
+
_context11.next = 10;
|
|
504
505
|
break;
|
|
505
|
-
case 8:
|
|
506
|
-
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
507
506
|
case 9:
|
|
507
|
+
throw new Error("\u6CA1\u6709\u627E\u5230".concat(accountId, "\u8D26\u6237"));
|
|
508
|
+
case 10:
|
|
508
509
|
case "end":
|
|
509
510
|
return _context11.stop();
|
|
510
511
|
}
|
|
@@ -916,7 +917,8 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
916
917
|
var _accountCartItems$0$_, _accountCartItems$;
|
|
917
918
|
var holder_id = _ref7.holder_id,
|
|
918
919
|
resources_code = _ref7.resources_code,
|
|
919
|
-
timeSlots = _ref7.timeSlots
|
|
920
|
+
timeSlots = _ref7.timeSlots,
|
|
921
|
+
countMap = _ref7.countMap;
|
|
920
922
|
var dateRange = this.store.date.getDateRange();
|
|
921
923
|
var cartItems = this.store.cart.getItems();
|
|
922
924
|
// 取到账号下所有的商品,然后根据商品的 duration 和资源列表,获取所有可用的资源
|
|
@@ -958,6 +960,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
958
960
|
try {
|
|
959
961
|
var _loop2 = function _loop2() {
|
|
960
962
|
var n = _step2.value;
|
|
963
|
+
var recordCount = countMap[n.id] || 0;
|
|
961
964
|
var canUseTime = n.times.find(function (item) {
|
|
962
965
|
return getIsUsableByTimeItem({
|
|
963
966
|
timeSlice: item,
|
|
@@ -966,7 +969,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
966
969
|
end_time: end_time
|
|
967
970
|
},
|
|
968
971
|
resource: n,
|
|
969
|
-
currentCount: 1
|
|
972
|
+
currentCount: recordCount + 1
|
|
970
973
|
});
|
|
971
974
|
});
|
|
972
975
|
if (canUseTime) {
|
|
@@ -1021,6 +1024,7 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1021
1024
|
var resourcesMap = getResourcesMap(resources);
|
|
1022
1025
|
// 一个账号一个账号处理
|
|
1023
1026
|
var errorList = [];
|
|
1027
|
+
var selectResourcesMap = {};
|
|
1024
1028
|
this.store.accountList.getAccounts().forEach(function (account) {
|
|
1025
1029
|
var cartItems = _this7.store.cart.getCartByAccount(account.getId());
|
|
1026
1030
|
// 这里必须每次循环重新读,避免前一次循环操作了购物车,导致数据变更
|
|
@@ -1031,10 +1035,17 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1031
1035
|
var res = _this7.autoSelectAccountResources({
|
|
1032
1036
|
holder_id: item.holder_id,
|
|
1033
1037
|
resources_code: resources_code,
|
|
1034
|
-
timeSlots: timeSlots
|
|
1038
|
+
timeSlots: timeSlots,
|
|
1039
|
+
countMap: selectResourcesMap
|
|
1035
1040
|
});
|
|
1036
1041
|
if (res !== null && res !== void 0 && res.selectedResource) {
|
|
1042
|
+
if (!selectResourcesMap[res.selectedResource.id]) {
|
|
1043
|
+
selectResourcesMap[res.selectedResource.id] = 1;
|
|
1044
|
+
} else {
|
|
1045
|
+
selectResourcesMap[res.selectedResource.id]++;
|
|
1046
|
+
}
|
|
1037
1047
|
console.log(_this7.store.cart.getItems());
|
|
1048
|
+
res.selectedResource.capacity = 1;
|
|
1038
1049
|
_this7.store.cart.updateItem({
|
|
1039
1050
|
_id: item._id,
|
|
1040
1051
|
// 这里要做去重,避免出现同样类型的资源被塞进同一个商品
|
|
@@ -1056,11 +1067,13 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1056
1067
|
return n.code === resources_code;
|
|
1057
1068
|
})) === null || _productResources$fin === void 0 ? void 0 : _productResources$fin.renderList;
|
|
1058
1069
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
1070
|
+
var targetResource = targetRenderList[0];
|
|
1071
|
+
targetResource.capacity = 1;
|
|
1059
1072
|
_this7.store.cart.updateItem({
|
|
1060
1073
|
_id: item._id,
|
|
1061
1074
|
resources: [].concat(_toConsumableArray((item._origin.resources || []).filter(function (existingRes) {
|
|
1062
1075
|
return existingRes.resourceType !== targetRenderList[0].resourceType;
|
|
1063
|
-
})), [
|
|
1076
|
+
})), [targetResource])
|
|
1064
1077
|
});
|
|
1065
1078
|
} else {
|
|
1066
1079
|
// 如果没有可用的技师了,推到错误列表里让 UI 去提示
|
|
@@ -1122,47 +1135,43 @@ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
|
|
|
1122
1135
|
}
|
|
1123
1136
|
|
|
1124
1137
|
// 提交时间切片,绑定到对应购物车的商品上,更新购物车
|
|
1125
|
-
// submitTimeSlot({
|
|
1126
|
-
// resourceProductData,
|
|
1127
|
-
// selectedResources,
|
|
1128
|
-
// timeSlots,
|
|
1129
|
-
// }: {
|
|
1130
|
-
// resourceProductData: any;
|
|
1131
|
-
// selectedResources: any[];
|
|
1132
|
-
// timeSlots: TimeSliceItem;
|
|
1133
|
-
// }) {
|
|
1134
|
-
// const newResources = cloneDeep(selectedResources);
|
|
1135
|
-
// newResources.forEach((n) => {
|
|
1136
|
-
// n.startTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
1137
|
-
// n.endTime = dayjs(n.startTime)
|
|
1138
|
-
// .add(
|
|
1139
|
-
// resourceProductData.product.duration.value,
|
|
1140
|
-
// resourceProductData.product.duration.type
|
|
1141
|
-
// )
|
|
1142
|
-
// .format("YYYY-MM-DD HH:mm");
|
|
1143
|
-
// delete n.times;
|
|
1144
|
-
// });
|
|
1145
|
-
// this.store.cart.updateItem({
|
|
1146
|
-
// _id: resourceProductData._id,
|
|
1147
|
-
// resources: newResources,
|
|
1148
|
-
// });
|
|
1149
|
-
// }
|
|
1150
1138
|
}, {
|
|
1151
1139
|
key: "submitTimeSlot",
|
|
1152
1140
|
value: function submitTimeSlot(timeSlots) {
|
|
1153
1141
|
var _this9 = this;
|
|
1142
|
+
// 以账号为维度处理数据。购物车里每一项的 startTime应该是前一个商品的 endTime,如果是第一个商品则用 timeSlots.start_at
|
|
1154
1143
|
var cartItems = this.store.cart.getItems();
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1144
|
+
|
|
1145
|
+
// 按账号分组
|
|
1146
|
+
var itemsByAccount = cartItems.reduce(function (acc, item) {
|
|
1147
|
+
var holderId = item.holder_id;
|
|
1148
|
+
if (!acc[holderId]) {
|
|
1149
|
+
acc[holderId] = [];
|
|
1150
|
+
}
|
|
1151
|
+
acc[holderId].push(item);
|
|
1152
|
+
return acc;
|
|
1153
|
+
}, {});
|
|
1154
|
+
|
|
1155
|
+
// 处理每个账号的商品
|
|
1156
|
+
Object.values(itemsByAccount).forEach(function (accountItems) {
|
|
1157
|
+
var currentStartTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
1158
|
+
accountItems.forEach(function (item, index) {
|
|
1159
|
+
var newResources = cloneDeep(item._origin.resources);
|
|
1160
|
+
newResources.forEach(function (resource) {
|
|
1161
|
+
var _item$_productOrigin$2, _item$_productOrigin4, _ref8, _item$_productOrigin5;
|
|
1162
|
+
resource.startTime = currentStartTime;
|
|
1163
|
+
resource.endTime = dayjs(currentStartTime).add((_item$_productOrigin$2 = (_item$_productOrigin4 = item._productOrigin) === null || _item$_productOrigin4 === void 0 || (_item$_productOrigin4 = _item$_productOrigin4.duration) === null || _item$_productOrigin4 === void 0 ? void 0 : _item$_productOrigin4.value) !== null && _item$_productOrigin$2 !== void 0 ? _item$_productOrigin$2 : 0, (_ref8 = (_item$_productOrigin5 = item._productOrigin) === null || _item$_productOrigin5 === void 0 || (_item$_productOrigin5 = _item$_productOrigin5.duration) === null || _item$_productOrigin5 === void 0 ? void 0 : _item$_productOrigin5.type) !== null && _ref8 !== void 0 ? _ref8 : "minutes").format("YYYY-MM-DD HH:mm");
|
|
1164
|
+
delete resource.times;
|
|
1165
|
+
});
|
|
1166
|
+
_this9.store.cart.updateItem({
|
|
1167
|
+
_id: item._id,
|
|
1168
|
+
resources: newResources
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
// 更新下一个商品的开始时间为当前商品的结束时间
|
|
1172
|
+
if (index < accountItems.length - 1) {
|
|
1173
|
+
currentStartTime = newResources[0].endTime;
|
|
1174
|
+
}
|
|
1166
1175
|
});
|
|
1167
1176
|
});
|
|
1168
1177
|
}
|
|
@@ -110,6 +110,9 @@ var checkCapacity = function checkCapacity(_ref) {
|
|
|
110
110
|
resource = _ref.resource,
|
|
111
111
|
_ref$currentCount = _ref.currentCount,
|
|
112
112
|
currentCount = _ref$currentCount === void 0 ? 1 : _ref$currentCount;
|
|
113
|
+
if (currentCount > resource.capacity) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
113
116
|
var conflict = (event_list || []).filter(function (d) {
|
|
114
117
|
return isConflict({
|
|
115
118
|
start_at: d.start_at,
|
|
@@ -116,7 +116,7 @@ var AccountListModule = class extends import_BaseModule.BaseModule {
|
|
|
116
116
|
}
|
|
117
117
|
return account;
|
|
118
118
|
});
|
|
119
|
-
this.core.effects.emit(`${this.name}:changed`, { value: this.store.accountList });
|
|
119
|
+
this.core.effects.emit(`${this.name}:changed`, { path: "accounts", value: this.store.accountList });
|
|
120
120
|
}
|
|
121
121
|
async removeAccount(id) {
|
|
122
122
|
try {
|
|
@@ -106,10 +106,11 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
106
106
|
timeSlots: any[];
|
|
107
107
|
selectedResource: any;
|
|
108
108
|
} | undefined;
|
|
109
|
-
autoSelectAccountResources({ holder_id, resources_code, timeSlots, }: {
|
|
109
|
+
autoSelectAccountResources({ holder_id, resources_code, timeSlots, countMap }: {
|
|
110
110
|
holder_id: string;
|
|
111
111
|
resources_code: string | number;
|
|
112
112
|
timeSlots?: TimeSliceItem;
|
|
113
|
+
countMap: Record<number, number>;
|
|
113
114
|
}): {
|
|
114
115
|
selectedResource: any;
|
|
115
116
|
timeSlots?: undefined;
|
|
@@ -238,7 +238,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
238
238
|
async setLoginAccount(accountId, accountInfo) {
|
|
239
239
|
const account = this.store.accountList.getAccount(accountId);
|
|
240
240
|
if (account) {
|
|
241
|
-
|
|
241
|
+
let stateAccountId = account.getId();
|
|
242
242
|
account.setAccountInfo(accountInfo);
|
|
243
243
|
const cartItems = this.store.cart.getItems();
|
|
244
244
|
cartItems.forEach((item) => {
|
|
@@ -249,6 +249,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
|
+
this.store.accountList.updateAccountListById(stateAccountId, accountInfo);
|
|
252
253
|
} else {
|
|
253
254
|
throw new Error(`没有找到${accountId}账户`);
|
|
254
255
|
}
|
|
@@ -476,7 +477,8 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
476
477
|
autoSelectAccountResources({
|
|
477
478
|
holder_id,
|
|
478
479
|
resources_code,
|
|
479
|
-
timeSlots
|
|
480
|
+
timeSlots,
|
|
481
|
+
countMap
|
|
480
482
|
}) {
|
|
481
483
|
var _a, _b, _c;
|
|
482
484
|
const dateRange = this.store.date.getDateRange();
|
|
@@ -506,12 +508,13 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
506
508
|
const end_time = (0, import_dayjs.default)(`${dateRange[0].date} ${start_time}`).add(duration, durationType).format("HH:mm");
|
|
507
509
|
let targetResource = null;
|
|
508
510
|
for (const n of resources) {
|
|
511
|
+
const recordCount = countMap[n.id] || 0;
|
|
509
512
|
const canUseTime = n.times.find(
|
|
510
513
|
(item) => (0, import_resources.getIsUsableByTimeItem)({
|
|
511
514
|
timeSlice: item,
|
|
512
515
|
time: { start_time, end_time },
|
|
513
516
|
resource: n,
|
|
514
|
-
currentCount: 1
|
|
517
|
+
currentCount: recordCount + 1
|
|
515
518
|
})
|
|
516
519
|
);
|
|
517
520
|
if (canUseTime) {
|
|
@@ -551,6 +554,7 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
551
554
|
});
|
|
552
555
|
const resourcesMap = (0, import_utils.getResourcesMap)(resources);
|
|
553
556
|
const errorList = [];
|
|
557
|
+
const selectResourcesMap = {};
|
|
554
558
|
this.store.accountList.getAccounts().forEach((account) => {
|
|
555
559
|
const cartItems = this.store.cart.getCartByAccount(account.getId());
|
|
556
560
|
const allCartItems = this.store.cart.getItems();
|
|
@@ -560,10 +564,17 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
560
564
|
const res = this.autoSelectAccountResources({
|
|
561
565
|
holder_id: item.holder_id,
|
|
562
566
|
resources_code,
|
|
563
|
-
timeSlots
|
|
567
|
+
timeSlots,
|
|
568
|
+
countMap: selectResourcesMap
|
|
564
569
|
});
|
|
565
570
|
if (res == null ? void 0 : res.selectedResource) {
|
|
571
|
+
if (!selectResourcesMap[res.selectedResource.id]) {
|
|
572
|
+
selectResourcesMap[res.selectedResource.id] = 1;
|
|
573
|
+
} else {
|
|
574
|
+
selectResourcesMap[res.selectedResource.id]++;
|
|
575
|
+
}
|
|
566
576
|
console.log(this.store.cart.getItems());
|
|
577
|
+
res.selectedResource.capacity = 1;
|
|
567
578
|
this.store.cart.updateItem({
|
|
568
579
|
_id: item._id,
|
|
569
580
|
// 这里要做去重,避免出现同样类型的资源被塞进同一个商品
|
|
@@ -582,13 +593,15 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
582
593
|
const productResources = (0, import_resources.getResourcesByProduct)(resourcesMap, item, allCartItems);
|
|
583
594
|
const targetRenderList = (_a = productResources.find((n) => n.code === resources_code)) == null ? void 0 : _a.renderList;
|
|
584
595
|
if (targetRenderList && targetRenderList.length > 0) {
|
|
596
|
+
const targetResource = targetRenderList[0];
|
|
597
|
+
targetResource.capacity = 1;
|
|
585
598
|
this.store.cart.updateItem({
|
|
586
599
|
_id: item._id,
|
|
587
600
|
resources: [
|
|
588
601
|
...(item._origin.resources || []).filter(
|
|
589
602
|
(existingRes) => existingRes.resourceType !== targetRenderList[0].resourceType
|
|
590
603
|
),
|
|
591
|
-
|
|
604
|
+
targetResource
|
|
592
605
|
]
|
|
593
606
|
});
|
|
594
607
|
} else {
|
|
@@ -639,47 +652,33 @@ var BookingByStepImpl = class extends import_BaseModule.BaseModule {
|
|
|
639
652
|
return timeSlots;
|
|
640
653
|
}
|
|
641
654
|
// 提交时间切片,绑定到对应购物车的商品上,更新购物车
|
|
642
|
-
// submitTimeSlot({
|
|
643
|
-
// resourceProductData,
|
|
644
|
-
// selectedResources,
|
|
645
|
-
// timeSlots,
|
|
646
|
-
// }: {
|
|
647
|
-
// resourceProductData: any;
|
|
648
|
-
// selectedResources: any[];
|
|
649
|
-
// timeSlots: TimeSliceItem;
|
|
650
|
-
// }) {
|
|
651
|
-
// const newResources = cloneDeep(selectedResources);
|
|
652
|
-
// newResources.forEach((n) => {
|
|
653
|
-
// n.startTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
654
|
-
// n.endTime = dayjs(n.startTime)
|
|
655
|
-
// .add(
|
|
656
|
-
// resourceProductData.product.duration.value,
|
|
657
|
-
// resourceProductData.product.duration.type
|
|
658
|
-
// )
|
|
659
|
-
// .format("YYYY-MM-DD HH:mm");
|
|
660
|
-
// delete n.times;
|
|
661
|
-
// });
|
|
662
|
-
// this.store.cart.updateItem({
|
|
663
|
-
// _id: resourceProductData._id,
|
|
664
|
-
// resources: newResources,
|
|
665
|
-
// });
|
|
666
|
-
// }
|
|
667
655
|
submitTimeSlot(timeSlots) {
|
|
668
656
|
const cartItems = this.store.cart.getItems();
|
|
669
|
-
cartItems.
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
657
|
+
const itemsByAccount = cartItems.reduce((acc, item) => {
|
|
658
|
+
const holderId = item.holder_id;
|
|
659
|
+
if (!acc[holderId]) {
|
|
660
|
+
acc[holderId] = [];
|
|
661
|
+
}
|
|
662
|
+
acc[holderId].push(item);
|
|
663
|
+
return acc;
|
|
664
|
+
}, {});
|
|
665
|
+
Object.values(itemsByAccount).forEach((accountItems) => {
|
|
666
|
+
let currentStartTime = timeSlots.start_at.format("YYYY-MM-DD HH:mm");
|
|
667
|
+
accountItems.forEach((item, index) => {
|
|
668
|
+
const newResources = (0, import_lodash_es.cloneDeep)(item._origin.resources);
|
|
669
|
+
newResources.forEach((resource) => {
|
|
670
|
+
var _a, _b, _c, _d;
|
|
671
|
+
resource.startTime = currentStartTime;
|
|
672
|
+
resource.endTime = (0, import_dayjs.default)(currentStartTime).add(((_b = (_a = item._productOrigin) == null ? void 0 : _a.duration) == null ? void 0 : _b.value) ?? 0, ((_d = (_c = item._productOrigin) == null ? void 0 : _c.duration) == null ? void 0 : _d.type) ?? "minutes").format("YYYY-MM-DD HH:mm");
|
|
673
|
+
delete resource.times;
|
|
674
|
+
});
|
|
675
|
+
this.store.cart.updateItem({
|
|
676
|
+
_id: item._id,
|
|
677
|
+
resources: newResources
|
|
678
|
+
});
|
|
679
|
+
if (index < accountItems.length - 1) {
|
|
680
|
+
currentStartTime = newResources[0].endTime;
|
|
681
|
+
}
|
|
683
682
|
});
|
|
684
683
|
});
|
|
685
684
|
}
|
|
@@ -72,6 +72,9 @@ var formatResource = (resourceItem, booking) => {
|
|
|
72
72
|
return _resourceItem;
|
|
73
73
|
};
|
|
74
74
|
var checkCapacity = ({ event_list, timeSlice, resource, currentCount = 1 }) => {
|
|
75
|
+
if (currentCount > resource.capacity) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
75
78
|
let conflict = (event_list || []).filter((d) => {
|
|
76
79
|
return isConflict({ start_at: d.start_at, end_at: d.end_at }, { start_at: timeSlice.start_at, end_at: timeSlice.end_at });
|
|
77
80
|
});
|