@pisell/private-materials 3.0.127 → 3.0.128

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.
Files changed (42) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/meta.js +1 -1
  5. package/build/lowcode/preview.js +2 -2
  6. package/build/lowcode/render/default/view.js +8 -8
  7. package/build/lowcode/view.js +4 -4
  8. package/es/components/booking/components/TabProduct/index.js +63 -60
  9. package/es/components/booking/components/customSelect/index.d.ts +1 -1
  10. package/es/components/booking/forms/forms.d.ts +2 -2
  11. package/es/components/booking/forms/forms.js +61 -58
  12. package/es/components/booking/info/client/index.d.ts +4 -4
  13. package/es/components/booking/info/client/index.js +94 -90
  14. package/es/components/booking/info/clientVariant/vertical/index.js +5 -4
  15. package/es/components/booking/info/index.js +1 -1
  16. package/es/components/booking/info/pet/index.d.ts +3 -3
  17. package/es/components/booking/info/pet/index.js +135 -131
  18. package/es/components/booking/info/service/addService/index.js +47 -45
  19. package/es/components/booking/info/service/addTimeModal/index.d.ts +2 -2
  20. package/es/components/booking/info/service/addTimeModal/index.js +218 -225
  21. package/es/components/booking/info/service/editService/index.js +194 -192
  22. package/es/components/booking/info/service/index.d.ts +2 -2
  23. package/es/components/booking/info/service/index.js +1 -1
  24. package/es/components/eftposPay/store/index.d.ts +4 -4
  25. package/lib/components/booking/components/TabProduct/index.js +61 -58
  26. package/lib/components/booking/components/customSelect/index.d.ts +1 -1
  27. package/lib/components/booking/forms/forms.d.ts +2 -2
  28. package/lib/components/booking/forms/forms.js +90 -75
  29. package/lib/components/booking/info/client/index.d.ts +4 -4
  30. package/lib/components/booking/info/client/index.js +59 -48
  31. package/lib/components/booking/info/clientVariant/vertical/index.js +5 -4
  32. package/lib/components/booking/info/index.js +1 -1
  33. package/lib/components/booking/info/pet/index.d.ts +3 -3
  34. package/lib/components/booking/info/pet/index.js +113 -84
  35. package/lib/components/booking/info/service/addService/index.js +112 -99
  36. package/lib/components/booking/info/service/addTimeModal/index.d.ts +2 -2
  37. package/lib/components/booking/info/service/addTimeModal/index.js +154 -127
  38. package/lib/components/booking/info/service/editService/index.js +196 -171
  39. package/lib/components/booking/info/service/index.d.ts +2 -2
  40. package/lib/components/booking/info/service/index.js +1 -1
  41. package/lib/components/eftposPay/store/index.d.ts +4 -4
  42. package/package.json +4 -4
@@ -13,18 +13,18 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
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
14
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useContext, useEffect, useMemo, useState, useRef } from "react";
16
+ import React, { useContext, useEffect, useMemo, useState, useRef } from 'react';
17
17
  import Drawer from "../../../components/drawer";
18
18
  import { Context } from "../../model";
19
- import { Button, Skeleton, message, Alert } from "antd";
19
+ import { Button, Skeleton, message, Alert } from 'antd';
20
20
  import "./index.less";
21
- import { locales, formatAmount, createArray, formatDate } from "@pisell/utils";
22
- import { useUpdateEffect, useDebounceFn } from "ahooks";
21
+ import { locales, formatAmount, createArray, formatDate } from '@pisell/utils';
22
+ import { useUpdateEffect, useDebounceFn, useMemoizedFn } from 'ahooks';
23
23
  import Footer from "../../../components/footer";
24
24
  import { saveAddTimeProduct, getAddTimeProducts } from "./serve";
25
25
  import { getAddTimeSplits, isUsableProduct, addTimeRowKey } from "./utils";
26
- import classNames from "classnames";
27
- import dayjs from "dayjs";
26
+ import classNames from 'classnames';
27
+ import dayjs from 'dayjs';
28
28
  import BrowserSelect from "../../../components/browserSelect";
29
29
  import { isNowTime, getNowTime, getDiscountTime, getResourceTimeIsUsable, flexibleObj, isWalkIn } from "../../../utils";
30
30
  import useEngineContext from "../../../../../hooks/useEngineContext";
@@ -38,7 +38,7 @@ var numberList = createArray(100, function (d, i) {
38
38
  return item;
39
39
  });
