@pisell/pisellos 0.0.45 → 0.0.47
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.d.ts +2 -2
- package/dist/modules/AccountList/index.js +52 -38
- package/dist/modules/Cart/index.d.ts +1 -1
- package/dist/modules/Cart/index.js +13 -2
- package/dist/modules/Cart/types.d.ts +10 -3
- package/dist/modules/Cart/utils.d.ts +37 -12
- package/dist/modules/Cart/utils.js +78 -48
- package/dist/solution/BookingByStep/index.d.ts +12 -6
- package/dist/solution/BookingByStep/index.js +280 -201
- package/dist/solution/BookingByStep/utils/resources.d.ts +1 -0
- package/dist/solution/BookingByStep/utils/resources.js +26 -8
- package/lib/modules/AccountList/index.d.ts +2 -2
- package/lib/modules/AccountList/index.js +16 -4
- package/lib/modules/Cart/index.d.ts +1 -1
- package/lib/modules/Cart/index.js +11 -1
- package/lib/modules/Cart/types.d.ts +10 -3
- package/lib/modules/Cart/utils.d.ts +37 -12
- package/lib/modules/Cart/utils.js +50 -28
- package/lib/solution/BookingByStep/index.d.ts +12 -6
- package/lib/solution/BookingByStep/index.js +69 -29
- package/lib/solution/BookingByStep/utils/resources.d.ts +1 -0
- package/lib/solution/BookingByStep/utils/resources.js +27 -8
- package/package.json +1 -1
|
@@ -81,7 +81,10 @@ var checkCapacity = ({
|
|
|
81
81
|
currentCount = 1
|
|
82
82
|
}) => {
|
|
83
83
|
if (currentCount > resource.capacity) {
|
|
84
|
-
return
|
|
84
|
+
return {
|
|
85
|
+
status: false,
|
|
86
|
+
capacity: resource.capacity
|
|
87
|
+
};
|
|
85
88
|
}
|
|
86
89
|
let conflict = (event_list || []).filter((d) => {
|
|
87
90
|
return isConflict(
|
|
@@ -91,16 +94,28 @@ var checkCapacity = ({
|
|
|
91
94
|
});
|
|
92
95
|
if (resource.resourceType === "single") {
|
|
93
96
|
if (conflict.length === 0) {
|
|
94
|
-
return
|
|
97
|
+
return {
|
|
98
|
+
status: true,
|
|
99
|
+
capacity: 1
|
|
100
|
+
};
|
|
95
101
|
} else {
|
|
96
|
-
return
|
|
102
|
+
return {
|
|
103
|
+
status: false,
|
|
104
|
+
capacity: 1
|
|
105
|
+
};
|
|
97
106
|
}
|
|
98
107
|
} else {
|
|
99
108
|
let conflictCount = getUseableEventCount(conflict, resource.capacity);
|
|
100
109
|
if (currentCount <= conflictCount) {
|
|
101
|
-
return
|
|
110
|
+
return {
|
|
111
|
+
status: true,
|
|
112
|
+
capacity: conflictCount
|
|
113
|
+
};
|
|
102
114
|
} else {
|
|
103
|
-
return
|
|
115
|
+
return {
|
|
116
|
+
status: false,
|
|
117
|
+
capacity: conflictCount
|
|
118
|
+
};
|
|
104
119
|
}
|
|
105
120
|
}
|
|
106
121
|
};
|
|
@@ -113,21 +128,25 @@ var getIsUsableByTimeItem = ({
|
|
|
113
128
|
let status = {
|
|
114
129
|
afterToDay: false,
|
|
115
130
|
capacity: false,
|
|
116
|
-
usable: false
|
|
131
|
+
usable: false,
|
|
132
|
+
remainingCapacity: 0
|
|
133
|
+
// 剩余容量
|
|
117
134
|
};
|
|
118
135
|
let earliest = (0, import_dayjs.default)();
|
|
119
136
|
if (!checkAfterToDay(timeSlice.start_at, earliest)) {
|
|
120
137
|
return status;
|
|
121
138
|
}
|
|
122
139
|
status.afterToDay = true;
|
|
123
|
-
|
|
140
|
+
const checkCapacityResult = checkCapacity({
|
|
124
141
|
event_list: time == null ? void 0 : time.event_list,
|
|
125
142
|
timeSlice,
|
|
126
143
|
resource,
|
|
127
144
|
currentCount
|
|
128
|
-
})
|
|
145
|
+
});
|
|
146
|
+
if (!checkCapacityResult.status) {
|
|
129
147
|
return status;
|
|
130
148
|
}
|
|
149
|
+
status.remainingCapacity = checkCapacityResult.capacity;
|
|
131
150
|
status.capacity = true;
|
|
132
151
|
status.usable = true;
|
|
133
152
|
return status;
|