@pisell/private-materials 3.3.43 → 3.3.45
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/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +5 -5
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +5 -5
- package/es/businessModel/SalesModel/index.d.ts +0 -1
- package/es/components/Sales/Summary/utils.d.ts +1 -1
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -25
- package/es/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +31 -16
- package/es/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Content/index.js +39 -20
- package/es/components/appointmentBooking/components/Date/index.js +2 -13
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Form/index.js +76 -167
- package/es/components/appointmentBooking/components/Form/utils.d.ts +8 -0
- package/es/components/appointmentBooking/components/Form/utils.js +36 -0
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Header/index.js +78 -46
- package/es/components/appointmentBooking/components/Resource/index.js +92 -115
- package/es/components/appointmentBooking/components/Services/index.js +19 -4
- package/es/components/appointmentBooking/components/TimeSlicing/index.js +20 -27
- package/es/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
- package/es/components/appointmentBooking/context.js +50 -3
- package/es/components/appointmentBooking/deposit/index.d.ts +0 -1
- package/es/components/appointmentBooking/hooks.d.ts +1 -2
- package/es/components/appointmentBooking/hooks.js +377 -269
- package/es/components/appointmentBooking/utils.d.ts +91 -2
- package/es/components/appointmentBooking/utils.js +350 -61
- package/es/components/booking/components/footer/amount.d.ts +24 -0
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/es/components/booking/hooks/useClearCart.d.ts +0 -1
- package/es/components/booking/info/dateRange/index.d.ts +0 -1
- package/es/components/booking/info/service/Lists.d.ts +0 -1
- package/es/components/booking/info/service/addService/index.d.ts +11 -0
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
- package/es/components/booking/info/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/info/service2/Lists.d.ts +0 -1
- package/es/components/booking/info/service2/utils.d.ts +244 -0
- package/es/components/booking/info/utils.d.ts +50 -0
- package/es/components/booking/info2/service/addService/index.d.ts +12 -0
- package/es/components/booking/info2/service/editService/index.d.ts +7 -0
- package/es/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/es/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/es/components/booking/utils.d.ts +172 -0
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/es/components/eftposPay/component/fail/index.d.ts +1 -0
- package/es/components/eftposPay/component/fail/unknow.d.ts +1 -0
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/index.d.ts +1 -0
- package/es/components/eftposPay/pay.d.ts +1 -0
- package/es/components/eftposPay/store/index.d.ts +2 -2
- package/es/components/eftposPay/windcave/windcave.d.ts +1 -0
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Event/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/Resource/index.d.ts +0 -1
- package/es/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/es/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +0 -1
- package/es/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/es/components/eventBooking/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
- package/es/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/RightPanel/index.d.ts +0 -1
- package/es/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/es/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +0 -1
- package/es/components/productExtension/index.d.ts +0 -1
- package/es/components/productSelect/components/TabProduct/index.d.ts +0 -1
- package/es/components/productSelect/components/productGroup/index.d.ts +11 -7
- package/es/components/productSelect/components/productGroup/index.js +32 -19
- package/es/components/productSelect/components/productGroup/index.less +17 -3
- package/es/components/productSelect/index.d.ts +3 -2
- package/es/components/productSelect/index.js +20 -6
- package/es/components/productSelect/index.less +7 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/es/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/es/components/shoppingCart/index.d.ts +0 -1
- package/es/components/ticketBooking/components/addServiceVariant/addService.d.ts +9 -0
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +11 -3
- package/es/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/es/components/ticketBooking/utils/index.d.ts +14 -0
- package/es/components/wallet/hooks/useWalletCard.d.ts +0 -1
- package/es/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/lib/businessModel/SalesModel/index.d.ts +0 -1
- package/lib/components/Sales/Summary/utils.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +0 -5
- package/lib/components/appointmentBooking/components/Cart/Item/Total.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +35 -16
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Content/index.js +37 -21
- package/lib/components/appointmentBooking/components/Date/index.js +0 -6
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Form/index.js +56 -108
- package/lib/components/appointmentBooking/components/Form/utils.d.ts +8 -0
- package/lib/components/appointmentBooking/components/Form/utils.js +49 -0
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Header/index.js +49 -19
- package/lib/components/appointmentBooking/components/Resource/index.js +51 -69
- package/lib/components/appointmentBooking/components/Services/index.js +16 -3
- package/lib/components/appointmentBooking/components/TimeSlicing/index.js +1 -7
- package/lib/components/appointmentBooking/components/Voucher/index.d.ts +0 -1
- package/lib/components/appointmentBooking/context.js +52 -4
- package/lib/components/appointmentBooking/deposit/index.d.ts +0 -1
- package/lib/components/appointmentBooking/hooks.d.ts +1 -2
- package/lib/components/appointmentBooking/hooks.js +153 -57
- package/lib/components/appointmentBooking/utils.d.ts +91 -2
- package/lib/components/appointmentBooking/utils.js +210 -50
- package/lib/components/booking/components/footer/amount.d.ts +24 -0
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +0 -1
- package/lib/components/booking/info/dateRange/index.d.ts +0 -1
- package/lib/components/booking/info/service/Lists.d.ts +0 -1
- package/lib/components/booking/info/service/addService/index.d.ts +11 -0
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +0 -1
- package/lib/components/booking/info/service/serviceItem/index.d.ts +0 -1
- package/lib/components/booking/info/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/info/service2/Lists.d.ts +0 -1
- package/lib/components/booking/info/service2/utils.d.ts +244 -0
- package/lib/components/booking/info/utils.d.ts +50 -0
- package/lib/components/booking/info2/service/addService/index.d.ts +12 -0
- package/lib/components/booking/info2/service/editService/index.d.ts +7 -0
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +0 -1
- package/lib/components/booking/info2/service/serviceList/index.d.ts +0 -1
- package/lib/components/booking/utils.d.ts +172 -0
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/component/fail/failCustom.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/index.d.ts +1 -0
- package/lib/components/eftposPay/component/fail/unknow.d.ts +1 -0
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/index.d.ts +1 -0
- package/lib/components/eftposPay/pay.d.ts +1 -0
- package/lib/components/eftposPay/store/index.d.ts +2 -2
- package/lib/components/eftposPay/windcave/windcave.d.ts +1 -0
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Content/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Event/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Header/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +0 -1
- package/lib/components/eventBooking/components/Provider/SelectHolderModal.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Resource.d.ts +0 -1
- package/lib/components/eventBooking/components/bookingDetailModal/components/Schedule.d.ts +0 -1
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +0 -1
- package/lib/components/eventBooking/components/scheduleCalendar/components/ScheduleTimeItem/index.d.ts +0 -1
- package/lib/components/eventBooking/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +0 -1
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/index.d.ts +0 -1
- package/lib/components/pay/toC/WalletPassBlock/components/WalletUseList/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/Add/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/RightPanel/index.d.ts +0 -1
- package/lib/components/pisellSelectCustomerModal/index.d.ts +0 -1
- package/lib/components/productExtension/fields/Actor/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +0 -1
- package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +0 -1
- package/lib/components/productExtension/index.d.ts +0 -1
- package/lib/components/productSelect/components/TabProduct/index.d.ts +0 -1
- package/lib/components/productSelect/components/productGroup/index.d.ts +11 -7
- package/lib/components/productSelect/components/productGroup/index.js +12 -10
- package/lib/components/productSelect/components/productGroup/index.less +17 -3
- package/lib/components/productSelect/index.d.ts +3 -2
- package/lib/components/productSelect/index.js +17 -3
- package/lib/components/productSelect/index.less +7 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Empty/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +0 -1
- package/lib/components/shoppingCart/hooks/useClearCart.d.ts +0 -1
- package/lib/components/shoppingCart/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/addServiceVariant/addService.d.ts +9 -0
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +9 -1
- package/lib/components/ticketBooking/components/timeBar/index.d.ts +0 -1
- package/lib/components/ticketBooking/utils/index.d.ts +14 -0
- package/lib/components/wallet/hooks/useWalletCard.d.ts +0 -1
- package/lib/components/workSpaceList/components/Modal/index.d.ts +0 -1
- package/lowcode/product-select/meta.ts +18 -34
- package/package.json +4 -4
|
@@ -39,10 +39,8 @@ var import_materials = require("@pisell/materials");
|
|
|
39
39
|
var import_hooks = require("../../hooks");
|
|
40
40
|
var import_context = require("../../context");
|
|
41
41
|
var import_utils = require("../../utils");
|
|
42
|
-
var import_utils2 = require("../../components/Cart/utils");
|
|
43
|
-
var import_utils3 = require("./utils");
|
|
44
42
|
var import_guests = __toESM(require("../../assets/guests.svg"));
|
|
45
|
-
var
|
|
43
|
+
var import_utils2 = require("@pisell/utils");
|
|
46
44
|
var import_index = require("./index.less");
|
|
47
45
|
var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
48
46
|
const [selectedResource, setSelectedResource] = (0, import_react.useState)(0);
|
|
@@ -50,63 +48,19 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
50
48
|
appointmentBooking,
|
|
51
49
|
carts,
|
|
52
50
|
resourceOtherParams,
|
|
53
|
-
setCarts,
|
|
54
51
|
currentStep,
|
|
55
52
|
setResourceOtherParams,
|
|
56
|
-
|
|
57
|
-
setPolicyIds
|
|
53
|
+
currentStepParams
|
|
58
54
|
} = (0, import_context.useAppointmentBookingContext)();
|
|
59
|
-
const {
|
|
60
|
-
getResourceList,
|
|
61
|
-
autoSelectAllProductResources,
|
|
62
|
-
getResourceTimeSlot
|
|
63
|
-
} = (0, import_hooks.useAppointmentBookingResource)();
|
|
55
|
+
const { getResourceList } = (0, import_hooks.useAppointmentBookingResource)();
|
|
64
56
|
const { checkSkipResourceStep } = (0, import_hooks.useIsSkipResourceStep)();
|
|
65
57
|
const { updateStep, nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
66
|
-
const { openLoginModal, isLogin } = (0, import_hooks.useAppointmentBookingLogin)();
|
|
67
|
-
const { getHolders, checkAccount } = (0, import_hooks.useAppointmentBookingAccount)();
|
|
68
|
-
const { isFormSubject } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
69
|
-
const utils = (0, import_hooks.contextUtils)();
|
|
70
58
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
71
59
|
next: async () => {
|
|
72
|
-
var _a, _b, _c;
|
|
73
|
-
const result = (0, import_utils2.checkResource)({ carts, resources });
|
|
74
|
-
if (result) {
|
|
75
|
-
setCarts(result);
|
|
76
|
-
}
|
|
77
|
-
setIsErrorHolder(!!result);
|
|
78
|
-
if (!!result) {
|
|
79
|
-
(0, import_utils3.scrollToFirstErrorCard)();
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
const resultCarts = (0, import_utils.formatCartsResources)(carts, resources, setPolicyIds);
|
|
83
|
-
const stepList = ((_c = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.step) == null ? void 0 : _b.store) == null ? void 0 : _c.stepList) || [];
|
|
84
|
-
const accountLists = await appointmentBooking.getAccounts();
|
|
85
|
-
const checkResult = (0, import_utils.checkHasFormStep)({
|
|
86
|
-
setIsErrorHolder,
|
|
87
|
-
nextStep,
|
|
88
|
-
hasResourceFormId: (resultCarts == null ? void 0 : resultCarts.length) > 0,
|
|
89
|
-
currentStep,
|
|
90
|
-
stepList,
|
|
91
|
-
appointmentBooking,
|
|
92
|
-
locales: import_utils4.locales,
|
|
93
|
-
openLoginModal,
|
|
94
|
-
utils,
|
|
95
|
-
accountLists,
|
|
96
|
-
getHolders,
|
|
97
|
-
checkHolder: import_utils2.checkHolder,
|
|
98
|
-
checkAccount,
|
|
99
|
-
setCarts,
|
|
100
|
-
carts,
|
|
101
|
-
isFormSubject,
|
|
102
|
-
isLogin
|
|
103
|
-
});
|
|
104
|
-
if (checkResult) return;
|
|
105
60
|
setResourceOtherParams({
|
|
106
61
|
...resourceOtherParams,
|
|
107
62
|
errorList: null
|
|
108
63
|
});
|
|
109
|
-
getResourceTimeSlot();
|
|
110
64
|
nextStep();
|
|
111
65
|
}
|
|
112
66
|
}));
|
|
@@ -119,8 +73,6 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
119
73
|
var _a;
|
|
120
74
|
try {
|
|
121
75
|
const _resources = getResourceList();
|
|
122
|
-
await autoSelectAllProductResources();
|
|
123
|
-
getResourceList();
|
|
124
76
|
const skipResourceStep = await checkSkipResourceStep();
|
|
125
77
|
const key = (_a = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a.key;
|
|
126
78
|
updateStep(key, {
|
|
@@ -135,40 +87,70 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
135
87
|
}
|
|
136
88
|
};
|
|
137
89
|
checkAndSkipResourceStep();
|
|
138
|
-
}, []);
|
|
90
|
+
}, [currentStepParams.key]);
|
|
139
91
|
const anyResource = [
|
|
140
92
|
{
|
|
141
93
|
id: 0,
|
|
142
94
|
image: import_guests.default,
|
|
143
|
-
title:
|
|
144
|
-
subtitle:
|
|
95
|
+
title: import_utils2.locales.getText("pisell2.appointment.any.professional"),
|
|
96
|
+
subtitle: import_utils2.locales.getText("pisell2.appointment.for.maximum.availability")
|
|
145
97
|
}
|
|
146
98
|
];
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
99
|
+
const appointmentBoard = (0, import_react.useMemo)(() => {
|
|
100
|
+
return (0, import_utils.currentAppointmentBoard)(
|
|
101
|
+
currentStepParams.key,
|
|
102
|
+
resources,
|
|
103
|
+
appointmentBooking
|
|
104
|
+
);
|
|
105
|
+
}, [currentStepParams.key, resources]);
|
|
106
|
+
const renderLists = (0, import_react.useMemo)(() => {
|
|
107
|
+
if (carts.length > 1 || !(carts == null ? void 0 : carts.length)) {
|
|
108
|
+
return [];
|
|
157
109
|
}
|
|
158
|
-
|
|
110
|
+
return (0, import_utils.currentRenderLists)(resources, appointmentBoard == null ? void 0 : appointmentBoard.form_code);
|
|
111
|
+
}, [resources, appointmentBoard == null ? void 0 : appointmentBoard.form_code, carts]);
|
|
112
|
+
(0, import_react.useEffect)(() => {
|
|
113
|
+
const autoSelectResources = async () => {
|
|
114
|
+
if (!(appointmentBoard == null ? void 0 : appointmentBoard.form_code)) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const res = await appointmentBooking.autoSelectAllProductResources(
|
|
118
|
+
appointmentBoard == null ? void 0 : appointmentBoard.form_code
|
|
119
|
+
);
|
|
120
|
+
setResourceOtherParams({
|
|
121
|
+
...resourceOtherParams,
|
|
122
|
+
...res
|
|
123
|
+
});
|
|
124
|
+
getResourceList();
|
|
125
|
+
const cartItem = carts == null ? void 0 : carts[0];
|
|
126
|
+
appointmentBooking.updateCart({
|
|
127
|
+
_id: cartItem == null ? void 0 : cartItem._id,
|
|
128
|
+
...cartItem
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
autoSelectResources();
|
|
132
|
+
}, [appointmentBoard]);
|
|
159
133
|
const resourcesResult = (0, import_react.useMemo)(() => {
|
|
160
|
-
|
|
161
|
-
|
|
134
|
+
let _anyResource = (appointmentBoard == null ? void 0 : appointmentBoard.isRequired) ? [] : [...anyResource];
|
|
135
|
+
return _anyResource.concat(renderLists || []);
|
|
136
|
+
}, [renderLists, appointmentBoard]);
|
|
162
137
|
const onClick = (e) => {
|
|
163
138
|
var _a;
|
|
164
139
|
setSelectedResource(e.id);
|
|
165
140
|
if (e.id) {
|
|
166
141
|
return appointmentBooking.updateCart({
|
|
167
142
|
_id: (_a = carts == null ? void 0 : carts[0]) == null ? void 0 : _a._id,
|
|
168
|
-
resources: [e
|
|
143
|
+
resources: (0, import_utils.updateCartResources)(carts == null ? void 0 : carts[0], e)
|
|
169
144
|
});
|
|
170
145
|
}
|
|
171
146
|
};
|
|
147
|
+
(0, import_react.useEffect)(() => {
|
|
148
|
+
var _a, _b, _c;
|
|
149
|
+
const selectedResource2 = (_c = (_b = (_a = carts == null ? void 0 : carts[0]) == null ? void 0 : _a._origin) == null ? void 0 : _b.resources) == null ? void 0 : _c.find(
|
|
150
|
+
(item) => (item == null ? void 0 : item.form_id) === (appointmentBoard == null ? void 0 : appointmentBoard.form_id)
|
|
151
|
+
);
|
|
152
|
+
setSelectedResource((selectedResource2 == null ? void 0 : selectedResource2.id) || 0);
|
|
153
|
+
}, [carts, appointmentBoard == null ? void 0 : appointmentBoard.form_id]);
|
|
172
154
|
return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-resource-wrap" }, !(resourcesResult == null ? void 0 : resourcesResult.length) ? /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: true, active: true }) : /* @__PURE__ */ import_react.default.createElement(
|
|
173
155
|
import_materials.PisellCustomCheckboxGroup,
|
|
174
156
|
{
|
|
@@ -188,7 +170,7 @@ var Resource = (0, import_react.forwardRef)((props, ref) => {
|
|
|
188
170
|
}
|
|
189
171
|
);
|
|
190
172
|
},
|
|
191
|
-
columns: (0,
|
|
173
|
+
columns: (0, import_utils2.isMobile)() ? 2 : 3,
|
|
192
174
|
horizontalGap: 16,
|
|
193
175
|
verticalGap: 16,
|
|
194
176
|
onClick: (e) => onClick && onClick(e)
|
|
@@ -48,7 +48,7 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
48
48
|
const { isDateSelectedFirst, isRetailTemplate } = (0, import_hooks.useAppointmentBookingSetting)();
|
|
49
49
|
const { getProducts, checkProductType } = (0, import_hooks.useAppointmentBookingProduct)();
|
|
50
50
|
const { removeStep, nextStep } = (0, import_hooks.useAppointmentBookingStep)();
|
|
51
|
-
const { currentStep, setLoading } = (0, import_context.useAppointmentBookingContext)();
|
|
51
|
+
const { currentStep, setLoading, carts } = (0, import_context.useAppointmentBookingContext)();
|
|
52
52
|
const [products, setProducts] = (0, import_react.useState)(null);
|
|
53
53
|
const [productLoading, setProductLoading] = (0, import_react.useState)(false);
|
|
54
54
|
(0, import_react.useImperativeHandle)(ref, () => ({
|
|
@@ -57,7 +57,7 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
57
57
|
setTimeout(() => {
|
|
58
58
|
nextStep();
|
|
59
59
|
setLoading(false);
|
|
60
|
-
},
|
|
60
|
+
}, 500);
|
|
61
61
|
}
|
|
62
62
|
}));
|
|
63
63
|
(0, import_react.useEffect)(() => {
|
|
@@ -153,6 +153,17 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
};
|
|
156
|
+
const productListSetting = (0, import_react.useMemo)(() => {
|
|
157
|
+
var _a;
|
|
158
|
+
const { customPageData } = ((_a = context.engine) == null ? void 0 : _a.props) || {};
|
|
159
|
+
let productListBlock;
|
|
160
|
+
if (Array.isArray(customPageData == null ? void 0 : customPageData.block)) {
|
|
161
|
+
productListBlock = customPageData.block.find(
|
|
162
|
+
(b) => "product_list" === b.type
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
return (productListBlock == null ? void 0 : productListBlock.setting) || {};
|
|
166
|
+
}, [context]);
|
|
156
167
|
return /* @__PURE__ */ import_react.default.createElement("div", { className: "appointment-service-wrap" }, /* @__PURE__ */ import_react.default.createElement(
|
|
157
168
|
import_productSelect.default,
|
|
158
169
|
{
|
|
@@ -171,7 +182,9 @@ var Services = (0, import_react.forwardRef)((props, ref) => {
|
|
|
171
182
|
tabItemActiveBg: "var(--theme-color)",
|
|
172
183
|
categoryTextColor: "#1B1B1B",
|
|
173
184
|
cardSelectedBg: "var(--theme-color)"
|
|
174
|
-
}
|
|
185
|
+
},
|
|
186
|
+
productListSetting,
|
|
187
|
+
selectedItems: carts
|
|
175
188
|
}
|
|
176
189
|
));
|
|
177
190
|
});
|
|
@@ -65,13 +65,7 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
|
|
|
65
65
|
}, []);
|
|
66
66
|
const getAutoSelect = async (val) => {
|
|
67
67
|
setSelectedTime(val);
|
|
68
|
-
const { resourceCodes } = getResourceList();
|
|
69
|
-
const { errorList } = await appointmentBooking.autoSelectAllProductResources(
|
|
70
|
-
resourceCodes == null ? void 0 : resourceCodes[1],
|
|
71
|
-
val
|
|
72
|
-
);
|
|
73
68
|
const result = await appointmentBooking.submitTimeSlot(val);
|
|
74
|
-
console.log(errorList, result, "wh9896788");
|
|
75
69
|
};
|
|
76
70
|
(0, import_react.useEffect)(() => {
|
|
77
71
|
var _a, _b, _c;
|
|
@@ -81,7 +75,7 @@ var TimeSlicing = (0, import_react.forwardRef)((props, ref) => {
|
|
|
81
75
|
if ((_c = carts == null ? void 0 : carts[0]) == null ? void 0 : _c.start_time) return;
|
|
82
76
|
getAutoSelect(times == null ? void 0 : times[0]);
|
|
83
77
|
}
|
|
84
|
-
}, [times]);
|
|
78
|
+
}, [times, carts]);
|
|
85
79
|
const onClick = async (e) => {
|
|
86
80
|
setSelectedResource(e == null ? void 0 : e.start_time);
|
|
87
81
|
getAutoSelect(e);
|
|
@@ -37,11 +37,12 @@ var import_react = __toESM(require("react"));
|
|
|
37
37
|
var import_hooks = require("./hooks");
|
|
38
38
|
var import_useEngineContext = __toESM(require("../../hooks/useEngineContext"));
|
|
39
39
|
var import_tasks = require("../../utils/tasks");
|
|
40
|
+
var import_utils = require("./utils");
|
|
40
41
|
var AppointmentBookingContext = (0, import_react.createContext)(void 0);
|
|
41
42
|
var AppointmentBookingProvider = ({
|
|
42
43
|
children
|
|
43
44
|
}) => {
|
|
44
|
-
var _a, _b, _c, _d, _e;
|
|
45
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
45
46
|
const policyIdsRef = (0, import_react.useRef)([]);
|
|
46
47
|
const appointmentBooking = (0, import_hooks.useAppointmentBooking)();
|
|
47
48
|
const [summary, setSummary] = (0, import_react.useState)({});
|
|
@@ -57,6 +58,7 @@ var AppointmentBookingProvider = ({
|
|
|
57
58
|
const [isErrorHolder, setIsErrorHolder] = (0, import_react.useState)(false);
|
|
58
59
|
const [tasksManager] = (0, import_react.useState)(() => new import_tasks.TasksManager());
|
|
59
60
|
const [policyParams, setPolicyParams] = (0, import_react.useState)(null);
|
|
61
|
+
const [currentSelectedResources, setCurrentSelectedResources] = (0, import_react.useState)();
|
|
60
62
|
const { appHelper } = (0, import_useEngineContext.default)();
|
|
61
63
|
const symbolic = (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.getSymbolic();
|
|
62
64
|
(0, import_react.useEffect)(() => {
|
|
@@ -75,14 +77,57 @@ var AppointmentBookingProvider = ({
|
|
|
75
77
|
policyParams.callback();
|
|
76
78
|
}
|
|
77
79
|
};
|
|
80
|
+
const stepLists = (0, import_react.useMemo)(() => {
|
|
81
|
+
var _a2, _b2, _c2;
|
|
82
|
+
return ((_c2 = (_b2 = (_a2 = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a2.step) == null ? void 0 : _b2.store) == null ? void 0 : _c2.stepList) || [];
|
|
83
|
+
}, [(_d = (_c = (_b = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _b.step) == null ? void 0 : _c.store) == null ? void 0 : _d.stepList]);
|
|
78
84
|
const isLastStep = (0, import_react.useMemo)(() => {
|
|
79
85
|
var _a2;
|
|
80
86
|
const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
|
|
81
87
|
return key === "confirm-information";
|
|
82
88
|
}, [
|
|
83
|
-
(
|
|
84
|
-
(
|
|
89
|
+
(_e = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _e.key,
|
|
90
|
+
(_h = (_g = (_f = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _f.step) == null ? void 0 : _g.store) == null ? void 0 : _h.stepList
|
|
85
91
|
]);
|
|
92
|
+
const currentStepParams = (0, import_react.useMemo)(() => {
|
|
93
|
+
var _a2;
|
|
94
|
+
const key = (_a2 = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _a2.key;
|
|
95
|
+
const index = stepLists.findIndex((item) => item.key === key);
|
|
96
|
+
return {
|
|
97
|
+
key,
|
|
98
|
+
index,
|
|
99
|
+
stepLists
|
|
100
|
+
};
|
|
101
|
+
}, [(_i = currentStep == null ? void 0 : currentStep.step) == null ? void 0 : _i.key, stepLists]);
|
|
102
|
+
(0, import_react.useEffect)(() => {
|
|
103
|
+
var _a2, _b2;
|
|
104
|
+
if (((_a2 = currentStepParams == null ? void 0 : currentStepParams.key) == null ? void 0 : _a2.startsWith("select-resource")) || ((_b2 = currentStepParams == null ? void 0 : currentStepParams.key) == null ? void 0 : _b2.startsWith("fill-form"))) {
|
|
105
|
+
if (!(carts == null ? void 0 : carts.length) || !(resources == null ? void 0 : resources.length)) {
|
|
106
|
+
return setCurrentSelectedResources(null);
|
|
107
|
+
}
|
|
108
|
+
const currentSelectedResources2 = carts.map((item) => {
|
|
109
|
+
return {
|
|
110
|
+
_id: item == null ? void 0 : item._id,
|
|
111
|
+
currentSelectedResource: (0, import_utils.getCartCurrentResourceData)(
|
|
112
|
+
item,
|
|
113
|
+
currentStepParams == null ? void 0 : currentStepParams.key,
|
|
114
|
+
resources
|
|
115
|
+
)
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
setCurrentSelectedResources(currentSelectedResources2);
|
|
119
|
+
appointmentBooking.setOtherData(
|
|
120
|
+
"current_selected_resources",
|
|
121
|
+
currentSelectedResources2
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}, [currentStepParams == null ? void 0 : currentStepParams.key, carts, resources]);
|
|
125
|
+
(0, import_react.useEffect)(() => {
|
|
126
|
+
const currentSelectedResources2 = appointmentBooking.getOtherData(
|
|
127
|
+
"current_selected_resources"
|
|
128
|
+
);
|
|
129
|
+
setCurrentSelectedResources(currentSelectedResources2 || []);
|
|
130
|
+
}, []);
|
|
86
131
|
const value = {
|
|
87
132
|
appointmentBooking,
|
|
88
133
|
times,
|
|
@@ -116,7 +161,10 @@ var AppointmentBookingProvider = ({
|
|
|
116
161
|
policyIdsRef,
|
|
117
162
|
setPolicyIds,
|
|
118
163
|
openPolicy,
|
|
119
|
-
closePolicy
|
|
164
|
+
closePolicy,
|
|
165
|
+
currentStepParams,
|
|
166
|
+
currentSelectedResources,
|
|
167
|
+
setCurrentSelectedResources
|
|
120
168
|
};
|
|
121
169
|
return /* @__PURE__ */ import_react.default.createElement(AppointmentBookingContext.Provider, { value }, children);
|
|
122
170
|
};
|
|
@@ -75,7 +75,6 @@ export declare const useAppointmentBookingResource: () => {
|
|
|
75
75
|
resources: any;
|
|
76
76
|
resourceCodes: any;
|
|
77
77
|
};
|
|
78
|
-
autoSelectAllProductResources: (index?: number) => Promise<any>;
|
|
79
78
|
};
|
|
80
79
|
/**
|
|
81
80
|
* @title: 是否跳过资源选择步骤
|
|
@@ -85,7 +84,7 @@ export declare const useAppointmentBookingResource: () => {
|
|
|
85
84
|
* @Date: 2025-04-21 11:47
|
|
86
85
|
*/
|
|
87
86
|
export declare const useIsSkipResourceStep: () => {
|
|
88
|
-
checkSkipResourceStep: (
|
|
87
|
+
checkSkipResourceStep: () => Promise<boolean>;
|
|
89
88
|
};
|
|
90
89
|
/**
|
|
91
90
|
* @title: 获取预约配置
|
|
@@ -48,7 +48,7 @@ var import_useEngineContext = require("../../hooks/useEngineContext");
|
|
|
48
48
|
var import_useEngineContext2 = __toESM(require("../../hooks/useEngineContext"));
|
|
49
49
|
var import_utils2 = require("./utils");
|
|
50
50
|
var import_context = require("./context");
|
|
51
|
-
var import_utils3 = require("./components/
|
|
51
|
+
var import_utils3 = require("./components/Resource/utils");
|
|
52
52
|
var useAppointmentBooking = () => {
|
|
53
53
|
const pisellOS = (0, import_useEngineContext.usePisellOS)();
|
|
54
54
|
return pisellOS.getModule("appointmentBooking");
|
|
@@ -66,9 +66,13 @@ var contextUtils = () => {
|
|
|
66
66
|
var useAppointmentBookingStep = () => {
|
|
67
67
|
var _a, _b, _c;
|
|
68
68
|
const pisellOS = (0, import_useEngineContext.usePisellOS)();
|
|
69
|
-
const { appointmentBooking, setCurrentStep,
|
|
69
|
+
const { appointmentBooking, setCurrentStep, carts, openPolicy, setLoading, setCurrentSelectedResources, currentStepParams, setIsErrorHolder } = (0, import_context.useAppointmentBookingContext)();
|
|
70
70
|
const { isRetailTemplate } = useAppointmentBookingSetting();
|
|
71
71
|
const stepList = ((_c = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.step) == null ? void 0 : _b.store) == null ? void 0 : _c.stepList) || [];
|
|
72
|
+
const { isLogin, openLoginModal } = useAppointmentBookingLogin();
|
|
73
|
+
const { isFormSubject } = useAppointmentBookingSetting();
|
|
74
|
+
const { getHolders, checkAccount } = useAppointmentBookingAccount();
|
|
75
|
+
const utils = contextUtils();
|
|
72
76
|
const getCurrentAndLastStep = () => {
|
|
73
77
|
const currentStep = appointmentBooking == null ? void 0 : appointmentBooking.getCurrentStep();
|
|
74
78
|
setCurrentStep(currentStep);
|
|
@@ -115,28 +119,120 @@ var useAppointmentBookingStep = () => {
|
|
|
115
119
|
});
|
|
116
120
|
};
|
|
117
121
|
const nextStep = () => {
|
|
118
|
-
var _a2, _b2, _c2, _d;
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
var _a2, _b2, _c2, _d, _e;
|
|
123
|
+
let stepList2 = appointmentBooking.getStepList() || [];
|
|
124
|
+
const currentKey = currentStepParams == null ? void 0 : currentStepParams.key;
|
|
125
|
+
let nextStep2 = stepList2[(currentStepParams == null ? void 0 : currentStepParams.index) + 1];
|
|
126
|
+
const currentSelectedResources = appointmentBooking.getOtherData(
|
|
127
|
+
"current_selected_resources"
|
|
128
|
+
);
|
|
129
|
+
if ((nextStep2 == null ? void 0 : nextStep2.key) === "select-resource") {
|
|
130
|
+
const result = appointmentBooking.checkResourceListForDate();
|
|
131
|
+
if (!result) {
|
|
132
|
+
return (0, import_utils2.Toast)(import_utils.locales.getText("pisell2.appointment.unuse.date"));
|
|
133
|
+
}
|
|
121
134
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const showNextPolicy = () => {
|
|
128
|
-
if (idx < policyIdsRef.current.length) {
|
|
129
|
-
openPolicy({ id: policyIdsRef.current[idx] }, () => {
|
|
130
|
-
idx++;
|
|
131
|
-
showNextPolicy();
|
|
132
|
-
});
|
|
133
|
-
} else {
|
|
134
|
-
appointmentBooking.next();
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
showNextPolicy();
|
|
135
|
+
if (currentKey == null ? void 0 : currentKey.startsWith("select-resource")) {
|
|
136
|
+
const { hasError, updatedCartList } = (0, import_utils2.checkAndMarkCartRenderError)(currentSelectedResources, appointmentBooking, utils);
|
|
137
|
+
if (hasError) {
|
|
138
|
+
setCurrentSelectedResources(updatedCartList);
|
|
139
|
+
(0, import_utils3.scrollToFirstErrorCard)();
|
|
138
140
|
return;
|
|
139
141
|
}
|
|
142
|
+
currentSelectedResources == null ? void 0 : currentSelectedResources.forEach((cart) => {
|
|
143
|
+
var _a3, _b3;
|
|
144
|
+
const selectedResource2 = cart == null ? void 0 : cart.currentSelectedResource;
|
|
145
|
+
const resourceItem = (selectedResource2 == null ? void 0 : selectedResource2.resourceItem) || {};
|
|
146
|
+
const formId = (_a3 = selectedResource2 == null ? void 0 : selectedResource2.renderItem) == null ? void 0 : _a3.resource_form_id;
|
|
147
|
+
const policyId = (_b3 = selectedResource2 == null ? void 0 : selectedResource2.renderItem) == null ? void 0 : _b3.policy_id;
|
|
148
|
+
const formKey = `fill-form_@${resourceItem == null ? void 0 : resourceItem.form_id}-${resourceItem == null ? void 0 : resourceItem.code}-${cart == null ? void 0 : cart._id}-${formId}-${policyId}`;
|
|
149
|
+
if (formId) {
|
|
150
|
+
const description = import_utils.locales.getText("pisell2.appointment.fill-form");
|
|
151
|
+
const beforeKey = (0, import_utils2.getFormInsertBeforeKey)(currentKey, stepList2);
|
|
152
|
+
appointmentBooking.addStep({ key: formKey, description }, beforeKey);
|
|
153
|
+
} else {
|
|
154
|
+
appointmentBooking.removeStep(formKey);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
stepList2 = appointmentBooking.getStepList();
|
|
158
|
+
const selectedResource = (_a2 = currentSelectedResources == null ? void 0 : currentSelectedResources[0]) == null ? void 0 : _a2.currentSelectedResource;
|
|
159
|
+
if (selectedResource) {
|
|
160
|
+
const originRenderLists = ((_b2 = selectedResource == null ? void 0 : selectedResource.resourceItem) == null ? void 0 : _b2.originRenderLists) || [];
|
|
161
|
+
const currentResourceIndex = originRenderLists == null ? void 0 : originRenderLists.findIndex((item) => {
|
|
162
|
+
var _a3;
|
|
163
|
+
return item.id === ((_a3 = selectedResource == null ? void 0 : selectedResource.renderItem) == null ? void 0 : _a3.form_id);
|
|
164
|
+
});
|
|
165
|
+
const nextResource = originRenderLists == null ? void 0 : originRenderLists[currentResourceIndex + 1];
|
|
166
|
+
const resourceKey = `select-resource_@${nextResource == null ? void 0 : nextResource.form_id}-${nextResource == null ? void 0 : nextResource.code}`;
|
|
167
|
+
if (nextResource) {
|
|
168
|
+
const beforeKey = (_c2 = stepList2[stepList2.length - 2]) == null ? void 0 : _c2.key;
|
|
169
|
+
appointmentBooking.addStep({ key: resourceKey, description: "" }, beforeKey);
|
|
170
|
+
} else {
|
|
171
|
+
appointmentBooking.removeStep(resourceKey);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
stepList2 = appointmentBooking.getStepList();
|
|
176
|
+
nextStep2 = stepList2[(currentStepParams == null ? void 0 : currentStepParams.index) + 1];
|
|
177
|
+
if (((_d = nextStep2 == null ? void 0 : nextStep2.key) == null ? void 0 : _d.startsWith("select-resource_")) || (nextStep2 == null ? void 0 : nextStep2.key) === "confirm-information") {
|
|
178
|
+
const selectedResource = ((_e = currentSelectedResources == null ? void 0 : currentSelectedResources[0]) == null ? void 0 : _e.currentSelectedResource) || {};
|
|
179
|
+
const renderItem = (selectedResource == null ? void 0 : selectedResource.renderItem) || {};
|
|
180
|
+
const checkHolder = () => {
|
|
181
|
+
setLoading(false);
|
|
182
|
+
if (isRetailTemplate) {
|
|
183
|
+
return appointmentBooking.next();
|
|
184
|
+
}
|
|
185
|
+
const { hasError } = (0, import_utils2.checkAndGoNext)(isFormSubject, checkAccount, carts);
|
|
186
|
+
setIsErrorHolder(hasError);
|
|
187
|
+
if (hasError) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (!!(renderItem == null ? void 0 : renderItem.policy_id)) {
|
|
191
|
+
openPolicy({ id: renderItem == null ? void 0 : renderItem.policy_id }, () => {
|
|
192
|
+
return appointmentBooking.next();
|
|
193
|
+
});
|
|
194
|
+
} else {
|
|
195
|
+
return appointmentBooking.next();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
const checkLogin = async () => {
|
|
199
|
+
if (!isLogin) {
|
|
200
|
+
const accountLists = await appointmentBooking.getAccounts();
|
|
201
|
+
return openLoginModal({
|
|
202
|
+
callback: (status) => {
|
|
203
|
+
var _a3;
|
|
204
|
+
if (status === "success") {
|
|
205
|
+
if (!isFormSubject) {
|
|
206
|
+
const user = JSON.parse(((_a3 = utils == null ? void 0 : utils.storage) == null ? void 0 : _a3.get("customer")) || "{}");
|
|
207
|
+
const currentUser = (0, import_utils2.formatCustomer)(user);
|
|
208
|
+
const meAccount = accountLists == null ? void 0 : accountLists.find((d) => !(d == null ? void 0 : d.isGuest));
|
|
209
|
+
appointmentBooking.setLoginAccount(meAccount == null ? void 0 : meAccount.id, currentUser);
|
|
210
|
+
} else {
|
|
211
|
+
getHolders();
|
|
212
|
+
}
|
|
213
|
+
checkHolder();
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
} else {
|
|
218
|
+
return checkHolder();
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
if ((nextStep2 == null ? void 0 : nextStep2.key) !== "confirm-information") {
|
|
222
|
+
if (!(renderItem == null ? void 0 : renderItem.policy_id)) {
|
|
223
|
+
return appointmentBooking.next();
|
|
224
|
+
}
|
|
225
|
+
return openPolicy({ id: renderItem == null ? void 0 : renderItem.policy_id }, () => {
|
|
226
|
+
const cartItem = carts == null ? void 0 : carts[0];
|
|
227
|
+
appointmentBooking.updateCart({
|
|
228
|
+
_id: cartItem == null ? void 0 : cartItem._id,
|
|
229
|
+
...cartItem
|
|
230
|
+
});
|
|
231
|
+
appointmentBooking.next();
|
|
232
|
+
});
|
|
233
|
+
} else {
|
|
234
|
+
return checkLogin();
|
|
235
|
+
}
|
|
140
236
|
}
|
|
141
237
|
appointmentBooking.next();
|
|
142
238
|
};
|
|
@@ -177,11 +273,25 @@ var useAppointmentBookingCart = () => {
|
|
|
177
273
|
const { appointmentBooking, setCarts, setSummary, setIsAgreeDepositPolicy } = (0, import_context.useAppointmentBookingContext)();
|
|
178
274
|
const { bookingSubject } = ((_a = appointmentBooking == null ? void 0 : appointmentBooking.otherParams) == null ? void 0 : _a.productModuleParams) || {};
|
|
179
275
|
const getCartAndSummary = async () => {
|
|
276
|
+
var _a2;
|
|
277
|
+
const locale = ((_a2 = utils == null ? void 0 : utils.storage) == null ? void 0 : _a2.get("umi_locale")) || "en-US";
|
|
278
|
+
const symbol = (utils == null ? void 0 : utils.getSymbolic()) || "$";
|
|
180
279
|
const carts = await appointmentBooking.getCart();
|
|
280
|
+
const accountLists = await appointmentBooking.getAccounts();
|
|
181
281
|
const newCarts = carts == null ? void 0 : carts.map((item) => {
|
|
282
|
+
var _a3;
|
|
182
283
|
return {
|
|
183
284
|
...item,
|
|
184
|
-
addHolderButtonText: utils == null ? void 0 : utils.translation(bookingSubject == null ? void 0 : bookingSubject.form_name)
|
|
285
|
+
addHolderButtonText: utils == null ? void 0 : utils.translation(bookingSubject == null ? void 0 : bookingSubject.form_name),
|
|
286
|
+
format: ["HH:mm", "HH:mm"],
|
|
287
|
+
show_time: true,
|
|
288
|
+
duration_type: ((_a3 = item == null ? void 0 : item.duration) == null ? void 0 : _a3.type) || "minutes",
|
|
289
|
+
locale,
|
|
290
|
+
symbol,
|
|
291
|
+
holders: (0, import_utils2.formatHolder)(accountLists),
|
|
292
|
+
allowClearHolder: true,
|
|
293
|
+
allowClearResource: true,
|
|
294
|
+
isMultipleResource: true
|
|
185
295
|
};
|
|
186
296
|
});
|
|
187
297
|
setCarts(newCarts || []);
|
|
@@ -235,7 +345,6 @@ var useAppointmentBookingAccount = () => {
|
|
|
235
345
|
"appointmentBooking_accountList:changed",
|
|
236
346
|
async (res) => {
|
|
237
347
|
if (res.path === "accounts") {
|
|
238
|
-
console.log("appointmentBooking_accountList:changed", res);
|
|
239
348
|
getAccountLists();
|
|
240
349
|
}
|
|
241
350
|
}
|
|
@@ -274,7 +383,7 @@ var useAppointmentBookingAccount = () => {
|
|
|
274
383
|
return { accountLists, getHolders, form_id, addAccount, checkAccount };
|
|
275
384
|
};
|
|
276
385
|
var useAppointmentBookingResource = () => {
|
|
277
|
-
const { appointmentBooking, setResources, setTimes
|
|
386
|
+
const { appointmentBooking, setResources, setTimes } = (0, import_context.useAppointmentBookingContext)();
|
|
278
387
|
const { resourceSort } = (appointmentBooking == null ? void 0 : appointmentBooking.otherParams) || {};
|
|
279
388
|
const getResourceList = () => {
|
|
280
389
|
var _a;
|
|
@@ -296,53 +405,40 @@ var useAppointmentBookingResource = () => {
|
|
|
296
405
|
const data = await appointmentBooking.getTimeSlotByAllResources(code);
|
|
297
406
|
setTimes(data || []);
|
|
298
407
|
};
|
|
299
|
-
|
|
300
|
-
const { resourceCodes } = getResourceList();
|
|
301
|
-
const code = resourceCodes == null ? void 0 : resourceCodes[index || 0];
|
|
302
|
-
const data = await appointmentBooking.getTimeSlotByAllResources(code);
|
|
303
|
-
let res = await appointmentBooking.autoSelectAllProductResources(code);
|
|
304
|
-
setResourceOtherParams({
|
|
305
|
-
...resourceOtherParams,
|
|
306
|
-
...res,
|
|
307
|
-
resourceCodes
|
|
308
|
-
});
|
|
309
|
-
return res;
|
|
310
|
-
};
|
|
311
|
-
return { getResourceTimeSlot, getResourceList, autoSelectAllProductResources };
|
|
408
|
+
return { getResourceTimeSlot, getResourceList };
|
|
312
409
|
};
|
|
313
410
|
var useIsSkipResourceStep = () => {
|
|
314
|
-
|
|
315
|
-
const {
|
|
316
|
-
const { getResourceList, autoSelectAllProductResources } = useAppointmentBookingResource();
|
|
411
|
+
const { currentStepParams } = (0, import_context.useAppointmentBookingContext)();
|
|
412
|
+
const { getResourceList } = useAppointmentBookingResource();
|
|
317
413
|
const { isFormSubject } = useAppointmentBookingSetting();
|
|
318
414
|
const appointmentBooking = useAppointmentBooking();
|
|
319
|
-
const stepList = ((_c = (_b = (_a = appointmentBooking == null ? void 0 : appointmentBooking.store) == null ? void 0 : _a.step) == null ? void 0 : _b.store) == null ? void 0 : _c.stepList) || [];
|
|
320
|
-
const { isLogin, openLoginModal } = useAppointmentBookingLogin();
|
|
321
|
-
const { getHolders, checkAccount } = useAppointmentBookingAccount();
|
|
322
415
|
const { nextStep } = useAppointmentBookingStep();
|
|
323
|
-
const
|
|
324
|
-
const checkSkipResourceStep = async (isSkipUpdateFormStep) => {
|
|
325
|
-
var _a2, _b2, _c2, _d, _e;
|
|
416
|
+
const checkSkipResourceStep = async () => {
|
|
326
417
|
try {
|
|
418
|
+
const { resources } = getResourceList();
|
|
327
419
|
const accountLists = await appointmentBooking.getAccounts();
|
|
328
|
-
const
|
|
420
|
+
const { isSystem, isSkip, form_code } = (0, import_utils2.currentAppointmentBoard)(currentStepParams.key, resources, appointmentBooking);
|
|
421
|
+
if (isSystem) {
|
|
422
|
+
nextStep();
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
329
425
|
if ((accountLists == null ? void 0 : accountLists.length) === 1 || isFormSubject) {
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
if (
|
|
333
|
-
|
|
334
|
-
const resultCarts = (0, import_utils2.formatCartsResources)(carts, resources, setPolicyIds);
|
|
335
|
-
(0, import_utils2.checkHasFormStep)({ setIsErrorHolder, nextStep, isSkip: true, openLoginModal, utils, accountLists, getHolders, checkHolder: import_utils3.checkHolder, setCarts, checkAccount, carts, isFormSubject, hasResourceFormId: (resultCarts == null ? void 0 : resultCarts.length) > 0, currentStep, stepList, appointmentBooking, locales: import_utils.locales, isLogin });
|
|
336
|
-
}
|
|
337
|
-
return true;
|
|
426
|
+
const renderLists = (0, import_utils2.currentRenderLists)(resources, form_code);
|
|
427
|
+
let _isSkip = false;
|
|
428
|
+
if ((renderLists == null ? void 0 : renderLists.length) === 1) {
|
|
429
|
+
_isSkip = isSkip || false;
|
|
338
430
|
} else {
|
|
339
|
-
|
|
431
|
+
_isSkip = false;
|
|
432
|
+
}
|
|
433
|
+
if (_isSkip) {
|
|
434
|
+
nextStep();
|
|
435
|
+
return true;
|
|
340
436
|
}
|
|
437
|
+
return _isSkip;
|
|
341
438
|
} else {
|
|
342
439
|
return false;
|
|
343
440
|
}
|
|
344
441
|
} catch (error) {
|
|
345
|
-
console.log(error, "checkSkipResourceStep33");
|
|
346
442
|
return false;
|
|
347
443
|
}
|
|
348
444
|
};
|