@pisell/private-materials 3.0.72 → 3.0.74

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 (89) 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/footer/amount.js +47 -24
  14. package/es/components/booking/components/footer/index.js +5 -0
  15. package/es/components/booking/components/footer/utils.js +22 -1
  16. package/es/components/booking/deposit/index.js +10 -1
  17. package/es/components/booking/forms/forms.d.ts +1 -1
  18. package/es/components/booking/forms/index.d.ts +1 -1
  19. package/es/components/booking/forms/model.d.ts +1 -2
  20. package/es/components/booking/index.d.ts +1 -1
  21. package/es/components/booking/info/index.d.ts +1 -1
  22. package/es/components/booking/info/model.d.ts +1 -2
  23. package/es/components/booking/info/service/actions/index.d.ts +6 -0
  24. package/es/components/booking/info/service/actions/index.js +73 -0
  25. package/es/components/booking/info/service/actions/index.less +9 -0
  26. package/es/components/booking/info/service/addTimeModal/index.d.ts +4 -0
  27. package/es/components/booking/info/service/addTimeModal/index.js +658 -0
  28. package/es/components/booking/info/service/addTimeModal/index.less +133 -0
  29. package/es/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
  30. package/es/components/booking/info/service/addTimeModal/serve.js +50 -0
  31. package/es/components/booking/info/service/addTimeModal/utils.d.ts +12 -0
  32. package/es/components/booking/info/service/addTimeModal/utils.js +96 -0
  33. package/es/components/booking/info/service/index.js +2 -1
  34. package/es/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
  35. package/es/components/booking/info/service/serviceItem/Sales/index.js +0 -0
  36. package/es/components/booking/info/service/serviceItem/Sales/index.less +0 -0
  37. package/es/components/booking/info/service/serviceItem/index.js +24 -2
  38. package/es/components/booking/info/service/serviceItem/index.less +28 -0
  39. package/es/components/booking/locales.d.ts +24 -0
  40. package/es/components/booking/locales.js +26 -2
  41. package/es/components/booking/model.d.ts +3 -2
  42. package/es/components/booking/notes/index.d.ts +1 -1
  43. package/es/components/booking/notes/model.d.ts +1 -2
  44. package/es/components/booking/payments/index.d.ts +1 -1
  45. package/es/components/booking/payments/model.d.ts +1 -2
  46. package/es/components/booking/utils.d.ts +12 -0
  47. package/es/components/booking/utils.js +91 -48
  48. package/es/components/schedules/index.d.ts +1 -1
  49. package/es/components/schedules/model.d.ts +1 -2
  50. package/lib/components/booking/addons/index.d.ts +1 -1
  51. package/lib/components/booking/addons/model.d.ts +1 -2
  52. package/lib/components/booking/components/footer/amount.js +10 -0
  53. package/lib/components/booking/components/footer/index.js +5 -0
  54. package/lib/components/booking/components/footer/utils.js +21 -1
  55. package/lib/components/booking/deposit/index.js +3 -1
  56. package/lib/components/booking/forms/forms.d.ts +1 -1
  57. package/lib/components/booking/forms/index.d.ts +1 -1
  58. package/lib/components/booking/forms/model.d.ts +1 -2
  59. package/lib/components/booking/index.d.ts +1 -1
  60. package/lib/components/booking/info/index.d.ts +1 -1
  61. package/lib/components/booking/info/model.d.ts +1 -2
  62. package/lib/components/booking/info/service/actions/index.d.ts +6 -0
  63. package/lib/components/booking/info/service/actions/index.js +97 -0
  64. package/lib/components/booking/info/service/actions/index.less +9 -0
  65. package/lib/components/booking/info/service/addTimeModal/index.d.ts +4 -0
  66. package/lib/components/booking/info/service/addTimeModal/index.js +566 -0
  67. package/lib/components/booking/info/service/addTimeModal/index.less +133 -0
  68. package/lib/components/booking/info/service/addTimeModal/serve.d.ts +5 -0
  69. package/lib/components/booking/info/service/addTimeModal/serve.js +39 -0
  70. package/lib/components/booking/info/service/addTimeModal/utils.d.ts +12 -0
  71. package/lib/components/booking/info/service/addTimeModal/utils.js +129 -0
  72. package/lib/components/booking/info/service/index.js +2 -1
  73. package/lib/components/booking/info/service/serviceItem/Sales/index.d.ts +0 -0
  74. package/lib/components/booking/info/service/serviceItem/Sales/index.js +0 -0
  75. package/lib/components/booking/info/service/serviceItem/Sales/index.less +0 -0
  76. package/lib/components/booking/info/service/serviceItem/index.js +14 -1
  77. package/lib/components/booking/info/service/serviceItem/index.less +28 -0
  78. package/lib/components/booking/locales.d.ts +24 -0
  79. package/lib/components/booking/locales.js +26 -2
  80. package/lib/components/booking/model.d.ts +3 -2
  81. package/lib/components/booking/notes/index.d.ts +1 -1
  82. package/lib/components/booking/notes/model.d.ts +1 -2
  83. package/lib/components/booking/payments/index.d.ts +1 -1
  84. package/lib/components/booking/payments/model.d.ts +1 -2
  85. package/lib/components/booking/utils.d.ts +12 -0
  86. package/lib/components/booking/utils.js +82 -33
  87. package/lib/components/schedules/index.d.ts +1 -1
  88. package/lib/components/schedules/model.d.ts +1 -2
  89. package/package.json +2 -2
