@pisell/private-materials 3.0.73 → 3.0.75

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