40
40
  var AddTimeModal = function AddTimeModal() {
41
- var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _currentTimeItem$stat, _currentProduct$add_t;
41
+ var _context$appHelper, _state$bookingConfig2, _state$bookingConfig3, _currentTimeItem$stat2, _currentProduct$add_t2;
42
42
  var _useContext = useContext(Context),
43
43
  state = _useContext.state,
44
44
  dispatch = _useContext.dispatch;
@@ -46,12 +46,12 @@ var AddTimeModal = function AddTimeModal() {
46
46
  _useState2 = _slicedToArray(_useState, 2),
47
47
  isEdit = _useState2[0],
48
48
  setIsEdit = _useState2[1];
49
- var _useState3 = useState(""),
49
+ var _useState3 = useState(''),
50
50
  _useState4 = _slicedToArray(_useState3, 2),
51
51
  loading = _useState4[0],
52
52
  setLoading = _useState4[1];
53
53
  // id_time
54
- var _useState5 = useState(""),
54
+ var _useState5 = useState(''),
55
55
  _useState6 = _slicedToArray(_useState5, 2),
56
56
  recordKey = _useState6[0],
57
57
  setRecordKey = _useState6[1];
@@ -69,16 +69,16 @@ var AddTimeModal = function AddTimeModal() {
69
69
  interaction = _context$appHelper$ut.interaction;
70
70
  var statusMap = {
71
71
  available: {
72
- label: locales.getText("page.booking.text.available"),
73
- color: "#079455"
72
+ label: locales.getText('page.booking.text.available'),
73
+ color: '#079455'
74
74
  },
75
75
  fully_booked: {
76
- label: locales.getText("page.booking.text.fully-booked"),
77
- color: "#DC6803"
76
+ label: locales.getText('page.booking.text.fully-booked'),
77
+ color: '#DC6803'
78
78
  },
79
79
  unavailable: {
80
- label: locales.getText("page.booking.text.unavailable"),
81
- color: "#98A2B3"
80
+ label: locales.getText('page.booking.text.unavailable'),
81
+ color: '#98A2B3'
82
82
  }
83
83
  };
84
84
 
@@ -93,7 +93,7 @@ var AddTimeModal = function AddTimeModal() {
93
93
  var transaction_habit_selection = useMemo(function () {
94
94
  var _state$bookingConfig, _state$bookingConfig$, _state$bookingConfig$2;
95
95
  return (state === null || state === void 0 ? void 0 : (_state$bookingConfig = state.bookingConfig) === null || _state$bookingConfig === void 0 ? void 0 : (_state$bookingConfig$ = _state$bookingConfig.config) === null || _state$bookingConfig$ === void 0 ? void 0 : (_state$bookingConfig$2 = _state$bookingConfig$.information_tab) === null || _state$bookingConfig$2 === void 0 ? void 0 : _state$bookingConfig$2.transaction_habit_selection) || {
96
- type: "service_now_pay_later",
96
+ type: 'service_now_pay_later',
97
97
  button_rows: 1
98
98
  };
99
99
  }, [state === null || state === void 0 ? void 0 : (_state$bookingConfig2 = state.bookingConfig) === null || _state$bookingConfig2 === void 0 ? void 0 : (_state$bookingConfig3 = _state$bookingConfig2.config) === null || _state$bookingConfig3 === void 0 ? void 0 : _state$bookingConfig3.information_tab]);
@@ -105,7 +105,7 @@ var AddTimeModal = function AddTimeModal() {
105
105
 
106
106
  // 当前time
107
107
  var currentTime = useMemo(function () {
108
- var _time = addTimeRowKey.getValue(recordKey).time || "";
108
+ var _time = addTimeRowKey.getValue(recordKey).time || '';
109
109
  return _time;
110
110
  }, [recordKey]);
111
111
 
@@ -138,17 +138,17 @@ var AddTimeModal = function AddTimeModal() {
138
138
  try {
139
139
  var _state$service$cacheI3;
140
140
  if (!currentResource || !((_state$service$cacheI3 = state.service.cacheItem) !== null && _state$service$cacheI3 !== void 0 && _state$service$cacheI3._extend)) {
141
- return "";
141
+ return '';
142
142
  }
143
143
  var timeItem = currentResource === null || currentResource === void 0 ? void 0 : currentResource.times.find(function (_time) {
144
144
  return _time.item_id === state.service.cacheItem._extend.relation_id;
145
145
  });
146
- var timeEndDate = dayjs(timeItem.end_date + " " + timeItem.end_time).add(1, "second");
146
+ var timeEndDate = dayjs(timeItem.end_date + ' ' + timeItem.end_time).add(1, 'second');
147
147
  return timeEndDate;
148
148
  } catch (err) {
149
- console.log("err", err);
149
+ console.log('err', err);
150
150
  }
151
- return "";
151
+ return '';
152
152
  }, [state.service.cacheItem, currentResource]);
153
153
  var getTimeUsableStatus = function getTimeUsableStatus(time) {
154
154
  var _state$service$cacheI4;
@@ -163,11 +163,11 @@ var AddTimeModal = function AddTimeModal() {
163
163
  var _extend = _objectSpread({}, state.service.cacheItem._extend);
164
164
 
165
165
  // 结束时间加上加时
166
- _extend.endDate = _extend.endDate.add(time, "minutes");
166
+ _extend.endDate = _extend.endDate.add(time, 'minutes');
167
167
  _extend.start_date = _extend.startDate;
168
168
  _extend.end_date = _extend.endDate;
169
- _extend.end_time = _extend.endDate.format("HH:mm");
170
- _extend.start_time = _extend.startDate.format("HH:mm");
169
+ _extend.end_time = _extend.endDate.format('HH:mm');
170
+ _extend.start_time = _extend.startDate.format('HH:mm');
171
171
 
172
172
  // 时长加上加时
173
173
  _extend.duration = flexibleObj.add(_extend.duration, time);
@@ -177,10 +177,10 @@ var AddTimeModal = function AddTimeModal() {
177
177
  }
178
178
 
179
179
  // 如果跨天 结束时间前面加一个明天
180
- var startText = _extend.startDate.format("hh:mm A");
181
- var endText = _extend.endDate.format("hh:mm A");
182
- if (_extend.endDate.isAfter(_extend.startDate, "day")) {
183
- endText = locales.getText("pisell1.text.tomorrow") + endText;
180
+ var startText = _extend.startDate.format('hh:mm A');
181
+ var endText = _extend.endDate.format('hh:mm A');
182
+ if (_extend.endDate.isAfter(_extend.startDate, 'day')) {
183
+ endText = locales.getText('pisell1.text.tomorrow') + endText;
184
184
  }
185
185
  var timeItem = currentResource === null || currentResource === void 0 ? void 0 : currentResource.times.find(function (_time) {
186
186
  return _time.item_id === _extend.relation_id;
@@ -192,7 +192,7 @@ var AddTimeModal = function AddTimeModal() {
192
192
  return {
193
193
  // maxEndTime:
194
194
  status: statusMap.unavailable,
195
- message: "".concat(currentResource.room_name || currentResource.name, " ").concat(locales.getText("pisell2.text.status.service-error-2"))
195
+ message: "".concat(currentResource.room_name || currentResource.name, " ").concat(locales.getText('pisell2.text.status.service-error-2'))
196
196
  };
197
197
  }
198
198
  } catch (err) {}
@@ -252,9 +252,9 @@ var AddTimeModal = function AddTimeModal() {
252
252
  skip: 1,
253
253
  num: 500,
254
254
  open_quotation: 1,
255
- schedule_date: state.date.value.format("YYYY-MM-DD"),
255
+ schedule_date: state.date.value.format('YYYY-MM-DD'),
256
256
  customer_id: isWalkIn((_state$client = state.client) === null || _state$client === void 0 ? void 0 : (_state$client$value = _state$client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id) ? undefined : (_state$client2 = state.client) === null || _state$client2 === void 0 ? void 0 : (_state$client2$value = _state$client2.value) === null || _state$client2$value === void 0 ? void 0 : _state$client2$value.id,
257
- extension_type: ["product_add_time"]
257
+ extension_type: ['product_add_time']
258
258
  }, {
259
259
  useCache: true
260
260
  });
@@ -279,7 +279,7 @@ var AddTimeModal = function AddTimeModal() {
279
279
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
280
280
  while (1) switch (_context2.prev = _context2.next) {
281
281
  case 0:
282
- setLoading("list");
282
+ setLoading('list');
283
283
  _context2.next = 3;
284
284
  return _getAddTimeProducts();
285
285
  case 3:
@@ -305,7 +305,7 @@ var AddTimeModal = function AddTimeModal() {
305
305
  if (list.length) {
306
306
  setDefaultProduct(list);
307
307
  }
308
- setLoading("");
308
+ setLoading('');
309
309
  setIsEdit(true);
310
310
  case 9:
311
311
  case "end":
@@ -338,11 +338,11 @@ var AddTimeModal = function AddTimeModal() {
338
338
  }, [state.service.addTimeModal]);
339
339
 
340
340
  // 选择
341
- var onSelectItem = function onSelectItem(pItem, item) {
341
+ var onSelectItem = useMemoizedFn(function (pItem, item) {
342
342
  setRecordKey(addTimeRowKey.create(pItem.id, item.value));
343
343
  setIsEdit(true);
344
344
  updateServices.run();
345
- };
345
+ });
346
346
 
347
347
  // 临时模拟出的新服务
348
348
  var newService = useMemo(function () {
@@ -357,10 +357,10 @@ var AddTimeModal = function AddTimeModal() {
357
357
  price: currentTimeItem.price || 0,
358
358
  product_id: currentProduct.id,
359
359
  discount_amount: 0,
360
- product_discount_reason: "",
360
+ product_discount_reason: '',
361
361
  is_charge_tax: currentProduct.is_charge_tax,
362
- discountway: "num",
363
- discount_type: "discount"
362
+ discountway: 'num',
363
+ discount_type: 'discount'
364
364
  };
365
365
 
366
366
  // 当前子预约
@@ -368,11 +368,11 @@ var AddTimeModal = function AddTimeModal() {
368
368
  var relation_products = [relation_product];
369
369
 
370
370
  // 结束时间加上加时
371
- _extend.endDate = _extend.endDate.add(relation_product.product_add_schedule_time, "minutes");
372
- var start_date = _extend.startDate.format("YYYY-MM-DD");
373
- var end_date = _extend.endDate.format("YYYY-MM-DD");
374
- var end_time = _extend.endDate.format("HH:mm");
375
- var start_time = _extend.startDate.format("HH:mm");
371
+ _extend.endDate = _extend.endDate.add(relation_product.product_add_schedule_time, 'minutes');
372
+ var start_date = _extend.startDate.format('YYYY-MM-DD');
373
+ var end_date = _extend.endDate.format('YYYY-MM-DD');
374
+ var end_time = _extend.endDate.format('HH:mm');
375
+ var start_time = _extend.startDate.format('HH:mm');
376
376
 
377
377
  // 时长加上加时
378
378
  var duration = flexibleObj.add(_extend.duration, relation_product.product_add_schedule_time);
@@ -413,14 +413,14 @@ var AddTimeModal = function AddTimeModal() {
413
413
  var _edit = (_originServices$curre2 = originServices.current) === null || _originServices$curre2 === void 0 ? void 0 : _originServices$curre2.edit;
414
414
  originServices.current = null;
415
415
  dispatch({
416
- type: "setService",
416
+ type: 'setService',
417
417
  payload: {
418
418
  value: _val,
419
419
  edit: _edit
420
420
  }
421
421
  });
422
422
  };
423
- var createNewServices = function createNewServices() {
423
+ var createNewServices = useMemoizedFn(function () {
424
424
  var _state$service2;
425
425
  var _list = ((_state$service2 = state.service) === null || _state$service2 === void 0 ? void 0 : _state$service2.value) || [];
426
426
  if (!originServices.current) {
@@ -437,7 +437,7 @@ var AddTimeModal = function AddTimeModal() {
437
437
  return _item;
438
438
  });
439
439
  dispatch({
440
- type: "setService",
440
+ type: 'setService',
441
441
  payload: {
442
442
  value: _list,
443
443
  edit: true
@@ -446,7 +446,7 @@ var AddTimeModal = function AddTimeModal() {
446
446
  } else {
447
447
  resetService();
448
448
  }
449
- };
449
+ });
450
450
  var goCheckout = /*#__PURE__*/function () {
451
451
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
452
452
  var _interaction$utils, _interaction$utils$po;
@@ -458,15 +458,15 @@ var AddTimeModal = function AddTimeModal() {
458
458
  break;
459
459
  }
460
460
  return _context3.abrupt("return", interaction === null || interaction === void 0 ? void 0 : (_interaction$utils = interaction.utils) === null || _interaction$utils === void 0 ? void 0 : (_interaction$utils$po = _interaction$utils.postMessageToApp) === null || _interaction$utils$po === void 0 ? void 0 : _interaction$utils$po.call(_interaction$utils, {
461
- module: "booking",
462
- key: "booking_checkout",
461
+ module: 'booking',
462
+ key: 'booking_checkout',
463
463
  data: {
464
464
  order_id: state.bookingId
465
465
  }
466
466
  }));
467
467
  case 2:
468
468
  state.action({
469
- type: "pisell1.handlePayment",
469
+ type: 'pisell1.handlePayment',
470
470
  data: {
471
471
  orderId: state.bookingId
472
472
  },
@@ -484,214 +484,207 @@ var AddTimeModal = function AddTimeModal() {
484
484
  return _ref3.apply(this, arguments);
485
485
  };
486
486
  }();
487
- var handleCheckout = /*#__PURE__*/function () {
488
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
489
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
490
- while (1) switch (_context4.prev = _context4.next) {
491
- case 0:
492
- if (!isEdit) {
493
- _context4.next = 3;
494
- break;
495
- }
487
+ var handleCheckout = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
488
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
489
+ while (1) switch (_context4.prev = _context4.next) {
490
+ case 0:
491
+ if (!isEdit) {
496
492
  _context4.next = 3;
497
- return handleSave("checkout");
498
- case 3:
499
- goCheckout();
500
- case 4:
501
- case "end":
502
- return _context4.stop();
503
- }
504
- }, _callee4);
505
- }));
506
- return function handleCheckout() {
507
- return _ref4.apply(this, arguments);
508
- };
509
- }();
510
- var handleSave = /*#__PURE__*/function () {
511
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
512
- var loadingType,
513
- _args5 = arguments;
514
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
515
- while (1) switch (_context5.prev = _context5.next) {
516
- case 0:
517
- loadingType = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : "save";
518
- if (!(currentTime === null)) {
519
- _context5.next = 3;
520
- break;
521
- }
522
- return _context5.abrupt("return");
523
- case 3:
524
- setLoading(loadingType);
493
+ break;
494
+ }
495
+ _context4.next = 3;
496
+ return handleSave('checkout');
497
+ case 3:
498
+ goCheckout();
499
+ case 4:
500
+ case "end":
501
+ return _context4.stop();
502
+ }
503
+ }, _callee4);
504
+ })));
505
+ var handleSave = useMemoizedFn( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
506
+ var loadingType,
507
+ _args5 = arguments;
508
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
509
+ while (1) switch (_context5.prev = _context5.next) {
510
+ case 0:
511
+ loadingType = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : 'save';
512
+ if (!(currentTime === null)) {
513
+ _context5.next = 3;
514
+ break;
515
+ }
516
+ return _context5.abrupt("return");
517
+ case 3:
518
+ setLoading(loadingType);
525
519
 
526
- // save
527
- _context5.next = 6;
528
- return saveAddTimeProduct({
529
- orderId: state.bookingId,
530
- params: _objectSpread(_objectSpread({}, newService), {}, {
531
- _extend: undefined
532
- })
533
- });
534
- case 6:
535
- // 更新外部预约列表
536
- setLoading("");
537
- message.success(locales.getText("page.booking.text.add-time-success"));
520
+ // save
521
+ _context5.next = 6;
522
+ return saveAddTimeProduct({
523
+ orderId: state.bookingId,
524
+ params: _objectSpread(_objectSpread({}, newService), {}, {
525
+ _extend: undefined
526
+ })
527
+ });
528
+ case 6:
529
+ // 更新外部预约列表
530
+ setLoading('');
531
+ message.success(locales.getText('page.booking.text.add-time-success'));
538
532
 
539
- // close
540
- onCancel();
541
- if (!(loadingType === "checkout")) {
542
- _context5.next = 11;
543
- break;
544
- }
545
- return _context5.abrupt("return");
546
- case 11:
547
- // 回调关闭弹窗
548
- state === null || state === void 0 ? void 0 : state.action("init");
549
- case 12:
550
- case "end":
551
- return _context5.stop();
552
- }
553
- }, _callee5);
554
- }));
555
- return function handleSave() {
556
- return _ref5.apply(this, arguments);
557
- };
558
- }();
533
+ // close
534
+ onCancel();
535
+ if (!(loadingType === 'checkout')) {
536
+ _context5.next = 11;
537
+ break;
538
+ }
539
+ return _context5.abrupt("return");
540
+ case 11:
541
+ // 回调关闭弹窗
542
+ state === null || state === void 0 ? void 0 : state.action('init');
543
+ case 12:
544
+ case "end":
545
+ return _context5.stop();
546
+ }
547
+ }, _callee5);
548
+ })));
559
549
  useEffect(function () {
560
550
  if (!state.modalOpen) {
561
551
  onCancel();
562
552
  }
563
553
  }, [state.modalOpen]);
