@pisell/private-materials 3.0.94 → 3.0.95

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 (29) 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 +5 -5
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +4 -4
  11. package/es/components/booking/forms/format.js +1 -1
  12. package/es/components/booking/info/clientVariant/hooks/useClientFn.d.ts +4 -2
  13. package/es/components/booking/info/clientVariant/hooks/useClientFn.js +19 -9
  14. package/es/components/booking/info/clientVariant/vertical/index.js +150 -39
  15. package/es/components/booking/info/clientVariant/vertical/index.less +18 -0
  16. package/es/components/booking/info/utils.d.ts +1 -0
  17. package/es/components/booking/info/utils.js +11 -0
  18. package/es/components/booking/locales.d.ts +3 -0
  19. package/es/components/booking/locales.js +6 -3
  20. package/lib/components/booking/forms/format.js +1 -1
  21. package/lib/components/booking/info/clientVariant/hooks/useClientFn.d.ts +4 -2
  22. package/lib/components/booking/info/clientVariant/hooks/useClientFn.js +6 -1
  23. package/lib/components/booking/info/clientVariant/vertical/index.js +147 -40
  24. package/lib/components/booking/info/clientVariant/vertical/index.less +18 -0
  25. package/lib/components/booking/info/utils.d.ts +1 -0
  26. package/lib/components/booking/info/utils.js +11 -0
  27. package/lib/components/booking/locales.d.ts +3 -0
  28. package/lib/components/booking/locales.js +6 -3
  29. package/package.json +3 -3
@@ -36,7 +36,7 @@ export var changeFormValues = function changeFormValues(_ref) {
36
36
  return _values;
37
37
  };
38
38
  export var sortFormValues = function sortFormValues(list, clientId) {
39
- return list.sort(function (a, b) {
39
+ return (list || []).sort(function (a, b) {
40
40
  var _a$customer, _b$customer, _b$customer2, _a$customer2;
41
41
  if ((a === null || a === void 0 ? void 0 : (_a$customer = a.customer) === null || _a$customer === void 0 ? void 0 : _a$customer.id) === clientId && (b === null || b === void 0 ? void 0 : (_b$customer = b.customer) === null || _b$customer === void 0 ? void 0 : _b$customer.id) !== clientId) {
42
42
  return -1;
@@ -17,13 +17,15 @@ declare const useClientFn: (_params: useClientFnParams) => {
17
17
  label: any;
18
18
  }[];
19
19
  handleCreateItem: () => void;
20
- getClients: ({ customer_id, ...resetParams }: {
20
+ getClients: ({ customer_id, customer_ids, ...resetParams }: {
21
21
  customer_id?: number | undefined;
22
22
  skip?: number | undefined;
23
23
  search?: string | undefined;
24
24
  with?: string[] | undefined;
25
25
  relation_form_id?: number | undefined;
26
- }) => Promise<{}>;
26
+ num?: number | undefined;
27
+ customer_ids?: string[] | undefined;
28
+ }, returnResult?: boolean) => Promise<any>;
27
29
  params: {
28
30
  skip: number;
29
31
  num: number;
@@ -1,5 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["customer_id"];
2
+ var _excluded = ["customer_id", "customer_ids"];
3
3
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -72,17 +72,21 @@ var useClientFn = function useClientFn(_params) {
72
72
  return getIsWalkIn((_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.id);
73
73
  }, [(_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.id]);
74
74
  var getClients = /*#__PURE__*/function () {
75
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
76
- var customer_id, resetParams, _setLoading, api, data, list, _payload, customerItem, totalList;
75
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, returnResult) {
76
+ var customer_id, customer_ids, resetParams, _setLoading, api, data, list, _payload, customerItem, totalList;
77
77
  return _regeneratorRuntime().wrap(function _callee$(_context) {
78
78
  while (1) switch (_context.prev = _context.next) {
79
79
  case 0:
80
- customer_id = _ref.customer_id, resetParams = _objectWithoutProperties(_ref, _excluded);
80
+ customer_id = _ref.customer_id, customer_ids = _ref.customer_ids, resetParams = _objectWithoutProperties(_ref, _excluded);
81
81
  _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
82
82
  _setLoading(true);
83
83
  api = state.isFranchisee ? getFranchiseeCustomerList : state.apis.getClients;
84
84
  _context.next = 6;
85
- return api(_objectSpread(_objectSpread({}, resetParams), !state.isFranchisee ? {
85
+ return api(_objectSpread(_objectSpread(_objectSpread({}, resetParams), state.isFranchisee ? {
86
+ franchisee_customer_ids: customer_ids
87
+ } : {
88
+ customer_ids: customer_ids
89
+ }), !state.isFranchisee ? {
86
90
  _config: {
87
91
  abort: true
88
92
  }
@@ -101,6 +105,12 @@ var useClientFn = function useClientFn(_params) {
101
105
  })) || []
102
106
  });
103
107
  });
108
+ if (!returnResult) {
109
+ _context.next = 10;
110
+ break;
111
+ }
112
+ return _context.abrupt("return", list);
113
+ case 10:
104
114
  _payload = {
105
115
  clients: list
106
116
  }; // 有传递, 则表示新增客户之后刷新列表的, 应该默认选中
@@ -128,13 +138,13 @@ var useClientFn = function useClientFn(_params) {
128
138
  });
129
139
  _setLoading(false);
130
140
  return _context.abrupt("return", {});
131
- case 17:
141
+ case 19:
132
142
  case "end":
133
143
  return _context.stop();
134
144
  }
135
145
  }, _callee);
136
146
  }));
137
- return function getClients(_x2) {
147
+ return function getClients(_x2, _x3) {
138
148
  return _ref2.apply(this, arguments);
139
149
  };
140
150
  }();
@@ -246,7 +256,7 @@ var useClientFn = function useClientFn(_params) {
246
256
  }
247
257
  }, _callee2, null, [[0, 9]]);
248
258
  }));
