@pisell/private-materials 3.2.25 → 3.2.27

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 (113) 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 +8 -8
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +8 -8
  11. package/es/components/appointmentBooking/components/Cart/ContinueButton/index.js +5 -5
  12. package/es/components/appointmentBooking/components/Cart/Item/index.js +1 -5
  13. package/es/components/appointmentBooking/components/Cart/Item/index.less +8 -1
  14. package/es/components/appointmentBooking/components/Header/index.js +4 -1
  15. package/es/components/booking/addons/index.js +7 -5
  16. package/es/components/booking/addons/model.d.ts +1 -10
  17. package/es/components/booking/components/footer/index.js +1 -6
  18. package/es/components/booking/components/footer/utils.js +8 -5
  19. package/es/components/booking/forms/footer.d.ts +6 -0
  20. package/es/components/booking/forms/footer.js +88 -0
  21. package/es/components/booking/forms/index.d.ts +1 -1
  22. package/es/components/booking/forms/index.js +25 -20
  23. package/es/components/booking/forms/index.less +7 -0
  24. package/es/components/booking/forms/model.d.ts +1 -10
  25. package/es/components/booking/forms/sendModal/index.d.ts +27 -0
  26. package/es/components/booking/forms/sendModal/index.js +82 -0
  27. package/es/components/booking/forms/sendModal/index.less +9 -0
  28. package/es/components/booking/forms/sendModal/useSendModal.d.ts +9 -0
  29. package/es/components/booking/forms/sendModal/useSendModal.js +79 -0
  30. package/es/components/booking/forms/serve.d.ts +9 -0
  31. package/es/components/booking/forms/serve.js +20 -0
  32. package/es/components/booking/info/model.d.ts +1 -10
  33. package/es/components/booking/info/service/addService/index.js +3 -3
  34. package/es/components/booking/info/service/editService/index.js +71 -51
  35. package/es/components/booking/info2/service/addService/index.js +3 -2
  36. package/es/components/booking/info2/service/addService/utils.js +57 -5
  37. package/es/components/booking/info2/service/editService/Resources/index.js +20 -2
  38. package/es/components/booking/info2/service/editService/index.js +5 -3
  39. package/es/components/booking/info2/service/editService/utils.d.ts +4 -2
  40. package/es/components/booking/info2/service/editService/utils.js +18 -0
  41. package/es/components/booking/locales.d.ts +39 -0
  42. package/es/components/booking/locales.js +39 -0
  43. package/es/components/booking/model.d.ts +1 -9
  44. package/es/components/booking/notes/model.d.ts +1 -10
  45. package/es/components/booking/payments/model.d.ts +1 -10
  46. package/es/components/eftposPay/hooks.d.ts +1 -1
  47. package/es/components/eftposPay/store/index.d.ts +1 -1
  48. package/es/components/pay/toC/PaymentList/serve.js +2 -2
  49. package/es/components/pay/toC/model.d.ts +1 -9
  50. package/es/components/pay/toC/serve.js +2 -2
  51. package/es/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.js +4 -1
  52. package/es/components/schedules/model.d.ts +1 -9
  53. package/es/components/wallet/Detail/model.d.ts +1 -13
  54. package/es/components/wallet/DiscountCard/model.d.ts +1 -14
  55. package/es/components/wallet/PointCard/model.d.ts +1 -13
  56. package/es/components/wallet/RechargeableCard/model.d.ts +1 -29
  57. package/es/components/wallet/Voucher/model.d.ts +1 -13
  58. package/es/components/wallet/model.d.ts +1 -9
  59. package/lib/components/appointmentBooking/components/Cart/ContinueButton/index.js +8 -8
  60. package/lib/components/appointmentBooking/components/Cart/Item/index.js +1 -2
  61. package/lib/components/appointmentBooking/components/Cart/Item/index.less +8 -1
  62. package/lib/components/appointmentBooking/components/Header/index.js +4 -1
  63. package/lib/components/booking/addons/index.js +7 -5
  64. package/lib/components/booking/addons/model.d.ts +1 -10
  65. package/lib/components/booking/components/footer/index.js +1 -2
  66. package/lib/components/booking/components/footer/utils.js +4 -5
  67. package/lib/components/booking/forms/footer.d.ts +6 -0
  68. package/lib/components/booking/forms/footer.js +81 -0
  69. package/lib/components/booking/forms/index.d.ts +1 -1
  70. package/lib/components/booking/forms/index.js +4 -2
  71. package/lib/components/booking/forms/index.less +7 -0
  72. package/lib/components/booking/forms/model.d.ts +1 -10
  73. package/lib/components/booking/forms/sendModal/index.d.ts +27 -0
  74. package/lib/components/booking/forms/sendModal/index.js +128 -0
  75. package/lib/components/booking/forms/sendModal/index.less +9 -0
  76. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +9 -0
  77. package/lib/components/booking/forms/sendModal/useSendModal.js +70 -0
  78. package/lib/components/booking/forms/serve.d.ts +9 -0
  79. package/lib/components/booking/forms/serve.js +5 -2
  80. package/lib/components/booking/info/model.d.ts +1 -10
  81. package/lib/components/booking/info/service/addService/index.js +2 -2
  82. package/lib/components/booking/info/service/editService/index.js +12 -2
  83. package/lib/components/booking/info2/service/addService/index.js +3 -2
  84. package/lib/components/booking/info2/service/addService/utils.js +36 -1
  85. package/lib/components/booking/info2/service/editService/Resources/index.js +16 -1
  86. package/lib/components/booking/info2/service/editService/index.js +4 -2
  87. package/lib/components/booking/info2/service/editService/utils.d.ts +4 -2
  88. package/lib/components/booking/info2/service/editService/utils.js +48 -0
  89. package/lib/components/booking/locales.d.ts +39 -0
  90. package/lib/components/booking/locales.js +39 -0
  91. package/lib/components/booking/model.d.ts +1 -9
  92. package/lib/components/booking/notes/model.d.ts +1 -10
  93. package/lib/components/booking/payments/model.d.ts +1 -10
  94. package/lib/components/eftposPay/hooks.d.ts +1 -1
  95. package/lib/components/eftposPay/store/index.d.ts +1 -1
  96. package/lib/components/pay/toC/PaymentList/serve.js +1 -1
  97. package/lib/components/pay/toC/model.d.ts +1 -9
  98. package/lib/components/pay/toC/serve.js +1 -1
  99. package/lib/components/pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.js +4 -1
  100. package/lib/components/schedules/model.d.ts +1 -9
  101. package/lib/components/wallet/Detail/model.d.ts +1 -13
  102. package/lib/components/wallet/DiscountCard/model.d.ts +1 -14
  103. package/lib/components/wallet/PointCard/model.d.ts +1 -13
  104. package/lib/components/wallet/RechargeableCard/model.d.ts +1 -29
  105. package/lib/components/wallet/Voucher/model.d.ts +1 -13
  106. package/lib/components/wallet/model.d.ts +1 -9
  107. package/package.json +3 -3
  108. package/es/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  109. package/es/components/eventBooking/components/Provider/SelectProduct/index.js +0 -77
  110. package/es/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
  111. package/lib/components/eventBooking/components/Provider/SelectProduct/index.d.ts +0 -4
  112. package/lib/components/eventBooking/components/Provider/SelectProduct/index.js +0 -69
  113. package/lib/components/eventBooking/components/Provider/SelectProduct/index.less +0 -131