564
- var onCancel = function onCancel() {
554
+ var onCancel = useMemoizedFn(function () {
565
555
  setIsEdit(false);
566
- setRecordKey("");
556
+ setRecordKey('');
567
557
  resetService();
568
558
  setTimeout(function () {
569
559
  dispatch({
570
- type: "setService",
560
+ type: 'setService',
571
561
  payload: {
572
562
  addTimeModal: false
573
563
  }
574
564
  });
575
565
  }, 50);
576
- };
566
+ });
577
567
  var updateTime = useMemo(function () {
578
568
  if (!newService) {
579
- return "";
569
+ return '';
580
570
  }
581
571
  var startTime = newService.start_time;
582
572
  var endTime = newService.end_time;
583
573
  var hours = getDiscountTime(flexibleObj.getValue(newService.duration));
584
574
  if (newService.start_date !== newService.end_date) {
585
575
  var locale = state.locale;
586
- var format = locale === "en" || locale === "en-US" ? "HH:mm DD/MM" : "MM-DD HH:mm";
576
+ var format = locale === 'en' || locale === 'en-US' ? 'HH:mm DD/MM' : 'MM-DD HH:mm';
587
577
  startTime = formatDate("".concat(newService.start_date, " ").concat(newService.start_time), format);
588
578
  endTime = formatDate("".concat(newService.end_date, " ").concat(newService.end_time), format);
589
579
  }
590
- return "".concat(locales.getText("page.booking.text.update-time"), ": ").concat(startTime, " ~ ").concat(endTime, " (").concat(hours, ")");
580
+ return "".concat(locales.getText('page.booking.text.update-time'), ": ").concat(startTime, " ~ ").concat(endTime, " (").concat(hours, ")");
591
581
  }, [newService, state.locale]);