@@ -0,0 +1,39 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/booking/info/service/addTimeModal/serve.ts
20
+ var serve_exports = {};
21
+ __export(serve_exports, {
22
+ getAddTimeProducts: () => getAddTimeProducts,
23
+ saveAddTimeProduct: () => saveAddTimeProduct
24
+ });
25
+ module.exports = __toCommonJS(serve_exports);
26
+ var import_utils = require("../../../utils");
27
+ var getAddTimeProducts = async (params, config) => {
28
+ let { data } = await import_utils.request.getRequest().post(`/shop/product/query`, params, config);
29
+ return data;
30
+ };
31
+ var saveAddTimeProduct = async ({ orderId, params }) => {
32
+ let { data } = await import_utils.request.getRequest().put(`/shop/order/appointment/child-booking/${orderId}`, params);
33
+ return data;
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ getAddTimeProducts,
38
+ saveAddTimeProduct
39
+ });
@@ -0,0 +1,12 @@
1
+ export declare const getAddTimeSplits: (config: any, price: number) => ({
2
+ label: string;
3
+ value: number;
4
+ readonly: boolean;
5
+ price?: undefined;
6
+ } | {
7
+ label: string;
8
+ value: number;
9
+ price: number;
10
+ readonly?: undefined;
11
+ })[];
12
+ export declare const isUsableProduct: (relationProduct: any, currentItem: any) => any;
@@ -0,0 +1,129 @@
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/addTimeModal/utils.ts
30
+ var utils_exports = {};
31
+ __export(utils_exports, {
32
+ getAddTimeSplits: () => getAddTimeSplits,
33
+ isUsableProduct: () => isUsableProduct
34
+ });
35
+ module.exports = __toCommonJS(utils_exports);
36
+ var import_dayjs = __toESM(require("dayjs"));
37
+ var import_utils = require("../../../utils");
38
+ var import_utils2 = require("@pisell/utils");
39
+ var import_lodash = require("lodash");
40
+ var getIsAddH = (pre, current) => {
41
+ if (current < 60) {
42
+ return "";
43
+ }
44
+ let preH = Math.floor(pre / 60);
45
+ let currentH = Math.floor(current / 60);
46
+ if (current % 60 !== 0) {
47
+ return "";
48
+ }
49
+ return (0, import_utils.getDiscountTime)(currentH * 60);
50
+ };
51
+ var getAddTimeSplits = (config, price) => {
52
+ const startTime = (0, import_dayjs.default)().startOf("day");
53
+ const endTime = startTime.add(config.max_add_time, "minute");
54
+ const timeSlice = (config == null ? void 0 : config.unit_duration) || 5;
55
+ let arr = [];
56
+ let currentTime = startTime;
57
+ let lastDuration = 0;
58
+ while (currentTime.isBefore(endTime)) {
59
+ let nextTime = currentTime;
60
+ if (lastDuration === 0) {
61
+ nextTime = nextTime.add(config.min_add_time, "minute");
62
+ } else {
63
+ nextTime = currentTime.add(timeSlice, "minute");
64
+ }
65
+ const durationValue = nextTime.diff(startTime, "minute");
66
+ const isAddH = getIsAddH(lastDuration, durationValue);
67
+ console.log("isAddH", isAddH);
68
+ if (isAddH) {
69
+ arr.push({
70
+ label: isAddH,
71
+ value: 0,
72
+ readonly: true
73
+ });
74
+ }
75
+ if (durationValue >= 60) {
76
+ const durationLabel = (0, import_utils.getDiscountTime)(durationValue);
77
+ arr.push({
78
+ label: durationLabel,
79
+ value: durationValue,
80
+ price: durationValue / timeSlice * price
81
+ });
82
+ } else {
83
+ const durationLabel = `${durationValue} ${import_utils2.locales.getText("pisell2.text.min")}`;
84
+ arr.push({
85
+ label: durationLabel,
86
+ value: durationValue,
87
+ price: durationValue / timeSlice * price
88
+ });
89
+ }
90
+ lastDuration = durationValue;
91
+ currentTime = nextTime;
92
+ }
93
+ return arr;
94
+ };
95
+ var isUsableProduct = (relationProduct, currentItem) => {
96
+ const type = relationProduct.type;
97
+ if (!currentItem) {
98
+ return false;
99
+ }
100
+ if (type === "product_all") {
101
+ return true;
102
+ } else {
103
+ if (type === "product_collection") {
104
+ return !!(0, import_lodash.intersectionBy)(
105
+ relationProduct.products.map((item) => ({
106
+ ...item,
107
+ id: item.product_collection_id
108
+ })) || [],
109
+ currentItem.collection || [],
110
+ "id"
111
+ ).length;
112
+ } else {
113
+ return relationProduct.products.some(
114
+ (item) => {
115
+ if (type === "products") {
116
+ if (item.product_id == currentItem.product_id) {
117
+ return true;
118
+ }
119
+ }
120
+ }
121
+ );
122
+ }
123
+ }
124
+ };
125
+ // Annotate the CommonJS export names for ESM import in node:
126
+ 0 && (module.exports = {
127
+ getAddTimeSplits,
128
+ isUsableProduct
129
+ });
@@ -37,10 +37,11 @@ var import_addService = __toESM(require("./addService"));
37
37
  var import_editService = __toESM(require("./editService"));
