@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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.js +2 -2
- package/es/components/booking/components/addButton/index.js +3 -3
- package/es/components/booking/components/customSelect/index.d.ts +3 -0
- package/es/components/booking/components/customSelect/index.js +10 -4
- package/es/components/booking/components/customSelect/index.less +0 -1
- package/es/components/booking/components/drawer/index.d.ts +1 -0
- package/es/components/booking/components/drawer/index.js +4 -2
- package/es/components/booking/forms/format.d.ts +1 -0
- package/es/components/booking/forms/format.js +14 -0
- package/es/components/booking/info/client/index.js +3 -0
- package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +40 -0
- package/es/components/booking/info/clientVariant/hooks/useClientFn.js +379 -0
- package/es/components/booking/info/clientVariant/index.d.ts +1 -0
- package/es/components/booking/info/clientVariant/index.js +1 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.js +348 -0
- package/es/components/booking/info/clientVariant/vertical/SelectDrawer.less +86 -0
- package/es/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
- package/es/components/booking/info/clientVariant/vertical/index.js +247 -0
- package/es/components/booking/info/clientVariant/vertical/index.less +83 -0
- package/es/components/booking/info/index.js +1 -1
- package/es/components/booking/info/pet/index.d.ts +11 -1
- package/es/components/booking/info/pet/index.js +44 -29
- package/es/components/booking/info/service/addService/index.js +1 -1
- package/es/components/booking/info/service/editService/index.js +12 -4
- package/es/components/booking/info/utils.d.ts +1 -0
- package/es/components/booking/info/utils.js +12 -0
- package/es/components/booking/locales.d.ts +6 -0
- package/es/components/booking/locales.js +9 -3
- package/es/components/booking/model.d.ts +2 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/lib/components/booking/components/addButton/index.js +2 -2
- package/lib/components/booking/components/customSelect/index.d.ts +3 -0
- package/lib/components/booking/components/customSelect/index.js +10 -4
- package/lib/components/booking/components/customSelect/index.less +0 -1
- package/lib/components/booking/components/drawer/index.d.ts +1 -0
- package/lib/components/booking/components/drawer/index.js +2 -2
- package/lib/components/booking/forms/format.d.ts +1 -0
- package/lib/components/booking/forms/format.js +17 -2
- package/lib/components/booking/info/client/index.js +2 -1
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +40 -0
- package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +309 -0
- package/lib/components/booking/info/clientVariant/index.d.ts +1 -0
- package/lib/components/booking/info/clientVariant/index.js +39 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.d.ts +22 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.js +356 -0
- package/lib/components/booking/info/clientVariant/vertical/SelectDrawer.less +86 -0
- package/lib/components/booking/info/clientVariant/vertical/index.d.ts +8 -0
- package/lib/components/booking/info/clientVariant/vertical/index.js +277 -0
- package/lib/components/booking/info/clientVariant/vertical/index.less +83 -0
- package/lib/components/booking/info/index.js +1 -1
- package/lib/components/booking/info/pet/index.d.ts +11 -1
- package/lib/components/booking/info/pet/index.js +23 -12
- package/lib/components/booking/info/service/addService/index.js +1 -1
- package/lib/components/booking/info/service/editService/index.js +18 -14
- package/lib/components/booking/info/utils.d.ts +1 -0
- package/lib/components/booking/info/utils.js +16 -2
- package/lib/components/booking/locales.d.ts +6 -0
- package/lib/components/booking/locales.js +9 -3
- package/lib/components/booking/model.d.ts +2 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +5 -2
- package/lowcode/booking-vertical-client/meta.ts +124 -0
- package/lowcode/vertical-client/meta.ts +71 -0
- package/package.json +3 -3
|
@@ -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;
|
|
@@ -171,7 +171,9 @@ export default {
|
|
|
171
171
|
'page.booking.text.available': 'Available',
|
|
172
172
|
'page.booking.text.fully-booked': 'Fully booked',
|
|
173
173
|
'page.booking.text.unlimited': 'Unlimited',
|
|
174
|
-
'pisell2.text.terminal-edit-message': "This operation cannot be performed. To proceed, please use the Pisell Terminal."
|
|
174
|
+
'pisell2.text.terminal-edit-message': "This operation cannot be performed. To proceed, please use the Pisell Terminal.",
|
|
175
|
+
"pisell2.text.actions": "Actions",
|
|
176
|
+
"pisell2.text.add-client": "Add customer"
|
|
175
177
|
},
|
|
176
178
|
'zh-CN': {
|
|
177
179
|
'pisell2.text.refunded-amount': '已退金额',
|
|
@@ -350,7 +352,9 @@ export default {
|
|
|
350
352
|
'page.booking.text.unavailable': '不可用',
|
|
351
353
|
'page.booking.text.available': '可用',
|
|
352
354
|
'page.booking.text.fully-booked': '已约满',
|
|
353
|
-
'page.booking.text.unlimited': '无限制'
|
|
355
|
+
'page.booking.text.unlimited': '无限制',
|
|
356
|
+
"pisell2.text.actions": "操作选项",
|
|
357
|
+
"pisell2.text.add-client": "添加客户"
|
|
354
358
|
},
|
|
355
359
|
'zh-HK': {
|
|
356
360
|
'pisell2.text.refunded-amount': '已退金額',
|
|
@@ -529,6 +533,8 @@ export default {
|
|
|
529
533
|
'page.booking.text.unavailable': '不可用',
|
|
530
534
|
'page.booking.text.available': '可用',
|
|
531
535
|
'page.booking.text.fully-booked': '已約滿',
|
|
532
|
-
'page.booking.text.unlimited': '無限制'
|
|
536
|
+
'page.booking.text.unlimited': '無限制',
|
|
537
|
+
"pisell2.text.actions": "操作選項",
|
|
538
|
+
"pisell2.text.add-client": "添加客戶"
|
|
533
539
|
}
|
|
534
540
|
};
|
package/es/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';
|
package/es/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { default as BookingResources } from "./components/booking/materiels/reso
|
|
|
15
15
|
export { default as BookingStartTime } from "./components/booking/materiels/startTime";
|
|
16
16
|
export { default as BookingDuration } from "./components/booking/materiels/duration";
|
|
17
17
|
export { default as BookingContacts } from "./components/booking/materiels/contacts";
|
|
18
|
+
export { VerticalClient } from "./components/booking/info/clientVariant";
|
|
18
19
|
export { default as ProductExtension } from "./components/productExtension";
|
|
19
20
|
export { default as BookingDeposit } from "./components/booking/deposit";
|
|
20
21
|
export { default as RuleSetting } from "./components/ruleSetting";
|
|
@@ -68,7 +68,7 @@ var AddButton = ({
|
|
|
68
68
|
{
|
|
69
69
|
className: "pisell-lowcode__booking-add-button-add-row",
|
|
70
70
|
onClick: _onClick,
|
|
71
|
-
style
|
|
71
|
+
style: (0, import_utils.isFunction)(style) ? style(showSub) : style
|
|
72
72
|
},
|
|
73
73
|
/* @__PURE__ */ import_react.default.createElement(import_PlusCircle.default, { className: "pisell-lowcode__booking-add-button-add-row-icon" }),
|
|
74
74
|
/* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-add-button-add-row-txt" }, subTitle)
|
|
@@ -79,7 +79,7 @@ var AddButton = ({
|
|
|
79
79
|
"pisell-lowcode__booking-add-button-add-disabled": disabled
|
|
80
80
|
}),
|
|
81
81
|
onClick: _onClick,
|
|
82
|
-
style
|
|
82
|
+
style: (0, import_utils.isFunction)(style) ? style(showSub) : style
|
|
83
83
|
},
|
|
84
84
|
/* @__PURE__ */ import_react.default.createElement("span", { className: "pisell-lowcode__booking-add-button-add-label" }, title),
|
|
85
85
|
/* @__PURE__ */ import_react.default.createElement(import_ChevronRight.default, { className: "pisell-lowcode__booking-add-button-add-icon" })
|
|
@@ -6,6 +6,7 @@ interface CustomSelectProps {
|
|
|
6
6
|
value: any[];
|
|
7
7
|
rowKey: string;
|
|
8
8
|
previewItemRender?: (item: any) => React.ReactNode;
|
|
9
|
+
previewItemTitleRender?: (item: any, index: number, values: any[]) => React.ReactNode;
|
|
9
10
|
addButtonRender?: () => React.ReactNode;
|
|
10
11
|
optionRender: (item: any) => React.ReactNode;
|
|
11
12
|
addButtonProps?: any;
|
|
@@ -29,6 +30,8 @@ interface CustomSelectProps {
|
|
|
29
30
|
modalOpen?: boolean;
|
|
30
31
|
closeCallback?: () => any;
|
|
31
32
|
autoFocus?: boolean;
|
|
33
|
+
showDropDown?: boolean;
|
|
34
|
+
handleOpenModal: () => void;
|
|
32
35
|
}
|
|
33
36
|
declare const _default: React.ForwardRefExoticComponent<CustomSelectProps & React.RefAttributes<unknown>>;
|
|
34
37
|
export default _default;
|
|
@@ -54,6 +54,7 @@ var CustomSelect = (props, ref) => {
|
|
|
54
54
|
drawerProps,
|
|
55
55
|
createItemText = "",
|
|
56
56
|
previewItemRender,
|
|
57
|
+
previewItemTitleRender,
|
|
57
58
|
addButtonRender,
|
|
58
59
|
optionRender,
|
|
59
60
|
filterItem,
|
|
@@ -73,7 +74,8 @@ var CustomSelect = (props, ref) => {
|
|
|
73
74
|
modalOpen,
|
|
74
75
|
closeCallback,
|
|
75
76
|
autoFocus,
|
|
76
|
-
showDropDown = true
|
|
77
|
+
showDropDown = true,
|
|
78
|
+
handleOpenModal: propsHandleOpenModal
|
|
77
79
|
} = props;
|
|
78
80
|
const searchRef = (0, import_react.useRef)();
|
|
79
81
|
const [_value, set_value] = (0, import_react.useState)([]);
|
|
@@ -110,6 +112,10 @@ var CustomSelect = (props, ref) => {
|
|
|
110
112
|
if (disabled) {
|
|
111
113
|
return;
|
|
112
114
|
}
|
|
115
|
+
if (propsHandleOpenModal) {
|
|
116
|
+
propsHandleOpenModal();
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
113
119
|
if (addButtonProps == null ? void 0 : addButtonProps.addCallback) {
|
|
114
120
|
addButtonProps == null ? void 0 : addButtonProps.addCallback();
|
|
115
121
|
}
|
|
@@ -199,8 +205,8 @@ var CustomSelect = (props, ref) => {
|
|
|
199
205
|
const isShowAddButton = (0, import_react.useMemo)(() => {
|
|
200
206
|
return (mode === "multiple" || mode === "single" && !isMore) && !disabled;
|
|
201
207
|
}, [mode, isMore, disabled]);
|
|
202
|
-
return /* @__PURE__ */ import_react.default.createElement("div", null, isPreview ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__custom-select-cards" }, _value.map((d) => {
|
|
203
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
208
|
+
return /* @__PURE__ */ import_react.default.createElement("div", null, isPreview ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__custom-select-cards" }, _value.map((d, index) => {
|
|
209
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, previewItemTitleRender == null ? void 0 : previewItemTitleRender(d, index, _value), /* @__PURE__ */ import_react.default.createElement(
|
|
204
210
|
"div",
|
|
205
211
|
{
|
|
206
212
|
className: (0, import_classnames.default)(
|
|
@@ -232,7 +238,7 @@ var CustomSelect = (props, ref) => {
|
|
|
232
238
|
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__custom-select-card-menu-wrap" }, /* @__PURE__ */ import_react.default.createElement(import_DotsVertical.default, { className: "pisell-lowcode__custom-select-card-menu-icon" }))
|
|
233
239
|
)
|
|
234
240
|
)
|
|
235
|
-
);
|
|
241
|
+
));
|
|
236
242
|
})), isShowAddButton ? addButtonRender ? addButtonRender() : /* @__PURE__ */ import_react.default.createElement(
|
|
237
243
|
import_addButton.default,
|
|
238
244
|
{
|
|
@@ -38,7 +38,7 @@ var import_ArrowLeft = __toESM(require("@pisell/icon/es/ArrowLeft"));
|
|
|
38
38
|
var import_index = require("./index.less");
|
|
39
39
|
var import_classnames = __toESM(require("classnames"));
|
|
40
40
|
var Drawer = (props) => {
|
|
41
|
-
const { hideScrollBar = true } = props;
|
|
41
|
+
const { hideScrollBar = true, showGoBack = true } = props;
|
|
42
42
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
43
43
|
import_antd.Drawer,
|
|
44
44
|
{
|
|
@@ -54,7 +54,7 @@ var Drawer = (props) => {
|
|
|
54
54
|
push: false,
|
|
55
55
|
mask: false
|
|
56
56
|
},
|
|
57
|
-
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-lowcode__booking-drawer-title-wrap") }, /* @__PURE__ */ import_react.default.createElement(
|
|
57
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-lowcode__booking-drawer-title-wrap") }, showGoBack && /* @__PURE__ */ import_react.default.createElement(
|
|
58
58
|
import_ArrowLeft.default,
|
|
59
59
|
{
|
|
60
60
|
className: "pisell-lowcode__booking-drawer-back",
|
|
@@ -3,6 +3,7 @@ export declare const changeFormValues: ({ clientId, values, forms, }: {
|
|
|
3
3
|
values: any;
|
|
4
4
|
forms: any[];
|
|
5
5
|
}) => any;
|
|
6
|
+
export declare const sortFormValues: (list: any[], clientId: number) => any[];
|
|
6
7
|
export declare const formatAddFormValues: ({ clientId, value, data_range }: {
|
|
7
8
|
clientId: number;
|
|
8
9
|
value: any[];
|
|
@@ -20,7 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
var format_exports = {};
|
|
21
21
|
__export(format_exports, {
|
|
22
22
|
changeFormValues: () => changeFormValues,
|
|
23
|
-
formatAddFormValues: () => formatAddFormValues
|
|
23
|
+
formatAddFormValues: () => formatAddFormValues,
|
|
24
|
+
sortFormValues: () => sortFormValues
|
|
24
25
|
});
|
|
25
26
|
module.exports = __toCommonJS(format_exports);
|
|
26
27
|
var changeFormValues = ({
|
|
@@ -39,6 +40,18 @@ var changeFormValues = ({
|
|
|
39
40
|
}
|
|
40
41
|
return _values;
|
|
41
42
|
};
|
|
43
|
+
var sortFormValues = (list, clientId) => {
|
|
44
|
+
return list.sort((a, b) => {
|
|
45
|
+
var _a, _b, _c, _d, _e, _f;
|
|
46
|
+
if (((_a = a == null ? void 0 : a.customer) == null ? void 0 : _a.id) === clientId && ((_b = b == null ? void 0 : b.customer) == null ? void 0 : _b.id) !== clientId) {
|
|
47
|
+
return -1;
|
|
48
|
+
} else if (((_c = b == null ? void 0 : b.customer) == null ? void 0 : _c.id) === clientId && ((_d = a == null ? void 0 : a.customer) == null ? void 0 : _d.id) !== clientId) {
|
|
49
|
+
return 1;
|
|
50
|
+
} else {
|
|
51
|
+
return ((_e = a == null ? void 0 : a.customer) == null ? void 0 : _e.id) - ((_f = b == null ? void 0 : b.customer) == null ? void 0 : _f.id);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
|
42
55
|
var formatAddFormValues = ({
|
|
43
56
|
clientId,
|
|
44
57
|
value,
|
|
@@ -53,10 +66,12 @@ var formatAddFormValues = ({
|
|
|
53
66
|
};
|
|
54
67
|
});
|
|
55
68
|
}
|
|
69
|
+
_value = sortFormValues(_value, clientId);
|
|
56
70
|
return _value;
|
|
57
71
|
};
|
|
58
72
|
// Annotate the CommonJS export names for ESM import in node:
|
|
59
73
|
0 && (module.exports = {
|
|
60
74
|
changeFormValues,
|
|
61
|
-
formatAddFormValues
|
|
75
|
+
formatAddFormValues,
|
|
76
|
+
sortFormValues
|
|
62
77
|
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormState } from "../../../model";
|
|
3
|
+
interface useClientFnParams {
|
|
4
|
+
state: any;
|
|
5
|
+
setGlobalState: (val: any) => void;
|
|
6
|
+
modalRef: any;
|
|
7
|
+
}
|
|
8
|
+
declare const useClientFn: (_params: useClientFnParams) => {
|
|
9
|
+
setClient: (client: Partial<FormState["client"]>) => void;
|
|
10
|
+
isWalkIn: boolean;
|
|
11
|
+
handleSelectClient: (value: any) => Promise<unknown>;
|
|
12
|
+
menuChange: (e: any) => void;
|
|
13
|
+
handleViewClient: () => void;
|
|
14
|
+
menus: {
|
|
15
|
+
key: string;
|
|
16
|
+
label: any;
|
|
17
|
+
}[];
|
|
18
|
+
handleCreateItem: () => void;
|
|
19
|
+
getClients: ({ customer_id, ...resetParams }: {
|
|
20
|
+
customer_id?: number | undefined;
|
|
21
|
+
skip?: number | undefined;
|
|
22
|
+
search?: string | undefined;
|
|
23
|
+
with?: string[] | undefined;
|
|
24
|
+
relation_form_id?: number | undefined;
|
|
25
|
+
}) => Promise<{}>;
|
|
26
|
+
params: {
|
|
27
|
+
skip: number;
|
|
28
|
+
num: number;
|
|
29
|
+
total: number;
|
|
30
|
+
search: string;
|
|
31
|
+
with: string[];
|
|
32
|
+
relation_form_id: any;
|
|
33
|
+
};
|
|
34
|
+
searchChange: (search: string) => void;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
loadMore: React.JSX.Element | null;
|
|
37
|
+
handleOpenClientModal: () => void;
|
|
38
|
+
getNickname: (item: any) => any;
|
|
39
|
+
};
|
|
40
|
+
export default useClientFn;
|
|
@@ -0,0 +1,309 @@
|
|
|
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/hooks/useClientFn.tsx
|
|
30
|
+
var useClientFn_exports = {};
|
|
31
|
+
__export(useClientFn_exports, {
|
|
32
|
+
default: () => useClientFn_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useClientFn_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("../../../utils");
|
|
37
|
+
var import_serve = require("../../client/serve");
|
|
38
|
+
var import_model = require("../../model");
|
|
39
|
+
var import_utils2 = require("@pisell/utils");
|
|
40
|
+
var import_antd = require("antd");
|
|
41
|
+
var useClientFn = (_params) => {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
43
|
+
const { state, setGlobalState, modalRef } = _params;
|
|
44
|
+
const [loadLoading, setLoadLoading] = (0, import_react.useState)(false);
|
|
45
|
+
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
46
|
+
const [franchiseeLoading, setFranchiseeLoading] = (0, import_react.useState)(0);
|
|
47
|
+
const [params, setParams] = (0, import_react.useState)({
|
|
48
|
+
skip: 1,
|
|
49
|
+
num: 50,
|
|
50
|
+
total: 0,
|
|
51
|
+
search: "",
|
|
52
|
+
with: ["formRecord"],
|
|
53
|
+
relation_form_id: (_d = (_c = (_b = (_a = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _a.config) == null ? void 0 : _b.basic) == null ? void 0 : _c.appointment_subject) == null ? void 0 : _d.form_id
|
|
54
|
+
});
|
|
55
|
+
const paramsRef = (0, import_react.useRef)(params);
|
|
56
|
+
paramsRef.current = params;
|
|
57
|
+
(0, import_react.useEffect)(() => {
|
|
58
|
+
setParams((v) => {
|
|
59
|
+
var _a2, _b2, _c2, _d2;
|
|
60
|
+
return {
|
|
61
|
+
...v,
|
|
62
|
+
relation_form_id: (_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_subject) == null ? void 0 : _d2.form_id
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
}, [(_g = (_f = (_e = state == null ? void 0 : state.bookingConfig) == null ? void 0 : _e.config) == null ? void 0 : _f.basic) == null ? void 0 : _g.appointment_subject]);
|
|
66
|
+
const stateRef = (0, import_react.useRef)(state);
|
|
67
|
+
stateRef.current = state;
|
|
68
|
+
const isWalkIn = (0, import_react.useMemo)(() => {
|
|
69
|
+
var _a2;
|
|
70
|
+
return (0, import_utils.isWalkIn)((_a2 = state.client.value) == null ? void 0 : _a2.id);
|
|
71
|
+
}, [(_h = state.client.value) == null ? void 0 : _h.id]);
|
|
72
|
+
const getClients = async ({
|
|
73
|
+
customer_id,
|
|
74
|
+
...resetParams
|
|
75
|
+
}) => {
|
|
76
|
+
let _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
|
|
77
|
+
_setLoading(true);
|
|
78
|
+
const api = state.isFranchisee ? import_serve.getFranchiseeCustomerList : state.apis.getClients;
|
|
79
|
+
const data = await api({
|
|
80
|
+
...resetParams,
|
|
81
|
+
...!state.isFranchisee ? { _config: { abort: true } } : {}
|
|
82
|
+
});
|
|
83
|
+
const list = ((data == null ? void 0 : data.list) || []).map((d) => {
|
|
84
|
+
return {
|
|
85
|
+
...d,
|
|
86
|
+
name: getNickname(d),
|
|
87
|
+
id: d.franchisee_customer_id || d.id,
|
|
88
|
+
form_record: d.form_record.map((item) => ({
|
|
89
|
+
...item,
|
|
90
|
+
...item.data,
|
|
91
|
+
form_record_id: item.id
|
|
92
|
+
}))
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
let _payload = {
|
|
96
|
+
clients: list
|
|
97
|
+
};
|
|
98
|
+
if (!(0, import_utils.isWalkIn)(customer_id)) {
|
|
99
|
+
const customerItem = list.find((d) => d.id === customer_id);
|
|
100
|
+
if (customerItem) {
|
|
101
|
+
_payload.value = customerItem;
|
|
102
|
+
_payload.edit = true;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let totalList = [...state.client.clients];
|
|
106
|
+
if (resetParams.skip === 1) {
|
|
107
|
+
totalList = list;
|
|
108
|
+
} else {
|
|
109
|
+
totalList = totalList.concat(list);
|
|
110
|
+
}
|
|
111
|
+
_payload.clients = totalList;
|
|
112
|
+
setParams({
|
|
113
|
+
...params,
|
|
114
|
+
...resetParams,
|
|
115
|
+
total: (data == null ? void 0 : data.count) || 0
|
|
116
|
+
});
|
|
117
|
+
setGlobalState({
|
|
118
|
+
client: {
|
|
119
|
+
...stateRef.current.client,
|
|
120
|
+
..._payload
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
_setLoading(false);
|
|
124
|
+
return {};
|
|
125
|
+
};
|
|
126
|
+
const handleOpenClientModal = () => {
|
|
127
|
+
var _a2;
|
|
128
|
+
if (state.disabledEdit) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
setClient({
|
|
132
|
+
showModal: true
|
|
133
|
+
});
|
|
134
|
+
getClients({ ...paramsRef.current, search: "", skip: 1 });
|
|
135
|
+
(_a2 = modalRef.current) == null ? void 0 : _a2.open();
|
|
136
|
+
};
|
|
137
|
+
const handleViewClient = () => {
|
|
138
|
+
state.action({
|
|
139
|
+
type: "pisell1.handleOpenCustomerModal",
|
|
140
|
+
data: { id: state.client.value.id },
|
|
141
|
+
callback: (data) => {
|
|
142
|
+
if (state.disabledEdit) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (data) {
|
|
146
|
+
handleSelectClient([data]);
|
|
147
|
+
}
|
|
148
|
+
getClients({
|
|
149
|
+
...state.client.clientsParams,
|
|
150
|
+
search: "",
|
|
151
|
+
customer_id: data == null ? void 0 : data.id,
|
|
152
|
+
skip: 1
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
const menus = (0, import_react.useMemo)(() => {
|
|
158
|
+
let list = [
|
|
159
|
+
// { key: "view", label: locales.getText("pisell2.text.view-profile") },
|
|
160
|
+
{ key: "change", label: import_utils2.locales.getText("pisell2.text.change-customer") },
|
|
161
|
+
{ key: "remove", label: import_utils2.locales.getText("pisell2.text.remove-customer") }
|
|
162
|
+
];
|
|
163
|
+
if (state.disabledEdit) {
|
|
164
|
+
list = list.filter((d) => d.key === "view");
|
|
165
|
+
}
|
|
166
|
+
return list;
|
|
167
|
+
}, [state.disabledEdit]);
|
|
168
|
+
const handleRemoveClient = () => {
|
|
169
|
+
if (state.disabledEdit) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
handleSelectClient([import_model.walkInData]);
|
|
173
|
+
};
|
|
174
|
+
const menuChange = (e) => {
|
|
175
|
+
e.domEvent.stopPropagation();
|
|
176
|
+
let maps = {
|
|
177
|
+
view: handleViewClient,
|
|
178
|
+
change: handleOpenClientModal,
|
|
179
|
+
remove: handleRemoveClient
|
|
180
|
+
};
|
|
181
|
+
maps[e.key]();
|
|
182
|
+
};
|
|
183
|
+
const setClient = (client) => {
|
|
184
|
+
setGlobalState({
|
|
185
|
+
client: {
|
|
186
|
+
...stateRef.current.client,
|
|
187
|
+
...client
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
const _getFranchiseeCustomerInfo = async (customer) => {
|
|
192
|
+
try {
|
|
193
|
+
setFranchiseeLoading(customer.id);
|
|
194
|
+
const res = await (0, import_serve.getFranchiseeCustomerInfo)({
|
|
195
|
+
franchisor_customer_id: customer.id
|
|
196
|
+
});
|
|
197
|
+
setFranchiseeLoading(0);
|
|
198
|
+
return {
|
|
199
|
+
...customer,
|
|
200
|
+
id: res.franchisee_customer_id
|
|
201
|
+
};
|
|
202
|
+
} catch (err) {
|
|
203
|
+
setFranchiseeLoading(0);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const getNickname = (0, import_react.useCallback)(
|
|
207
|
+
(item) => {
|
|
208
|
+
if ((0, import_utils.isWalkIn)(item == null ? void 0 : item.id)) {
|
|
209
|
+
return import_utils2.locales.getText("pisell2.text.select-a-customer");
|
|
210
|
+
}
|
|
211
|
+
return item.name || (item.display_name || "").trim() || (item.nickname || "").trim() || "";
|
|
212
|
+
},
|
|
213
|
+
[import_utils2.locales.localeMap]
|
|
214
|
+
);
|
|
215
|
+
(0, import_react.useEffect)(() => {
|
|
216
|
+
if (state.action) {
|
|
217
|
+
state.action({
|
|
218
|
+
type: "pisell1.registerPlugin",
|
|
219
|
+
data: {
|
|
220
|
+
pluginList: ["CustomerDetailPlugin"]
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}, []);
|
|
225
|
+
const handleSelectClient = async (value) => {
|
|
226
|
+
let _value = (value == null ? void 0 : value[value.length - 1]) || import_model.walkInData;
|
|
227
|
+
if (_value.loading) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (state.isFranchisee && _value.franchisee_customer_id === 0) {
|
|
231
|
+
try {
|
|
232
|
+
_value = await _getFranchiseeCustomerInfo(_value);
|
|
233
|
+
} catch (err) {
|
|
234
|
+
}
|
|
235
|
+
if (!_value) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
setClient({
|
|
240
|
+
value: {
|
|
241
|
+
..._value,
|
|
242
|
+
name: getNickname(_value)
|
|
243
|
+
},
|
|
244
|
+
edit: true
|
|
245
|
+
});
|
|
246
|
+
return new Promise((resolve) => {
|
|
247
|
+
resolve(0);
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
const handleCreateItem = () => {
|
|
251
|
+
state.action({
|
|
252
|
+
type: "pisell1.handleOpenAddCustomerModal",
|
|
253
|
+
data: {
|
|
254
|
+
showReceiveAddress: false,
|
|
255
|
+
showAcceptsMarketing: false
|
|
256
|
+
},
|
|
257
|
+
callback: (customer_id) => {
|
|
258
|
+
getClients({
|
|
259
|
+
...state.client.clientsParams,
|
|
260
|
+
search: "",
|
|
261
|
+
customer_id,
|
|
262
|
+
skip: 1
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
const searchChange = (search) => {
|
|
268
|
+
let _params2 = {
|
|
269
|
+
...paramsRef.current,
|
|
270
|
+
skip: 1,
|
|
271
|
+
search
|
|
272
|
+
};
|
|
273
|
+
getClients({ ..._params2 });
|
|
274
|
+
};
|
|
275
|
+
const loadMore = (0, import_react.useMemo)(() => {
|
|
276
|
+
const show = state.client.clients.length < params.total || 0;
|
|
277
|
+
return show ? /* @__PURE__ */ import_react.default.createElement("div", { className: "", style: { textAlign: "center", padding: "16px 0" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
278
|
+
import_antd.Button,
|
|
279
|
+
{
|
|
280
|
+
loading: loadLoading,
|
|
281
|
+
onClick: () => {
|
|
282
|
+
let _params2 = {
|
|
283
|
+
...params,
|
|
284
|
+
skip: params.skip + 1
|
|
285
|
+
};
|
|
286
|
+
getClients({ ..._params2 });
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
import_utils2.locales.getText("pisell2.text.load-more")
|
|
290
|
+
)) : null;
|
|
291
|
+
}, [loadLoading, params, state.client.clients.length]);
|
|
292
|
+
return {
|
|
293
|
+
setClient,
|
|
294
|
+
isWalkIn,
|
|
295
|
+
handleSelectClient,
|
|
296
|
+
menuChange,
|
|
297
|
+
handleViewClient,
|
|
298
|
+
menus,
|
|
299
|
+
handleCreateItem,
|
|
300
|
+
getClients,
|
|
301
|
+
params,
|
|
302
|
+
searchChange,
|
|
303
|
+
loading,
|
|
304
|
+
loadMore,
|
|
305
|
+
handleOpenClientModal,
|
|
306
|
+
getNickname
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
var useClientFn_default = useClientFn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as VerticalClient } from './vertical';
|
|
@@ -0,0 +1,39 @@
|
|
|
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/index.tsx
|
|
30
|
+
var clientVariant_exports = {};
|
|
31
|
+
__export(clientVariant_exports, {
|
|
32
|
+
VerticalClient: () => import_vertical.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(clientVariant_exports);
|
|
35
|
+
var import_vertical = __toESM(require("./vertical"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
VerticalClient
|
|
39
|
+
});
|