@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,566 @@
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/index.tsx
30
+ var addTimeModal_exports = {};
31
+ __export(addTimeModal_exports, {
32
+ default: () => addTimeModal_default
33
+ });
34
+ module.exports = __toCommonJS(addTimeModal_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_drawer = __toESM(require("../../../components/drawer"));
37
+ var import_model = require("../../model");
38
+ var import_antd = require("antd");
39
+ var import_index = require("./index.less");
40
+ var import_utils = require("@pisell/utils");
41
+ var import_ahooks = require("ahooks");
42
+ var import_footer = __toESM(require("../../../components/footer"));
43
+ var import_serve = require("./serve");
44
+ var import_utils2 = require("./utils");
45
+ var import_classnames = __toESM(require("classnames"));
46
+ var import_browserSelect = __toESM(require("../../../components/browserSelect"));
47
+ var import_utils3 = require("../../../utils");
48
+ var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
49
+ var numberList = (0, import_utils.createArray)(100, (d, i) => {
50
+ let item = {
51
+ label: i + 1,
52
+ value: i + 1
53
+ };
54
+ return item;
55
+ });
56
+ var AddTimeModal = () => {
57
+ var _a, _b, _c, _d, _e;
58
+ const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
59
+ const [isEdit, setIsEdit] = (0, import_react.useState)(false);
60
+ const [loading, setLoading] = (0, import_react.useState)("");
61
+ const [currentProductId, setCurrentProductId] = (0, import_react.useState)(null);
62
+ const [currentTime, setCurrentTime] = (0, import_react.useState)(null);
63
+ const [number, setNumber] = (0, import_react.useState)(1);
64
+ const originServices = (0, import_react.useRef)([]);
65
+ const [renderList, setRenderList] = (0, import_react.useState)([]);
66
+ const context = (0, import_useEngineContext.default)();
67
+ const { isTerminal, interaction, store } = (_a = context.appHelper) == null ? void 0 : _a.utils;
68
+ const statusMap = {
69
+ available: {
70
+ label: import_utils.locales.getText("page.booking.text.available"),
71
+ color: "#079455"
72
+ },
73
+ fully_booked: {
74
+ label: import_utils.locales.getText("page.booking.text.fully-booked"),
75
+ color: "#DC6803"
76
+ },
77
+ unavailable: {
78
+ label: import_utils.locales.getText("page.booking.text.unavailable"),
79
+ color: "#98A2B3"
80
+ }
81
+ };
82
+ const updateServices = (0, import_ahooks.useDebounceFn)(
83
+ () => {
84
+ createNewServices();
85
+ },
86
+ { wait: 200 }
87
+ );
88
+ const transaction_habit_selection = (0, import_react.useMemo)(() => {
89
+ var _a2, _b2, _c2;
90
+ return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.information_tab) == null ? void 0 : _c2.transaction_habit_selection) || {
91
+ type: "service_now_pay_later",
92
+ button_rows: 1
93
+ };
94
+ }, [(_c = (_b = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _b.config) == null ? void 0 : _c.information_tab]);
95
+ const addTimeProducts = (0, import_react.useMemo)(() => {
96
+ return (renderList || []).map((d) => {
97
+ return {
98
+ label: d.title,
99
+ value: d.id
100
+ };
101
+ });
102
+ }, [renderList, state.service.cacheItem]);
103
+ const currentProduct = (0, import_react.useMemo)(() => {
104
+ return (renderList || []).find((d) => d.id === currentProductId);
105
+ }, [renderList, currentProductId]);
106
+ const currentResource = (0, import_react.useMemo)(() => {
107
+ var _a2;
108
+ const list = ((_a2 = state.service) == null ? void 0 : _a2.resourcesOrigin) || [];
109
+ let item = list.find(
110
+ (d) => {
111
+ var _a3, _b2;
112
+ return d.form_record_id == ((_b2 = (_a3 = state.service.cacheItem) == null ? void 0 : _a3._extend) == null ? void 0 : _b2.relation_id);
113
+ }
114
+ );
115
+ return item;
116
+ }, [state.service.cacheItem, state.service.resourcesOrigin]);
117
+ const getTimeUsableStatus = (time) => {
118
+ var _a2, _b2;
119
+ if (!((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend) || !currentResource) {
120
+ return { status: statusMap.unavailable };
121
+ }
122
+ try {
123
+ let _extend = { ...state.service.cacheItem._extend };
124
+ _extend.endDate = _extend.endDate.add(time, "minutes");
125
+ _extend.start_date = _extend.startDate;
126
+ _extend.end_date = _extend.endDate;
127
+ _extend.end_time = _extend.endDate.format("HH:mm");
128
+ _extend.start_time = _extend.startDate.format("HH:mm");
129
+ _extend.duration = import_utils3.flexibleObj.add(_extend.duration, time);
130
+ if ((0, import_utils3.isNowTime)(_extend.start_time)) {
131
+ _extend.start_time = (0, import_utils3.getNowTime)();
132
+ }
133
+ const startText = _extend.startDate.format("hh:mm A");
134
+ let endText = _extend.endDate.format("hh:mm A");
135
+ if (_extend.endDate.isAfter(_extend.startDate, "day")) {
136
+ endText = import_utils.locales.getText("pisell1.text.tomorrow") + endText;
137
+ }
138
+ let timeItem = currentResource == null ? void 0 : currentResource.times.find(
139
+ (_time) => _time.item_id === _extend.relation_id
140
+ );
141
+ const res = (0, import_utils3.getResourceTimeIsUsable)(timeItem, {
142
+ ...state.service.cacheItem,
143
+ _extend: {
144
+ ...state.service.cacheItem._extend,
145
+ ..._extend
146
+ }
147
+ });
148
+ if (!((_b2 = res._extend) == null ? void 0 : _b2.isUsable)) {
149
+ return {
150
+ status: statusMap.unavailable,
151
+ message: import_utils.locales.getText("pisell1.text.resource-error-message-2")(
152
+ currentResource.room_name || currentResource.name,
153
+ startText,
154
+ endText
155
+ )
156
+ };
157
+ }
158
+ } catch (err) {
159
+ }
160
+ return { status: statusMap.available };
161
+ };
162
+ const times = (0, import_react.useMemo)(() => {
163
+ let config = (currentProduct == null ? void 0 : currentProduct.add_time) || {
164
+ calculate_type: "select_quantity",
165
+ // 最大时长
166
+ max_add_time: 30,
167
+ // 最小时长
168
+ min_add_time: 30,
169
+ // 关联产品
170
+ relation_product: { type: "product_all", products: [] },
171
+ // 单位切片
172
+ unit_duration: 30
173
+ };
174
+ return (0, import_utils2.getAddTimeSplits)(config, (currentProduct == null ? void 0 : currentProduct.price) || 0).map((d) => {
175
+ return {
176
+ ...d,
177
+ status: getTimeUsableStatus(d.value)
178
+ };
179
+ });
180
+ }, [currentProduct]);
181
+ (0, import_react.useEffect)(() => {
182
+ if (state.service.addTimeModal && state.service.cacheItem && currentProduct && times.length) {
183
+ if (!currentTime) {
184
+ setCurrentTime(times[0].value);
185
+ setNumber(1);
186
+ setIsEdit(true);
187
+ updateServices.run();
188
+ }
189
+ }
190
+ }, [
191
+ times,
192
+ currentTime,
193
+ state.service.addTimeModal,
194
+ state.service.cacheItem,
195
+ currentProduct
196
+ ]);
197
+ const _getAddTimeProducts = async () => {
198
+ var _a2, _b2, _c2, _d2;
199
+ const data = await (0, import_serve.getAddTimeProducts)(
200
+ {
201
+ skip: 1,
202
+ num: 500,
203
+ open_quotation: 1,
204
+ schedule_date: state.date.value.format("YYYY-MM-DD"),
205
+ customer_id: (0, import_utils3.isWalkIn)((_b2 = (_a2 = state.client) == null ? void 0 : _a2.value) == null ? void 0 : _b2.id) ? void 0 : (_d2 = (_c2 = state.client) == null ? void 0 : _c2.value) == null ? void 0 : _d2.id,
206
+ extension_type: ["product_add_time"]
207
+ },
208
+ {
209
+ useCache: true
210
+ }
211
+ );
212
+ return (data == null ? void 0 : data.list) || [];
213
+ };
214
+ const getTimeProducts = async () => {
215
+ setLoading("list");
216
+ const newList = await _getAddTimeProducts();
217
+ let list = newList.map((d) => {
218
+ let isUsable = (0, import_utils2.isUsableProduct)(
219
+ d.add_time.relation_product,
220
+ state.service.cacheItem
221
+ );
222
+ return {
223
+ ...d,
224
+ usable: isUsable
225
+ };
226
+ }).filter((d) => d.usable).sort((a, b) => b.sort - a.sort);
227
+ setRenderList(list);
228
+ if (list.length) {
229
+ setDefaultProduct(list);
230
+ }
231
+ setLoading("");
232
+ };
233
+ const setDefaultProduct = (list) => {
234
+ setCurrentProductId(list[0].id);
235
+ };
236
+ (0, import_ahooks.useUpdateEffect)(() => {
237
+ if (state.service.addTimeModal) {
238
+ getTimeProducts();
239
+ originServices.current = state.service;
240
+ } else {
241
+ updateServices.run();
242
+ }
243
+ }, [state.service.addTimeModal]);
244
+ const onSelectItem = (item) => {
245
+ setCurrentTime(item == null ? void 0 : item.value);
246
+ setIsEdit(true);
247
+ updateServices.run();
248
+ };
249
+ const currentTimeItem = (0, import_react.useMemo)(() => {
250
+ return times.find((d) => d.value === currentTime) || { price: 0 };
251
+ }, [currentTime, times]);
252
+ const newService = (0, import_react.useMemo)(() => {
253
+ if (!currentProduct || !currentProduct || !state.service.cacheItem) {
254
+ return null;
255
+ }
256
+ const relation_product = {
257
+ product_add_schedule_time: currentTime,
258
+ num: number,
259
+ price: currentTimeItem.price || 0,
260
+ product_id: currentProduct.id,
261
+ discount_amount: 0,
262
+ product_discount_reason: "",
263
+ is_charge_tax: currentProduct.is_charge_tax,
264
+ discountway: "num",
265
+ discount_type: "discount"
266
+ };
267
+ let _extend = { ...state.service.cacheItem._extend };
268
+ let relation_products = [relation_product];
269
+ _extend.endDate = _extend.endDate.add(
270
+ relation_product.product_add_schedule_time,
271
+ "minutes"
272
+ );
273
+ const start_date = _extend.startDate.format("YYYY-MM-DD");
274
+ const end_date = _extend.endDate.format("YYYY-MM-DD");
275
+ const end_time = _extend.endDate.format("HH:mm");
276
+ let start_time = _extend.startDate.format("HH:mm");
277
+ let duration = import_utils3.flexibleObj.add(
278
+ _extend.duration,
279
+ relation_product.product_add_schedule_time
280
+ );
281
+ if ((0, import_utils3.isNowTime)(_extend.start_time)) {
282
+ start_time = (0, import_utils3.getNowTime)();
283
+ }
284
+ _extend.relation_details = (_extend.relation_details || []).concat(
285
+ relation_products
286
+ );
287
+ _extend.duration = duration;
288
+ _extend.start_time = start_time;
289
+ _extend.end_time = end_time;
290
+ _extend.start_date = start_date;
291
+ _extend.end_date = end_date;
292
+ let data = {
293
+ id: _extend.id,
294
+ relation_id: _extend.relation_id,
295
+ like_status: _extend.like_status,
296
+ relation_type: _extend.relation_type,
297
+ is_all: _extend.is_all,
298
+ schedule_id: _extend.schedule_id,
299
+ end_time,
300
+ sub_type: _extend.sub_type,
301
+ select_date: start_date,
302
+ start_time,
303
+ end_date,
304
+ start_date,
305
+ duration,
306
+ number: _extend.number || 1,
307
+ relation_products,
308
+ _extend
309
+ };
310
+ return data;
311
+ }, [
312
+ currentTime,
313
+ state.service.cacheItem,
314
+ currentProduct,
315
+ number,
316
+ currentTimeItem
317
+ ]);
318
+ const resetService = () => {
319
+ var _a2, _b2;
320
+ let _val = ((_a2 = originServices.current) == null ? void 0 : _a2.value) || [];
321
+ let _edit = (_b2 = originServices.current) == null ? void 0 : _b2.edit;
322
+ originServices.current = null;
323
+ dispatch({
324
+ type: "setService",
325
+ payload: {
326
+ value: _val,
327
+ edit: _edit
328
+ }
329
+ });
330
+ };
331
+ const createNewServices = () => {
332
+ var _a2;
333
+ let _list = ((_a2 = state.service) == null ? void 0 : _a2.value) || [];
334
+ if (!originServices.current) {
335
+ return;
336
+ }
337
+ if (state.service.addTimeModal) {
338
+ _list = _list.map((d) => {
339
+ let _item = {
340
+ ...d
341
+ };
342
+ if (_item._extend.id === (newService == null ? void 0 : newService.id)) {
343
+ _item = {
344
+ ..._item,
345
+ ...newService || {},
346
+ _extend: newService == null ? void 0 : newService._extend
347
+ };
348
+ }
349
+ return _item;
350
+ });
351
+ dispatch({
352
+ type: "setService",
353
+ payload: {
354
+ value: _list,
355
+ edit: true
356
+ }
357
+ });
358
+ } else {
359
+ resetService();
360
+ }
361
+ };
362
+ const goCheckout = async () => {
363
+ var _a2, _b2;
364
+ if (state.isTerminal) {
365
+ return (_b2 = (_a2 = interaction == null ? void 0 : interaction.utils) == null ? void 0 : _a2.postMessageToApp) == null ? void 0 : _b2.call(_a2, {
366
+ module: "booking",
367
+ key: "booking_checkout",
368
+ data: {
369
+ order_id: state.bookingId
370
+ }
371
+ });
372
+ }
373
+ state.action({
374
+ type: "pisell1.handlePayment",
375
+ data: {
376
+ orderId: state.bookingId
377
+ },
378
+ callback: () => {
379
+ state == null ? void 0 : state.callback();
380
+ }
381
+ });
382
+ };
383
+ const handleCheckout = async () => {
384
+ if (isEdit) {
385
+ await handleSave("checkout");
386
+ }
387
+ goCheckout();
388
+ };
389
+ const handleSave = async (loadingType = "save") => {
390
+ if (currentTime === null) {
391
+ return;
392
+ }
393
+ setLoading(loadingType);
394
+ await (0, import_serve.saveAddTimeProduct)({
395
+ orderId: state.bookingId,
396
+ params: {
397
+ ...newService,
398
+ _extend: void 0
399
+ }
400
+ });
401
+ setLoading("");
402
+ import_antd.message.success(import_utils.locales.getText("page.booking.text.add-time-success"));
403
+ onCancel();
404
+ if (loadingType === "checkout") {
405
+ return;
406
+ }
407
+ state == null ? void 0 : state.action("init");
408
+ };
409
+ const productChange = (e) => {
410
+ setCurrentProductId(e);
411
+ setCurrentTime(null);
412
+ };
413
+ (0, import_react.useEffect)(() => {
414
+ if (!state.modalOpen) {
415
+ onCancel();
416
+ }
417
+ }, [state.modalOpen]);
418
+ const onCancel = () => {
419
+ setIsEdit(false);
420
+ setCurrentProductId(null);
421
+ setCurrentTime(null);
422
+ resetService();
423
+ setTimeout(() => {
424
+ dispatch({
425
+ type: "setService",
426
+ payload: {
427
+ addTimeModal: false
428
+ }
429
+ });
430
+ }, 50);
431
+ };
432
+ console.log("newService.duration", currentTimeItem);
433
+ const updateTime = (0, import_react.useMemo)(() => {
434
+ if (!newService) {
435
+ return "";
436
+ }
437
+ let startTime = newService.start_time;
438
+ let endTime = newService.end_time;
439
+ let hours = (0, import_utils3.getDiscountTime)(import_utils3.flexibleObj.getValue(newService.duration));
440
+ if (newService.start_date !== newService.end_date) {
441
+ const locale = state.locale;
442
+ const format = locale === "en" || locale === "en-US" ? "HH:mm DD/MM" : "MM-DD HH:mm";
443
+ startTime = (0, import_utils.formatDate)(
444
+ `${newService.start_date} ${newService.start_time}`,
445
+ format
446
+ );
447
+ endTime = (0, import_utils.formatDate)(
448
+ `${newService.end_date} ${newService.end_time}`,
449
+ format
450
+ );
451
+ }
452
+ return `${import_utils.locales.getText(
453
+ "page.booking.text.update-time"
454
+ )}: ${startTime} ~ ${endTime} (${hours})`;
455
+ }, [newService, state.locale]);
456
+ return /* @__PURE__ */ import_react.default.createElement(
457
+ import_drawer.default,
458
+ {
459
+ open: state.service.addTimeModal,
460
+ title: import_utils.locales.getText("page.booking.text.add-time"),
461
+ rootClassName: "booking-server-wrap",
462
+ onClose: onCancel,
463
+ header: addTimeProducts.length > 1 && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-header" }, /* @__PURE__ */ import_react.default.createElement(
464
+ import_antd.Select,
465
+ {
466
+ options: addTimeProducts,
467
+ style: { width: "100%" },
468
+ size: "large",
469
+ loading: loading === "list",
470
+ value: currentProductId,
471
+ onChange: productChange
472
+ }
473
+ )),
474
+ footerStyle: { padding: "10px 32px 20px" },
475
+ footer: /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-total-wrap" }, currentTimeItem && ((_d = currentTimeItem == null ? void 0 : currentTimeItem.status) == null ? void 0 : _d.message) ? /* @__PURE__ */ import_react.default.createElement(
476
+ import_antd.Alert,
477
+ {
478
+ message: currentTimeItem.status.message,
479
+ type: "warning",
480
+ showIcon: true,
481
+ style: { marginBottom: 12 }
482
+ }
483
+ ) : null, newService ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-summary-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-summary" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-summary-time" }, updateTime), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-summary-total" }, import_utils.locales.getText("pisell1.text.subtotal"), ":", " ", (0, import_utils.formatAmount)(
484
+ (currentTimeItem.price || 0) * number,
485
+ 2,
486
+ state.amountSymbol
487
+ ))), ((_e = currentProduct == null ? void 0 : currentProduct.add_time) == null ? void 0 : _e.calculate_type) === "select_quantity" && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-quantity-wrap" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-add-time-quantity" }, import_utils.locales.getText("page.booking.text.quantity")), " ", /* @__PURE__ */ import_react.default.createElement(
488
+ import_browserSelect.default,
489
+ {
490
+ value: number,
491
+ onChange: (e) => {
492
+ setNumber(Number(e.target.value));
493
+ updateServices.run();
494
+ },
495
+ className: "pisell-lowcode__booking-add-time-quantity-select",
496
+ options: numberList
497
+ }
498
+ ))) : null), /* @__PURE__ */ import_react.default.createElement(
499
+ import_footer.default,
500
+ {
501
+ state,
502
+ dispatch,
503
+ source: "addTime",
504
+ buttons: [
505
+ /* @__PURE__ */ import_react.default.createElement(
506
+ import_antd.Button,
507
+ {
508
+ className: "pisell-lowcode__booking-footer-buttons-item",
509
+ type: transaction_habit_selection.type === "service_now_pay_later" ? "default" : "primary",
510
+ disabled: loading === "list" || !isEdit || !currentTime,
511
+ onClick: handleCheckout,
512
+ loading: loading === "checkout"
513
+ },
514
+ import_utils.locales.getText("pisell2.text.checkout")
515
+ ),
516
+ /* @__PURE__ */ import_react.default.createElement(
517
+ import_antd.Button,
518
+ {
519
+ className: "pisell-lowcode__booking-footer-buttons-item",
520
+ type: transaction_habit_selection.type === "service_now_pay_later" ? "primary" : "default",
521
+ disabled: loading === "list" || !isEdit || !currentTime,
522
+ loading: loading === "save",
523
+ onClick: () => {
524
+ handleSave("save");
525
+ }
526
+ },
527
+ import_utils.locales.getText("pisell2.text.save")
528
+ )
529
+ ]
530
+ }
531
+ ))
532
+ },
533
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-body" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: loading === "list", active: true, round: true }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-list" }, times.map((child, index) => {
534
+ var _a2, _b2, _c2, _d2;
535
+ if (child.readonly) {
536
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-hours" }, child.label);
537
+ }
538
+ return /* @__PURE__ */ import_react.default.createElement(
539
+ "div",
540
+ {
541
+ className: (0, import_classnames.default)(
542
+ "pisell-lowcode__booking-add-time-child-card",
543
+ {
544
+ "pisell-lowcode__booking-add-time-child-card-active": currentTime === child.value
545
+ }
546
+ ),
547
+ onClick: () => {
548
+ onSelectItem(child);
549
+ }
550
+ },
551
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left-time" }, child.label), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-add-time-child-card-left-price" }, (0, import_utils.formatAmount)(child.price, 2, state.amountSymbol))),
552
+ /* @__PURE__ */ import_react.default.createElement(
553
+ "div",
554
+ {
555
+ className: "pisell-lowcode__booking-add-time-child-card-right",
556
+ style: {
557
+ color: (_b2 = (_a2 = child.status) == null ? void 0 : _a2.status) == null ? void 0 : _b2.color
558
+ }
559
+ },
560
+ (_d2 = (_c2 = child.status) == null ? void 0 : _c2.status) == null ? void 0 : _d2.label
561
+ )
562
+ );
563
+ }))), /* @__PURE__ */ import_react.default.createElement("div", { className: "" }))
564
+ );
565
+ };
566
+ var addTimeModal_default = AddTimeModal;
@@ -0,0 +1,133 @@
1
+ .pisell-lowcode__booking-add-time-header {
2
+ margin-top: 10px;
3
+ margin-bottom: 10px;
4
+ }
5
+
6
+ .pisell-lowcode__booking-add-time-body {
7
+ padding: 10px 32px 30px;
8
+ display: flex;
9
+ flex-direction: column;
10
+ width: 100%;
11
+ height: 100%;
12
+
13
+ .pisell-lowcode__booking-add-time-child-card-list {
14
+ width: 100%;
15
+ display: flex;
16
+ flex-wrap: wrap;
17
+ gap: 10px;
18
+
19
+ .pisell-lowcode__booking-add-time-hours {
20
+ padding: 6px;
21
+ color: var(--Gray-900, #101828);
22
+ font-size: 14px;
23
+ font-style: normal;
24
+ font-weight: 500;
25
+ background: var(--Gray-50, #F9FAFB);
26
+ margin: 10px 0;
27
+ flex: 0 0 100%;
28
+ }
29
+
30
+ .pisell-lowcode__booking-add-time-child-card {
31
+ flex: 0 0 calc(50% - 5px);
32
+ border-radius: 10px;
33
+
34
+ background: #FFF;
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: space-between;
38
+ padding: 10px 20px;
39
+ cursor: pointer;
40
+ position: relative;
41
+
42
+ &::before {
43
+ content: '';
44
+ position: absolute;
45
+ top: 0;
46
+ left: 0;
47
+ bottom: 0;
48
+ right: 0;
49
+ cursor: pointer;
50
+ border-radius: 10px;
51
+ border: 1px solid var(--Gray-true-300, #D6D6D6);
52
+ }
53
+
54
+ &.pisell-lowcode__booking-add-time-child-card-active {
55
+ &::before {
56
+ border-color: #7f56d9;
57
+ border-width: 2px;
58
+ }
59
+ }
60
+
61
+ .pisell-lowcode__booking-add-time-child-card-left {
62
+
63
+ .pisell-lowcode__booking-add-time-child-card-left-time {
64
+ color: var(--Gray-900, #101828);
65
+ font-size: 20px;
66
+ font-style: normal;
67
+ font-weight: 500;
68
+ }
69
+
70
+ .pisell-lowcode__booking-add-time-child-card-left-price {
71
+ color: var(--Gray-500, #667085);
72
+ font-size: 16px;
73
+ font-style: normal;
74
+ font-weight: 400;
75
+ }
76
+ }
77
+
78
+ .pisell-lowcode__booking-add-time-child-card-right {}
79
+ }
80
+ }
81
+
82
+ .pisell-lowcode__booking-add-time-footer {
83
+ width: 100%;
84
+ }
85
+ }
86
+
87
+ .pisell-lowcode__booking-add-time-total-wrap {
88
+ border-bottom: 1px solid var(--Gray-true-300, #f9fafb);
89
+ margin: -10px -32px 10px;
90
+ padding: 10px 32px 0;
91
+ background-color: #f3f4f6;
92
+
93
+ .pisell-lowcode__booking-add-time-summary-wrap {
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: space-between;
97
+ border: none;
98
+ margin: 0;
99
+ padding: 0 0 10px 0;
100
+
101
+ .pisell-lowcode__booking-add-time-summary {
102
+ padding-right: 20px;
103
+
104
+ .pisell-lowcode__booking-add-time-summary-time {}
105
+
106
+ .pisell-lowcode__booking-add-time-summary-total {}
107
+ }
108
+
109
+ .pisell-lowcode__booking-add-time-quantity-wrap {
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: center;
113
+
114
+
115
+ .pisell-lowcode__booking-add-time-quantity {
116
+ margin-right: 14px;
117
+ color: var(--Gray-500, #667085);
118
+ font-size: 14px;
119
+ font-style: normal;
120
+ font-weight: 500;
121
+ white-space: nowrap;
122
+ }
123
+
124
+ .pisell-lowcode__booking-add-time-quantity-select {
125
+ min-width: 75px;
126
+ border-radius: 30px;
127
+ height: 44px;
128
+ padding: 0 16px;
129
+ background-color: var(--Gray-true-200, #E5E5E5);
130
+ }
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,5 @@
1
+ export declare const getAddTimeProducts: (params: any, config: any) => Promise<any>;
2
+ export declare const saveAddTimeProduct: ({ orderId, params }: {
3
+ orderId: number | string;
4
+ params: any;
5
+ }) => Promise<any>;