38
38
  var import_index = require("./index.less");
39
39
  var import_serviceList = __toESM(require("./serviceList"));
40
+ var import_addTimeModal = __toESM(require("./addTimeModal"));
40
41
  var Service = () => {
41
42
  (0, import_react.useEffect)(() => {
42
43
  document.body.id = "body";
43
44
  }, []);
44
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-wrap" }, /* @__PURE__ */ import_react.default.createElement(import_serviceList.default, null), /* @__PURE__ */ import_react.default.createElement(import_addService.default, null)), /* @__PURE__ */ import_react.default.createElement(import_editService.default, null));
45
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-wrap" }, /* @__PURE__ */ import_react.default.createElement(import_serviceList.default, null), /* @__PURE__ */ import_react.default.createElement(import_addService.default, null)), /* @__PURE__ */ import_react.default.createElement(import_editService.default, null), /* @__PURE__ */ import_react.default.createElement(import_addTimeModal.default, null));
45
46
  };
46
47
  var service_default = Service;
@@ -39,6 +39,7 @@ var import_utils2 = require("@pisell/utils");
39
39
  var import_collapsibleList = __toESM(require("../../../components/collapsibleList"));
40
40
  var import_utils3 = require("../../../components/collapsibleList/utils");
41
41
  var import_antd = require("antd");
42
+ var import_actions = __toESM(require("../actions"));
42
43
  var import_index = require("./index.less");
