@pisell/private-materials 3.3.77 → 3.3.79

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 (166) 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 +13 -13
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +4 -4
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +7 -7
  11. package/es/components/booking/addons/model.d.ts +10 -1
  12. package/es/components/booking/components/TabProduct/tabs/index.js +1 -5
  13. package/es/components/booking/components/browserSelect/index.js +1 -1
  14. package/es/components/booking/components/footer/utils.d.ts +1 -0
  15. package/es/components/booking/components/footer/utils.js +2 -2
  16. package/es/components/booking/editBookingModal/index.d.ts +5 -0
  17. package/es/components/booking/editBookingModal/index.js +386 -0
  18. package/es/components/booking/editBookingModal/index.less +8 -0
  19. package/es/components/booking/editBookingModal/locales.d.ts +21 -0
  20. package/es/components/booking/editBookingModal/locales.js +20 -0
  21. package/es/components/booking/editBookingModal/mock.d.ts +807 -0
  22. package/es/components/booking/editBookingModal/mock.js +2993 -0
  23. package/es/components/booking/editBookingModal/serve.d.ts +51 -0
  24. package/es/components/booking/editBookingModal/serve.js +288 -0
  25. package/es/components/booking/editBookingModal/type.d.ts +12 -0
  26. package/es/components/booking/editBookingModal/type.js +1 -0
  27. package/es/components/booking/editBookingModal/utils.d.ts +12 -0
  28. package/es/components/booking/editBookingModal/utils.js +157 -0
  29. package/es/components/booking/forms/model.d.ts +10 -1
  30. package/es/components/booking/forms/model.js +5 -5
  31. package/es/components/booking/info/model.d.ts +10 -1
  32. package/es/components/booking/info/service/like/index.js +1 -1
  33. package/es/components/booking/info/service2/utils.js +3 -2
  34. package/es/components/booking/info2/service/addService/utils.d.ts +10 -0
  35. package/es/components/booking/info2/service/addService/utils.js +43 -13
  36. package/es/components/booking/info2/service/editService/Resources/index.js +22 -8
  37. package/es/components/booking/info2/service/editService/Resources/index.less +6 -0
  38. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +7 -0
  39. package/es/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +26 -0
  40. package/es/components/booking/info2/service/editService/ResourcesV2/index.d.ts +10 -0
  41. package/es/components/booking/info2/service/editService/ResourcesV2/index.js +308 -0
  42. package/es/components/booking/info2/service/editService/ResourcesV2/index.less +44 -0
  43. package/es/components/booking/info2/utilsByBooking.js +9 -0
  44. package/es/components/booking/locales.d.ts +3 -0
  45. package/es/components/booking/locales.js +3 -0
  46. package/es/components/booking/materiels/startTime/index.js +1 -1
  47. package/es/components/booking/model.d.ts +9 -1
  48. package/es/components/booking/notes/NoteBlock/NoteItem/index.js +1 -1
  49. package/es/components/booking/notes/NoteBlock/index.js +11 -11
  50. package/es/components/booking/notes/model.d.ts +10 -1
  51. package/es/components/booking/notes/model.js +5 -5
  52. package/es/components/booking/payments/model.d.ts +10 -1
  53. package/es/components/booking/payments/model.js +5 -5
  54. package/es/components/booking/utils.d.ts +2 -2
  55. package/es/components/eftposPay/amount.d.ts +1 -1
  56. package/es/components/eftposPay/device.d.ts +1 -1
  57. package/es/components/eftposPay/hooks.d.ts +2 -2
  58. package/es/components/eftposPay/store/index.d.ts +6 -6
  59. package/es/components/index.d.ts +2 -1
  60. package/es/components/index.js +2 -1
  61. package/es/components/listComponent/index.js +5 -5
  62. package/es/components/pay/toC/model.d.ts +9 -1
  63. package/es/components/productExtension/card/index.js +3 -3
  64. package/es/components/productExtension/fields/Actor/CutOffTime/index.js +1 -1
  65. package/es/components/productExtension/fields/Forms/index.js +12 -12
  66. package/es/components/productExtension/fields/SelectProducts/ProductItemPreview/index.js +1 -1
  67. package/es/components/productExtension/fields/SelectProducts/server.js +2 -2
  68. package/es/components/productExtension/fields/SelectResourcesTable/server.js +2 -2
  69. package/es/components/productExtension/server.js +2 -2
  70. package/es/components/ruleSetting/ruleBorder/index.js +1 -1
  71. package/es/components/schedules/calendar/index.js +4 -4
  72. package/es/components/schedules/calendar/serve.js +2 -2
  73. package/es/components/schedules/components/CurrentDay/index.js +5 -5
  74. package/es/components/schedules/components/CurrentDay/serve.js +2 -2
  75. package/es/components/schedules/components/DropdownSort/index.js +1 -1
  76. package/es/components/schedules/components/ResourceList/index.js +1 -1
  77. package/es/components/schedules/components/Search/index.js +5 -5
  78. package/es/components/schedules/model.d.ts +9 -1
  79. package/es/components/schedules/model.js +5 -5
  80. package/es/components/schedules/openHours/index.js +1 -1
  81. package/es/components/schedules/openHours/serve.js +2 -2
  82. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/MaxParticipantsModule/index.js +1 -1
  83. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/ResourcesModule/index.js +5 -5
  84. package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +4 -4
  85. package/es/components/schedules/products/ProductDetailDrawer/index.js +3 -3
  86. package/es/components/schedules/products/serve.js +2 -2
  87. package/es/components/schedules/products/utils.js +5 -5
  88. package/es/components/schedules/resources/detail/detailContent.js +2 -2
  89. package/es/components/schedules/resources/detail/index.js +10 -10
  90. package/es/components/schedules/resources/list/index.js +2 -2
  91. package/es/components/schedules/resources/relationProduct/index.js +1 -1
  92. package/es/components/schedules/resources/serve.js +2 -2
  93. package/es/components/schedules/schedules/ScheduleDetailDrawer/index.js +9 -9
  94. package/es/components/schedules/utils.d.ts +1 -1
  95. package/es/components/schedules/utils.js +4 -4
  96. package/es/components/selectModal/index.js +2 -2
  97. package/es/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  98. package/es/components/ticketBooking/components/ticketBooking/index.js +137 -137
  99. package/es/components/wallet/Detail/model.d.ts +13 -1
  100. package/es/components/wallet/DiscountCard/model.d.ts +14 -1
  101. package/es/components/wallet/PointCard/model.d.ts +13 -1
  102. package/es/components/wallet/RechargeableCard/model.d.ts +29 -1
  103. package/es/components/wallet/Voucher/model.d.ts +13 -1
  104. package/es/components/wallet/model.d.ts +9 -1
  105. package/es/hooks/useComponents.js +1 -1
  106. package/es/index.d.ts +1 -0
  107. package/es/index.js +2 -1
  108. package/es/utils/index.d.ts +1 -1
  109. package/lib/components/booking/addons/model.d.ts +10 -1
  110. package/lib/components/booking/components/footer/utils.d.ts +1 -0
  111. package/lib/components/booking/components/footer/utils.js +3 -1
  112. package/lib/components/booking/editBookingModal/index.d.ts +5 -0
  113. package/lib/components/booking/editBookingModal/index.js +363 -0
  114. package/lib/components/booking/editBookingModal/index.less +8 -0
  115. package/lib/components/booking/editBookingModal/locales.d.ts +21 -0
  116. package/lib/components/booking/editBookingModal/locales.js +44 -0
  117. package/lib/components/booking/editBookingModal/mock.d.ts +807 -0
  118. package/lib/components/booking/editBookingModal/mock.js +3314 -0
  119. package/lib/components/booking/editBookingModal/serve.d.ts +51 -0
  120. package/lib/components/booking/editBookingModal/serve.js +178 -0
  121. package/lib/components/booking/editBookingModal/type.d.ts +12 -0
  122. package/lib/components/booking/editBookingModal/type.js +17 -0
  123. package/lib/components/booking/editBookingModal/utils.d.ts +12 -0
  124. package/lib/components/booking/editBookingModal/utils.js +158 -0
  125. package/lib/components/booking/forms/model.d.ts +10 -1
  126. package/lib/components/booking/info/model.d.ts +10 -1
  127. package/lib/components/booking/info/service2/utils.js +2 -2
  128. package/lib/components/booking/info2/service/addService/utils.d.ts +10 -0
  129. package/lib/components/booking/info2/service/addService/utils.js +26 -4
  130. package/lib/components/booking/info2/service/editService/Resources/index.js +54 -10
  131. package/lib/components/booking/info2/service/editService/Resources/index.less +6 -0
  132. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.d.ts +7 -0
  133. package/lib/components/booking/info2/service/editService/ResourcesV2/MaxLengthSelect/index.js +53 -0
  134. package/lib/components/booking/info2/service/editService/ResourcesV2/index.d.ts +10 -0
  135. package/lib/components/booking/info2/service/editService/ResourcesV2/index.js +311 -0
  136. package/lib/components/booking/info2/service/editService/ResourcesV2/index.less +44 -0
  137. package/lib/components/booking/info2/utilsByBooking.js +6 -0
  138. package/lib/components/booking/locales.d.ts +3 -0
  139. package/lib/components/booking/locales.js +3 -0
  140. package/lib/components/booking/model.d.ts +9 -1
  141. package/lib/components/booking/notes/model.d.ts +10 -1
  142. package/lib/components/booking/payments/model.d.ts +10 -1
  143. package/lib/components/booking/utils.d.ts +2 -2
  144. package/lib/components/eftposPay/amount.d.ts +1 -1
  145. package/lib/components/eftposPay/device.d.ts +1 -1
  146. package/lib/components/eftposPay/hooks.d.ts +2 -2
  147. package/lib/components/eftposPay/store/index.d.ts +6 -6
  148. package/lib/components/index.d.ts +2 -1
  149. package/lib/components/index.js +3 -0
  150. package/lib/components/pay/toC/model.d.ts +9 -1
  151. package/lib/components/schedules/model.d.ts +9 -1
  152. package/lib/components/schedules/utils.d.ts +1 -1
  153. package/lib/components/schedules/utils.js +1 -1
  154. package/lib/components/ticketBooking/components/ticketBooking/index.d.ts +1 -0
  155. package/lib/components/ticketBooking/components/ticketBooking/index.js +143 -138
  156. package/lib/components/wallet/Detail/model.d.ts +13 -1
  157. package/lib/components/wallet/DiscountCard/model.d.ts +14 -1
  158. package/lib/components/wallet/PointCard/model.d.ts +13 -1
  159. package/lib/components/wallet/RechargeableCard/model.d.ts +29 -1
  160. package/lib/components/wallet/Voucher/model.d.ts +13 -1
  161. package/lib/components/wallet/model.d.ts +9 -1
  162. package/lib/index.d.ts +1 -0
  163. package/lib/index.js +3 -0
  164. package/lib/utils/index.d.ts +1 -1
  165. package/lowcode/edit-booking-modal/meta.ts +53 -0
  166. package/package.json +3 -3
