@pisell/private-materials 3.0.83 → 3.0.84

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 (71) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.js +2 -2
  6. package/build/lowcode/view.js +2 -2
  7. package/es/components/booking/components/addButton/index.js +3 -3
  8. package/es/components/booking/components/customSelect/index.d.ts +3 -0
  9. package/es/components/booking/components/customSelect/index.js +10 -4
  10. package/es/components/booking/components/customSelect/index.less +0 -1
  11. package/es/components/booking/components/drawer/index.d.ts +1 -0
  12. package/es/components/booking/components/drawer/index.js +4 -2
  13. package/es/components/booking/forms/format.d.ts +1 -0
  14. package/es/components/booking/forms/format.js +14 -0
  15. package/es/components/booking/info/client/index.js +3 -0
  16. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +40 -0
  17. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +379 -0
  18. package/es/components/booking/info/clientVariant/index.d.ts +1 -0
  19. package/es/components/booking/info/clientVariant/index.js +1 -0
  20. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
  21. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +348 -0
  22. package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +86 -0
  23. package/es/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
  24. package/es/components/booking/info/clientVariant/vertical/index.js +247 -0
  25. package/es/components/booking/info/clientVariant/vertical/index.less +83 -0
  26. package/es/components/booking/info/index.js +1 -1
  27. package/es/components/booking/info/pet/index.d.ts +11 -1
  28. package/es/components/booking/info/pet/index.js +44 -29
  29. package/es/components/booking/info/service/addService/index.js +1 -1
  30. package/es/components/booking/info/service/editService/index.js +12 -4
  31. package/es/components/booking/info/utils.d.ts +1 -0
  32. package/es/components/booking/info/utils.js +12 -0
  33. package/es/components/booking/locales.d.ts +6 -0
  34. package/es/components/booking/locales.js +9 -3
  35. package/es/components/booking/model.d.ts +2 -0
  36. package/es/index.d.ts +1 -0
  37. package/es/index.js +1 -0
  38. package/lib/components/booking/components/addButton/index.js +2 -2
  39. package/lib/components/booking/components/customSelect/index.d.ts +3 -0
  40. package/lib/components/booking/components/customSelect/index.js +10 -4
  41. package/lib/components/booking/components/customSelect/index.less +0 -1
  42. package/lib/components/booking/components/drawer/index.d.ts +1 -0
  43. package/lib/components/booking/components/drawer/index.js +2 -2
  44. package/lib/components/booking/forms/format.d.ts +1 -0
  45. package/lib/components/booking/forms/format.js +17 -2
  46. package/lib/components/booking/info/client/index.js +2 -1
  47. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +40 -0
  48. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +309 -0
  49. package/lib/components/booking/info/clientVariant/index.d.ts +1 -0
  50. package/lib/components/booking/info/clientVariant/index.js +39 -0
  51. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
  52. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +356 -0
  53. package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +86 -0
  54. package/lib/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
  55. package/lib/components/booking/info/clientVariant/vertical/index.js +277 -0
  56. package/lib/components/booking/info/clientVariant/vertical/index.less +83 -0
  57. package/lib/components/booking/info/index.js +1 -1
  58. package/lib/components/booking/info/pet/index.d.ts +11 -1
  59. package/lib/components/booking/info/pet/index.js +23 -12
  60. package/lib/components/booking/info/service/addService/index.js +1 -1
  61. package/lib/components/booking/info/service/editService/index.js +18 -14
  62. package/lib/components/booking/info/utils.d.ts +1 -0
  63. package/lib/components/booking/info/utils.js +16 -2
  64. package/lib/components/booking/locales.d.ts +6 -0
  65. package/lib/components/booking/locales.js +9 -3
  66. package/lib/components/booking/model.d.ts +2 -0
  67. package/lib/index.d.ts +1 -0
  68. package/lib/index.js +5 -2
  69. package/lowcode/booking-vertical-client/meta.ts +124 -0
  70. package/lowcode/vertical-client/meta.ts +71 -0
  71. package/package.json +3 -3
