@pisell/private-materials 3.3.16 → 3.3.18
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 +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +3 -3
- package/es/components/Sales/Summary/utils.d.ts +1 -1
- package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -16
- package/es/components/appointmentBooking/components/Cart/Item/Total.js +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Cart/Item/index.js +40 -13
- package/es/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Cart/utils.d.ts +20 -0
- package/es/components/appointmentBooking/components/Cart/utils.js +67 -1
- package/es/components/appointmentBooking/components/ConfirmInformation/index.js +2 -3
- package/es/components/appointmentBooking/components/Content/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Content/index.js +50 -7
- package/es/components/appointmentBooking/components/Date/index.js +6 -0
- package/es/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Form/index.js +61 -49
- package/es/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/appointmentBooking/components/Header/index.d.ts +0 -1
- package/es/components/appointmentBooking/components/Header/index.js +5 -4
- package/es/components/appointmentBooking/components/Services/index.js +2 -4
- package/es/components/appointmentBooking/components/Voucher/index.js +1 -1
- package/es/components/appointmentBooking/context.d.ts +5 -1
- package/es/components/appointmentBooking/context.js +37 -14
- package/es/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
- package/es/components/appointmentBooking/deposit/index.d.ts +1 -0
- package/es/components/appointmentBooking/hooks.js +7 -19
- package/es/components/appointmentBooking/locales.d.ts +3 -0
- package/es/components/appointmentBooking/locales.js +196 -193
- package/es/components/appointmentBooking/utils.js +21 -13
- package/es/components/booking/components/customSelect/index.js +2 -0
- package/es/components/booking/components/footer/index.d.ts +0 -1
- package/es/components/booking/components/footer/index.js +27 -22
- package/es/components/booking/components/footer/utils.d.ts +1 -0
- package/es/components/booking/components/footer/utils.js +17 -2
- package/es/components/booking/components/voucher/index.d.ts +1 -0
- package/es/components/booking/forms/footer.d.ts +1 -0
- package/es/components/booking/forms/forms.d.ts +4 -0
- package/es/components/booking/forms/forms.js +14 -3
- package/es/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/es/components/booking/forms/single/index.d.ts +1 -2
- package/es/components/booking/forms/single/index.js +33 -26
- package/es/components/booking/hooks/useClearCart.d.ts +1 -0
- package/es/components/booking/info/client/index.js +24 -3
- package/es/components/booking/info/client/index.less +39 -0
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +10 -1
- package/es/components/booking/info/clientVariant/utils.d.ts +1 -0
- package/es/components/booking/info/clientVariant/utils.js +6 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +17 -2
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +17 -0
- package/es/components/booking/info/clientVariant/vertical/index.js +29 -4
- package/es/components/booking/info/clientVariant/vertical/index.less +18 -0
- package/es/components/booking/info/dateRange/index.d.ts +1 -0
- package/es/components/booking/info/hooks/useAddHolder.d.ts +8 -1
- package/es/components/booking/info/hooks/useAddHolder.js +131 -31
- package/es/components/booking/info/hooks/useGetHolderList.d.ts +2 -0
- package/es/components/booking/info/hooks/useGetHolderList.js +48 -0
- package/es/components/booking/info/hooks/useHolderConfig.js +2 -2
- package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/es/components/booking/info/hooks/useInfoHolder.js +4 -41
- package/es/components/booking/info/pet/index.js +83 -8
- package/es/components/booking/info/pet/serve.d.ts +1 -0
- package/es/components/booking/info/pet/serve.js +27 -0
- package/es/components/booking/info/service/Lists.d.ts +0 -1
- package/es/components/booking/info/service/Lists.js +2 -1
- package/es/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/es/components/booking/info/service/serviceItem/index.d.ts +1 -0
- package/es/components/booking/info/service2/utils.d.ts +2 -0
- package/es/components/booking/info/service2/utils.js +20 -10
- package/es/components/booking/info2/service/serviceItem/index.d.ts +1 -0
- package/es/components/booking/info2/utilsByBooking.d.ts +1 -0
- package/es/components/booking/info2/utilsByBooking.js +9 -1
- package/es/components/booking/locales.d.ts +21 -0
- package/es/components/booking/locales.js +42 -3
- package/es/components/booking/utils.js +3 -1
- package/es/components/eftposPay/amount.d.ts +1 -1
- package/es/components/eftposPay/device.d.ts +1 -1
- package/es/components/eftposPay/hooks.d.ts +1 -1
- package/es/components/eftposPay/store/index.d.ts +3 -3
- package/es/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/es/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/es/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/es/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/es/components/pisellSelectCustomerModal/index.d.ts +1 -0
- package/es/components/productSelect/components/TabProduct/index.d.ts +1 -0
- package/es/components/productSelect/components/productGroup/index.d.ts +1 -0
- package/es/components/shoppingCart/Provider.js +0 -1
- package/es/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/es/components/shoppingCart/components/Cart/index.d.ts +1 -0
- package/es/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/es/components/shoppingCart/components/Render/index.js +0 -1
- package/es/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/es/components/shoppingCart/hooks/useClearCart.js +0 -2
- package/es/components/ticketBooking/components/addServiceVariant/addService.js +2 -3
- package/es/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/es/components/ticketBooking/components/ticketBooking/index.js +5 -6
- package/es/components/ticketBooking/components/timeBar/index.d.ts +1 -0
- package/es/components/ticketBooking/index.d.ts +5 -2
- package/es/components/ticketBooking/index.js +20 -5
- package/es/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/es/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/lib/components/Sales/Summary/utils.d.ts +1 -1
- package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +4 -8
- package/lib/components/appointmentBooking/components/Cart/Item/Total.js +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Cart/Item/index.js +27 -11
- package/lib/components/appointmentBooking/components/Cart/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Cart/utils.d.ts +20 -0
- package/lib/components/appointmentBooking/components/Cart/utils.js +32 -2
- package/lib/components/appointmentBooking/components/ConfirmInformation/index.js +3 -3
- package/lib/components/appointmentBooking/components/Content/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Content/index.js +26 -1
- package/lib/components/appointmentBooking/components/Deposit/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Footer/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Form/index.js +48 -36
- package/lib/components/appointmentBooking/components/Guest/components/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/appointmentBooking/components/Header/index.d.ts +0 -1
- package/lib/components/appointmentBooking/components/Header/index.js +5 -4
- package/lib/components/appointmentBooking/components/Services/index.js +4 -6
- package/lib/components/appointmentBooking/components/Voucher/index.js +2 -4
- package/lib/components/appointmentBooking/context.d.ts +5 -1
- package/lib/components/appointmentBooking/context.js +17 -5
- package/lib/components/appointmentBooking/deposit/components/PolicyModal/index.d.ts +1 -0
- package/lib/components/appointmentBooking/deposit/index.d.ts +1 -0
- package/lib/components/appointmentBooking/hooks.js +1 -12
- package/lib/components/appointmentBooking/locales.d.ts +3 -0
- package/lib/components/appointmentBooking/locales.js +4 -1
- package/lib/components/appointmentBooking/utils.js +19 -13
- package/lib/components/booking/components/customSelect/index.js +2 -0
- package/lib/components/booking/components/footer/index.d.ts +0 -1
- package/lib/components/booking/components/footer/index.js +3 -1
- package/lib/components/booking/components/footer/utils.d.ts +1 -0
- package/lib/components/booking/components/footer/utils.js +16 -1
- package/lib/components/booking/components/voucher/index.d.ts +1 -0
- package/lib/components/booking/forms/footer.d.ts +1 -0
- package/lib/components/booking/forms/forms.d.ts +4 -0
- package/lib/components/booking/forms/forms.js +13 -3
- package/lib/components/booking/forms/sendModal/useSendModal.d.ts +1 -0
- package/lib/components/booking/forms/single/index.d.ts +1 -2
- package/lib/components/booking/forms/single/index.js +13 -1
- package/lib/components/booking/hooks/useClearCart.d.ts +1 -0
- package/lib/components/booking/info/client/index.js +20 -3
- package/lib/components/booking/info/client/index.less +39 -0
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +0 -1
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +8 -1
- package/lib/components/booking/info/clientVariant/utils.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/utils.js +34 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +11 -3
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +17 -0
- package/lib/components/booking/info/clientVariant/vertical/index.js +31 -6
- package/lib/components/booking/info/clientVariant/vertical/index.less +18 -0
- package/lib/components/booking/info/dateRange/index.d.ts +1 -0
- package/lib/components/booking/info/hooks/useAddHolder.d.ts +8 -1
- package/lib/components/booking/info/hooks/useAddHolder.js +88 -16
- package/lib/components/booking/info/hooks/useGetHolderList.d.ts +2 -0
- package/lib/components/booking/info/hooks/useGetHolderList.js +61 -0
- package/lib/components/booking/info/hooks/useHolderConfig.js +2 -2
- package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
- package/lib/components/booking/info/hooks/useInfoHolder.js +2 -21
- package/lib/components/booking/info/pet/index.js +57 -10
- package/lib/components/booking/info/pet/serve.d.ts +1 -0
- package/lib/components/booking/info/pet/serve.js +33 -0
- package/lib/components/booking/info/service/Lists.d.ts +0 -1
- package/lib/components/booking/info/service/Lists.js +1 -1
- package/lib/components/booking/info/service/editService/BookingList/index.d.ts +1 -0
- package/lib/components/booking/info/service/serviceItem/index.d.ts +1 -0
- package/lib/components/booking/info/service2/utils.d.ts +2 -0
- package/lib/components/booking/info/service2/utils.js +17 -7
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +1 -0
- package/lib/components/booking/info2/utilsByBooking.d.ts +1 -0
- package/lib/components/booking/info2/utilsByBooking.js +8 -1
- package/lib/components/booking/locales.d.ts +21 -0
- package/lib/components/booking/locales.js +42 -3
- package/lib/components/booking/utils.js +3 -1
- package/lib/components/eftposPay/amount.d.ts +1 -1
- package/lib/components/eftposPay/device.d.ts +1 -1
- package/lib/components/eftposPay/hooks.d.ts +1 -1
- package/lib/components/eftposPay/store/index.d.ts +3 -3
- package/lib/components/eventBooking/components/ErrorTip/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/ContinueButton/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/Item/Total.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/Item/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Cart/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/EmptyHolderModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Event/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Footer/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Information/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/InformationOptionsModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/OrderProductModal/index.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/RemoveOptionConfirmModal.d.ts +1 -0
- package/lib/components/eventBooking/components/Provider/Resource/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +1 -0
- package/lib/components/eventBooking/components/bookingDetailModal/components/BookingOptions.d.ts +1 -0
- package/lib/components/eventBooking/components/scheduleCalendar/calendarItem.d.ts +1 -0
- package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/SetupForm/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/RightPanel/List/index.d.ts +1 -0
- package/lib/components/pisellSelectCustomerModal/index.d.ts +1 -0
- package/lib/components/productSelect/components/TabProduct/index.d.ts +1 -0
- package/lib/components/productSelect/components/productGroup/index.d.ts +1 -0
- package/lib/components/shoppingCart/Provider.js +0 -1
- package/lib/components/shoppingCart/components/Cart/Product.d.ts +1 -0
- package/lib/components/shoppingCart/components/Cart/index.d.ts +1 -0
- package/lib/components/shoppingCart/components/Render/index.d.ts +0 -1
- package/lib/components/shoppingCart/components/Render/index.js +0 -1
- package/lib/components/shoppingCart/hooks/useAddService.d.ts +1 -0
- package/lib/components/shoppingCart/hooks/useClearCart.js +1 -2
- package/lib/components/ticketBooking/components/addServiceVariant/addService.js +2 -3
- package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +0 -1
- package/lib/components/ticketBooking/components/ticketBooking/index.js +4 -3
- package/lib/components/ticketBooking/components/timeBar/index.d.ts +1 -0
- package/lib/components/ticketBooking/index.d.ts +5 -2
- package/lib/components/ticketBooking/index.js +13 -4
- package/lib/components/workSpaceList/components/Modal/index.d.ts +1 -0
- package/lib/components/workSpaceList/components/SearchWorkspaceAndBase/index.d.ts +1 -0
- package/lowcode/ticket-booking/meta.ts +26 -0
- package/package.json +2 -2
|
@@ -35,8 +35,11 @@ import ChangePetModal from "../../pet/ChangePetModal";
|
|
|
35
35
|
import { getAppointmentService, getPets, isDayBooking, isOpenDeletePet, updateServicePrice, isEventBooking } from "../../service2/utils";
|
|
36
36
|
import { moveItemToFront } from "../../utils";
|
|
37
37
|
import "./index.less";
|
|
38
|
+
import useAddHolder, { useFormDataConfig } from "../../hooks/useAddHolder";
|
|
39
|
+
import { getWaiverTitle } from "../utils";
|
|
40
|
+
import useGetHolderList from "../../hooks/useGetHolderList";
|
|
38
41
|
var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
39
|
-
var _context$appHelper, _context$appHelper$ge, _state$bookingConfig2, _state$bookingConfig4, _state$pet3, _state$pet4, _state$pet6, _state$pet8, _state$client$value3, _state$bookingConfig7, _state$pet9, _state$bookingConfig8, _state$service2, _state$client$value5, _state$client$value6, _state$client$value7, _state$client$value8, _state$client$value9, _context$appHelper2, _context$appHelper2$i, _state$bookingConfig9, _state$client6;
|
|
42
|
+
var _context$appHelper, _context$appHelper$ge, _state$bookingConfig2, _state$bookingConfig4, _state$pet3, _state$pet4, _state$pet6, _state$pet8, _state$client$value3, _state$bookingConfig7, _state$pet9, _state$bookingConfig8, _state$service2, _state$client$value5, _state$client$value6, _state$client$value7, _state$client$value8, _state$client$value9, _state$client$value10, _state$client$value11, _state$client$value12, _state$client$value13, _context$appHelper2, _context$appHelper2$i, _state$bookingConfig9, _state$client6;
|
|
40
43
|
var globalState = props.globalState,
|
|
41
44
|
setGlobalState = props.setGlobalState;
|
|
42
45
|
var modalRef = useRef();
|
|
@@ -106,6 +109,11 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
106
109
|
});
|
|
107
110
|
}
|
|
108
111
|
};
|
|
112
|
+
var getHolderList = useGetHolderList(state, petDispatch);
|
|
113
|
+
var _useAddHolder = useAddHolder(state, petDispatch),
|
|
114
|
+
waiverForm = _useAddHolder.waiverForm;
|
|
115
|
+
var _useFormDataConfig = useFormDataConfig(state),
|
|
116
|
+
isMinorAndWaiver = _useFormDataConfig.isMinorAndWaiver;
|
|
109
117
|
var boardConfig = useMemo(function () {
|
|
110
118
|
var _state$bookingConfig;
|
|
111
119
|
return (state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.config) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.basic) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.appointment_subject) || {};
|
|
@@ -150,13 +158,20 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
150
158
|
var handleAddPet = function handleAddPet(_client, cb) {
|
|
151
159
|
var _state$pet$formData;
|
|
152
160
|
var _data = {
|
|
153
|
-
formDataConfig: _objectSpread({},
|
|
161
|
+
formDataConfig: isMinorAndWaiver ? _objectSpread(_objectSpread({}, waiverForm), {}, {
|
|
162
|
+
customer_id: _client.id
|
|
163
|
+
}) : _objectSpread({}, ((_state$pet$formData = state.pet.formData) === null || _state$pet$formData === void 0 ? void 0 : _state$pet$formData[0]) || {})
|
|
154
164
|
};
|
|
155
165
|
_data.customerId = _client.id;
|
|
156
166
|
state.action({
|
|
157
167
|
type: 'pisell1.goCustomFormAddData',
|
|
158
168
|
data: _data,
|
|
159
169
|
callback: function callback(res) {
|
|
170
|
+
if (isMinorAndWaiver) {
|
|
171
|
+
getClients(params);
|
|
172
|
+
getHolderList();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
160
175
|
var newFormRecordObj = res.reduce(function (p, c) {
|
|
161
176
|
return _objectSpread(_objectSpread({}, p), {}, _defineProperty({}, c.key, c.value));
|
|
162
177
|
}, {});
|
|
@@ -175,7 +190,6 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
175
190
|
clients: newClients
|
|
176
191
|
});
|
|
177
192
|
cb === null || cb === void 0 || cb(newFormRecordObj);
|
|
178
|
-
// getClients(params);
|
|
179
193
|
}
|
|
180
194
|
});
|
|
181
195
|
};
|
|
@@ -448,7 +462,18 @@ var VerticalClient = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
448
462
|
className: "pisell-lowcode__booking-client-desc-item"
|
|
449
463
|
}, (_state$client$value7 = state.client.value) === null || _state$client$value7 === void 0 ? void 0 : _state$client$value7.email) : null, (_state$client$value8 = state.client.value) !== null && _state$client$value8 !== void 0 && _state$client$value8.phone ? /*#__PURE__*/React.createElement("div", {
|
|
450
464
|
className: "pisell-lowcode__booking-client-desc-item"
|
|
451
|
-
}, (_state$client$value9 = state.client.value) === null || _state$client$value9 === void 0 ? void 0 : _state$client$value9.phone) : null
|
|
465
|
+
}, (_state$client$value9 = state.client.value) === null || _state$client$value9 === void 0 ? void 0 : _state$client$value9.phone) : null, !!((_state$client$value10 = state.client.value) !== null && _state$client$value10 !== void 0 && (_state$client$value10 = _state$client$value10.waiver_form) !== null && _state$client$value10 !== void 0 && _state$client$value10.length) && /*#__PURE__*/React.createElement("div", {
|
|
466
|
+
className: 'pisell-lowcode__booking-client-waiver',
|
|
467
|
+
title: getWaiverTitle((_state$client$value11 = state.client.value) === null || _state$client$value11 === void 0 ? void 0 : _state$client$value11.waiver_form)
|
|
468
|
+
}, (_state$client$value12 = state.client.value) === null || _state$client$value12 === void 0 || (_state$client$value12 = _state$client$value12.waiver_form) === null || _state$client$value12 === void 0 || (_state$client$value13 = _state$client$value12.map) === null || _state$client$value13 === void 0 ? void 0 : _state$client$value13.call(_state$client$value12, function (item) {
|
|
469
|
+
return /*#__PURE__*/React.createElement("span", null, item.form_title, /*#__PURE__*/React.createElement("span", {
|
|
470
|
+
className: 'pisell-lowcode__booking-client-waiver-colon'
|
|
471
|
+
}, ":"), item.is_filled ? /*#__PURE__*/React.createElement("span", {
|
|
472
|
+
className: 'pisell-lowcode__booking-client-waiver-filled'
|
|
473
|
+
}, locales.getText('pisell2.text.filled')) : /*#__PURE__*/React.createElement("span", {
|
|
474
|
+
className: 'pisell-lowcode__booking-client-waiver-not-filled'
|
|
475
|
+
}, locales.getText('pisell2.text.not-filled')), " ; ");
|
|
476
|
+
}))), !isWalkIn && /*#__PURE__*/React.createElement("div", {
|
|
452
477
|
className: "pisell-lowcode__booking-client-action-wrap"
|
|
453
478
|
}, !state.disabledEdit && /*#__PURE__*/React.createElement(Dropdown.Button, {
|
|
454
479
|
menu: {
|
|
@@ -43,6 +43,24 @@
|
|
|
43
43
|
text-align: center;
|
|
44
44
|
display: inline-block;
|
|
45
45
|
}
|
|
46
|
+
.pisell-lowcode__booking-client-waiver {
|
|
47
|
+
color: var(--Gray-400, #98A2B3);
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
font-style: normal;
|
|
50
|
+
font-weight: 400;
|
|
51
|
+
line-height: 20px; /* 142.857% */
|
|
52
|
+
margin-top: 16px;
|
|
53
|
+
text-align: center;
|
|
54
|
+
.pisell-lowcode__booking-client-waiver-colon {
|
|
55
|
+
margin: 0 2px;
|
|
56
|
+
}
|
|
57
|
+
.pisell-lowcode__booking-client-waiver-filled {
|
|
58
|
+
color: var(--Success-600, #079455);
|
|
59
|
+
}
|
|
60
|
+
.pisell-lowcode__booking-client-waiver-not-filled {
|
|
61
|
+
color: var(--Error-600, #D92D20);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
46
64
|
.pisell-lowcode__booking-client-desc-item {
|
|
47
65
|
color: var(--Gray-400, #98a2b3);
|
|
48
66
|
font-size: 14px;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
declare const
|
|
1
|
+
export declare const useFormDataConfig: (state: any) => {
|
|
2
|
+
formDataConfig: any;
|
|
3
|
+
isMinorAndWaiver: any;
|
|
4
|
+
};
|
|
5
|
+
declare const useAddHolder: (state: any, dispatch: any) => {
|
|
6
|
+
handleAddHolder: (products: any[], currentItem: any) => void;
|
|
7
|
+
waiverForm: any;
|
|
8
|
+
};
|
|
2
9
|
export default useAddHolder;
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
2
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
4
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
7
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
13
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
18
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
19
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
13
20
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
21
|
import { isWalkIn } from "../../utils";
|
|
15
|
-
import { useMemo } from 'react';
|
|
16
|
-
|
|
22
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
23
|
+
import { getFormDetail } from "../pet/serve";
|
|
24
|
+
import useGetHolderList from "./useGetHolderList";
|
|
25
|
+
import { handleChangeHolder } from "../service2/utils";
|
|
26
|
+
export var useFormDataConfig = function useFormDataConfig(state) {
|
|
17
27
|
var _state$bookingConfig2;
|
|
18
28
|
var formDataConfig = useMemo(function () {
|
|
19
29
|
var _state$bookingConfig, _holder$form, _holder$form2;
|
|
20
|
-
var _holder = (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.holder;
|
|
30
|
+
var _holder = state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.holder;
|
|
21
31
|
if (!_holder) {
|
|
22
32
|
return null;
|
|
23
33
|
}
|
|
@@ -28,43 +38,133 @@ var useAddHolder = function useAddHolder(state, dispatch) {
|
|
|
28
38
|
relation_type: 'appointment_booking',
|
|
29
39
|
form_record: []
|
|
30
40
|
});
|
|
31
|
-
}, [(_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.holder]);
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
}, [state === null || state === void 0 || (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : _state$bookingConfig2.holder]);
|
|
42
|
+
|
|
43
|
+
// 是Minor并且与Waiver关联
|
|
44
|
+
var isMinorAndWaiver = useMemo(function () {
|
|
45
|
+
if ((formDataConfig === null || formDataConfig === void 0 ? void 0 : formDataConfig.form_type) === "minors") {
|
|
46
|
+
var detail = formDataConfig === null || formDataConfig === void 0 ? void 0 : formDataConfig.form_field.find(function (item) {
|
|
47
|
+
return item.filed_type === 'form_to_form' && item.status === 'hide';
|
|
48
|
+
});
|
|
49
|
+
if (detail) {
|
|
50
|
+
var _detail$setting;
|
|
51
|
+
return detail === null || detail === void 0 || (_detail$setting = detail.setting) === null || _detail$setting === void 0 ? void 0 : _detail$setting.linkedTable;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}, [formDataConfig]);
|
|
57
|
+
return {
|
|
58
|
+
formDataConfig: formDataConfig,
|
|
59
|
+
isMinorAndWaiver: isMinorAndWaiver
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
var useAddHolder = function useAddHolder(state, dispatch) {
|
|
63
|
+
var _useState = useState(null),
|
|
64
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
+
waiverForm = _useState2[0],
|
|
66
|
+
setWaiverForm = _useState2[1];
|
|
67
|
+
var getHolders = useGetHolderList(state, dispatch);
|
|
68
|
+
var _useFormDataConfig = useFormDataConfig(state),
|
|
69
|
+
formDataConfig = _useFormDataConfig.formDataConfig,
|
|
70
|
+
isMinorAndWaiver = _useFormDataConfig.isMinorAndWaiver;
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
if (isMinorAndWaiver) {
|
|
73
|
+
getFormDetail(isMinorAndWaiver).then(function (res) {
|
|
74
|
+
setWaiverForm(res);
|
|
75
|
+
dispatch({
|
|
76
|
+
type: 'setPet',
|
|
77
|
+
payload: {
|
|
78
|
+
waiverForm: res
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}, [isMinorAndWaiver]);
|
|
84
|
+
var handleAddHolder = function handleAddHolder(products, currentItem) {
|
|
85
|
+
var _state$client, _state$client2;
|
|
34
86
|
var _data = {
|
|
35
|
-
formDataConfig: _objectSpread({},
|
|
87
|
+
formDataConfig: isMinorAndWaiver ? _objectSpread(_objectSpread({}, waiverForm), {}, {
|
|
88
|
+
customer_id: (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id
|
|
89
|
+
}) : _objectSpread({}, formDataConfig)
|
|
36
90
|
};
|
|
37
|
-
var isWalkInBol = isWalkIn((_state$
|
|
91
|
+
var isWalkInBol = isWalkIn((_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id);
|
|
38
92
|
if (formDataConfig.data_range === 'customer' && !isWalkInBol) {
|
|
39
|
-
var _state$
|
|
40
|
-
_data.customerId = (_state$
|
|
93
|
+
var _state$client3;
|
|
94
|
+
_data.customerId = (_state$client3 = state.client) === null || _state$client3 === void 0 ? void 0 : _state$client3.value.id;
|
|
41
95
|
}
|
|
42
96
|
state.action({
|
|
43
97
|
type: 'pisell1.goCustomFormAddData',
|
|
44
98
|
data: _data,
|
|
45
|
-
callback: function
|
|
46
|
-
var
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
99
|
+
callback: function () {
|
|
100
|
+
var _callback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
|
|
101
|
+
var obj, _iterator, _step, item, _state$pet, _find, oldList, formValue, selectId, oldDetail, value;
|
|
102
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
103
|
+
while (1) switch (_context.prev = _context.next) {
|
|
104
|
+
case 0:
|
|
105
|
+
obj = {};
|
|
106
|
+
_iterator = _createForOfIteratorHelper(res);
|
|
107
|
+
try {
|
|
108
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
109
|
+
item = _step.value;
|
|
110
|
+
obj[item.key] = item.value;
|
|
111
|
+
}
|
|
112
|
+
} catch (err) {
|
|
113
|
+
_iterator.e(err);
|
|
114
|
+
} finally {
|
|
115
|
+
_iterator.f();
|
|
116
|
+
}
|
|
117
|
+
if (!isMinorAndWaiver) {
|
|
118
|
+
_context.next = 13;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
oldList = (state === null || state === void 0 || (_state$pet = state.pet) === null || _state$pet === void 0 ? void 0 : _state$pet.holders) || [];
|
|
122
|
+
formValue = ((_find = (obj["form_to_form_value"] || []).find(function (item) {
|
|
123
|
+
return item.form_id === formDataConfig.form_id;
|
|
124
|
+
})) === null || _find === void 0 ? void 0 : _find.form_data_value) || [];
|
|
125
|
+
selectId = Math.max.apply(Math, _toConsumableArray(formValue));
|
|
126
|
+
oldDetail = oldList.find(function (item) {
|
|
127
|
+
return item.form_record_id === selectId;
|
|
128
|
+
});
|
|
129
|
+
_context.next = 10;
|
|
130
|
+
return getHolders();
|
|
131
|
+
case 10:
|
|
132
|
+
if (formValue.length && !oldDetail) {
|
|
133
|
+
value = handleChangeHolder(products, currentItem, {
|
|
134
|
+
id: selectId
|
|
135
|
+
});
|
|
136
|
+
dispatch({
|
|
137
|
+
type: 'setService',
|
|
138
|
+
payload: {
|
|
139
|
+
value: value
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
_context.next = 14;
|
|
144
|
+
break;
|
|
145
|
+
case 13:
|
|
146
|
+
dispatch({
|
|
147
|
+
type: 'setPet',
|
|
148
|
+
payload: {
|
|
149
|
+
holders: !isWalkInBol ? [obj].concat(_toConsumableArray(state.pet.holders)) : state.pet.holders
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
case 14:
|
|
153
|
+
case "end":
|
|
154
|
+
return _context.stop();
|
|
155
|
+
}
|
|
156
|
+
}, _callee);
|
|
157
|
+
}));
|
|
158
|
+
function callback(_x) {
|
|
159
|
+
return _callback.apply(this, arguments);
|
|
58
160
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
payload: {
|
|
62
|
-
holders: !isWalkInBol ? [obj].concat(_toConsumableArray(state.pet.holders)) : state.pet.holders
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
161
|
+
return callback;
|
|
162
|
+
}()
|
|
66
163
|
});
|
|
67
164
|
};
|
|
68
|
-
return
|
|
165
|
+
return {
|
|
166
|
+
handleAddHolder: handleAddHolder,
|
|
167
|
+
waiverForm: waiverForm
|
|
168
|
+
};
|
|
69
169
|
};
|
|
70
170
|
export default useAddHolder;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { useMemoizedFn } from "ahooks";
|
|
6
|
+
import useHolderConfig from "./useHolderConfig";
|
|
7
|
+
var useGetHolderList = function useGetHolderList(state, dispatch) {
|
|
8
|
+
var _useHolderConfig = useHolderConfig(state),
|
|
9
|
+
holder = _useHolderConfig.holder,
|
|
10
|
+
appointment_subject = _useHolderConfig.appointment_subject;
|
|
11
|
+
var getHolders = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
12
|
+
var _state$client, _state$client2;
|
|
13
|
+
var params, data;
|
|
14
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
|
+
while (1) switch (_context.prev = _context.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
if (!(holder.data_range === 'customer' && !((_state$client = state.client) !== null && _state$client !== void 0 && (_state$client = _state$client.value) !== null && _state$client !== void 0 && _state$client.id))) {
|
|
18
|
+
_context.next = 2;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
return _context.abrupt("return");
|
|
22
|
+
case 2:
|
|
23
|
+
params = {
|
|
24
|
+
form_id: appointment_subject.form_id,
|
|
25
|
+
source_shop_customer: holder === null || holder === void 0 ? void 0 : holder.is_franchisor,
|
|
26
|
+
customer_id: holder.data_range === 'customer' ? (_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id : undefined,
|
|
27
|
+
skip: 1,
|
|
28
|
+
num: 100
|
|
29
|
+
};
|
|
30
|
+
_context.next = 5;
|
|
31
|
+
return state.apis.getPetsData(params);
|
|
32
|
+
case 5:
|
|
33
|
+
data = _context.sent;
|
|
34
|
+
dispatch({
|
|
35
|
+
type: 'setPet',
|
|
36
|
+
payload: {
|
|
37
|
+
holders: data.list
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
case 7:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}, _callee);
|
|
45
|
+
})));
|
|
46
|
+
return getHolders;
|
|
47
|
+
};
|
|
48
|
+
export default useGetHolderList;
|
|
@@ -18,8 +18,8 @@ var useHolderConfig = function useHolderConfig(state) {
|
|
|
18
18
|
}, [appointment_subject.type]);
|
|
19
19
|
var isWalkInBol = useMemo(function () {
|
|
20
20
|
var _state$client;
|
|
21
|
-
return isWalkIn((_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id);
|
|
22
|
-
}, [(_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id]);
|
|
21
|
+
return isWalkIn(state === null || state === void 0 || (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id);
|
|
22
|
+
}, [state === null || state === void 0 || (_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id]);
|
|
23
23
|
|
|
24
24
|
// 配置主体为特定表单时
|
|
25
25
|
var isCustomerSubject = useMemo(function () {
|
|
@@ -4,60 +4,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
-
import { useMemoizedFn } from "ahooks";
|
|
11
7
|
import { useEffect, useMemo, useRef } from "react";
|
|
12
8
|
import useHolderConfig from "./useHolderConfig";
|
|
13
9
|
import { isOpenAddTime } from "../utils";
|
|
10
|
+
import useGetHolderList from "./useGetHolderList";
|
|
14
11
|
var useInfoHolder = function useInfoHolder(state, dispatch) {
|
|
15
|
-
var _state$
|
|
12
|
+
var _state$client, _state$bookingConfig2;
|
|
16
13
|
var detailRef = useRef();
|
|
17
14
|
var _useHolderConfig = useHolderConfig(state),
|
|
18
15
|
holder = _useHolderConfig.holder,
|
|
19
16
|
isFormSubject = _useHolderConfig.isFormSubject,
|
|
20
17
|
appointment_subject = _useHolderConfig.appointment_subject;
|
|
21
|
-
var getHolders =
|
|
22
|
-
var _state$client, _state$client2;
|
|
23
|
-
var params, data;
|
|
24
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
25
|
-
while (1) switch (_context.prev = _context.next) {
|
|
26
|
-
case 0:
|
|
27
|
-
if (!(holder.data_range === 'customer' && !((_state$client = state.client) !== null && _state$client !== void 0 && (_state$client = _state$client.value) !== null && _state$client !== void 0 && _state$client.id))) {
|
|
28
|
-
_context.next = 2;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
return _context.abrupt("return");
|
|
32
|
-
case 2:
|
|
33
|
-
params = {
|
|
34
|
-
form_id: appointment_subject.form_id,
|
|
35
|
-
source_shop_customer: holder === null || holder === void 0 ? void 0 : holder.is_franchisor,
|
|
36
|
-
customer_id: holder.data_range === 'customer' ? (_state$client2 = state.client) === null || _state$client2 === void 0 || (_state$client2 = _state$client2.value) === null || _state$client2 === void 0 ? void 0 : _state$client2.id : undefined,
|
|
37
|
-
skip: 1,
|
|
38
|
-
num: 100
|
|
39
|
-
};
|
|
40
|
-
_context.next = 5;
|
|
41
|
-
return state.apis.getPetsData(params);
|
|
42
|
-
case 5:
|
|
43
|
-
data = _context.sent;
|
|
44
|
-
dispatch({
|
|
45
|
-
type: 'setPet',
|
|
46
|
-
payload: {
|
|
47
|
-
holders: data.list
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
case 7:
|
|
51
|
-
case "end":
|
|
52
|
-
return _context.stop();
|
|
53
|
-
}
|
|
54
|
-
}, _callee);
|
|
55
|
-
})));
|
|
18
|
+
var getHolders = useGetHolderList(state, dispatch);
|
|
56
19
|
useEffect(function () {
|
|
57
20
|
if (isFormSubject) {
|
|
58
21
|
getHolders();
|
|
59
22
|
}
|
|
60
|
-
}, [appointment_subject, holder, (_state$
|
|
23
|
+
}, [appointment_subject, holder, (_state$client = state.client) === null || _state$client === void 0 || (_state$client = _state$client.value) === null || _state$client === void 0 ? void 0 : _state$client.id]);
|
|
61
24
|
var appointment_card = useMemo(function () {
|
|
62
25
|
var _state$bookingConfig;
|
|
63
26
|
return (state === null || state === void 0 || (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.config) === null || _state$bookingConfig === void 0 || (_state$bookingConfig = _state$bookingConfig.information_tab) === null || _state$bookingConfig === void 0 ? void 0 : _state$bookingConfig.appointment_card) || {
|