@@ -1 +1,29 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ interface RechargeState {
3
+ selectedGiftOptionId: string | null;
4
+ cardList: Array<{
5
+ id: string;
6
+ name: string;
7
+ price: number;
8
+ }>;
9
+ selectedItem: {
10
+ id?: string;
11
+ gift_price?: number;
12
+ price?: number;
13
+ name?: string;
14
+ variant_id?: string;
15
+ };
16
+ productId?: string;
17
+ detailId?: string;
18
+ total: string | number;
19
+ rechargeModalOpen: boolean;
20
+ }
21
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
22
+ state: RechargeState;
23
+ } & {
24
+ dispatch: (params: {
25
+ type: string;
26
+ payload: any;
27
+ }) => void;
28
+ }>;
29
+ export {};
@@ -1 +1,13 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ interface RechargeState {
3
+ total: 0;
4
+ }
5
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
6
+ state: RechargeState;
7
+ } & {
8
+ dispatch: (params: {
9
+ type: string;
10
+ payload: any;
11
+ }) => void;
12
+ }>;
13
+ export {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IWalletListItemProps } from './serve';
2
3
  export interface WalletCardItemProps {
3
4
  id: string;
@@ -26,4 +27,11 @@ export interface WalletListProps {
26
27
  currentSearchListItemCode?: string;
27
28
  [key: string]: any;
28
29
  }
29
- export declare const Provider: any, Context: any;
30
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
31
+ global_wallet: WalletListProps;
32
+ } & {
33
+ dispatch: (params: {
34
+ type: string;
35
+ payload: any;
36
+ }) => void;
37
+ }>;
@@ -8,7 +8,7 @@ var useComponents = function useComponents(params) {
8
8
  var _utils$getComponents;
9
9
  var _ref = appHelper || {},
10
10
  utils = _ref.utils;
11
- return (utils === null || utils === void 0 || (_utils$getComponents = utils.getComponents) === null || _utils$getComponents === void 0 ? void 0 : _utils$getComponents.call(utils, components)) || [];
11
+ return (utils === null || utils === void 0 ? void 0 : (_utils$getComponents = utils.getComponents) === null || _utils$getComponents === void 0 ? void 0 : _utils$getComponents.call(utils, components)) || [];
12
12
  }, [components]);