@@ -0,0 +1,277 @@
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/clientVariant/vertical/index.tsx
30
+ var vertical_exports = {};
31
+ __export(vertical_exports, {
32
+ default: () => vertical_default
33
+ });
34
+ module.exports = __toCommonJS(vertical_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_User01 = __toESM(require("@pisell/icon/es/User01"));
37
+ var import_antd = require("antd");
38
+ var import_utils = require("@pisell/utils");
39
+ var import_icons = require("@ant-design/icons");
40
+ var import_useClientFn = __toESM(require("../hooks/useClientFn"));
41
+ var import_SelectDrawer = __toESM(require("./SelectDrawer"));
42
+ var import_pet = __toESM(require("../../pet"));
43
+ var import_index = require("./index.less");
44
+ var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
45
+ var VerticalClient = (props) => {
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
47
+ const { globalState, setGlobalState } = props;
48
+ const modalRef = (0, import_react.useRef)();
49
+ const state = globalState;
50
+ const stateRef = (0, import_react.useRef)(state);
51
+ const prevCustomerId = (0, import_react.useRef)(null);
52
+ const context = (0, import_useEngineContext.default)();
53
+ stateRef.current = state;
54
+ const {
55
+ isWalkIn,
56
+ setClient,
57
+ handleSelectClient,
58
+ menuChange,
59
+ handleViewClient,
60
+ menus,
61
+ handleCreateItem,
62
+ getClients,
63
+ params,
64
+ searchChange,
65
+ loading,
66
+ loadMore,
67
+ handleOpenClientModal,
68
+ getNickname
69
+ } = (0, import_useClientFn.default)({
70
+ state,
71
+ setGlobalState,
72
+ modalRef
73
+ });
74
+ const renderList = (0, import_react.useMemo)(() => {
75
+ let _list = [...state.client.clients];
76
+ return _list;
77
+ }, [state.client.clients]);
78
+ const handleClose = () => {
79
+ setTimeout(() => {
80
+ setClient({
81
+ showModal: false
82
+ });
83
+ });
84
+ };
85
+ const petDispatch = ({ type, payload }) => {
86
+ if (type === "setPet") {
87
+ setGlobalState({
88
+ pet: {
89
+ ...stateRef.current.pet,
90
+ ...payload
91
+ }
92
+ });
93
+ }
94
+ };
95
+ const boardConfig = (0, import_react.useMemo)(() => {
96
+ var _a2, _b2, _c2;
97
+ return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.appointment_subject) || {};
98
+ }, [(_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic]);
99
+ (0, import_react.useEffect)(() => {
100
+ var _a2, _b2, _c2, _d2;
101
+ if (((_d2 = (_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.appointment_customer) == null ? void 0 : _d2.type) === "customer" && (state == null ? void 0 : state.modalOpen) && !(state == null ? void 0 : state.bookingId)) {
102
+ handleOpenClientModal();
103
+ } else {
104
+ modalRef.current.close();
105
+ setClient({
106
+ showModal: false
107
+ });
108
+ }
109
+ }, [
110
+ (_f = (_e = (_d = (_c = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _c.config) == null ? void 0 : _d.basic) == null ? void 0 : _e.appointment_customer) == null ? void 0 : _f.type,
111
+ state == null ? void 0 : state.modalOpen
112
+ ]);
113
+ const handleSelectPet = (val) => {
114
+ setGlobalState({
115
+ pet: {
116
+ ...state.pet,
117
+ edit: true,
118
+ value: val
119
+ }
120
+ });
121
+ };
122
+ const handleOpenModal = () => {
123
+ handleOpenClientModal();
124
+ };
125
+ const handleAddPet = (_client) => {
126
+ var _a2;
127
+ let _data = {
128
+ formDataConfig: { ...((_a2 = state.pet.formData) == null ? void 0 : _a2[0]) || {} }
129
+ };
130
+ _data.customerId = _client.id;
131
+ state.action({
132
+ type: "pisell1.goCustomFormAddData",
133
+ data: _data,
134
+ callback: (res) => {
135
+ const newClients = stateRef.current.client.clients.map((item) => {
136
+ if (item.id === _client.id) {
137
+ const newFormRecordObj = res.reduce((p, c) => {
138
+ return {
139
+ ...p,
140
+ [c.key]: c.value
141
+ };
142
+ }, {});
143
+ return {
144
+ ...item,
145
+ form_record: [
146
+ ...item.form_record,
147
+ {
148
+ ...newFormRecordObj,
149
+ id: newFormRecordObj.form_record_id,
150
+ data: newFormRecordObj
151
+ }
152
+ ]
153
+ };
154
+ }
155
+ return item;
156
+ });
157
+ setClient({
158
+ clients: newClients
159
+ });
160
+ }
161
+ });
162
+ };
163
+ const previewItemTitleRender = (value, index, values) => {
164
+ var _a2, _b2, _c2, _d2, _e2, _f2;
165
+ const title = getNickname(value.customer) || ((_a2 = value == null ? void 0 : value.customer) == null ? void 0 : _a2.email) || ((_b2 = value == null ? void 0 : value.customer) == null ? void 0 : _b2.phone) || "";
166
+ if (((_c2 = value == null ? void 0 : value.customer) == null ? void 0 : _c2.id) === prevCustomerId.current) {
167
+ if (values.length === index + 1) {
168
+ prevCustomerId.current = null;
169
+ }
170
+ return null;
171
+ }
172
+ prevCustomerId.current = (_d2 = value == null ? void 0 : value.customer) == null ? void 0 : _d2.id;
173
+ if (values.length === index + 1) {
174
+ prevCustomerId.current = null;
175
+ }
176
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-pet-title" }, title, " ' ", ((_f2 = (_e2 = state.pet.formData) == null ? void 0 : _e2[0]) == null ? void 0 : _f2.title) || "");
177
+ };
178
+ const isShowAddBtn = (0, import_react.useMemo)(() => {
179
+ var _a2, _b2, _c2, _d2, _e2, _f2;
180
+ const formId = (_c2 = (_b2 = (_a2 = state.pet) == null ? void 0 : _a2.formData) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.form_id;
181
+ if ((!isWalkIn || ((_f2 = (_e2 = (_d2 = state.pet) == null ? void 0 : _d2.value) == null ? void 0 : _e2[formId]) == null ? void 0 : _f2.length)) && !(state == null ? void 0 : state.disabledEdit) && boardConfig.type === "form") {
182
+ return true;
183
+ }
184
+ return false;
185
+ }, [
186
+ isWalkIn,
187
+ state == null ? void 0 : state.disabledEdit,
188
+ (_g = state.pet) == null ? void 0 : _g.value,
189
+ (_h = state.pet) == null ? void 0 : _h.formData,
190
+ boardConfig.type
191
+ ]);
192
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-vertical-client-wrap" }, /* @__PURE__ */ import_react.default.createElement(
193
+ "div",
194
+ {
195
+ className: "pisell-lowcode__booking-vertical-client",
196
+ onClick: () => {
197
+ if (!isWalkIn || (state == null ? void 0 : state.disableEventBookingEdit)) {
198
+ return;
199
+ }
200
+ handleOpenClientModal();
201
+ }
202
+ },
203
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: state.loading, active: true, round: true }, /* @__PURE__ */ import_react.default.createElement(
204
+ import_antd.Avatar,
205
+ {
206
+ className: "pisell-lowcode__booking-client-avatar",
207
+ src: import_utils.image.ali((_i = state.client.value) == null ? void 0 : _i.cover, 100),
208
+ size: 64,
209
+ icon: /* @__PURE__ */ import_react.default.createElement(import_User01.default, { className: "pisell-lowcode__booking-client-list-item-avatar-icon" })
210
+ }
211
+ ), isWalkIn ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-info-desc" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-title" }, import_utils.locales.getText("pisell2.text.add-client")), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-desc-item" }, import_utils.locales.getText("pisell2.text.leave-empty-for-walk-in"))) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-title" }, getNickname(state.client.value)), ((_j = state.client.value) == null ? void 0 : _j.email) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-desc-item" }, (_k = state.client.value) == null ? void 0 : _k.email) : null, ((_l = state.client.value) == null ? void 0 : _l.phone) ? /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-desc-item" }, (_m = state.client.value) == null ? void 0 : _m.phone) : null), !isWalkIn && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-client-action-wrap" }, !state.disabledEdit && /* @__PURE__ */ import_react.default.createElement(
212
+ import_antd.Dropdown,
213
+ {
214
+ menu: {
215
+ items: menus,
216
+ onClick: menuChange
217
+ },
218
+ placement: "bottomRight"
219
+ },
220
+ /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react.default.createElement(import_antd.Space, null, import_utils.locales.getText("pisell2.text.actions"), /* @__PURE__ */ import_react.default.createElement(import_icons.DownOutlined, null)))
221
+ ), /* @__PURE__ */ import_react.default.createElement(
222
+ import_antd.Button,
223
+ {
224
+ onClick: (e) => {
225
+ e.stopPropagation();
226
+ handleViewClient();
227
+ }
228
+ },
229
+ import_utils.locales.getText("pisell2.text.view-profile")
230
+ )))
231
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-vertical-pet" }, !(state == null ? void 0 : state.disabledEdit) ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, boardConfig.type === "form" ? /* @__PURE__ */ import_react.default.createElement(
232
+ import_pet.default,
233
+ {
234
+ clientChangeNotSetPet: true,
235
+ state,
236
+ dispatch: petDispatch,
237
+ hideTitle: !((_o = (_n = state.pet) == null ? void 0 : _n.value) == null ? void 0 : _o.length),
238
+ handleOpenModal,
239
+ addButtonProps: {
240
+ onClick: handleOpenClientModal,
241
+ style: { display: "none" }
242
+ },
243
+ previewItemTitleRender
244
+ }
245
+ ) : null) : null), isShowAddBtn && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-vertical-footer" }, /* @__PURE__ */ import_react.default.createElement(
246
+ import_antd.Button,
247
+ {
248
+ icon: /* @__PURE__ */ import_react.default.createElement(import_icons.PlusOutlined, null),
249
+ onClick: handleOpenClientModal,
250
+ block: true,
251
+ size: "large"
252
+ },
253
+ import_utils.locales.getText("pisell2.text.add")
254
+ )), /* @__PURE__ */ import_react.default.createElement(
255
+ import_SelectDrawer.default,
256
+ {
257
+ modalOpen: state.modalOpen,
258
+ loading,
259
+ autoFocus: !((_r = (_q = (_p = context == null ? void 0 : context.appHelper) == null ? void 0 : _p.utils) == null ? void 0 : _q.isTerminal) == null ? void 0 : _r.call(_q)),
260
+ ref: modalRef,
261
+ onClose: handleClose,
262
+ handleSelectClient,
263
+ handleCreateItem,
264
+ childrenValue: state.pet.value,
265
+ handleSelectPet,
266
+ formData: state.pet.formData,
267
+ searchChange,
268
+ options: renderList,
269
+ holder: (_s = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _s.holder,
270
+ client: (_t = state == null ? void 0 : state.client) == null ? void 0 : _t.value,
271
+ loadMore,
272
+ showPet: (boardConfig == null ? void 0 : boardConfig.type) === "form",
273
+ handleAddPet
274
+ }
275
+ ));
276
+ };
277
+ var vertical_default = VerticalClient;
@@ -0,0 +1,83 @@
1
+ .pisell-lowcode__booking-vertical-client-wrap {
2
+ position: relative;
3
+ overflow: hidden;
4
+ height: 100%;
5
+ width: 100%;
6
+ border-right: 1px solid var(--Gray-200, #EAECF0);
7
+ background: var(--Gray-50, #F9FAFB);
8
+ display: flex;
9
+ flex-direction: column;
10
+ .pisell-lowcode-drawer-content {
11
+ border-right: 1px solid var(--Gray-200, #EAECF0);
12
+ }
13
+ .pisell-lowcode__booking-drawer-title-wrap {
14
+ padding: 24px 24px 0;
15
+ }
16
+ .pisell-lowcode__booking-drawer-back {
17
+ margin-right: 6px;
18
+ }
19
+ .pisell-lowcode__booking-drawer-back, .pisell-lowcode__booking-drawer-title {
20
+ font-size: 18px;
21
+ }
22
+ }
23
+ .pisell-lowcode__booking-vertical-client {
24
+ padding: 24px 16px;
25
+ display: flex;
26
+ flex-direction: column;
27
+ align-items: center;
28
+ width: 100%;
29
+ border-bottom: 1px solid var(--Gray-200, #EAECF0);
30
+ .pisell-lowcode__booking-client-avatar {
31
+ margin-bottom: 16px;
32
+ }
33
+ .pisell-lowcode__booking-client-title {
34
+ color: var(--Gray-900, #101828);
35
+ font-size: 16px;
36
+ font-style: normal;
37
+ font-weight: 600;
38
+ line-height: 24px; /* 150% */
39
+ text-align: center;
40
+ }
41
+ .pisell-lowcode__booking-client-desc-item {
42
+ color: var(--Gray-400, #98A2B3);
43
+ font-size: 14px;
44
+ font-style: normal;
45
+ font-weight: 400;
46
+ line-height: 20px; /* 142.857% */
47
+ text-align: center;
48
+ max-width: 200px;
49
+ word-break:break-word
50
+ }
51
+ .pisell-lowcode__booking-client-action-wrap {
52
+ display: flex;
53
+ gap: 16px;
54
+ justify-content: center;
55
+ margin-top: 16px;
56
+ }
57
+ }
58
+
59
+ .pisell-lowcode__booking-vertical-pet {
60
+ padding: 0 24px 24px;
61
+ flex:1;
62
+ overflow: auto;
63
+ }
64
+ .pisell-lowcode__booking-pet-title {
65
+ color: var(--Gray-700, #344054);
66
+ font-size: 14px;
67
+ font-style: normal;
68
+ font-weight: 500;
69
+ line-height: 20px;
70
+ margin-bottom: 8px;
71
+ word-break: break-word;
72
+ }
73
+
74
+ .pisell-lowcode__booking-vertical-footer {
75
+ display: flex;
76
+ padding: var(--rateStarSize, 20px) 32px;
77
+ flex-direction: column;
78
+ align-items: flex-start;
79
+ gap: 16px;
80
+ border-top: 1px solid var(--Gray-200, #EAECF0);
81
+ background: var(--Base-White, #FFF);
82
+ box-shadow: 0px -4px 8px -2px rgba(16, 24, 40, 0.10), 0px -2px 4px -2px rgba(16, 24, 40, 0.06);
83
+ }
@@ -109,7 +109,7 @@ var Info = (0, import_model.Provider)((props) => {
109
109
  if ((globalState == null ? void 0 : globalState.renderType) === "eventBooking") {
110
110
  return import_utils.locales.getText("pisell2.text.enroll.detail");
111
111
  }
112
- return (globalState == null ? void 0 : globalState.bookingId) ? /* @__PURE__ */ import_react.default.createElement(import_header.default, { state: modal.state, dispatch: modal.dispatch }) : /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { height: 20 } });
112
+ return (globalState == null ? void 0 : globalState.bookingId) ? /* @__PURE__ */ import_react.default.createElement(import_header.default, { state: modal.state, dispatch: modal.dispatch }) : /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { height: 0 } });
113
113
  }, [
114
114
  globalState == null ? void 0 : globalState.bookingId,
115
115
  modal.state,
@@ -1,4 +1,14 @@
1
1
  import React from "react";
2
2
  import "./index.less";
3
- declare const Pet: () => React.JSX.Element;
3
+ import { InfoProps } from "../../forms/forms";
4
+ interface PetProps {
5
+ state?: any;
6
+ dispatch?: any;
7
+ hideTitle?: boolean;
8
+ addButtonProps?: InfoProps['addButtonProps'];
9
+ handleOpenModal?: () => void;
10
+ clientChangeNotSetPet?: boolean;
11
+ previewItemTitleRender?: (item: any, index: number, values: any[]) => React.ReactNode;
12
+ }
13
+ declare const Pet: (props: PetProps) => React.JSX.Element;
4
14
  export default Pet;
@@ -48,15 +48,18 @@ var defaultParams = {
48
48
  total: 0,
49
49
  keyword: ""
50
50
  };
51
- var Pet = () => {
51
+ var Pet = (props) => {
52
52
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
53
+ const { hideTitle, addButtonProps, handleOpenModal, clientChangeNotSetPet, previewItemTitleRender } = props;
53
54
  const [loadLoading, setLoadLoading] = (0, import_react.useState)(false);
54
55
  const [loading, setLoading] = (0, import_react.useState)(false);
55
- const { state, dispatch } = (0, import_react.useContext)(import_model.Context);
56
+ let { state, dispatch } = (0, import_react.useContext)(import_model.Context);
56
57
  const [valueLoading, setValueLoading] = (0, import_react.useState)(false);
57
58
  const context = (0, import_useEngineContext.default)();
58
59
  const { isTerminal } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
59
60
  const [params, setParams] = (0, import_react.useState)(defaultParams);
61
+ state = state || (props == null ? void 0 : props.state);
62
+ dispatch = dispatch || (props == null ? void 0 : props.dispatch);
60
63
  const boardParams = (0, import_react.useMemo)(() => {
61
64
  var _a2, _b2, _c2;
62
65
  return ((_c2 = (_b2 = (_a2 = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a2.config) == null ? void 0 : _b2.basic) == null ? void 0 : _c2.appointment_subject) || {};
@@ -119,7 +122,7 @@ var Pet = () => {
119
122
  setLoading(false);
120
123
  };
121
124
  const getForms = async (isUpdateValue = true) => {
122
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
125
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
123
126
  let values = {
124
127
  ...state.pet.value
125
128
  };
@@ -151,10 +154,11 @@ var Pet = () => {
151
154
  };
152
155
  if (isSetValue) {
153
156
  let records = await state.apis.getFormRecords({
154
- form_record_ids: (_g2 = (_f2 = state.bookingDetail) == null ? void 0 : _f2.holder) == null ? void 0 : _g2.form_record
157
+ form_record_ids: (_g2 = (_f2 = state.bookingDetail) == null ? void 0 : _f2.holder) == null ? void 0 : _g2.form_record,
158
+ with: ["customer"]
155
159
  });
156
160
  console.log("records", records);
157
- values[boardParams == null ? void 0 : boardParams.form_id] = records;
161
+ values[boardParams == null ? void 0 : boardParams.form_id] = (0, import_format.sortFormValues)(records, (_i2 = (_h2 = state.client) == null ? void 0 : _h2.value) == null ? void 0 : _i2.id);
158
162
  payload.value = values;
159
163
  setValueLoading(false);
160
164
  }
@@ -187,7 +191,9 @@ var Pet = () => {
187
191
  (d) => d.form_record_id !== item.form_record_id
188
192
  );
189
193
  } else {
190
- let obj = {};
194
+ let obj = {
195
+ customer: item == null ? void 0 : item.customer
196
+ };
191
197
  for (let item2 of res) {
192
198
  obj[item2.key] = item2.value;
193
199
  }
@@ -232,6 +238,8 @@ var Pet = () => {
232
238
  };
233
239
  (0, import_react.useEffect)(() => {
234
240
  var _a2, _b2, _c2, _d2;
241
+ if (clientChangeNotSetPet)
242
+ return;
235
243
  let changeFormValuesData = (0, import_format.changeFormValues)({
236
244
  values: ((_a2 = state.pet) == null ? void 0 : _a2.value) || {},
237
245
  clientId: (_c2 = (_b2 = state.client) == null ? void 0 : _b2.value) == null ? void 0 : _c2.id,
@@ -243,7 +251,7 @@ var Pet = () => {
243
251
  payload: { value: changeFormValuesData }
244
252
  });
245
253
  });
246
- }, [(_f = state.client.value) == null ? void 0 : _f.id]);
254
+ }, [(_f = state.client.value) == null ? void 0 : _f.id, clientChangeNotSetPet]);
247
255
  const handleUpdateForm = () => {
248
256
  if (state.bookingId) {
249
257
  if (!state.bookingDetail) {
@@ -263,9 +271,9 @@ var Pet = () => {
263
271
  state.bookingDetail,
264
272
  boardParams.form_id,
265
273
  boardParams.type,
266
- (_h = (_g = state.client) == null ? void 0 : _g.value) == null ? void 0 : _h.id,
267
274
  state.renderType,
268
- petForm
275
+ petForm,
276
+ clientChangeNotSetPet ? (_h = (_g = state.client) == null ? void 0 : _g.value) == null ? void 0 : _h.id : void 0
269
277
  ]);
270
278
  const addCallback = (_params) => {
271
279
  var _a2, _b2;
@@ -301,7 +309,7 @@ var Pet = () => {
301
309
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-pet-wraps" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Skeleton, { loading: valueLoading, active: true, round: true }, /* @__PURE__ */ import_react.default.createElement(
302
310
  import_forms.default,
303
311
  {
304
- hideTitle: true,
312
+ hideTitle,
305
313
  watch: { value: state.pet.value },
306
314
  addCallback: () => {
307
315
  addCallback();
@@ -328,7 +336,9 @@ var Pet = () => {
328
336
  loadMore,
329
337
  filterItem: () => {
330
338
  return true;
331
- }
339
+ },
340
+ handleOpenModal,
341
+ previewItemTitleRender
332
342
  },
333
343
  optionRender: (item) => {
334
344
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
@@ -368,7 +378,8 @@ var Pet = () => {
368
378
  showDisabledMessage: !state.disableEventBookingEdit,
369
379
  addCallback: async () => {
370
380
  addCallback();
371
- }
381
+ },
382
+ ...addButtonProps
372
383
  }
373
384
  }
374
385
  )));
@@ -235,7 +235,7 @@ var Info = () => {
235
235
  var _a2, _b2, _c2, _d2, _e, _f, _g;
236
236
  if (shopList.includes(
237
237
  (_e = (_d2 = (_c2 = (_b2 = (_a2 = context.appHelper.utils.store) == null ? void 0 : _a2.getState) == null ? void 0 : _b2.call(_a2)) == null ? void 0 : _c2.global) == null ? void 0 : _d2.globalConfig) == null ? void 0 : _e.id
238
- )) {
238
+ ) || state.closeAutoOpenService) {
239
239
  return;
240
240
  }
241
241
  if (state.modalOpen && !state.bookingId && state.renderType !== "eventBooking" && ((_g = (_f = state.service) == null ? void 0 : _f.value) == null ? void 0 : _g.length) === 0) {
@@ -312,20 +312,24 @@ var Info = () => {
312
312
  }, [(_i = (_h = (_g = (_f = state.service) == null ? void 0 : _f.cacheItem) == null ? void 0 : _g._extend) == null ? void 0 : _h.other) == null ? void 0 : _i.bundle]);
313
313
  const getResourcesData = async () => {
314
314
  setResourceLoading(true);
315
- let data = await state.apis.getResources({
316
- skip: 1,
317
- num: 1e3,
318
- with_date_times: state.date.value.format("YYYY-MM-DD"),
319
- codes: ["resources", "therapist", "table"],
320
- _config: { abort: true }
321
- });
322
- let _list = [(0, import_mock.getNoResource)()].concat((data == null ? void 0 : data.list) || []);
323
- dispatch({
324
- type: "setService",
325
- payload: {
326
- resourcesOrigin: _list
327
- }
328
- });
315
+ try {
316
+ let data = await state.apis.getResources({
317
+ skip: 1,
318
+ num: 1e3,
319
+ with_date_times: state.date.value.format("YYYY-MM-DD"),
320
+ codes: ["resources", "therapist", "table"],
321
+ _config: { abort: true }
322
+ });
323
+ let _list = [(0, import_mock.getNoResource)()].concat((data == null ? void 0 : data.list) || []);
324
+ dispatch({
325
+ type: "setService",
326
+ payload: {
327
+ resourcesOrigin: _list
328
+ }
329
+ });
330
+ } catch (err) {
331
+ console.log(err, "err");
332
+ }
329
333
  setResourceLoading(false);
330
334
  };
331
335
  (0, import_react.useEffect)(() => {
@@ -1 +1,2 @@
1
1
  export declare const getIsBundleOrCombination: (productDetail: any) => boolean;
2
+ export declare const uniqueByField: (arr: any[], field: string) => any[];
@@ -19,7 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/components/booking/info/utils.ts
20
20
  var utils_exports = {};
21
21
  __export(utils_exports, {
22
- getIsBundleOrCombination: () => getIsBundleOrCombination
22
+ getIsBundleOrCombination: () => getIsBundleOrCombination,
23
+ uniqueByField: () => uniqueByField
23
24
  });
24
25
  module.exports = __toCommonJS(utils_exports);
25
26
  var getIsBundleOrCombination = (productDetail) => {
@@ -29,7 +30,20 @@ var getIsBundleOrCombination = (productDetail) => {
29
30
  }
30
31
  return false;
31
32
  };
33
+ var uniqueByField = (arr, field) => {
34
+ const seen = /* @__PURE__ */ new Set();
35
+ return arr.filter((item) => {
36
+ const fieldValue = item[field];
37
+ if (seen.has(fieldValue)) {
38
+ return false;
39
+ } else {
40
+ seen.add(fieldValue);
41
+ return true;
42
+ }
43
+ });
44
+ };
32
45
  // Annotate the CommonJS export names for ESM import in node:
33
46
  0 && (module.exports = {
34
- getIsBundleOrCombination
47
+ getIsBundleOrCombination,
48
+ uniqueByField
35
49
  });
@@ -157,6 +157,8 @@ declare const _default: {
157
157
  'page.booking.text.fully-booked': string;
158
158
  'page.booking.text.unlimited': string;
159
159
  'pisell2.text.terminal-edit-message': string;
160
+ "pisell2.text.actions": string;
161
+ "pisell2.text.add-client": string;
160
162
  };
161
163
  'zh-CN': {
162
164
  'pisell2.text.refunded-amount': string;
@@ -316,6 +318,8 @@ declare const _default: {
316
318
  'page.booking.text.available': string;
317
319
  'page.booking.text.fully-booked': string;
318
320
  'page.booking.text.unlimited': string;
321
+ "pisell2.text.actions": string;
322
+ "pisell2.text.add-client": string;
319
323
  };
320
324
  'zh-HK': {
321
325
  'pisell2.text.refunded-amount': string;
@@ -475,6 +479,8 @@ declare const _default: {
475
479
  'page.booking.text.available': string;
476
480
  'page.booking.text.fully-booked': string;
477
481
  'page.booking.text.unlimited': string;
482
+ "pisell2.text.actions": string;
483
+ "pisell2.text.add-client": string;
478
484
  };
479
485
  };
480
486
  export default _default;
@@ -189,7 +189,9 @@ var locales_default = {
189
189
  "page.booking.text.available": "Available",
190
190
  "page.booking.text.fully-booked": "Fully booked",
191
191
  "page.booking.text.unlimited": "Unlimited",
192
- "pisell2.text.terminal-edit-message": "This operation cannot be performed. To proceed, please use the Pisell Terminal."
192
+ "pisell2.text.terminal-edit-message": "This operation cannot be performed. To proceed, please use the Pisell Terminal.",
193
+ "pisell2.text.actions": "Actions",
194
+ "pisell2.text.add-client": "Add customer"
193
195
  },
194
196
  "zh-CN": {
195
197
  "pisell2.text.refunded-amount": "已退金额",
@@ -362,7 +364,9 @@ var locales_default = {
362
364
  "page.booking.text.unavailable": "不可用",
363
365
  "page.booking.text.available": "可用",
364
366
  "page.booking.text.fully-booked": "已约满",
365
- "page.booking.text.unlimited": "无限制"
367
+ "page.booking.text.unlimited": "无限制",
368
+ "pisell2.text.actions": "操作选项",
369
+ "pisell2.text.add-client": "添加客户"
366
370
  },
367
371
  "zh-HK": {
368
372
  "pisell2.text.refunded-amount": "已退金額",
@@ -535,6 +539,8 @@ var locales_default = {
535
539
  "page.booking.text.unavailable": "不可用",
536
540
  "page.booking.text.available": "可用",
537
541
  "page.booking.text.fully-booked": "已約滿",
538
- "page.booking.text.unlimited": "無限制"
542
+ "page.booking.text.unlimited": "無限制",
543
+ "pisell2.text.actions": "操作選項",
544
+ "pisell2.text.add-client": "添加客戶"
539
545
  }
540
546
  };
@@ -89,6 +89,8 @@ export interface FormState {
89
89
  productIds: number[];
90
90
  };
91
91
  disableEventBookingEdit?: boolean;
92
+ /** 关闭自动打开选择服务弹窗 */
93
+ closeAutoOpenService?: boolean;
92
94
  }
93
95
  export declare const walkInData: {
94
96
  id: number;
package/lib/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { default as BookingResources } from './components/booking/materiels/reso
11
11
  export { default as BookingStartTime } from './components/booking/materiels/startTime';
12
12
  export { default as BookingDuration } from './components/booking/materiels/duration';
13
13
  export { default as BookingContacts } from './components/booking/materiels/contacts';
14
+ export { VerticalClient } from './components/booking/info/clientVariant';
14
15
  export { default as ProductExtension } from './components/productExtension';
15
16
  export { default as BookingDeposit } from './components/booking/deposit';
16
17
  export { default as RuleSetting } from './components/ruleSetting';