@pisell/private-materials 3.0.72 → 3.0.74
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/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +15 -15
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +9 -9
- package/es/components/booking/addons/index.d.ts +1 -1
- package/es/components/booking/addons/model.d.ts +1 -2
- package/es/components/booking/components/footer/amount.js +47 -24
- package/es/components/booking/components/footer/index.js +5 -0
- package/es/components/booking/components/footer/utils.js +22 -1
- package/es/components/booking/deposit/index.js +10 -1
- package/es/components/booking/forms/forms.d.ts +1 -1
- package/es/components/booking/forms/index.d.ts +1 -1
- package/es/components/booking/forms/model.d.ts +1 -2
- package/es/components/booking/index.d.ts +1 -1
- package/es/components/booking/info/index.d.ts +1 -1
- package/es/components/booking/info/model.d.ts +1 -2
- package/es/components/booking/info/service/actions/index.d.ts +6 -0
- package/es/components/booking/info/service/actions/index.js +73 -0
- package/es/components/booking/info/service/actions/index.less +9 -0
- package/es/components/booking/info/service/addTimeModal/index.d.ts +4 -0
- package/es/components/booking/info/service/addTimeModal/index.js +658 -0
- package/es/components/booking/info/service/addTimeModal/index.less +133 -0
- package/es/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
- package/es/components/booking/info/service/addTimeModal/serve.js +50 -0
- package/es/components/booking/info/service/addTimeModal/utils.d.ts +12 -0
- package/es/components/booking/info/service/addTimeModal/utils.js +96 -0
- package/es/components/booking/info/service/index.js +2 -1
- package/es/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
- package/es/components/booking/info/service/serviceItem/Sales/index.js +0 -0
- package/es/components/booking/info/service/serviceItem/Sales/index.less +0 -0
- package/es/components/booking/info/service/serviceItem/index.js +24 -2
- package/es/components/booking/info/service/serviceItem/index.less +28 -0
- package/es/components/booking/locales.d.ts +24 -0
- package/es/components/booking/locales.js +26 -2
- package/es/components/booking/model.d.ts +3 -2
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/booking/notes/model.d.ts +1 -2
- package/es/components/booking/payments/index.d.ts +1 -1
- package/es/components/booking/payments/model.d.ts +1 -2
- package/es/components/booking/utils.d.ts +12 -0
- package/es/components/booking/utils.js +91 -48
- package/es/components/schedules/index.d.ts +1 -1
- package/es/components/schedules/model.d.ts +1 -2
- package/lib/components/booking/addons/index.d.ts +1 -1
- package/lib/components/booking/addons/model.d.ts +1 -2
- package/lib/components/booking/components/footer/amount.js +10 -0
- package/lib/components/booking/components/footer/index.js +5 -0
- package/lib/components/booking/components/footer/utils.js +21 -1
- package/lib/components/booking/deposit/index.js +3 -1
- package/lib/components/booking/forms/forms.d.ts +1 -1
- package/lib/components/booking/forms/index.d.ts +1 -1
- package/lib/components/booking/forms/model.d.ts +1 -2
- package/lib/components/booking/index.d.ts +1 -1
- package/lib/components/booking/info/index.d.ts +1 -1
- package/lib/components/booking/info/model.d.ts +1 -2
- package/lib/components/booking/info/service/actions/index.d.ts +6 -0
- package/lib/components/booking/info/service/actions/index.js +97 -0
- package/lib/components/booking/info/service/actions/index.less +9 -0
- package/lib/components/booking/info/service/addTimeModal/index.d.ts +4 -0
- package/lib/components/booking/info/service/addTimeModal/index.js +566 -0
- package/lib/components/booking/info/service/addTimeModal/index.less +133 -0
- package/lib/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
- package/lib/components/booking/info/service/addTimeModal/serve.js +39 -0
- package/lib/components/booking/info/service/addTimeModal/utils.d.ts +12 -0
- package/lib/components/booking/info/service/addTimeModal/utils.js +129 -0
- package/lib/components/booking/info/service/index.js +2 -1
- package/lib/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
- package/lib/components/booking/info/service/serviceItem/Sales/index.js +0 -0
- package/lib/components/booking/info/service/serviceItem/Sales/index.less +0 -0
- package/lib/components/booking/info/service/serviceItem/index.js +14 -1
- package/lib/components/booking/info/service/serviceItem/index.less +28 -0
- package/lib/components/booking/locales.d.ts +24 -0
- package/lib/components/booking/locales.js +26 -2
- package/lib/components/booking/model.d.ts +3 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/booking/notes/model.d.ts +1 -2
- package/lib/components/booking/payments/index.d.ts +1 -1
- package/lib/components/booking/payments/model.d.ts +1 -2
- package/lib/components/booking/utils.d.ts +12 -0
- package/lib/components/booking/utils.js +82 -33
- package/lib/components/schedules/index.d.ts +1 -1
- package/lib/components/schedules/model.d.ts +1 -2
- package/package.json +2 -2
|
@@ -219,6 +219,51 @@ export var formatProductListByCategory = function formatProductListByCategory(li
|
|
|
219
219
|
}
|
|
220
220
|
return Object.values(categoryObject);
|
|
221
221
|
};
|
|
222
|
+
export var getResourceTimeIsUsable = function getResourceTimeIsUsable(item, cacheItem) {
|
|
223
|
+
var startDate = dayjs(cacheItem._extend.start_date.format("YYYY-MM-DD") + ' ' + getServeStartTime(cacheItem._extend.start_time));
|
|
224
|
+
var isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
|
|
225
|
+
|
|
226
|
+
// 是否在最大预约数量的区间内
|
|
227
|
+
var isMaxLimitRange = false;
|
|
228
|
+
|
|
229
|
+
// 是否在日期范围内
|
|
230
|
+
var isDateRange = false;
|
|
231
|
+
var time = _objectSpread({}, item);
|
|
232
|
+
// 已预约的数量 + 当前数量 <= 最大可预约数量 为可预约
|
|
233
|
+
if (time.max_participants_limit == 0) {
|
|
234
|
+
isMaxLimitRange = true;
|
|
235
|
+
} else {
|
|
236
|
+
// unknown 为 未知的, 需要掉接口确认是否可用
|
|
237
|
+
isMaxLimitRange = "unknown";
|
|
238
|
+
}
|
|
239
|
+
var timeStartDate = dayjs(time.start_date + " " + time.start_time).subtract(1, "second");
|
|
240
|
+
var timeEndDate = dayjs(time.end_date + " " + time.end_time).add(1, "second");
|
|
241
|
+
var bol;
|
|
242
|
+
|
|
243
|
+
// 灵活时长的 只判断开始时间是否在范围内
|
|
244
|
+
if (isFlexible) {
|
|
245
|
+
bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
|
|
246
|
+
} else {
|
|
247
|
+
// 其余判断 开始时间 和 结束时间 是否都在范围内
|
|
248
|
+
var endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), "minute");
|
|
249
|
+
bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// 是否在时间范围内
|
|
253
|
+
if (bol) {
|
|
254
|
+
isDateRange = true;
|
|
255
|
+
}
|
|
256
|
+
// 是否可用
|
|
257
|
+
var isUsable = isDateRange;
|
|
258
|
+
|
|
259
|
+
// 储存到拓展数据内
|
|
260
|
+
time._extend = {
|
|
261
|
+
isMaxLimitRange: isMaxLimitRange,
|
|
262
|
+
isDateRange: isDateRange,
|
|
263
|
+
isUsable: isUsable
|
|
264
|
+
};
|
|
265
|
+
return time;
|
|
266
|
+
};
|
|
222
267
|
|
|
223
268
|
/**
|
|
224
269
|
* @title: 查找是否有可用的time
|
|
@@ -228,59 +273,18 @@ export var formatProductListByCategory = function formatProductListByCategory(li
|
|
|
228
273
|
* @Author: zhiwei.Wang
|
|
229
274
|
* @Date: 2024-01-09 13:57
|
|
230
275
|
*/
|
|
231
|
-
var formatTimes = function formatTimes(resourceItem, cacheItem) {
|
|
276
|
+
export var formatTimes = function formatTimes(resourceItem, cacheItem) {
|
|
232
277
|
// 可用的time列表
|
|
233
278
|
var usableTimes = [];
|
|
234
279
|
var _resourceItem = _objectSpread({}, resourceItem);
|
|
235
|
-
var startDate = dayjs(cacheItem._extend.start_date.format("YYYY-MM-DD") + ' ' + getServeStartTime(cacheItem._extend.start_time));
|
|
236
|
-
var isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
|
|
237
280
|
// 循环times 区分可用和不可用的 并打上标记
|
|
238
|
-
_resourceItem.times = _resourceItem.times.map(function (
|
|
239
|
-
|
|
240
|
-
var isMaxLimitRange = false;
|
|
241
|
-
|
|
242
|
-
// 是否在日期范围内
|
|
243
|
-
var isDateRange = false;
|
|
244
|
-
var time = _objectSpread({}, d);
|
|
245
|
-
// 已预约的数量 + 当前数量 <= 最大可预约数量 为可预约
|
|
246
|
-
if (time.max_participants_limit == 0) {
|
|
247
|
-
isMaxLimitRange = true;
|
|
248
|
-
} else {
|
|
249
|
-
// unknown 为 未知的, 需要掉接口确认是否可用
|
|
250
|
-
isMaxLimitRange = "unknown";
|
|
251
|
-
}
|
|
252
|
-
var timeStartDate = dayjs(time.start_date + " " + time.start_time).subtract(1, "second");
|
|
253
|
-
var timeEndDate = dayjs(time.end_date + " " + time.end_time).add(1, "second");
|
|
254
|
-
var bol;
|
|
255
|
-
|
|
256
|
-
// 灵活时长的 只判断开始时间是否在范围内
|
|
257
|
-
if (isFlexible) {
|
|
258
|
-
bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
|
|
259
|
-
} else {
|
|
260
|
-
// 其余判断 开始时间 和 结束时间 是否都在范围内
|
|
261
|
-
var endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), "minute");
|
|
262
|
-
bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// 是否在时间范围内
|
|
266
|
-
if (bol) {
|
|
267
|
-
isDateRange = true;
|
|
268
|
-
}
|
|
269
|
-
// 是否可用
|
|
270
|
-
var isUsable = isDateRange;
|
|
271
|
-
|
|
272
|
-
// 储存到拓展数据内
|
|
273
|
-
time._extend = {
|
|
274
|
-
isMaxLimitRange: isMaxLimitRange,
|
|
275
|
-
isDateRange: isDateRange,
|
|
276
|
-
isUsable: isUsable
|
|
277
|
-
};
|
|
278
|
-
|
|
281
|
+
_resourceItem.times = _resourceItem.times.map(function (time) {
|
|
282
|
+
var _time = getResourceTimeIsUsable(time, cacheItem);
|
|
279
283
|
// 取出可用的列表
|
|
280
|
-
if (isUsable) {
|
|
281
|
-
usableTimes.push(
|
|
284
|
+
if (_time !== null && _time !== void 0 && _time._extend.isUsable) {
|
|
285
|
+
usableTimes.push(_time);
|
|
282
286
|
}
|
|
283
|
-
return
|
|
287
|
+
return _time;
|
|
284
288
|
});
|
|
285
289
|
|
|
286
290
|
// 获取第一个最佳的time
|
|
@@ -376,6 +380,13 @@ export var flexibleObj = {
|
|
|
376
380
|
return false;
|
|
377
381
|
}
|
|
378
382
|
return str.indexOf('flexible_') > -1;
|
|
383
|
+
},
|
|
384
|
+
add: function add(current, duration) {
|
|
385
|
+
if (flexibleObj.isFlexible(current)) {
|
|
386
|
+
return flexibleObj.create(flexibleObj.getValue(current) + duration);
|
|
387
|
+
} else {
|
|
388
|
+
return Number(current) + duration;
|
|
389
|
+
}
|
|
379
390
|
}
|
|
380
391
|
};
|
|
381
392
|
|
|
@@ -491,7 +502,9 @@ export var formatResource = function formatResource(resourceItem, cacheItem, for
|
|
|
491
502
|
_resourceItem.labelText = _resourceItem.room_name || _resourceItem.name;
|
|
492
503
|
var usable = _resourceItem._extend.usableTime && _resourceItem._extend.usableProduct;
|
|
493
504
|
_resourceItem.usable = usable;
|
|
494
|
-
|
|
505
|
+
if (formatLabel) {
|
|
506
|
+
_resourceItem.label = formatLabel(_resourceItem);
|
|
507
|
+
}
|
|
495
508
|
return _resourceItem;
|
|
496
509
|
};
|
|
497
510
|
|
|
@@ -631,4 +644,34 @@ export var isWalkIn = function isWalkIn(customer_id) {
|
|
|
631
644
|
return ['', '0', '1'].includes(customer_id);
|
|
632
645
|
}
|
|
633
646
|
return [0, 1].includes(customer_id);
|
|
647
|
+
};
|
|
648
|
+
export var getIsEdit = function getIsEdit(state) {
|
|
649
|
+
var _state$addons, _state$client, _state$date, _state$pet, _state$service, _state$notes, _state$contacts;
|
|
650
|
+
if ((_state$addons = state.addons) !== null && _state$addons !== void 0 && _state$addons.edit) {
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// info 是否有编辑
|
|
655
|
+
if (!state.bookingId) {
|
|
656
|
+
return true;
|
|
657
|
+
}
|
|
658
|
+
if ((_state$client = state.client) !== null && _state$client !== void 0 && _state$client.edit) {
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
if ((_state$date = state.date) !== null && _state$date !== void 0 && _state$date.edit) {
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
if ((_state$pet = state.pet) !== null && _state$pet !== void 0 && _state$pet.edit) {
|
|
665
|
+
return true;
|
|
666
|
+
}
|
|
667
|
+
if ((_state$service = state.service) !== null && _state$service !== void 0 && _state$service.edit) {
|
|
668
|
+
return true;
|
|
669
|
+
}
|
|
670
|
+
if ((_state$notes = state.notes) !== null && _state$notes !== void 0 && _state$notes.edit) {
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
if ((_state$contacts = state.contacts) !== null && _state$contacts !== void 0 && _state$contacts.edit) {
|
|
674
|
+
return true;
|
|
675
|
+
}
|
|
676
|
+
return false;
|
|
634
677
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { CalendarDataItem, ScheduleItem } from "./type";
|
|
3
2
|
import dayjs from "dayjs";
|
|
4
3
|
export interface FormState {
|
|
@@ -69,7 +68,7 @@ export interface FormState {
|
|
|
69
68
|
};
|
|
70
69
|
setGlobalState: Function | null;
|
|
71
70
|
}
|
|
72
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
71
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
73
72
|
state: FormState;
|
|
74
73
|
} & {
|
|
75
74
|
dispatch: (params: {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -25,6 +25,15 @@ __export(amount_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(amount_exports);
|
|
26
26
|
var import_utils = require("../../utils");
|
|
27
27
|
var import_utils2 = require("@pisell/utils");
|
|
28
|
+
var getRelationDetailsTotal = (relation_details) => {
|
|
29
|
+
let total = 0;
|
|
30
|
+
for (let item of relation_details) {
|
|
31
|
+
const number = item.product_quantity || item.num;
|
|
32
|
+
const price = item.payment_price || item.price;
|
|
33
|
+
total += Number(price) * Number(number);
|
|
34
|
+
}
|
|
35
|
+
return total;
|
|
36
|
+
};
|
|
28
37
|
var getProductAmount = (state, isEdit) => {
|
|
29
38
|
var _a, _b;
|
|
30
39
|
let price = 0;
|
|
@@ -33,6 +42,7 @@ var getProductAmount = (state, isEdit) => {
|
|
|
33
42
|
if ((state == null ? void 0 : state.service) || (state == null ? void 0 : state.addons)) {
|
|
34
43
|
for (let item of state == null ? void 0 : state.service.value) {
|
|
35
44
|
price += Number(item._extend.total);
|
|
45
|
+
price += getRelationDetailsTotal(item._extend.relation_details || []);
|
|
36
46
|
duration += import_utils.flexibleObj.getValue(item._extend.duration);
|
|
37
47
|
}
|
|
38
48
|
for (let item of state.addons.value) {
|
|
@@ -73,6 +73,25 @@ var formatProductBundle = (bundle) => {
|
|
|
73
73
|
};
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
+
var getSubType = (item) => {
|
|
77
|
+
var _a;
|
|
78
|
+
const _type = (_a = item.duration) == null ? void 0 : _a.type;
|
|
79
|
+
if (_type && _type !== "days") {
|
|
80
|
+
return _type;
|
|
81
|
+
}
|
|
82
|
+
return "minutes";
|
|
83
|
+
};
|
|
84
|
+
var formatRelationDetails = (list) => {
|
|
85
|
+
return (list || []).map((item) => {
|
|
86
|
+
return {
|
|
87
|
+
num: item.product_quantity,
|
|
88
|
+
price: item.payment_price || 0,
|
|
89
|
+
product_id: item.product_id,
|
|
90
|
+
is_charge_tax: item.is_charge_tax,
|
|
91
|
+
order_detail_id: item.order_detail_id
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
};
|
|
76
95
|
var formatBookings = (data) => {
|
|
77
96
|
const list = data.service.value;
|
|
78
97
|
const eventOtherParams = data.eventOtherParams;
|
|
@@ -105,6 +124,7 @@ var formatBookings = (data) => {
|
|
|
105
124
|
"product_bundle": formatProductBundle((_b = (_a = item._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle),
|
|
106
125
|
"bundle_edit": item._extend.bundle_edit
|
|
107
126
|
},
|
|
127
|
+
"relation_products": formatRelationDetails(item._extend.relation_details),
|
|
108
128
|
"id": item.booking_id || 0,
|
|
109
129
|
"relation_id": item._extend.relation_id,
|
|
110
130
|
"like_status": item._extend.like_status || "common",
|
|
@@ -112,7 +132,7 @@ var formatBookings = (data) => {
|
|
|
112
132
|
"is_all": false,
|
|
113
133
|
"schedule_id": item._extend.schedule_id,
|
|
114
134
|
"end_time": end_time,
|
|
115
|
-
"sub_type":
|
|
135
|
+
"sub_type": getSubType(item),
|
|
116
136
|
"select_date": start_date,
|
|
117
137
|
"start_time": start_time,
|
|
118
138
|
"end_date": end_date,
|
|
@@ -53,7 +53,7 @@ var Deposit = (props) => {
|
|
|
53
53
|
const context = (0, import_useEngineContext.default)();
|
|
54
54
|
const { isTerminal, interaction, action } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
|
|
55
55
|
import_utils2.request.setRequest(context.appHelper.utils.request);
|
|
56
|
-
const { bookingDetail, bookingId, amountSymbol, generatePaymentLink, locale } = globalState;
|
|
56
|
+
const { bookingDetail, bookingId, amountSymbol, generatePaymentLink, locale, callback } = globalState;
|
|
57
57
|
const sendEmail = (id) => {
|
|
58
58
|
action({
|
|
59
59
|
type: "pisell1.sendPayLinkEmail",
|
|
@@ -86,6 +86,7 @@ var Deposit = (props) => {
|
|
|
86
86
|
deposit_amount: 0
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
|
+
callback == null ? void 0 : callback({ order_id: bookingId, afterCloseUpdate: true });
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
});
|
|
@@ -141,6 +142,7 @@ var Deposit = (props) => {
|
|
|
141
142
|
deposit_amount: amount
|
|
142
143
|
}
|
|
143
144
|
});
|
|
145
|
+
callback == null ? void 0 : callback({ order_id: bookingId, afterCloseUpdate: true });
|
|
144
146
|
});
|
|
145
147
|
};
|
|
146
148
|
const handleGoOrderDetail = () => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
2
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
4
3
|
state: FormState;
|
|
5
4
|
} & {
|
|
6
5
|
dispatch: (params: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const Booking: (props: any) =>
|
|
1
|
+
declare const Booking: (props: any) => JSX.Element;
|
|
2
2
|
export default Booking;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormState } from "../model";
|
|
3
2
|
export declare const walkInData: {
|
|
4
3
|
id: number;
|
|
5
4
|
nickname: string;
|
|
6
5
|
};
|
|
7
|
-
export declare const Provider: (ComponentUi: any) => (props: any) =>
|
|
6
|
+
export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
|
|
8
7
|
state: FormState;
|
|
9
8
|
} & {
|
|
10
9
|
dispatch: (params: {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/booking/info/service/actions/index.tsx
|
|
30
|
+
var actions_exports = {};
|
|
31
|
+
__export(actions_exports, {
|
|
32
|
+
default: () => actions_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(actions_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_model = require("../../model");
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_utils = require("../../../utils");
|
|
39
|
+
var import_utils2 = require("../addTimeModal/utils");
|
|
40
|
+
var import_index = require("./index.less");
|
|
41
|
+
var import_utils3 = require("@pisell/utils");
|
|
42
|
+
var Actions = ({ currentService }) => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
|
|
45
|
+
const appointment_card = (0, import_react.useMemo)(() => {
|
|
46
|
+
var _a2, _b2, _c;
|
|
47
|
+
return ((_c = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.information_tab) == null ? void 0 : _c.appointment_card) || {
|
|
48
|
+
quick_time: 1
|
|
49
|
+
};
|
|
50
|
+
}, [(_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.information_tab]);
|
|
51
|
+
const onAddTime = () => {
|
|
52
|
+
dispatch({
|
|
53
|
+
type: "setService",
|
|
54
|
+
payload: {
|
|
55
|
+
addTimeModal: true,
|
|
56
|
+
cacheItem: currentService
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const addTimeProducts = (0, import_react.useMemo)(() => {
|
|
61
|
+
return (state.addTimeProducts || []).some(
|
|
62
|
+
(item) => (0, import_utils2.isUsableProduct)(item.add_time.relation_product, currentService)
|
|
63
|
+
);
|
|
64
|
+
}, [state.addTimeProducts, currentService]);
|
|
65
|
+
const showAddTimeButton = (0, import_react.useMemo)(() => {
|
|
66
|
+
if (state.renderType === "eventBooking") {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
if (state.disabledEdit) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (appointment_card.quick_time !== 1) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if ((0, import_utils.getIsEdit)(state)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if (!addTimeProducts) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}, [state, appointment_card.quick_time, addTimeProducts]);
|
|
83
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "actions-wrap" }, showAddTimeButton && /* @__PURE__ */ import_react.default.createElement(
|
|
84
|
+
import_antd.Button,
|
|
85
|
+
{
|
|
86
|
+
className: "action-item",
|
|
87
|
+
size: "large",
|
|
88
|
+
onClick: (e) => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
onAddTime();
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
import_utils3.locales.getText("page.booking.text.add-time")
|
|
95
|
+
));
|
|
96
|
+
};
|
|
97
|
+
var actions_default = Actions;
|