592
- return /*#__PURE__*/React.createElement(Drawer, {
593
- open: state.service.addTimeModal,
594
- title: locales.getText("page.booking.text.add-time"),
595
- rootClassName: "booking-server-wrap",
596
- onClose: onCancel,
597
- footerStyle: {
598
- padding: "10px 32px 20px"
599
- },
600
- hideScrollBar: false,
601
- bodyStyle: {
602
- position: "relative"
603
- },
604
- footer: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
605
- className: "pisell-lowcode__booking-add-time-total-wrap"
606
- }, currentTimeItem && currentTimeItem !== null && currentTimeItem !== void 0 && (_currentTimeItem$stat = currentTimeItem.status) !== null && _currentTimeItem$stat !== void 0 && _currentTimeItem$stat.message ? /*#__PURE__*/React.createElement(Alert, {
607
- message: currentTimeItem.status.message,
608
- type: "warning",
609
- showIcon: true,
610
- style: {
611
- marginBottom: 12
612
- }
613
- }) : null, newService ? /*#__PURE__*/React.createElement("div", {
614
- className: "pisell-lowcode__booking-add-time-summary-wrap"
615
- }, /*#__PURE__*/React.createElement("div", {
616
- className: "pisell-lowcode__booking-add-time-summary"
617
- }, /*#__PURE__*/React.createElement("div", {
618
- className: "pisell-lowcode__booking-add-time-summary-time"
619
- }, updateTime), /*#__PURE__*/React.createElement("div", {
620
- className: "pisell-lowcode__booking-add-time-summary-total"
621
- }, locales.getText("pisell1.text.subtotal"), ":", " ", formatAmount((currentTimeItem.price || 0) * number, 2, state.amountSymbol))), (currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$add_t = currentProduct.add_time) === null || _currentProduct$add_t === void 0 ? void 0 : _currentProduct$add_t.calculate_type) === "select_quantity" && /*#__PURE__*/React.createElement("div", {
622
- className: "pisell-lowcode__booking-add-time-quantity-wrap"
623
- }, /*#__PURE__*/React.createElement("span", {
624
- className: "pisell-lowcode__booking-add-time-quantity"
625
- }, locales.getText("page.booking.text.quantity")), " ", /*#__PURE__*/React.createElement(BrowserSelect, {
626
- value: number,
627
- onChange: function onChange(e) {
628
- setNumber(Number(e.target.value));
629
- updateServices.run();
582
+ return useMemo(function () {
583
+ var _currentTimeItem$stat, _currentProduct$add_t;
584
+ return /*#__PURE__*/React.createElement(Drawer, {
585
+ open: state.service.addTimeModal,
586
+ title: locales.getText('page.booking.text.add-time'),
587
+ rootClassName: "booking-server-wrap",
588
+ onClose: onCancel,
589
+ footerStyle: {
590
+ padding: '10px 32px 20px'
591
+ },
592
+ hideScrollBar: false,
593
+ bodyStyle: {
594
+ position: 'relative'
630
595
  },
631
- className: "pisell-lowcode__booking-add-time-quantity-select",
632
- options: numberList
633
- }))) : null), /*#__PURE__*/React.createElement(Footer, {
634
- state: state,
635
- dispatch: dispatch,
636
- source: "addTime",
637
- buttons: [/*#__PURE__*/React.createElement(Button, {
638
- className: "pisell-lowcode__booking-footer-buttons-item",
639
- type: transaction_habit_selection.type === "service_now_pay_later" ? "default" : "primary",
640
- disabled: loading === "list" || !isEdit || !currentTime,
641
- onClick: handleCheckout,
642
- loading: loading === "checkout"
643
- }, locales.getText("pisell2.text.checkout")), /*#__PURE__*/React.createElement(Button, {
644
- className: "pisell-lowcode__booking-footer-buttons-item",
645
- type: transaction_habit_selection.type === "service_now_pay_later" ? "primary" : "default",
646
- disabled: loading === "list" || !isEdit || !currentTime,
647
- loading: loading === "save",
648
- onClick: function onClick() {
649
- handleSave("save");
596
+ footer: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
597
+ className: "pisell-lowcode__booking-add-time-total-wrap"
598
+ }, currentTimeItem && currentTimeItem !== null && currentTimeItem !== void 0 && (_currentTimeItem$stat = currentTimeItem.status) !== null && _currentTimeItem$stat !== void 0 && _currentTimeItem$stat.message ? /*#__PURE__*/React.createElement(Alert, {
599
+ message: currentTimeItem.status.message,
600
+ type: "warning",
601
+ showIcon: true,
602
+ style: {
603
+ marginBottom: 12
650
604
  }
651
- }, locales.getText("pisell2.text.save"))]
652
- }))
653
- }, /*#__PURE__*/React.createElement("div", {
654
- className: "pisell-lowcode__booking-add-time-body"
655
- }, /*#__PURE__*/React.createElement(Skeleton, {
656
- loading: loading === "list",
657
- active: true,
658
- round: true
659
- }, /*#__PURE__*/React.createElement("div", {
660
- className: ""
661
- }, renderList.map(function (d) {
662
- return /*#__PURE__*/React.createElement("div", {
663
- className: ""
605
+ }) : null, newService ? /*#__PURE__*/React.createElement("div", {
606
+ className: "pisell-lowcode__booking-add-time-summary-wrap"
607
+ }, /*#__PURE__*/React.createElement("div", {
608
+ className: "pisell-lowcode__booking-add-time-summary"
609
+ }, /*#__PURE__*/React.createElement("div", {
610
+ className: "pisell-lowcode__booking-add-time-summary-time"
611
+ }, updateTime), /*#__PURE__*/React.createElement("div", {
612
+ className: "pisell-lowcode__booking-add-time-summary-total"
613
+ }, locales.getText('pisell1.text.subtotal'), ":", ' ', formatAmount((currentTimeItem.price || 0) * number, 2, state.amountSymbol))), (currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$add_t = currentProduct.add_time) === null || _currentProduct$add_t === void 0 ? void 0 : _currentProduct$add_t.calculate_type) === 'select_quantity' && /*#__PURE__*/React.createElement("div", {
614
+ className: "pisell-lowcode__booking-add-time-quantity-wrap"
615
+ }, /*#__PURE__*/React.createElement("span", {
616
+ className: "pisell-lowcode__booking-add-time-quantity"
617
+ }, locales.getText('page.booking.text.quantity')), ' ', /*#__PURE__*/React.createElement(BrowserSelect, {
618
+ value: number,
619
+ onChange: function onChange(e) {
620
+ setNumber(Number(e.target.value));
621
+ updateServices.run();
622
+ },
623
+ className: "pisell-lowcode__booking-add-time-quantity-select",
624
+ options: numberList
625
+ }))) : null), /*#__PURE__*/React.createElement(Footer, {
626
+ state: state,
627
+ dispatch: dispatch,
628
+ source: "addTime",
629
+ buttons: [/*#__PURE__*/React.createElement(Button, {
630
+ className: "pisell-lowcode__booking-footer-buttons-item",
631
+ type: transaction_habit_selection.type === 'service_now_pay_later' ? 'default' : 'primary',
632
+ disabled: loading === 'list' || !isEdit || !currentTime,
633
+ onClick: handleCheckout,
634
+ loading: loading === 'checkout'
635
+ }, locales.getText('pisell2.text.checkout')), /*#__PURE__*/React.createElement(Button, {
636
+ className: "pisell-lowcode__booking-footer-buttons-item",
637
+ type: transaction_habit_selection.type === 'service_now_pay_later' ? 'primary' : 'default',
638
+ disabled: loading === 'list' || !isEdit || !currentTime,
639
+ loading: loading === 'save',
640
+ onClick: function onClick() {
641
+ handleSave('save');
642
+ }
643
+ }, locales.getText('pisell2.text.save'))]
644
+ }))
664
645
  }, /*#__PURE__*/React.createElement("div", {
665
- className: "pisell-lowcode__booking-add-time-hours"
666
- }, d.title), d.times ? /*#__PURE__*/React.createElement("div", {
667
- className: "pisell-lowcode__booking-add-time-child-card-list"
668
- }, d.times.map(function (child) {
669
- var _child$status, _child$status$status, _child$status2, _child$status2$status;
646
+ className: "pisell-lowcode__booking-add-time-body"
647
+ }, /*#__PURE__*/React.createElement(Skeleton, {
648
+ loading: loading === 'list',
649
+ active: true,
650
+ round: true
651
+ }, /*#__PURE__*/React.createElement("div", {
652
+ className: ""
653
+ }, renderList.map(function (d) {
670
654
  return /*#__PURE__*/React.createElement("div", {
671
- className: classNames("pisell-lowcode__booking-add-time-child-card", {
672
- "pisell-lowcode__booking-add-time-child-card-active": recordKey === addTimeRowKey.create(d.id, child.value)
673
- }),
674
- onClick: function onClick() {
675
- if (!child.value) {
676
- return;
677
- }
678
- onSelectItem(d, child);
679
- }
680
- }, /*#__PURE__*/React.createElement("div", {
681
- className: "pisell-lowcode__booking-add-time-child-card-left"
655
+ className: ""
682
656
  }, /*#__PURE__*/React.createElement("div", {
683
- className: "pisell-lowcode__booking-add-time-child-card-left-time"
684
- }, child.label), /*#__PURE__*/React.createElement("div", {
685
- className: "pisell-lowcode__booking-add-time-child-card-left-price"
686
- }, formatAmount(child.price, 2, state.amountSymbol))), /*#__PURE__*/React.createElement("div", {
687
- className: "pisell-lowcode__booking-add-time-child-card-right",
688
- style: {
689
- color: (_child$status = child.status) === null || _child$status === void 0 ? void 0 : (_child$status$status = _child$status.status) === null || _child$status$status === void 0 ? void 0 : _child$status$status.color
690
- }
691
- }, (_child$status2 = child.status) === null || _child$status2 === void 0 ? void 0 : (_child$status2$status = _child$status2.status) === null || _child$status2$status === void 0 ? void 0 : _child$status2$status.label));
692
- })) : null);
693
- }))), /*#__PURE__*/React.createElement("div", {
694
- className: ""
695
- })));
657
+ className: "pisell-lowcode__booking-add-time-hours"
658
+ }, d.title), d.times ? /*#__PURE__*/React.createElement("div", {
659
+ className: "pisell-lowcode__booking-add-time-child-card-list"
660
+ }, d.times.map(function (child) {
661
+ var _child$status, _child$status$status, _child$status2, _child$status2$status;
662
+ return /*#__PURE__*/React.createElement("div", {
663
+ className: classNames('pisell-lowcode__booking-add-time-child-card', {
664
+ 'pisell-lowcode__booking-add-time-child-card-active': recordKey === addTimeRowKey.create(d.id, child.value)
665
+ }),
666
+ onClick: function onClick() {
667
+ if (!child.value) {
668
+ return;
669
+ }
670
+ onSelectItem(d, child);
671
+ }
672
+ }, /*#__PURE__*/React.createElement("div", {
673
+ className: "pisell-lowcode__booking-add-time-child-card-left"
674
+ }, /*#__PURE__*/React.createElement("div", {
675
+ className: "pisell-lowcode__booking-add-time-child-card-left-time"
676
+ }, child.label), /*#__PURE__*/React.createElement("div", {
677
+ className: "pisell-lowcode__booking-add-time-child-card-left-price"
678
+ }, formatAmount(child.price, 2, state.amountSymbol))), /*#__PURE__*/React.createElement("div", {
679
+ className: "pisell-lowcode__booking-add-time-child-card-right",
680
+ style: {
681
+ color: (_child$status = child.status) === null || _child$status === void 0 ? void 0 : (_child$status$status = _child$status.status) === null || _child$status$status === void 0 ? void 0 : _child$status$status.color
682
+ }
683
+ }, (_child$status2 = child.status) === null || _child$status2 === void 0 ? void 0 : (_child$status2$status = _child$status2.status) === null || _child$status2$status === void 0 ? void 0 : _child$status2$status.label));
684
+ })) : null);
685
+ }))), /*#__PURE__*/React.createElement("div", {
686
+ className: ""
687
+ })));
688
+ }, [state.service.addTimeModal, locales, currentTimeItem, currentTimeItem === null || currentTimeItem === void 0 ? void 0 : (_currentTimeItem$stat2 = currentTimeItem.status) === null || _currentTimeItem$stat2 === void 0 ? void 0 : _currentTimeItem$stat2.message, newService, updateTime, currentTimeItem.price, number, state.amountSymbol, currentProduct === null || currentProduct === void 0 ? void 0 : (_currentProduct$add_t2 = currentProduct.add_time) === null || _currentProduct$add_t2 === void 0 ? void 0 : _currentProduct$add_t2.calculate_type, numberList, updateServices.run, state, dispatch, transaction_habit_selection.type, loading, isEdit, currentTime, transaction_habit_selection.type, renderList, recordKey]);
696
689
  };
697
690
  export default AddTimeModal;