249
- return function _getFranchiseeCustomerInfo(_x3) {
259
+ return function _getFranchiseeCustomerInfo(_x4) {
250
260
  return _ref3.apply(this, arguments);
251
261
  };
252
262
  }();
@@ -315,7 +325,7 @@ var useClientFn = function useClientFn(_params) {
315
325
  }
316
326
  }, _callee3, null, [[4, 10]]);
317
327
  }));
318
- return function handleSelectClient(_x4) {
328
+ return function handleSelectClient(_x5) {
319
329
  return _ref4.apply(this, arguments);
320
330
  };
321
331
  }();
@@ -1,26 +1,36 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
2
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
6
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
7
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
8
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
9
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
10
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
9
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
10
11
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
13
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
- import React, { useEffect, useMemo, useRef } from 'react';
14
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
14
21
  import User01 from '@pisell/icon/es/User01';
15
- import { Avatar, Button, Dropdown, Skeleton } from 'antd';
22
+ import PlusCircle from '@pisell/icon/es/PlusCircle';
23
+ import { Avatar, Button, Dropdown, Empty, Skeleton } from 'antd';
16
24
  import { image, locales } from '@pisell/utils';
17
25
  import useClientFn from "../hooks/useClientFn";
18
26
  import SelectDrawer from "./SelectDrawer";
19
27
  import Pet from "../../pet";
20
28
  import "./index.less";
21
29
  import useEngineContext from "../../../../../hooks/useEngineContext";