@@ -195,11 +195,12 @@ var formatProducts = (item) => {
195
195
  const discount_amount = origin_total - total;
196
196
  const discount_list = (item == null ? void 0 : item.discount_list) || [];
197
197
  const discount_type = discount_amount < 0 ? "change_price" : "discount";
198
+ const notManualDiscount = discount_list.filter((item2) => item2.type !== "product");
198
199
  return {
199
200
  "num": item._extend.quantity,
200
201
  "price": formatProductPrice(item),
201
202
  "product_id": (item == null ? void 0 : item.product_id) || item.id,
202
- "discount_amount": discount_list.length > 0 ? 0 : discount_amount,
203
+ "discount_amount": notManualDiscount.length > 0 ? 0 : discount_amount,
203
204
  "product_discount_reason": item._extend.discount_reason || "",
204
205
  "is_charge_tax": item.is_charge_tax,
205
206
  "note": (item == null ? void 0 : item.note) || "",
@@ -211,7 +212,7 @@ var formatProducts = (item) => {
211
212
  "bundle_edit": item._extend.bundle_edit,
212
213
  "product_option_item": formatProductOption((_d = (_c = item._extend) == null ? void 0 : _c.other) == null ? void 0 : _d.option),
213
214
  "product_variant_id": ((_f = (_e = item._extend) == null ? void 0 : _e.other) == null ? void 0 : _f.product_variant_id) || 0,
214
- "discount_list": discount_list,
215
+ "discount_list": notManualDiscount,
215
216
  metadata: formatMetaData(item)
216
217
  };
217
218
  };
@@ -250,9 +251,7 @@ var formatBookings = (data, values) => {
250
251
  return (_a = d._extend) == null ? void 0 : _a.holder_id;
251
252
  });
