@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
@@ -35,14 +35,17 @@ __export(utils_exports, {
35
35
  flexibleObj: () => flexibleObj,
36
36
  formatProductListByCategory: () => formatProductListByCategory,
37
37
  formatResource: () => formatResource,
38
+ formatTimes: () => formatTimes,
38
39
  getCacheParams: () => getCacheParams,
39
40
  getDiscountTime: () => getDiscountTime,
40
41
  getDuration: () => getDuration,
41
42
  getEndDate: () => getEndDate,
42
43
  getErrorList: () => getErrorList,
44
+ getIsEdit: () => getIsEdit,
43
45
  getLastServer: () => getLastServer,
44
46
  getNowTime: () => getNowTime,
45
47
  getProductTotalPrice: () => getProductTotalPrice,
48
+ getResourceTimeIsUsable: () => getResourceTimeIsUsable,
46
49
  getServeStartTime: () => getServeStartTime,
47
50
  getServerItemExtend: () => getServerItemExtend,
48
51
  getServiceTime: () => getServiceTime,
@@ -204,42 +207,46 @@ var formatProductListByCategory = (list, filterItem) => {
204
207
  }
205
208
  return Object.values(categoryObject);
206
209
  };
210
+ var getResourceTimeIsUsable = (item, cacheItem) => {
211
+ const startDate = (0, import_dayjs.default)(cacheItem._extend.start_date.format("YYYY-MM-DD") + " " + getServeStartTime(cacheItem._extend.start_time));
212
+ const isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
213
+ let isMaxLimitRange = false;
214
+ let isDateRange = false;
215
+ let time = { ...item };
216
+ if (time.max_participants_limit == 0) {
217
+ isMaxLimitRange = true;
218
+ } else {
219
+ isMaxLimitRange = "unknown";
220
+ }
221
+ const timeStartDate = (0, import_dayjs.default)(time.start_date + " " + time.start_time).subtract(1, "second");
222
+ const timeEndDate = (0, import_dayjs.default)(time.end_date + " " + time.end_time).add(1, "second");
223
+ let bol;
224
+ if (isFlexible) {
225
+ bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
226
+ } else {
227
+ let endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), "minute");
228
+ bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
229
+ }
230
+ if (bol) {
231
+ isDateRange = true;
232
+ }
233
+ const isUsable = isDateRange;
234
+ time._extend = {
235
+ isMaxLimitRange,
236
+ isDateRange,
237
+ isUsable
238
+ };
239
+ return time;
240
+ };
207
241
  var formatTimes = (resourceItem, cacheItem) => {
208
242
  let usableTimes = [];
209
243
  let _resourceItem = { ...resourceItem };
210
- const startDate = (0, import_dayjs.default)(cacheItem._extend.start_date.format("YYYY-MM-DD") + " " + getServeStartTime(cacheItem._extend.start_time));
211
- const isFlexible = flexibleObj.isFlexible(cacheItem._extend.duration);
212
- _resourceItem.times = _resourceItem.times.map((d) => {
213
- let isMaxLimitRange = false;
214
- let isDateRange = false;
215
- let time = { ...d };
216
- if (time.max_participants_limit == 0) {
217
- isMaxLimitRange = true;
218
- } else {
219
- isMaxLimitRange = "unknown";
220
- }
221
- const timeStartDate = (0, import_dayjs.default)(time.start_date + " " + time.start_time).subtract(1, "second");
222
- const timeEndDate = (0, import_dayjs.default)(time.end_date + " " + time.end_time).add(1, "second");
223
- let bol;
224
- if (isFlexible) {
225
- bol = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
226
- } else {
227
- let endDate = startDate.add(flexibleObj.getValue(cacheItem._extend.duration), "minute");
228
- bol = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
229
- }
230
- if (bol) {
231
- isDateRange = true;
244
+ _resourceItem.times = _resourceItem.times.map((time) => {
245
+ let _time2 = getResourceTimeIsUsable(time, cacheItem);
246
+ if (_time2 == null ? void 0 : _time2._extend.isUsable) {
247
+ usableTimes.push(_time2);
232
248
  }
233
- const isUsable = isDateRange;
234
- time._extend = {
235
- isMaxLimitRange,
236
- isDateRange,
237
- isUsable
238
- };
239
- if (isUsable) {
240
- usableTimes.push(time);
241
- }
242
- return time;
249
+ return _time2;
243
250
  });
244
251
  let _time = (usableTimes || []).sort((a, b) => {
245
252
  const aEndDate = (0, import_dayjs.default)(a.end_date + " " + a.end_time).valueOf();
@@ -309,6 +316,15 @@ var flexibleObj = {
309
316
  return false;
310
317
  }
311
318
  return str.indexOf("flexible_") > -1;
319
+ },
320
+ add: (current, duration) => {
321
+ if (flexibleObj.isFlexible(current)) {
322
+ return flexibleObj.create(
323
+ flexibleObj.getValue(current) + duration
324
+ );
325
+ } else {
326
+ return Number(current) + duration;
327
+ }
312
328
  }
313
329
  };
314
330
  var getEndDate = (startDate, duration, endDate) => {
@@ -383,7 +399,9 @@ var formatResource = (resourceItem, cacheItem, formatLabel) => {
383
399
  _resourceItem.labelText = _resourceItem.room_name || _resourceItem.name;
384
400
  const usable = _resourceItem._extend.usableTime && _resourceItem._extend.usableProduct;
385
401
  _resourceItem.usable = usable;
386
- _resourceItem.label = formatLabel(_resourceItem);
402
+ if (formatLabel) {
403
+ _resourceItem.label = formatLabel(_resourceItem);
404
+ }
387
405
  return _resourceItem;
388
406
  };
389
407
  var getLastServer = (list) => {
@@ -485,6 +503,34 @@ var isWalkIn = (customer_id) => {
485
503
  }
486
504
  return [0, 1].includes(customer_id);
487
505
  };
506
+ var getIsEdit = (state) => {
507
+ var _a, _b, _c, _d, _e, _f, _g;
508
+ if ((_a = state.addons) == null ? void 0 : _a.edit) {
509
+ return true;
510
+ }
511
+ if (!state.bookingId) {
512
+ return true;
513
+ }
514
+ if ((_b = state.client) == null ? void 0 : _b.edit) {
515
+ return true;
516
+ }
517
+ if ((_c = state.date) == null ? void 0 : _c.edit) {
518
+ return true;
519
+ }
520
+ if ((_d = state.pet) == null ? void 0 : _d.edit) {
521
+ return true;
522
+ }
523
+ if ((_e = state.service) == null ? void 0 : _e.edit) {
524
+ return true;
525
+ }
526
+ if ((_f = state.notes) == null ? void 0 : _f.edit) {
527
+ return true;
528
+ }
529
+ if ((_g = state.contacts) == null ? void 0 : _g.edit) {
530
+ return true;
531
+ }
532
+ return false;
533
+ };
488
534
  // Annotate the CommonJS export names for ESM import in node:
489
535
  0 && (module.exports = {
490
536
  deleteCacheParams,
@@ -493,14 +539,17 @@ var isWalkIn = (customer_id) => {
493
539
  flexibleObj,
494
540
  formatProductListByCategory,
495
541
  formatResource,
542
+ formatTimes,
496
543
  getCacheParams,
497
544
  getDiscountTime,
498
545
  getDuration,
499
546
  getEndDate,
500
547
  getErrorList,
548
+ getIsEdit,
501
549
  getLastServer,
502
550
  getNowTime,
503
551
  getProductTotalPrice,
552
+ getResourceTimeIsUsable,
504
553
  getServeStartTime,
505
554
  getServerItemExtend,
506
555
  getServiceTime,
@@ -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: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.73",
3
+ "version": "3.0.75",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -58,9 +58,9 @@
58
58
  "ahooks": "^3.7.6",
59
59
  "react-infinite-scroll-component": "^6.1.0",
60
60
  "rc-virtual-list": "^3.11.3",
61
+ "@pisell/utils": "1.0.25",
61
62
  "@pisell/date-picker": "1.0.74",
62
- "@pisell/icon": "0.0.8",
63
- "@pisell/utils": "1.0.25"
63
+ "@pisell/icon": "0.0.8"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "react": "^18.0.0",