30
+ import { formatAddFormValues } from "../../../forms/format";
31
+ import { moveItemToFront } from "../../utils";
22
32
  var VerticalClient = function VerticalClient(props) {
23
- var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig8, _state$bookingConfig9, _state$bookingConfig10, _state$bookingConfig11, _state$pet3, _state$pet4, _state$pet5, _state$client$value, _state$client$value2, _state$client$value3, _state$client$value4, _state$client$value5, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2, _state$bookingConfig12, _state$client;
33
+ var _context$appHelper, _context$appHelper$ut, _context$appHelper$ut2, _context$appHelper$ut3, _state$bookingConfig2, _state$bookingConfig3, _state$bookingConfig8, _state$bookingConfig9, _state$bookingConfig10, _state$bookingConfig11, _state$pet3, _state$pet4, _state$pet6, _state$pet6$formData, _state$pet6$formData$, _state$pet8, _state$client$value4, _state$bookingConfig17, _state$bookingConfig18, _state$bookingConfig19, _state$pet9, _state$pet9$formData, _state$bookingConfig20, _state$bookingConfig21, _state$client$value5, _state$client$value6, _state$client$value7, _state$client$value8, _state$client$value9, _context$appHelper2, _context$appHelper2$u, _context$appHelper2$u2, _state$bookingConfig22, _state$client6;
24
34
  var globalState = props.globalState,
25
35
  setGlobalState = props.setGlobalState;
26
36
  var modalRef = useRef();
@@ -28,6 +38,10 @@ var VerticalClient = function VerticalClient(props) {
28
38
  var stateRef = useRef(state);
29
39
  var prevCustomerId = useRef(null);
30
40
  var context = useEngineContext();
41
+ var _useState = useState(true),
42
+ _useState2 = _slicedToArray(_useState, 2),
43
+ isHasFormRecord = _useState2[0],
44
+ setIsHasFormRecord = _useState2[1];
31
45
  var isFranchisee = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : (_context$appHelper$ut = _context$appHelper.utils) === null || _context$appHelper$ut === void 0 ? void 0 : (_context$appHelper$ut2 = _context$appHelper$ut.businessUtils) === null || _context$appHelper$ut2 === void 0 ? void 0 : (_context$appHelper$ut3 = _context$appHelper$ut2.getAppByModal) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2, 'franchisee');
32
46
  state.isFranchisee = isFranchisee;
33
47
  stateRef.current = state;
@@ -58,8 +72,8 @@ var VerticalClient = function VerticalClient(props) {
58
72
  franchiseeLoading = _useClientFn.franchiseeLoading;
59
73
  var renderList = useMemo(function () {
60
74
  var _list = _toConsumableArray(state.client.clients);
61
- return _list;
62
- }, [state.client.clients]);
75
+ return moveItemToFront(_list, state.client.value.id);
76
+ }, [state.client.clients, state.client.value.id]);
63
77
  var handleClose = function handleClose() {
64
78
  setTimeout(function () {
65
79
  setClient({
@@ -102,7 +116,7 @@ var VerticalClient = function VerticalClient(props) {
102
116
  var handleOpenModal = function handleOpenModal() {
103
117
  handleOpenClientModal();
104
118
  };
105
- var handleAddPet = function handleAddPet(_client) {
119
+ var handleAddPet = function handleAddPet(_client, cb) {
106
120
  var _state$pet$formData;
107
121
  var _data = {
108
122
  formDataConfig: _objectSpread({}, ((_state$pet$formData = state.pet.formData) === null || _state$pet$formData === void 0 ? void 0 : _state$pet$formData[0]) || {})
@@ -112,11 +126,11 @@ var VerticalClient = function VerticalClient(props) {
112
126
  type: 'pisell1.goCustomFormAddData',
113
127
  data: _data,
114
128
  callback: function callback(res) {
129
+ var newFormRecordObj = res.reduce(function (p, c) {
130
+ return _objectSpread(_objectSpread({}, p), {}, _defineProperty({}, c.key, c.value));
131
+ }, {});
115
132
  var newClients = stateRef.current.client.clients.map(function (item) {
116
133
  if (item.id === _client.id) {
117
- var newFormRecordObj = res.reduce(function (p, c) {
118
- return _objectSpread(_objectSpread({}, p), {}, _defineProperty({}, c.key, c.value));
119
- }, {});
120
134
  return _objectSpread(_objectSpread({}, item), {}, {
121
135
  form_record: [].concat(_toConsumableArray(item.form_record), [_objectSpread(_objectSpread({}, newFormRecordObj), {}, {
122
136
  id: newFormRecordObj.form_record_id,
@@ -129,6 +143,7 @@ var VerticalClient = function VerticalClient(props) {
129
143
  setClient({
130
144
  clients: newClients
131
145
  });
146
+ cb === null || cb === void 0 ? void 0 : cb(newFormRecordObj);
132
147
  // getClients(params);
133
148
  }
134
149
  });
@@ -159,7 +174,120 @@ var VerticalClient = function VerticalClient(props) {
159
174
  }
160
175
  return false;
161
176
  }, [isWalkIn, state === null || state === void 0 ? void 0 : state.disabledEdit, (_state$pet3 = state.pet) === null || _state$pet3 === void 0 ? void 0 : _state$pet3.value, (_state$pet4 = state.pet) === null || _state$pet4 === void 0 ? void 0 : _state$pet4.formData, boardConfig.type]);
162
- console.log((_state$pet5 = state.pet) === null || _state$pet5 === void 0 ? void 0 : _state$pet5.value, 'state.pet?.value');
177
+ var formId = useMemo(function () {
178
+ var _state$pet5, _state$pet5$formData, _state$pet5$formData$;
179
+ return (_state$pet5 = state.pet) === null || _state$pet5 === void 0 ? void 0 : (_state$pet5$formData = _state$pet5.formData) === null || _state$pet5$formData === void 0 ? void 0 : (_state$pet5$formData$ = _state$pet5$formData[0]) === null || _state$pet5$formData$ === void 0 ? void 0 : _state$pet5$formData$.form_id;
180
+ }, [(_state$pet6 = state.pet) === null || _state$pet6 === void 0 ? void 0 : (_state$pet6$formData = _state$pet6.formData) === null || _state$pet6$formData === void 0 ? void 0 : (_state$pet6$formData$ = _state$pet6$formData[0]) === null || _state$pet6$formData$ === void 0 ? void 0 : _state$pet6$formData$.form_id]);
181
+ var currentPetValue = useMemo(function () {
182
+ var _state$pet7, _state$pet7$value;
183
+ return (_state$pet7 = state.pet) === null || _state$pet7 === void 0 ? void 0 : (_state$pet7$value = _state$pet7.value) === null || _state$pet7$value === void 0 ? void 0 : _state$pet7$value[formId];
184
+ }, [(_state$pet8 = state.pet) === null || _state$pet8 === void 0 ? void 0 : _state$pet8.value, formId]);
185
+ var getCurrentClientSearchValue = useCallback(function () {
186
+ var _state$client$value, _state$client$value2;
187
+ var searchVal = getNickname(state.client.value) || ((_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.email) || ((_state$client$value2 = state.client.value) === null || _state$client$value2 === void 0 ? void 0 : _state$client$value2.phone) || '';
188
+ if (isWalkIn) {
189
+ searchVal = '';
190
+ }
191
+ return searchVal;
192
+ }, [state.client.value, isWalkIn]);
193
+ useEffect(function () {
194
+ if (!isWalkIn && formId && !(currentPetValue !== null && currentPetValue !== void 0 && currentPetValue.length) && boardConfig.type === 'form') {
195
+ var getData = /*#__PURE__*/function () {
196
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
197
+ var _stateRef$current, _stateRef$current$cli;
198
+ var findCurrentClient, clients, currentClient, _currentClient$form_r, _state$client2, _state$client2$value, _currentClient$form_r2, val, _currentClient;
199
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
200
+ while (1) switch (_context.prev = _context.next) {
201
+ case 0:
202
+ findCurrentClient = function findCurrentClient(list) {
203
+ return list.find(function (item) {
204
+ var _state$client, _state$client$value3;
205
+ return item.id === ((_state$client = state.client) === null || _state$client === void 0 ? void 0 : (_state$client$value3 = _state$client.value) === null || _state$client$value3 === void 0 ? void 0 : _state$client$value3.id);
206
+ });
207
+ };
208
+ clients = (_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 ? void 0 : (_stateRef$current$cli = _stateRef$current.client) === null || _stateRef$current$cli === void 0 ? void 0 : _stateRef$current$cli.clients;
209
+ currentClient = findCurrentClient(clients);
210
+ if (!currentClient) {
211
+ _context.next = 7;
212
+ break;
213
+ }
214
+ setIsHasFormRecord(!!(currentClient !== null && currentClient !== void 0 && (_currentClient$form_r = currentClient.form_record) !== null && _currentClient$form_r !== void 0 && _currentClient$form_r.length));
215
+ _context.next = 12;
216
+ break;
217
+ case 7:
218
+ _context.next = 9;
219
+ return getClients({
220
+ with: ['formRecord'],
221
+ relation_form_id: boardConfig === null || boardConfig === void 0 ? void 0 : boardConfig.form_id,
222
+ skip: 1,
223
+ num: 20,
224
+ customer_ids: [(_state$client2 = state.client) === null || _state$client2 === void 0 ? void 0 : (_state$client2$value = _state$client2.value) === null || _state$client2$value === void 0 ? void 0 : _state$client2$value.id]
225
+ }, true);
226
+ case 9:
227
+ val = _context.sent;
228
+ _currentClient = findCurrentClient(val);
229
+ setIsHasFormRecord(!!(_currentClient !== null && _currentClient !== void 0 && (_currentClient$form_r2 = _currentClient.form_record) !== null && _currentClient$form_r2 !== void 0 && _currentClient$form_r2.length));
230
+ case 12:
231
+ case "end":
232
+ return _context.stop();
233
+ }
234
+ }, _callee);
235
+ }));
236
+ return function getData() {
237
+ return _ref2.apply(this, arguments);
238
+ };
239
+ }();
240
+ getData();
241
+ }
242
+ }, [isWalkIn, formId, (_state$client$value4 = state.client.value) === null || _state$client$value4 === void 0 ? void 0 : _state$client$value4.id, currentPetValue, boardConfig]);
243
+ var petRender = useMemo(function () {
244
+ var _state$bookingConfig14, _state$bookingConfig15, _state$bookingConfig16;
245
+ if (state !== null && state !== void 0 && state.disabledEdit || boardConfig.type !== 'form') {
246
+ return null;
247
+ }
248
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !(currentPetValue !== null && currentPetValue !== void 0 && currentPetValue.length) && !isHasFormRecord && !isWalkIn && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Empty, {
249
+ style: {
250
+ marginBottom: 0
251
+ },
252
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
253
+ description: locales.getText('pisell2.text.variant-client-no-data')
254
+ }), /*#__PURE__*/React.createElement("div", {
255
+ className: "pisell-lowcode__create-form-wrap",
256
+ onClick: function onClick() {
257
+ var _state$client3;
258
+ handleAddPet === null || handleAddPet === void 0 ? void 0 : handleAddPet(state === null || state === void 0 ? void 0 : (_state$client3 = state.client) === null || _state$client3 === void 0 ? void 0 : _state$client3.value, function () {
259
+ var addRecord = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
260
+ setTimeout(function () {
261
+ var _state$client4, _state$client4$value, _state$client5, _state$bookingConfig12, _state$bookingConfig13;
262
+ handleSelectPet(_defineProperty({}, formId, formatAddFormValues({
263
+ clientId: state === null || state === void 0 ? void 0 : (_state$client4 = state.client) === null || _state$client4 === void 0 ? void 0 : (_state$client4$value = _state$client4.value) === null || _state$client4$value === void 0 ? void 0 : _state$client4$value.id,
264
+ value: [_objectSpread(_objectSpread({}, addRecord), {}, {
265
+ customer: state === null || state === void 0 ? void 0 : (_state$client5 = state.client) === null || _state$client5 === void 0 ? void 0 : _state$client5.value
266
+ })],
267
+ data_range: state === null || state === void 0 ? void 0 : (_state$bookingConfig12 = state.bookingConfig) === null || _state$bookingConfig12 === void 0 ? void 0 : (_state$bookingConfig13 = _state$bookingConfig12.holder) === null || _state$bookingConfig13 === void 0 ? void 0 : _state$bookingConfig13.data_range
268
+ })));
269
+ }, 200);
270
+ });
271
+ }
272
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PlusCircle, {
273
+ className: "pisell-lowcode__create-form-icon"
274
+ }), /*#__PURE__*/React.createElement("span", {
275
+ className: "pisell-lowcode__create-form-txt"
276
+ }, "".concat(locales.getText('pisell2.text.create-new'), " ").concat((state === null || state === void 0 ? void 0 : (_state$bookingConfig14 = state.bookingConfig) === null || _state$bookingConfig14 === void 0 ? void 0 : (_state$bookingConfig15 = _state$bookingConfig14.holder) === null || _state$bookingConfig15 === void 0 ? void 0 : (_state$bookingConfig16 = _state$bookingConfig15.form) === null || _state$bookingConfig16 === void 0 ? void 0 : _state$bookingConfig16.title) || '-'))))), /*#__PURE__*/React.createElement(Pet, {
277
+ clientChangeNotSetPet: true,
278
+ state: state,
279
+ dispatch: petDispatch,
280
+ hideTitle: true,
281
+ handleOpenModal: handleOpenModal,
282
+ addButtonProps: {
283
+ onClick: handleOpenClientModal,
284
+ style: {
285
+ display: 'none'
286
+ }
287
+ },
288
+ previewItemTitleRender: previewItemTitleRender
289
+ }));
290
+ }, [isWalkIn, isHasFormRecord, state === null || state === void 0 ? void 0 : state.disabledEdit, boardConfig.type, state === null || state === void 0 ? void 0 : (_state$bookingConfig17 = state.bookingConfig) === null || _state$bookingConfig17 === void 0 ? void 0 : (_state$bookingConfig18 = _state$bookingConfig17.holder) === null || _state$bookingConfig18 === void 0 ? void 0 : (_state$bookingConfig19 = _state$bookingConfig18.form) === null || _state$bookingConfig19 === void 0 ? void 0 : _state$bookingConfig19.title, (_state$pet9 = state.pet) === null || _state$pet9 === void 0 ? void 0 : (_state$pet9$formData = _state$pet9.formData) === null || _state$pet9$formData === void 0 ? void 0 : _state$pet9$formData[0], state, petDispatch, handleOpenModal, handleOpenClientModal, previewItemTitleRender, handleAddPet, currentPetValue, formId, state === null || state === void 0 ? void 0 : (_state$bookingConfig20 = state.bookingConfig) === null || _state$bookingConfig20 === void 0 ? void 0 : (_state$bookingConfig21 = _state$bookingConfig20.holder) === null || _state$bookingConfig21 === void 0 ? void 0 : _state$bookingConfig21.data_range]);
163
291
  return /*#__PURE__*/React.createElement("div", {
164
292
  className: "pisell-lowcode__booking-vertical-client-wrap"
165
293
  }, /*#__PURE__*/React.createElement("div", {
@@ -176,7 +304,7 @@ var VerticalClient = function VerticalClient(props) {
176
304
  round: true
177
305
  }, /*#__PURE__*/React.createElement(Avatar, {
178
306
  className: "pisell-lowcode__booking-client-avatar",
179
- src: image.ali((_state$client$value = state.client.value) === null || _state$client$value === void 0 ? void 0 : _state$client$value.cover, 100),
307
+ src: image.ali((_state$client$value5 = state.client.value) === null || _state$client$value5 === void 0 ? void 0 : _state$client$value5.cover, 100),
180
308
  size: 64,
181
309
  icon: /*#__PURE__*/React.createElement(User01, {
182
310
  className: "pisell-lowcode__booking-client-list-item-avatar-icon"
@@ -189,11 +317,11 @@ var VerticalClient = function VerticalClient(props) {
189
317
  className: "pisell-lowcode__booking-client-desc-item"
190
318
  }, locales.getText('pisell2.text.leave-empty-for-walk-in'))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
191
319
  className: "pisell-lowcode__booking-client-title"
192
- }, getNickname(state.client.value)), (_state$client$value2 = state.client.value) !== null && _state$client$value2 !== void 0 && _state$client$value2.email ? /*#__PURE__*/React.createElement("div", {
320
+ }, getNickname(state.client.value)), (_state$client$value6 = state.client.value) !== null && _state$client$value6 !== void 0 && _state$client$value6.email ? /*#__PURE__*/React.createElement("div", {
193
321
  className: "pisell-lowcode__booking-client-desc-item"
194
- }, (_state$client$value3 = state.client.value) === null || _state$client$value3 === void 0 ? void 0 : _state$client$value3.email) : null, (_state$client$value4 = state.client.value) !== null && _state$client$value4 !== void 0 && _state$client$value4.phone ? /*#__PURE__*/React.createElement("div", {
322
+ }, (_state$client$value7 = state.client.value) === null || _state$client$value7 === void 0 ? void 0 : _state$client$value7.email) : null, (_state$client$value8 = state.client.value) !== null && _state$client$value8 !== void 0 && _state$client$value8.phone ? /*#__PURE__*/React.createElement("div", {
195
323
  className: "pisell-lowcode__booking-client-desc-item"
196
- }, (_state$client$value5 = state.client.value) === null || _state$client$value5 === void 0 ? void 0 : _state$client$value5.phone) : null), !isWalkIn && /*#__PURE__*/React.createElement("div", {
324
+ }, (_state$client$value9 = state.client.value) === null || _state$client$value9 === void 0 ? void 0 : _state$client$value9.phone) : null), !isWalkIn && /*#__PURE__*/React.createElement("div", {
197
325
  className: "pisell-lowcode__booking-client-action-wrap"
198
326
  }, !state.disabledEdit && /*#__PURE__*/React.createElement(Dropdown.Button, {
199
327
  menu: {
@@ -211,30 +339,13 @@ var VerticalClient = function VerticalClient(props) {
211
339
  }
212
340
  }, locales.getText('pisell2.text.view-profile'))))), /*#__PURE__*/React.createElement("div", {
213
341
  className: "pisell-lowcode__booking-vertical-pet"
214
- }, !(state !== null && state !== void 0 && state.disabledEdit) ? /*#__PURE__*/React.createElement(React.Fragment, null, boardConfig.type === 'form' ? /*#__PURE__*/React.createElement(Pet, {
215
- clientChangeNotSetPet: true,
216
- state: state,
217
- dispatch: petDispatch,
218
- hideTitle: true,
219
- handleOpenModal: handleOpenModal,
220
- addButtonProps: {
221
- onClick: handleOpenClientModal,
222
- style: {
223
- display: 'none'
224
- }
225
- },
226
- previewItemTitleRender: previewItemTitleRender
227
- }) : null) : null), isShowAddBtn && /*#__PURE__*/React.createElement("div", {
342
+ }, petRender), isShowAddBtn && /*#__PURE__*/React.createElement("div", {
228
343
  className: "pisell-lowcode__booking-vertical-footer"
229
344
  }, /*#__PURE__*/React.createElement(Button, {
230
345
  onClick: function onClick() {
231
- var _state$client$value6, _state$client$value7;
232
- var searchVal = getNickname(state.client.value) || ((_state$client$value6 = state.client.value) === null || _state$client$value6 === void 0 ? void 0 : _state$client$value6.email) || ((_state$client$value7 = state.client.value) === null || _state$client$value7 === void 0 ? void 0 : _state$client$value7.phone) || '';
233
- if (isWalkIn) {
234
- searchVal = "";
235
- }
236
- modalRef.current.setSearch(searchVal);
237
- handleOpenClientModal(searchVal);
346
+ var currentClientSearchValue = getCurrentClientSearchValue();
347
+ modalRef.current.setSearch(currentClientSearchValue);
348
+ handleOpenClientModal(currentClientSearchValue);
238
349
  },
239
350
  block: true,
240
351
  size: "large"
@@ -251,8 +362,8 @@ var VerticalClient = function VerticalClient(props) {
251
362
  formData: state.pet.formData,
252
363
  searchChange: searchChange,
253
364
  options: renderList,
254
- holder: state === null || state === void 0 ? void 0 : (_state$bookingConfig12 = state.bookingConfig) === null || _state$bookingConfig12 === void 0 ? void 0 : _state$bookingConfig12.holder,
255
- client: state === null || state === void 0 ? void 0 : (_state$client = state.client) === null || _state$client === void 0 ? void 0 : _state$client.value,
365
+ holder: state === null || state === void 0 ? void 0 : (_state$bookingConfig22 = state.bookingConfig) === null || _state$bookingConfig22 === void 0 ? void 0 : _state$bookingConfig22.holder,
366
+ client: state === null || state === void 0 ? void 0 : (_state$client6 = state.client) === null || _state$client6 === void 0 ? void 0 : _state$client6.value,
256
367
  loadMore: loadMore,
257
368
  showPet: (boardConfig === null || boardConfig === void 0 ? void 0 : boardConfig.type) === 'form',
258
369
  handleAddPet: handleAddPet,
@@ -80,4 +80,22 @@
80
80
  border-top: 1px solid var(--Gray-200, #EAECF0);
81
81
  background: var(--Base-White, #FFF);
82
82
  box-shadow: 0px -4px 8px -2px rgba(16, 24, 40, 0.10), 0px -2px 4px -2px rgba(16, 24, 40, 0.06);
83
+ }
84
+ .pisell-lowcode__create-form-wrap {
85
+ display: flex;
86
+ gap: 8px;
87
+ align-items: center;
88
+ cursor: pointer;
89
+ padding: 16px;
90
+ .pisell-lowcode__create-form-icon {
91
+ font-size: 20px;
92
+ color: rgb(127, 86, 217);
93
+ }
94
+ .pisell-lowcode__create-form-txt {
95
+ color: #7f56d9;
96
+ font-size: 16px;
97
+ font-style: normal;
98
+ font-weight: 400;
99
+ line-height: 24px;
100
+ }
83
101
  }
@@ -1,2 +1,3 @@
1
1
  export declare const getIsBundleOrCombination: (productDetail: any) => boolean;
2
2
  export declare const uniqueByField: (arr: any[], field: string) => any[];
3
+ export declare const moveItemToFront: (arr: any[], targetId: string | number) => any[];
@@ -17,4 +17,15 @@ export var uniqueByField = function uniqueByField(arr, field) {
17
17
  return true;
18
18
  }
19
19
  });
20
+ };
21
+ export var moveItemToFront = function moveItemToFront(arr, targetId) {
22
+ var index = arr.findIndex(function (item) {
23
+ return item.id === targetId;
24
+ });
25
+ if (index !== -1) {
26
+ var targetItem = arr[index];
27
+ arr.splice(index, 1);
28
+ arr.unshift(targetItem);
29
+ }
30
+ return arr;
20
31
  };
@@ -160,6 +160,7 @@ declare const _default: {
160
160
  "pisell2.text.actions": string;
161
161
  "pisell2.text.add-client": string;
162
162
  'pisell2.text.variant-client-change': string;
163
+ 'pisell2.text.variant-client-no-data': string;
163
164
  };
164
165
  'zh-CN': {
165
166
  'pisell2.text.refunded-amount': string;
@@ -322,6 +323,7 @@ declare const _default: {
322
323
  "pisell2.text.actions": string;
323
324
  "pisell2.text.add-client": string;
324
325
  'pisell2.text.variant-client-change': string;
326
+ 'pisell2.text.variant-client-no-data': string;
325
327
  };
326
328
  'zh-HK': {
327
329
  'pisell2.text.refunded-amount': string;
@@ -484,6 +486,7 @@ declare const _default: {
484
486
  "pisell2.text.actions": string;
485
487
  "pisell2.text.add-client": string;
486
488
  'pisell2.text.variant-client-change': string;
489
+ 'pisell2.text.variant-client-no-data': string;
487
490
  };
488
491
  };
489
492
  export default _default;
@@ -174,7 +174,8 @@ export default {
174
174
  'pisell2.text.terminal-edit-message': "This operation cannot be performed. To proceed, please use the Pisell Terminal.",
175
175
  "pisell2.text.actions": "Actions",
176
176
  "pisell2.text.add-client": "Add customer",
177
- 'pisell2.text.variant-client-change': 'Change'
177
+ 'pisell2.text.variant-client-change': 'Change',
178
+ 'pisell2.text.variant-client-no-data': "No record"
178
179
  },
179
180
  'zh-CN': {
180
181
  'pisell2.text.refunded-amount': '已退金额',
@@ -356,7 +357,8 @@ export default {
356
357
  'page.booking.text.unlimited': '无限制',
357
358
  "pisell2.text.actions": "操作选项",
358
359
  "pisell2.text.add-client": "添加客户",
359
- 'pisell2.text.variant-client-change': '更改客户'
360
+ 'pisell2.text.variant-client-change': '更改客户',
361
+ 'pisell2.text.variant-client-no-data': "暂无数据"
360
362
  },
361
363
  'zh-HK': {
362
364
  'pisell2.text.refunded-amount': '已退金額',
@@ -538,6 +540,7 @@ export default {
538
540
  'page.booking.text.unlimited': '無限制',
539
541
  "pisell2.text.actions": "操作選項",
540
542
  "pisell2.text.add-client": "添加客戶",
541
- 'pisell2.text.variant-client-change': '更改客戶'
543
+ 'pisell2.text.variant-client-change': '更改客戶',
544
+ 'pisell2.text.variant-client-no-data': "暫無數據"
542
545
  }
543
546
  };
@@ -41,7 +41,7 @@ var changeFormValues = ({
41
41
  return _values;
42
42
  };
43
43
  var sortFormValues = (list, clientId) => {
44
- return list.sort((a, b) => {
44
+ return (list || []).sort((a, b) => {
45
45
  var _a, _b, _c, _d, _e, _f;
46
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
47
  return -1;
@@ -17,13 +17,15 @@ declare const useClientFn: (_params: useClientFnParams) => {
17
17
  label: any;
18
18
  }[];
19
19
  handleCreateItem: () => void;
20
- getClients: ({ customer_id, ...resetParams }: {
20
+ getClients: ({ customer_id, customer_ids, ...resetParams }: {
21
21
  customer_id?: number | undefined;
22
22
  skip?: number | undefined;
23
23
  search?: string | undefined;
24
24
  with?: string[] | undefined;
25
25
  relation_form_id?: number | undefined;
26
- }) => Promise<{}>;
26
+ num?: number | undefined;
27
+ customer_ids?: string[] | undefined;
28
+ }, returnResult?: boolean) => Promise<any>;
27
29
  params: {
28
30
  skip: number;
29
31
  num: number;
@@ -71,13 +71,15 @@ var useClientFn = (_params) => {
71
71
  }, [(_h = state.client.value) == null ? void 0 : _h.id]);
72
72
  const getClients = async ({
73
73
  customer_id,
74
+ customer_ids,
74
75
  ...resetParams
75
- }) => {
76
+ }, returnResult) => {
76
77
  let _setLoading = resetParams.skip === 1 ? setLoading : setLoadLoading;
77
78
  _setLoading(true);
78
79
  const api = state.isFranchisee ? import_serve.getFranchiseeCustomerList : state.apis.getClients;
79
80
  const data = await api({
80
81
  ...resetParams,
82
+ ...state.isFranchisee ? { franchisee_customer_ids: customer_ids } : { customer_ids },
81
83
  ...!state.isFranchisee ? { _config: { abort: true } } : {}
82
84
  });
83
85
  const list = ((data == null ? void 0 : data.list) || []).map((d) => {
@@ -93,6 +95,9 @@ var useClientFn = (_params) => {
93
95
  }))) || []
94
96
  };
95
97
  });
98
+ if (returnResult) {
99
+ return list;
100
+ }
96
101
  let _payload = {
97
102
  clients: list
98
103
  };