252
253
  }
253
- let dayParams = {
254
- relation_products: []
255
- };
254
+ let dayParams = {};
256
255
  const eventOtherParams = data.eventOtherParams;
257
256
  let bookings = [];
258
257
  bookings = list.map((item) => {
@@ -0,0 +1,6 @@
1
+ interface FooterProps {
2
+ state: any;
3
+ reload: () => void;
4
+ }
5
+ declare const Footer: ({ state, reload }: FooterProps) => JSX.Element | null;
6
+ export default Footer;
@@ -0,0 +1,81 @@
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/forms/footer.tsx
30
+ var footer_exports = {};
31
+ __export(footer_exports, {
32
+ default: () => footer_default
33
+ });
34
+ module.exports = __toCommonJS(footer_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_materials = require("@pisell/materials");
37
+ var import_icons = require("@ant-design/icons");
38
+ var import_useSendModal = __toESM(require("./sendModal/useSendModal"));
39
+ var import_sendModal = __toESM(require("./sendModal"));
40
+ var import_utils = require("@pisell/utils");
41
+ var Footer = ({ state, reload }) => {
42
+ var _a, _b, _c, _d, _e;
43
+ const { open, setOpen, handleOpen, handleValuesChange, handleOk } = (0, import_useSendModal.default)(state == null ? void 0 : state.bookingId);
44
+ const handleReload = async () => {
45
+ await reload();
46
+ import_materials.message.success(import_utils.locales.getText("pisell2.text.send-form-reminder-refresh"));
47
+ };
48
+ const isAllCompleted = (0, import_react.useMemo)(() => {
49
+ var _a2;
50
+ return Object.values(((_a2 = state == null ? void 0 : state.form) == null ? void 0 : _a2.value) || {}).every(
51
+ (item) => item.length > 0
52
+ );
53
+ }, [(_a = state == null ? void 0 : state.form) == null ? void 0 : _a.value]);
54
+ const defaultValues = (0, import_react.useMemo)(() => {
55
+ var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _i, _j;
56
+ return {
57
+ sendSms: !!((_b2 = (_a2 = state.client) == null ? void 0 : _a2.value) == null ? void 0 : _b2.phone),
58
+ sendEmail: !!((_d2 = (_c2 = state.client) == null ? void 0 : _c2.value) == null ? void 0 : _d2.email),
59
+ email: (_f = (_e2 = state.client) == null ? void 0 : _e2.value) == null ? void 0 : _f.email,
60
+ phone: {
61
+ code: (_h = (_g = state.client) == null ? void 0 : _g.value) == null ? void 0 : _h.country_calling_code,
62
+ phone: (_j = (_i = state.client) == null ? void 0 : _i.value) == null ? void 0 : _j.phone
63
+ }
64
+ };
65
+ }, [(_b = state.client) == null ? void 0 : _b.value]);
66
+ if (!state.bookingId || !((_c = state == null ? void 0 : state.form) == null ? void 0 : _c.forms.length)) {
67
+ return null;
68
+ }
69
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-form-footer" }, /* @__PURE__ */ import_react.default.createElement(import_materials.Tooltip, { title: import_utils.locales.getText("pisell2.text.send-form-reminder-tooltip") }, /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { size: "large", icon: /* @__PURE__ */ import_react.default.createElement(import_icons.ReloadOutlined, null), onClick: handleReload })), /* @__PURE__ */ import_react.default.createElement(import_materials.Button, { size: "large", block: true, type: "primary", onClick: handleOpen, disabled: isAllCompleted }, !isAllCompleted ? import_utils.locales.getText("pisell2.text.send-form-reminder") : import_utils.locales.getText("pisell2.text.send-form-reminder-completed")), /* @__PURE__ */ import_react.default.createElement(
70
+ import_sendModal.default,
71
+ {
72
+ refreshKey: (_e = (_d = state.client) == null ? void 0 : _d.value) == null ? void 0 : _e.id,
73
+ open,
74
+ onCancel: () => setOpen(false),
75
+ onOk: handleOk,
76
+ onValuesChange: handleValuesChange,
77
+ defaultValues
78
+ }
79
+ ));
80
+ };
81
+ var footer_default = Footer;
@@ -1,4 +1,4 @@
1
- import "./index.less";
1
+ import './index.less';
2
2
  export interface InfoProps {
3
3
  title?: string;
4
4
  style?: any;
@@ -42,9 +42,10 @@ var import_utils = require("@pisell/utils");
42
42
  var import_forms = __toESM(require("./forms"));
43
43
  var import_utils2 = require("../utils");
44
44
  var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
45
+ var import_footer = __toESM(require("./footer"));
45
46
  var relation_type = "appointment_booking";
46
47
  var Forms = (0, import_model.Provider)((props) => {
47
- var _a, _b, _c, _d, _e, _f, _g, _h;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
48
49
  const { globalState } = props;
49
50
  const [loading, setLoading] = (0, import_react.useState)(true);
50
51
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
@@ -215,7 +216,8 @@ var Forms = (0, import_model.Provider)((props) => {
215
216
  {
216
217
  header: import_utils.locales.getText("pisell2.text.forms"),
217
218
  loading: loading && globalState.bookingId,
218
- bodyClassName: "booking-forms-body"
219
+ bodyClassName: "booking-forms-body",
220
+ footer: state.bookingId && ((_i = state == null ? void 0 : state.form) == null ? void 0 : _i.forms.length) && /* @__PURE__ */ import_react.default.createElement(import_footer.default, { state: globalState, reload: geForms })
219
221
  },
220
222
  !globalState.bookingId ? /* @__PURE__ */ import_react.default.createElement(import_emptyBooking.default, null) : /* @__PURE__ */ import_react.default.createElement(
221
223
  import_forms.default,
@@ -16,4 +16,11 @@
16
16
 
17
17
  .booking-forms-body {
18
18
  padding-bottom: 32px !important;
19
+ }
20
+ .pisell-lowcode-send-form-wrap {
21
+ padding: 24px 0;
22
+ }
23
+ .pisell-lowcode__booking-form-footer {
24
+ display: flex;
25
+ gap: 8px;
19
26
  }
@@ -1,10 +1 @@
1
- /// <reference types="react" />
2
- import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
- state: FormState;
5
- } & {
6
- dispatch: (params: {
7
- type: string;
8
- payload: any;
9
- }) => void;
10
- }>;
1
+ export declare const Provider: any, Context: any;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export declare type SendModalValues = {
4
+ sendSms: boolean;
5
+ sendEmail: boolean;
6
+ phone: {
7
+ code: string;
8
+ phone: string;
9
+ };
10
+ email: string;
11
+ };
12
+ interface SendModalProps {
13
+ open: boolean;
14
+ refreshKey: string;
15
+ onCancel: () => void;
16
+ onOk: (values: SendModalValues) => void;
17
+ defaultValues?: {
18
+ email?: string;
19
+ phone?: {
20
+ code?: string;
21
+ phone?: string;
22
+ };
23
+ };
24
+ onValuesChange?: (values: any) => void;
25
+ }
26
+ declare const SendModal: React.FC<SendModalProps>;
27
+ export default SendModal;
@@ -0,0 +1,128 @@
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/forms/sendModal/index.tsx
30
+ var sendModal_exports = {};
31
+ __export(sendModal_exports, {
32
+ default: () => sendModal_default
33
+ });
34
+ module.exports = __toCommonJS(sendModal_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_materials = require("@pisell/materials");
38
+ var import_PhoneField = __toESM(require("../../../pisellSelectCustomerModal/RightPanel/Add/PhoneField"));
39
+ var import_utils = require("@pisell/utils");
40
+ var import_index = require("./index.less");
41
+ var SendModal = ({
42
+ open,
43
+ refreshKey,
44
+ onCancel,
45
+ onOk,
46
+ defaultValues = {},
47
+ onValuesChange
48
+ }) => {
49
+ const [form] = import_antd.Form.useForm();
50
+ const sendSms = import_antd.Form.useWatch("sendSms", form);
51
+ const sendEmail = import_antd.Form.useWatch("sendEmail", form);
52
+ const handleOk = () => {
53
+ form.validateFields().then((values) => {
54
+ onOk(values);
55
+ });
56
+ };
57
+ return /* @__PURE__ */ import_react.default.createElement(
58
+ import_materials.PisellModal,
59
+ {
60
+ open,
61
+ title: import_utils.locales.getText("pisell2.text.send-form-reminder"),
62
+ onCancel,
63
+ onOk: handleOk,
64
+ okText: import_utils.locales.getText("pisell2.text.send-form-ok")
65
+ },
66
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode-send-form-wrap" }, /* @__PURE__ */ import_react.default.createElement(
67
+ import_antd.Form,
68
+ {
69
+ form,
70
+ key: refreshKey,
71
+ onValuesChange,
72
+ layout: "vertical",
73
+ initialValues: defaultValues
74
+ },
75
+ /* @__PURE__ */ import_react.default.createElement(
76
+ import_antd.Form.Item,
77
+ {
78
+ name: "sendSms",
79
+ valuePropName: "checked",
80
+ style: { marginBottom: 12 }
81
+ },
82
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, null, import_utils.locales.getText("pisell2.text.send-sms-reminder"))
83
+ ),
84
+ /* @__PURE__ */ import_react.default.createElement(
85
+ import_antd.Form.Item,
86
+ {
87
+ name: "phone",
88
+ style: { marginLeft: 16 },
89
+ rules: [
90
+ {
91
+ required: sendSms,
92
+ message: import_utils.locales.getText("pisell2.text.phone-required-error-message")
93
+ }
94
+ ]
95
+ },
96
+ /* @__PURE__ */ import_react.default.createElement(import_PhoneField.default, null)
97
+ ),
98
+ /* @__PURE__ */ import_react.default.createElement(
99
+ import_antd.Form.Item,
100
+ {
101
+ name: "sendEmail",
102
+ valuePropName: "checked",
103
+ style: { marginBottom: 12 }
104
+ },
105
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Checkbox, null, import_utils.locales.getText("pisell2.text.send-email-reminder"))
106
+ ),
107
+ /* @__PURE__ */ import_react.default.createElement(
108
+ import_antd.Form.Item,
109
+ {
110
+ name: "email",
111
+ style: { marginLeft: 16 },
112
+ rules: [
113
+ {
114
+ required: sendEmail,
115
+ message: import_utils.locales.getText("pisell2.text.email-required-error-message")
116
+ },
117
+ {
118
+ pattern: /^([a-zA-Z0-9_\-\.+])+@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,63})+$/,
119
+ message: import_utils.locales.getText("pisell2.text.email-error-message")
120
+ }
121
+ ]
122
+ },
123
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Input, { size: "large" })
124
+ )
125
+ ))
126
+ );
127
+ };
128
+ var sendModal_default = SendModal;
@@ -0,0 +1,9 @@
1
+ .pisell-lowcode-send-form-wrap {
2
+ padding: 24px 0;
3
+
4
+ .ant-form-item {
5
+ &.ant-form-item-has-error {
6
+ margin-bottom: 24px;
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ import { SendModalValues } from './index';
2
+ declare const useSendModal: (bookingId?: number) => {
3
+ open: boolean;
4
+ setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
5
+ handleOpen: () => void;
6
+ handleValuesChange: (val: any) => void;
7
+ handleOk: (values: SendModalValues) => Promise<boolean | undefined>;
8
+ };
9
+ export default useSendModal;
@@ -0,0 +1,70 @@
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/forms/sendModal/useSendModal.ts
20
+ var useSendModal_exports = {};
21
+ __export(useSendModal_exports, {
22
+ default: () => useSendModal_default
23
+ });
24
+ module.exports = __toCommonJS(useSendModal_exports);
25
+ var import_react = require("react");
26
+ var import_materials = require("@pisell/materials");
27
+ var import_utils = require("@pisell/utils");
28
+ var import_serve = require("../serve");
29
+ var useSendModal = (bookingId) => {
30
+ const [open, setOpen] = (0, import_react.useState)(false);
31
+ const handleOpen = () => {
32
+ setOpen(true);
33
+ };
34
+ const handleValuesChange = (val) => {
35
+ console.log(val, "val");
36
+ };
37
+ const handleOk = async (values) => {
38
+ if (!values.sendSms && !values.sendEmail) {
39
+ return import_materials.message.error(
40
+ import_utils.locales.getText("pisell2.text.send-form-reminder-error-message")
41
+ );
42
+ }
43
+ if (values.sendSms && !values.phone.phone) {
44
+ return import_materials.message.error(
45
+ import_utils.locales.getText("pisell2.text.phone-required-error-message")
46
+ );
47
+ }
48
+ if (values.sendEmail && !values.email) {
49
+ return import_materials.message.error(
50
+ import_utils.locales.getText("pisell2.text.email-required-error-message")
51
+ );
52
+ }
53
+ const value = await (0, import_serve.sendFormReminder)({
54
+ phone: values.sendSms ? values.phone.phone : void 0,
55
+ email: values.sendEmail ? values.email : void 0,
56
+ order_id: bookingId,
57
+ country_calling_code: values.sendSms ? values.phone.code.replace("+", "") : void 0
58
+ });
59
+ import_materials.message.success(import_utils.locales.getText("pisell2.text.send-form-toast"));
60
+ setOpen(false);
61
+ };
62
+ return {
63
+ open,
64
+ setOpen,
65
+ handleOpen,
66
+ handleValuesChange,
67
+ handleOk
68
+ };
69
+ };
70
+ var useSendModal_default = useSendModal;
@@ -7,3 +7,12 @@ export declare const getFormData: (params: {
7
7
  num: number;
8
8
  skip: number;
9
9
  }) => Promise<any>;
10
+ /**
11
+ * 发送表单填写提醒
12
+ */
13
+ export declare const sendFormReminder: (params: {
14
+ email?: string;
15
+ phone?: string;
16
+ order_id: number;
17
+ country_calling_code?: string;
18
+ }) => Promise<any>;
@@ -19,12 +19,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/components/booking/forms/serve.ts
20
20
  var serve_exports = {};
21
21
  __export(serve_exports, {
22
- getFormData: () => getFormData
22
+ getFormData: () => getFormData,
23
+ sendFormReminder: () => sendFormReminder
23
24
  });
24
25
  module.exports = __toCommonJS(serve_exports);
25
26
  var import_utils = require("../utils");
26
27
  var getFormData = async (params) => import_utils.request.getRequest().get(`/shop/form/data/v1`, params);
28
+ var sendFormReminder = async (params) => import_utils.request.getRequest().post(`/shop/form/form-reminder`, params);
27
29
  // Annotate the CommonJS export names for ESM import in node:
28
30
  0 && (module.exports = {
29
- getFormData
31
+ getFormData,
32
+ sendFormReminder
30
33
  });
@@ -1,14 +1,5 @@
1
- /// <reference types="react" />
2
- import { FormState } from '../model';
3
1
  export declare const walkInData: {
4
2
  id: number;
5
3
  nickname: string;
6
4
  };
7
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
8
- state: FormState;
9
- } & {
10
- dispatch: (params: {
11
- type: string;
12
- payload: any;
13
- }) => void;
14
- }>;
5
+ export declare const Provider: any, Context: any;
@@ -245,9 +245,9 @@ var Info = (props) => {
245
245
  is_eject: isEject ? 1 : 0,
246
246
  customer_id: customerId
247
247
  },
248
- callback: async (e) => {
248
+ callback: async (e, extension_type, detail) => {
249
249
  const data = await createBookingData({
250
- product: { ...item, _params: e }
250
+ product: { ...detail || item, _params: e }
251
251
  });
252
252
  createBooking({ booking: data });
253
253
  }
@@ -72,6 +72,7 @@ var Info = (_, ref) => {
72
72
  const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
73
73
  const [selectOpen, setSelectOpen] = (0, import_react.useState)();
74
74
  const { holderLists } = (0, import_useSelectPet.default)(state);
75
+ const isChangeTotal = (0, import_react.useRef)(false);
75
76
  const { editBookingData, editBooking } = (0, import_serviceManager.useService)({ state, dispatch });
76
77
  const [currentTab, setCurrentTab] = (0, import_react.useState)("batch_edit");
77
78
  const isDayBookingMode = (0, import_react.useMemo)(() => {
@@ -255,10 +256,14 @@ var Info = (_, ref) => {
255
256
  errorList
256
257
  }
257
258
  });
259
+ if (isChangeTotal.current) {
260
+ delete data.discount_list;
261
+ }
258
262
  await editBooking({ booking: data });
259
263
  });
260
264
  const setEditData = (0, import_ahooks.useMemoizedFn)((_cacheItem, open) => {
261
265
  setCurrentTab("batch_edit");
266
+ isChangeTotal.current = false;
262
267
  let cacheItem = _cacheItem || state.service.cacheItem;
263
268
  let values = cacheItem._extend;
264
269
  values = {
@@ -423,10 +428,11 @@ var Info = (_, ref) => {
423
428
  },
424
429
  customer_id: isDayBookingMode ? ((_h2 = (_g2 = state.client) == null ? void 0 : _g2.value) == null ? void 0 : _h2.id) || 1 : void 0
425
430
  },
426
- callback: (e2) => {
431
+ callback: async (e2, extension_type, detail) => {
427
432
  var _a3, _b3, _c3, _d3;
433
+ const _detail = detail || item;
428
434
  let cacheItem = {
429
- ...item,
435
+ ..._detail,
430
436
  product_id: item.id,
431
437
  _id: item == null ? void 0 : item._id,
432
438
  _key: e2.key,
@@ -578,6 +584,9 @@ var Info = (_, ref) => {
578
584
  const isEditGroup = (0, import_react.useMemo)(() => {
579
585
  return items.length;
580
586
  }, [items]);
587
+ const handleTotalChange = (number) => {
588
+ isChangeTotal.current = true;
589
+ };
581
590
  return (0, import_react.useMemo)(() => {
582
591
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2;
583
592
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
@@ -661,6 +670,7 @@ var Info = (_, ref) => {
661
670
  style: { width: "100%" },
662
671
  min: 0,
663
672
  precision: 2,
673
+ onChange: handleTotalChange,
664
674
  prefix: state.amountSymbol,
665
675
  disabled: state.channelDisabledEdit,
666
676
  originValue: ((_j2 = (_i2 = state.service.cacheItem) == null ? void 0 : _i2._extend) == null ? void 0 : _j2.origin_total) || 0,
@@ -202,15 +202,16 @@ var Info = (props) => {
202
202
  setTimeout(() => {
203
203
  lock = false;
204
204
  }, 2e3);
205
+ const _detail = detail || item;
205
206
  let cacheItem = {
206
- ...detail || item,
207
+ ..._detail,
207
208
  product_id: item.id,
208
209
  _id: (0, import_utils4.getUniqueId)(),
209
210
  _key: e.key,
210
211
  _extend: {
211
212
  start_date: state.date.value,
212
213
  quantity: 1,
213
- price: item.price,
214
+ price: _detail.price,
214
215
  product_name: item.title,
215
216
  other: JSON.parse(JSON.stringify(e))
216
217
  },
@@ -45,6 +45,7 @@ var import_utilsByBooking = require("../../utilsByBooking");
45
45
  var import_dayjs = __toESM(require("dayjs"));
46
46
  var import_utils2 = require("@pisell/utils");
47
47
  var import_AlertTriangle = __toESM(require("@pisell/icon/es/AlertTriangle"));
48
+ var import_utils3 = require("../editService/utils");
48
49
  var import_mock = require("../../../mock");
49
50
  var getUsableTime = (cacheItem) => {
50
51
  try {
@@ -191,12 +192,43 @@ var formatResources = ({ cacheItem, resourcesOrigin }) => {
191
192
  maps: []
192
193
  };
193
194
  };
195
+ var getResourceMaxFreeTime = (resource) => {
196
+ const { renderList, form_id } = resource;
197
+ if (!(0, import_utils3.getAutoAllocationStorage)(form_id)) {
198
+ return [];
199
+ }
200
+ const usableList = renderList.filter((d) => d.usable && d.id !== 0);
201
+ let defaultResource = [];
202
+ let maxFreeTime = 0;
203
+ usableList.forEach((d) => {
204
+ const { times } = d;
205
+ const currentMaxFreeTime = times.reduce((pre, cur) => {
206
+ var _a, _b, _c;
207
+ const start = ((_c = (_b = cur.event_list) == null ? void 0 : _b[((_a = cur.event_list) == null ? void 0 : _a.length) - 1]) == null ? void 0 : _c.end_at) || cur.start_at;
208
+ const end = cur.end_at;
209
+ const diff = (0, import_dayjs.default)(end).diff((0, import_dayjs.default)(start), "minute");
210
+ return diff > pre ? diff : pre;
211
+ }, 0);
212
+ if (currentMaxFreeTime > maxFreeTime) {
213
+ maxFreeTime = currentMaxFreeTime;
214
+ defaultResource = [d];
215
+ }
216
+ });
217
+ return defaultResource;
218
+ };
194
219
  var setDefaultResource = ({ cacheItem, resources }) => {
195
220
  let obj = {};
196
221
  const serviceParams = (0, import_utils.getCacheParams)();
197
222
  let resourceId = Number(serviceParams == null ? void 0 : serviceParams.resource_id);
198
223
  for (let item of resources) {
199
- let defaultResource = item.renderList.filter((d) => d.is_default == 1 || d.id === resourceId).map((d) => {
224
+ const renderList = item.renderList.filter((d) => d.is_default == 1 || d.id === resourceId);
225
+ let defaultOriginalResource = [];
226
+ if (renderList.length === 0) {
227
+ defaultOriginalResource = getResourceMaxFreeTime(item);
228
+ } else {
229
+ defaultOriginalResource = renderList;
230
+ }
231
+ const defaultResource = defaultOriginalResource.map((d) => {
200
232
  return {
201
233
  ...d,
202
234
  relation_type: d.relation_type,
@@ -289,6 +321,9 @@ var getIsAutoClose = (cacheItem) => {
289
321
  }
290
322
  }
291
323
  }
324
+ return Object.entries(cacheItem._extend.resource).every(([key, value]) => {
325
+ return (0, import_utils3.getAutoAllocationStorage)(key) && (value == null ? void 0 : value.length);
326
+ });
292
327
  };
293
328
  var getProductExtend = ({ cacheItem, state }) => {
294
329
  const isNew = cacheItem.new || !cacheItem._extend.endDate;