43
44
  var ServiceItem = ({
44
45
  d,
@@ -48,7 +49,7 @@ var ServiceItem = ({
48
49
  resourceItem,
49
50
  errorMessage
50
51
  }) => {
51
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
52
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
52
53
  let resourceName = (resourceItem == null ? void 0 : resourceItem.labelText) || d.relation_form_name;
53
54
  const isDiscount = (0, import_react.useMemo)(() => {
54
55
  var _a2, _b2;
@@ -84,6 +85,18 @@ var ServiceItem = ({
84
85
  ) : null,
85
86
  d.id ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-price-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-price" }, (0, import_utils2.formatAmount)((_g = d._extend) == null ? void 0 : _g.total, 2, state.amountSymbol)), isDiscount ? /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-original-price" }, (0, import_utils2.formatAmount)(d._extend.origin_total, 2, state.amountSymbol)) : null)) : null,
86
87
  isDiscount && ((_h = d._extend) == null ? void 0 : _h.discount_reason) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-discount-reason" }, /* @__PURE__ */ import_react.default.createElement("span", null, import_utils2.locales.getText("pisell2.text.discount-reason"), ":"), " ", (_i = d._extend) == null ? void 0 : _i.discount_reason) : null,
88
+ ((_j = d._extend.relation_details) == null ? void 0 : _j.length) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-relation-details" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-title" }, import_utils2.locales.getText("page.booking.text.sales")), d._extend.relation_details.map((item, index) => {
89
+ return /* @__PURE__ */ import_react.default.createElement(
90
+ "div",
91
+ {
92
+ className: "pisell-lowcode__booking-service-item-relation-detail",
93
+ key: item.id
94
+ },
95
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-relation-detail-title" }, item.product_title),
96
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-item-relation-detail-info" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-relation-detail-info-price" }, (0, import_utils2.formatAmount)(item.payment_price, 2, state.amountSymbol)), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-relation-detail-info-unit" }, "x"), /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-service-item-relation-detail-info-quantity" }, item.product_quantity))
97
+ );
98
+ })) : null,
99
+ /* @__PURE__ */ import_react.default.createElement(import_actions.default, { currentService: d }),
87
100
  errorMessage ? /* @__PURE__ */ import_react.default.createElement(
88
101
  import_antd.Alert,
89
102
  {
@@ -94,4 +94,32 @@
94
94
  margin: 0 -20px -16px;
95
95
  border-radius: 0 0 8px 8px;
96
96
  }
97
+ }
98
+
99
+ .pisell-lowcode__booking-service-item-relation-details {
100
+ padding-top: 6px;
101
+ margin-top: 6px;
102
+ border-top: 1px solid #d5d7da;
103
+ margin-bottom: 6px;
104
+ }
105
+
106
+ .pisell-lowcode__booking-service-item-relation-detail {
107
+ display: flex;
108
+ align-items: flex-start;
109
+ justify-content: space-between;
110
+ margin-top: 4px;
111
+ overflow: hidden;
112
+
113
+ .pisell-lowcode__booking-service-item-relation-detail-title {}
114
+
115
+ .pisell-lowcode__booking-service-item-relation-detail-info {
116
+ .pisell-lowcode__booking-service-item-relation-detail-info-quantity {}
117
+
118
+ .pisell-lowcode__booking-service-item-relation-detail-info-unit {
119
+ padding: 0 4px;
120
+ }
121
+
122
+ .pisell-lowcode__booking-service-item-relation-detail-info-price {}
123
+ }
124
+
97
125
  }
@@ -146,6 +146,14 @@ declare const _default: {
146
146
  'pisell2.text.send-mail': string;
147
147
  'pisell2.text.copy-to-clipboard': string;
148
148
  'pisell2.text.ok': string;
149
+ 'page.booking.text.add-time': string;
150
+ 'page.booking.text.quantity': string;
151
+ 'page.booking.text.sales': string;
152
+ 'page.booking.text.update-time': string;
153
+ 'page.booking.text.add-time-success': string;
154
+ 'page.booking.text.unavailable': string;
155
+ 'page.booking.text.available': string;
156
+ 'page.booking.text.fully-booked': string;
149
157
  'pisell2.text.terminal-edit-message': string;
150
158
  };