13
13
  return Cpt;
14
14
  };
package/es/index.d.ts CHANGED
@@ -44,3 +44,4 @@ export { default as AppointmentDeposit } from './components/appointmentBooking/d
44
44
  export { default as TicketBooking } from './components/ticketBooking';
45
45
  export { default as SubTotal } from './components/subTotal';
46
46
  export { default as StepController } from './components/stepController';
47
+ export { default as EditBookingModal } from './components/booking/editBookingModal';
package/es/index.js CHANGED
@@ -47,4 +47,5 @@ export { default as AppointmentBooking } from "./components/appointmentBooking";
47
47
  export { default as AppointmentDeposit } from "./components/appointmentBooking/deposit";
48
48
  export { default as TicketBooking } from "./components/ticketBooking";
49
49
  export { default as SubTotal } from "./components/subTotal";
50
- export { default as StepController } from "./components/stepController";
50
+ export { default as StepController } from "./components/stepController";
51
+ export { default as EditBookingModal } from "./components/booking/editBookingModal";
@@ -18,6 +18,6 @@ declare let modal: Omit<ModalStaticFunctions, 'warn'>;
18
18
  export declare const setModal: (m: Omit<ModalStaticFunctions, 'warn'>) => void;
19
19
  export declare const saveConfirm: () => Promise<{
20
20
  destroy: () => void;
21
- update: (configUpdate: import("antd/es/modal/interface").ModalFuncProps | ((prevConfig: import("antd/es/modal/interface").ModalFuncProps) => import("antd/es/modal/interface").ModalFuncProps)) => void;
21
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
22
22
  }>;