151
159
  'zh-CN': {
@@ -296,6 +304,14 @@ declare const _default: {
296
304
  'pisell2.text.copy-to-clipboard': string;
297
305
  'pisell2.text.ok': string;
298
306
  'pisell2.text.terminal-edit-message': string;
307
+ 'page.booking.text.add-time': string;
308
+ 'page.booking.text.quantity': string;
309
+ 'page.booking.text.sales': string;
310
+ 'page.booking.text.update-time': string;
311
+ 'page.booking.text.add-time-success': string;
312
+ 'page.booking.text.unavailable': string;
313
+ 'page.booking.text.available': string;
314
+ 'page.booking.text.fully-booked': string;
299
315
  };
300
316
  'zh-HK': {
301
317
  'pisell2.text.refunded-amount': string;
@@ -445,6 +461,14 @@ declare const _default: {
445
461
  'pisell2.text.copy-to-clipboard': string;
446
462
  'pisell2.text.ok': string;
447
463
  'pisell2.text.terminal-edit-message': string;
464
+ 'page.booking.text.add-time': string;
465
+ 'page.booking.text.quantity': string;
466
+ 'page.booking.text.sales': string;
467
+ 'page.booking.text.update-time': string;
468
+ 'page.booking.text.add-time-success': string;
469
+ 'page.booking.text.unavailable': string;
470
+ 'page.booking.text.available': string;
471
+ 'page.booking.text.fully-booked': string;
448
472
  };
449
473
  };
450
474
  export default _default;
@@ -179,6 +179,14 @@ var locales_default = {
179
179
  "pisell2.text.send-mail": "Send email",
180
180
  "pisell2.text.copy-to-clipboard": "Copy to clipboard",
181
181
  "pisell2.text.ok": "OK",
182
+ "page.booking.text.add-time": "Add time",
183
+ "page.booking.text.quantity": "Quantity",
184
+ "page.booking.text.sales": "Sales",
185
+ "page.booking.text.update-time": "Update time",
186
+ "page.booking.text.add-time-success": "Add time successfully",
187
+ "page.booking.text.unavailable": "Unavailable",
188
+ "page.booking.text.available": "Available",
189
+ "page.booking.text.fully-booked": "Fully booked",
182
190
  "pisell2.text.terminal-edit-message": "This operation cannot be performed. To proceed, please use the Pisell Terminal."
183
191
  },
184
192
  "zh-CN": {
@@ -342,7 +350,15 @@ var locales_default = {
342
350
  "pisell2.text.send-mail": "发送邮件",
343
351
  "pisell2.text.copy-to-clipboard": "复制到剪切板",
344
352
  "pisell2.text.ok": "好的",
345
- "pisell2.text.terminal-edit-message": "此操作不可使用,如需使用请至Pisell 终端设备操作。"
353
+ "pisell2.text.terminal-edit-message": "此操作不可使用,如需使用请至Pisell 终端设备操作。",
354
+ "page.booking.text.add-time": "加时",
355
+ "page.booking.text.quantity": "数量",
356
+ "page.booking.text.sales": "销售",
357
+ "page.booking.text.update-time": "更新后的时间",
358
+ "page.booking.text.add-time-success": "加时成功",
359
+ "page.booking.text.unavailable": "不可用",
360
+ "page.booking.text.available": "可用",
361
+ "page.booking.text.fully-booked": "已约满"
346
362
  },
347
363
  "zh-HK": {
348
364
  "pisell2.text.refunded-amount": "已退金額",
@@ -505,6 +521,14 @@ var locales_default = {
505
521
  "pisell2.text.send-mail": "發送郵件",
506
522
  "pisell2.text.copy-to-clipboard": "複製到剪切板",
507
523
  "pisell2.text.ok": "好的",
508
- "pisell2.text.terminal-edit-message": "此操作不可使用,如需使用請至Pisell 終端設備操作。"
524
+ "pisell2.text.terminal-edit-message": "此操作不可使用,如需使用請至Pisell 終端設備操作。",
525
+ "page.booking.text.add-time": "加時",
526
+ "page.booking.text.quantity": "數量",
527
+ "page.booking.text.sales": "銷售",
528
+ "page.booking.text.update-time": "更新後的時間",
529
+ "page.booking.text.add-time-success": "加時成功!",
530
+ "page.booking.text.unavailable": "不可用",
531
+ "page.booking.text.available": "可用",
532
+ "page.booking.text.fully-booked": "已約滿"
509
533
  }
510
534
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface FormState {
3
2
  amountSymbol: string;
4
3
  apis: {
@@ -39,6 +38,7 @@ export interface FormState {
39
38
  value: any[];
40
39
  cacheItem: any;
41
40
  edit: boolean;
41
+ addTimeModal: boolean;
42
42
  };
43
43
  pet: {
44
44
  showModal: boolean;
@@ -76,6 +76,7 @@ export interface FormState {
76
76
  modalOpen?: boolean;
77
77
  isTerminal?: boolean;
78
78
  isFranchisee?: boolean;
79
+ addTimeProducts: any[];
79
80
  eventOtherParams?: {
80
81
  relation_id: number;
81
82
  number: number;
@@ -92,7 +93,7 @@ export declare const walkInData: {
92
93
  id: number;
93
94
  nickname: string;
94
95
  };
95
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
96
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
96
97
  state: FormState;
97
98
  } & {
98
99
  dispatch: (params: {
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => any;
7
+ declare const Notes: (props: any) => JSX.Element;
8
8
  export default Notes;
@@ -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 {};
@@ -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: {