23
23
  export { modal };
@@ -1 +1,10 @@
1
- export declare const Provider: any, Context: any;
1
+ /// <reference types="react" />
2
+ import { FormState } from "../model";
3
+ export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
4
+ state: FormState;
5
+ } & {
6
+ dispatch: (params: {
7
+ type: string;
8
+ payload: any;
9
+ }) => void;
10
+ }>;
@@ -27,6 +27,7 @@ export interface ResourceItem {
27
27
  * @Author: jinglin.tan
28
28
  */
29
29
  export declare const checkSubResourcesCapacity: (resource: ResourceItem) => void;
30
+ export declare const checkResourcesFormat: (resources: any[], service: any, isChild?: boolean) => any[];
30
31
  /**
31
32
  * @title: 格式化商品单价
32
33
  * @description:
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
32
  checkHolderIsError: () => checkHolderIsError,
33
+ checkResourcesFormat: () => checkResourcesFormat,
33
34
  checkSubResourcesCapacity: () => checkSubResourcesCapacity,
34
35
  formatProductBundle: () => formatProductBundle,
35
36
  formatProductOption: () => formatProductOption,
@@ -148,7 +149,7 @@ var checkResourcesFormat = (resources, service, isChild) => {
148
149
  return resources.map((resource) => {
149
150
  var _a;
150
151
  if (!isChild) {
151
- resource.capacity = (0, import_utilsByBooking.getSumCapacity)({ cacheItem: service });
152
+ resource.capacity = (0, import_utilsByBooking.getSumCapacity)({ cacheItem: service }, false);
152
153
  }
153
154
  checkSubResourcesCapacity(resource);
154
155
  return {
@@ -476,6 +477,7 @@ var checkHolderIsError = (state) => {
476
477
  // Annotate the CommonJS export names for ESM import in node:
477
478
  0 && (module.exports = {
478
479
  checkHolderIsError,
480
+ checkResourcesFormat,
479
481
  checkSubResourcesCapacity,
480
482
  formatProductBundle,
481
483
  formatProductOption,
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { EditBookingModalProps } from './type';
3
+ import './index.less';
4
+ declare const _default: React.ForwardRefExoticComponent<EditBookingModalProps & React.RefAttributes<unknown>>;
5
+ export default _default;
@@ -0,0 +1,363 @@
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/editBookingModal/index.tsx
30
+ var editBookingModal_exports = {};
31
+ __export(editBookingModal_exports, {
32
+ default: () => editBookingModal_default
33
+ });
34
+ module.exports = __toCommonJS(editBookingModal_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_materials = require("@pisell/materials");
38
+ var import_dayjs = __toESM(require("dayjs"));
39
+ var import_utils = require("@pisell/utils");
40
+ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
41
+ var import_utils2 = require("../../../utils");
42
+ var import_ResourcesV2 = __toESM(require("../info2/service/editService/ResourcesV2"));
43
+ var import_utils3 = require("../info2/service/addService/utils");
44
+ var import_serve = require("./serve");
45
+ var import_serve2 = require("./serve");
46
+ var import_utils4 = require("../../booking/components/footer/utils");
47
+ var import_locales = __toESM(require("./locales"));
48
+ var import_index = require("./index.less");
49
+ var EditBookingModal = (props, ref) => {
50
+ const [open, setOpen] = (0, import_react.useState)(false);
51
+ const [params, setParams] = (0, import_react.useState)({});
52
+ const [loading, setLoading] = (0, import_react.useState)(false);
53
+ const [updating, setUpdating] = (0, import_react.useState)(false);
54
+ const [data, setData] = (0, import_react.useState)(null);
55
+ const context = (0, import_useEngineContext.default)();
56
+ const [form] = import_antd.Form.useForm();
57
+ const useToDate = import_antd.Form.useWatch("toDate", form);
58
+ const useResource = import_antd.Form.useWatch("resource", form);
59
+ (0, import_react.useImperativeHandle)(ref, () => {
60
+ return {
61
+ open: (params2) => {
62
+ console.log("change", params2);
63
+ setParams(params2);
64
+ setOpen(true);
65
+ }
66
+ };
67
+ });
68
+ const getInitData = async (params2) => {
69
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
70
+ let mockProps = params2;
71
+ const _data = await (0, import_serve2.init)(mockProps);
72
+ setData(_data);
73
+ let _initResourceVal = _data.childrenBooking._extend.resource;
74
+ const toResourceFormId = (_a = _data.toResource) == null ? void 0 : _a.form_id;
75
+ if (params2.fromResourceId !== params2.toResourceId && toResourceFormId) {
76
+ const { list, maps } = (0, import_utils3.formatResources)({
77
+ cacheItem: _data.childrenBooking,
78
+ resourcesOrigin: _data.resourcesOrigin
79
+ });
80
+ const currentForm = maps[toResourceFormId];
81
+ const relation_id = (_b = _data.toResource) == null ? void 0 : _b.id;
82
+ if (currentForm && relation_id) {
83
+ let _targetResource = {
84
+ relation_type: ((_d = (_c = currentForm.renderListMaps[relation_id]) == null ? void 0 : _c.usable) == null ? void 0 : _d.relation_type) || "form",
85
+ form_id: toResourceFormId,
86
+ relation_id,
87
+ like_status: "common",
88
+ children: (_f = (_e = currentForm.renderListMaps) == null ? void 0 : _e[relation_id]) == null ? void 0 : _f.children,
89
+ metadata: {
90
+ ...(_h = (_g = currentForm.renderListMaps) == null ? void 0 : _g[relation_id]) == null ? void 0 : _h.metadata,
91
+ form_name: currentForm.title,
92
+ resource_name: (_i = currentForm.renderListMaps[relation_id]) == null ? void 0 : _i.main_field
93
+ }
94
+ };
95
+ if (Array.isArray(_initResourceVal[toResourceFormId])) {
96
+ const _cloned = [..._initResourceVal[toResourceFormId]];
97
+ const _idx = _cloned.findIndex(
98
+ (rs) => rs.relation_id == params2.fromResourceId
99
+ );
100
+ if (_idx !== -1) {
101
+ _cloned[_idx] = _targetResource;
102
+ } else {
103
+ _cloned.push(_targetResource);
104
+ }
105
+ _initResourceVal = {
106
+ ..._initResourceVal,
107
+ [toResourceFormId]: _cloned
108
+ };
109
+ } else {
110
+ _initResourceVal = {
111
+ ..._initResourceVal,
112
+ [toResourceFormId]: [_targetResource]
113
+ };
114
+ }
115
+ }
116
+ }
117
+ setTimeout(() => {
118
+ form.setFieldsValue({
119
+ resource: _initResourceVal,
120
+ fromDate: [
121
+ (0, import_dayjs.default)(`${mockProps.event.start_date} ${mockProps.event.start_time}`),
122
+ (0, import_dayjs.default)(`${mockProps.event.end_date} ${mockProps.event.end_time}`)
123
+ ],
124
+ toDate: [(0, import_dayjs.default)(mockProps.toStartDate), (0, import_dayjs.default)(mockProps.toEndDate)]
125
+ });
126
+ }, 100);
127
+ };
128
+ (0, import_react.useLayoutEffect)(() => {
129
+ var _a, _b;
130
+ import_utils.locales.init(
131
+ import_locales.default,
132
+ ((_b = (_a = context.appHelper.utils) == null ? void 0 : _a.storage) == null ? void 0 : _b.get("umi_locale")) || "en"
133
+ );
134
+ import_utils2.request.setRequest(context.appHelper.utils.request);
135
+ }, []);
136
+ (0, import_react.useEffect)(() => {
137
+ if (!open) return;
138
+ getInitData(params);
139
+ }, [params, open]);
140
+ const resourceData = (0, import_react.useMemo)(() => {
141
+ if (!data) {
142
+ return;
143
+ }
144
+ return (0, import_utils3.formatResources)({
145
+ cacheItem: data.childrenBooking,
146
+ resourcesOrigin: data.resourcesOrigin
147
+ });
148
+ }, [data]);
149
+ const updateResource = (resource) => {
150
+ form.setFieldsValue({
151
+ resource
152
+ });
153
+ };
154
+ const originCacheItem = (0, import_react.useMemo)(() => {
155
+ if (!data) {
156
+ return null;
157
+ }
158
+ const _cacheItem = (0, import_serve.createCacheItem)(data.childrenBooking, {
159
+ toDate: [
160
+ data.childrenBooking._extend.start_date,
161
+ data.childrenBooking._extend.end_date
162
+ ],
163
+ resource: data.childrenBooking._extend.resource
164
+ });
165
+ console.log("_origin_cacheItem", _cacheItem);
166
+ const { list, maps } = (0, import_utils3.formatResources)({
167
+ cacheItem: _cacheItem,
168
+ resourcesOrigin: data.resourcesOrigin
169
+ });
170
+ return {
171
+ ..._cacheItem,
172
+ _data: {
173
+ resources: list,
174
+ resourceMaps: maps
175
+ }
176
+ };
177
+ }, [data]);
178
+ const cacheItem = (0, import_react.useMemo)(() => {
179
+ if (!data) {
180
+ return null;
181
+ }
182
+ const _cacheItem = (0, import_serve.createCacheItem)(data.childrenBooking, {
183
+ toDate: useToDate,
184
+ resource: useResource
185
+ });
186
+ console.log("_cacheItem", _cacheItem);
187
+ const { list, maps } = (0, import_utils3.formatResources)({
188
+ cacheItem: _cacheItem,
189
+ resourcesOrigin: data.resourcesOrigin
190
+ });
191
+ const resource = (0, import_serve2.updateResourceErrors)(maps, _cacheItem);
192
+ updateResource(resource);
193
+ return {
194
+ ..._cacheItem,
195
+ _data: {
196
+ resources: list,
197
+ resourceMaps: maps
198
+ }
199
+ };
200
+ }, [data, useToDate, useResource]);
201
+ const initState = () => {
202
+ form.resetFields();
203
+ setData(null);
204
+ setOpen(false);
205
+ };
206
+ const onCancel = () => {
207
+ initState();
208
+ props == null ? void 0 : props.onCancel();
209
+ };
210
+ const onOk = async () => {
211
+ const values = form.getFieldsValue();
212
+ setUpdating(true);
213
+ try {
214
+ const { _extend, order_id } = data.childrenBooking;
215
+ const start_date = values.toDate[0].format("YYYY-MM-DD");
216
+ const start_time = values.toDate[0].format("HH:mm");
217
+ const end_date = values.toDate[1].format("YYYY-MM-DD");
218
+ const end_time = values.toDate[1].format("HH:mm");
219
+ await (0, import_serve.updateChildBooking)(order_id, {
220
+ ..._extend,
221
+ resources: Object.values(values.resource).reduce(
222
+ (pre, cur) => {
223
+ const newList = (0, import_utils4.checkResourcesFormat)(cur, cacheItem);
224
+ pre = pre.concat(newList);
225
+ return pre;
226
+ },
227
+ []
228
+ ),
229
+ start_date,
230
+ start_time,
231
+ end_date,
232
+ end_time,
233
+ duration: values.toDate[1].diff(values.toDate[0], "minutes")
234
+ });
235
+ setOpen(false);
236
+ props == null ? void 0 : props.onOk();
237
+ } catch (error) {
238
+ console.error(error);
239
+ }
240
+ setUpdating(false);
241
+ };
242
+ console.log("data", data);
243
+ return /* @__PURE__ */ import_react.default.createElement(
244
+ import_materials.PisellContainer,
245
+ {
246
+ renderType: "modal",
247
+ props: {
248
+ title: import_utils.locales.getText("pisell2.text.booking.confirm-changes"),
249
+ open,
250
+ cancelVisible: false,
251
+ bodyStyle: {
252
+ padding: 24
253
+ },
254
+ width: 680,
255
+ onCancel,
256
+ okButtonProps: {},
257
+ onOk: () => {
258
+ },
259
+ footer: null,
260
+ className: "pisell-edit-booking-modal"
261
+ }
262
+ },
263
+ /* @__PURE__ */ import_react.default.createElement(import_materials.Spin, { spinning: !data }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { form, layout: "vertical" }, /* @__PURE__ */ import_react.default.createElement(
264
+ "div",
265
+ {
266
+ style: {
267
+ display: "flex",
268
+ alignItems: "center",
269
+ gap: 8,
270
+ color: "#1b1b1b",
271
+ fontWeight: "500"
272
+ }
273
+ },
274
+ /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-copy-03", style: { fontSize: 16 } }),
275
+ import_utils.locales.getText("pisell2.text.booking.time-change")
276
+ ), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "fromDate", label: "From" }, /* @__PURE__ */ import_react.default.createElement(
277
+ import_antd.DatePicker.RangePicker,
278
+ {
279
+ format: "YYYY-MM-DD HH:mm",
280
+ showTime: true,
281
+ presets: [],
282
+ disabled: true,
283
+ style: { width: "100%" },
284
+ size: "large"
285
+ }
286
+ )), /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "toDate", label: "To" }, /* @__PURE__ */ import_react.default.createElement(
287
+ import_antd.DatePicker.RangePicker,
288
+ {
289
+ format: "YYYY-MM-DD HH:mm",
290
+ showTime: true,
291
+ presets: [],
292
+ style: { width: "100%" },
293
+ size: "large"
294
+ }
295
+ )), /* @__PURE__ */ import_react.default.createElement(
296
+ "div",
297
+ {
298
+ style: {
299
+ display: "flex",
300
+ alignItems: "center",
301
+ gap: 8,
302
+ color: "#1b1b1b",
303
+ fontWeight: "500"
304
+ }
305
+ },
306
+ /* @__PURE__ */ import_react.default.createElement(import_materials.Iconfont, { type: "pisell2-mark", style: { fontSize: 16 } }),
307
+ import_utils.locales.getText("pisell2.text.booking.resource-change.detail")
308
+ ), data ? /* @__PURE__ */ import_react.default.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "resource" }, /* @__PURE__ */ import_react.default.createElement(
309
+ import_ResourcesV2.default,
310
+ {
311
+ state: {},
312
+ resourceData,
313
+ cacheItem,
314
+ getCurrentCacheItem: () => {
315
+ return cacheItem;
316
+ },
317
+ config: {
318
+ autoAllocation: false,
319
+ labelCol: { span: 24 },
320
+ resourceErrorIcon: true,
321
+ disabled: false
322
+ },
323
+ originCacheItem,
324
+ originValue: originCacheItem._extend.resource
325
+ }
326
+ ))) : null)),
327
+ /* @__PURE__ */ import_react.default.createElement(
328
+ "div",
329
+ {
330
+ className: "",
331
+ style: {
332
+ display: "flex",
333
+ gap: 12
334
+ }
335
+ },
336
+ /* @__PURE__ */ import_react.default.createElement(
337
+ import_antd.Button,
338
+ {
339
+ onClick: onCancel,
340
+ block: true,
341
+ size: "large",
342
+ style: {
343
+ borderRadius: 20
344
+ }
345
+ },
346
+ import_utils.locales.getText("pisell2.text.cancel")
347
+ ),
348
+ /* @__PURE__ */ import_react.default.createElement(
349
+ import_antd.Button,
350
+ {
351
+ type: "primary",
352
+ onClick: onOk,
353
+ block: true,
354
+ size: "large",
355
+ loading: updating,
356
+ style: { borderRadius: 20 }
357
+ },
358
+ import_utils.locales.getText("pisell2.text.confirm")
359
+ )
360
+ )
361
+ );
362
+ };
363
+ var editBookingModal_default = (0, import_react.forwardRef)(EditBookingModal);
@@ -0,0 +1,8 @@
1
+ .pisell-edit-booking-modal {
2
+
3
+ .pisell-lowcode-form-item-label {
4
+ label {
5
+ color: #939393;
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,21 @@
1
+ declare const _default: {
2
+ en: {
3
+ 'pisell2.text.login': string;
4
+ 'pisell2.text.booking.confirm-changes': string;
5
+ 'pisell2.text.booking.time-change': string;
6
+ 'pisell2.text.booking.resource-change.detail': string;
7
+ };
8
+ 'zh-CN': {
9
+ 'pisell2.text.login': string;
10
+ 'pisell2.text.booking.confirm-changes': string;
11
+ 'pisell2.text.booking.time-change': string;
12
+ 'pisell2.text.booking.resource-change.detail': string;
13
+ };
14
+ 'zh-HK': {
15
+ 'pisell2.text.login': string;
16
+ 'pisell2.text.booking.confirm-changes': string;
17
+ 'pisell2.text.booking.time-change': string;
18
+ 'pisell2.text.booking.resource-change.detail': string;
19
+ };
20
+ };
21
+ export default _default;
@@ -0,0 +1,44 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/booking/editBookingModal/locales.ts
20
+ var locales_exports = {};
21
+ __export(locales_exports, {
22
+ default: () => locales_default
23
+ });
24
+ module.exports = __toCommonJS(locales_exports);
25
+ var locales_default = {
26
+ en: {
27
+ "pisell2.text.login": "Login",
28
+ "pisell2.text.booking.confirm-changes": "Confirm Booking Changes",
29
+ "pisell2.text.booking.time-change": "Time Change",
30
+ "pisell2.text.booking.resource-change.detail": "Resource Change Details"
31
+ },
32
+ "zh-CN": {
33
+ "pisell2.text.login": "登录",
34
+ "pisell2.text.booking.confirm-changes": "确认预约变更",
35
+ "pisell2.text.booking.time-change": "时间变更",
36
+ "pisell2.text.booking.resource-change.detail": "资源变更详情"
37
+ },
38
+ "zh-HK": {
39
+ "pisell2.text.login": "登录",
40
+ "pisell2.text.booking.confirm-changes": "確認預約變更",
41
+ "pisell2.text.booking.time-change": "時間變更",
42
+ "pisell2.text.booking.resource-change.detail": "資源變更詳情"
43
+ }
44
+ };