@pisell/private-materials 3.4.82 → 3.4.83

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 (162) 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 +2 -2
  6. package/build/lowcode/preview.js +152 -152
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +18 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -10
  11. package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  12. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  13. package/es/components/booking/notes/NoteBlock/index.js +3 -2
  14. package/es/components/booking/utils.d.ts +2 -2
  15. package/es/components/eftpos/hooks.d.ts +0 -1
  16. package/es/components/eftposPay/amount.d.ts +1 -1
  17. package/es/components/eftposPay/app.d.ts +1 -1
  18. package/es/components/eftposPay/device.d.ts +1 -1
  19. package/es/components/eftposPay/hooks.d.ts +2 -2
  20. package/es/components/eftposPay/store/index.d.ts +6 -6
  21. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  22. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  23. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  24. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  25. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  26. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  27. package/es/hooks/usePaymentLogger.d.ts +0 -1
  28. package/es/index.d.ts +4 -2
  29. package/es/index.js +3 -1
  30. package/es/plus/contactInfo/components/SwipeAction/index.js +1 -1
  31. package/es/plus/orderList/components/HandleActions.d.ts +1 -0
  32. package/es/plus/orderList/components/HandleActions.js +5 -2
  33. package/es/plus/orderList/components/Toolbar.d.ts +1 -0
  34. package/es/plus/orderList/components/Toolbar.js +4 -2
  35. package/es/plus/orderList/index.d.ts +1 -0
  36. package/es/plus/orderList/index.js +7 -2
  37. package/es/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  38. package/es/plus/pisellSalesGrid/PisellSalesGrid.js +363 -0
  39. package/es/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  40. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  41. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.js +559 -0
  42. package/es/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  43. package/es/plus/pisellSalesGrid/hooks/useActions.js +723 -0
  44. package/es/plus/pisellSalesGrid/index.d.ts +4 -0
  45. package/es/plus/pisellSalesGrid/index.js +3 -0
  46. package/es/plus/pisellSalesGrid/locales.d.ts +9 -0
  47. package/es/plus/pisellSalesGrid/locales.js +8 -0
  48. package/es/plus/pisellSalesGrid/serve.d.ts +19 -0
  49. package/es/plus/pisellSalesGrid/serve.js +151 -0
  50. package/es/plus/pisellSalesGrid/types.d.ts +170 -0
  51. package/es/plus/pisellSalesGrid/types.js +1 -0
  52. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  53. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.js +211 -0
  54. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  55. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.js +167 -0
  56. package/es/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  57. package/es/plus/pisellSalesManagement/components/ResourceSelector.js +102 -0
  58. package/es/plus/pisellSalesManagement/config/booking.d.ts +185 -0
  59. package/es/plus/pisellSalesManagement/config/booking.js +380 -0
  60. package/es/plus/pisellSalesManagement/config/index.d.ts +2 -0
  61. package/es/plus/pisellSalesManagement/config/index.js +11 -0
  62. package/es/plus/pisellSalesManagement/config/order.d.ts +172 -0
  63. package/es/plus/pisellSalesManagement/config/order.js +460 -0
  64. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  65. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.js +66 -0
  66. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  67. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.js +651 -0
  68. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  69. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.js +656 -0
  70. package/es/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  71. package/es/plus/pisellSalesManagement/hooks/usePerspectives.js +12 -0
  72. package/es/plus/pisellSalesManagement/index.d.ts +10 -0
  73. package/es/plus/pisellSalesManagement/index.js +84 -0
  74. package/es/plus/pisellSalesManagement/locales.d.ts +303 -0
  75. package/es/plus/pisellSalesManagement/locales.js +302 -0
  76. package/es/plus/pisellSalesManagement/serve.d.ts +26 -0
  77. package/es/plus/pisellSalesManagement/serve.js +222 -0
  78. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  79. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  80. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
  81. package/es/plus/walletPassGallery/components/passDetail/index.js +2 -26
  82. package/es/plus/walletPassGallery/components/passList/index.js +8 -1
  83. package/es/plus/walletPassGallery/index.js +0 -31
  84. package/es/pro/Selector/Selector.d.ts +1 -1
  85. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  86. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  87. package/lib/components/booking/notes/NoteBlock/index.js +2 -1
  88. package/lib/components/booking/utils.d.ts +2 -2
  89. package/lib/components/eftpos/hooks.d.ts +0 -1
  90. package/lib/components/eftposPay/amount.d.ts +1 -1
  91. package/lib/components/eftposPay/app.d.ts +1 -1
  92. package/lib/components/eftposPay/device.d.ts +1 -1
  93. package/lib/components/eftposPay/hooks.d.ts +2 -2
  94. package/lib/components/eftposPay/store/index.d.ts +6 -6
  95. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  96. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  97. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  98. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  99. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  100. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  101. package/lib/hooks/usePaymentLogger.d.ts +0 -1
  102. package/lib/index.d.ts +4 -2
  103. package/lib/index.js +8 -2
  104. package/lib/plus/contactInfo/components/SwipeAction/index.js +23 -23
  105. package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
  106. package/lib/plus/orderList/components/HandleActions.js +2 -2
  107. package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
  108. package/lib/plus/orderList/components/Toolbar.js +2 -2
  109. package/lib/plus/orderList/index.d.ts +1 -0
  110. package/lib/plus/orderList/index.js +3 -3
  111. package/lib/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  112. package/lib/plus/pisellSalesGrid/PisellSalesGrid.js +339 -0
  113. package/lib/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  114. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  115. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.js +455 -0
  116. package/lib/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  117. package/lib/plus/pisellSalesGrid/hooks/useActions.js +545 -0
  118. package/lib/plus/pisellSalesGrid/index.d.ts +4 -0
  119. package/lib/plus/pisellSalesGrid/index.js +42 -0
  120. package/lib/plus/pisellSalesGrid/locales.d.ts +9 -0
  121. package/lib/plus/pisellSalesGrid/locales.js +29 -0
  122. package/lib/plus/pisellSalesGrid/serve.d.ts +19 -0
  123. package/lib/plus/pisellSalesGrid/serve.js +142 -0
  124. package/lib/plus/pisellSalesGrid/types.d.ts +170 -0
  125. package/lib/plus/pisellSalesGrid/types.js +17 -0
  126. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  127. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.js +250 -0
  128. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  129. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.js +193 -0
  130. package/lib/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  131. package/lib/plus/pisellSalesManagement/components/ResourceSelector.js +106 -0
  132. package/lib/plus/pisellSalesManagement/config/booking.d.ts +185 -0
  133. package/lib/plus/pisellSalesManagement/config/booking.js +500 -0
  134. package/lib/plus/pisellSalesManagement/config/index.d.ts +2 -0
  135. package/lib/plus/pisellSalesManagement/config/index.js +43 -0
  136. package/lib/plus/pisellSalesManagement/config/order.d.ts +172 -0
  137. package/lib/plus/pisellSalesManagement/config/order.js +492 -0
  138. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  139. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.js +113 -0
  140. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  141. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.js +699 -0
  142. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  143. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.js +700 -0
  144. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  145. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.js +42 -0
  146. package/lib/plus/pisellSalesManagement/index.d.ts +10 -0
  147. package/lib/plus/pisellSalesManagement/index.js +113 -0
  148. package/lib/plus/pisellSalesManagement/locales.d.ts +303 -0
  149. package/lib/plus/pisellSalesManagement/locales.js +326 -0
  150. package/lib/plus/pisellSalesManagement/serve.d.ts +26 -0
  151. package/lib/plus/pisellSalesManagement/serve.js +120 -0
  152. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  153. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  154. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
  155. package/lib/plus/walletPassGallery/components/passDetail/index.js +1 -16
  156. package/lib/plus/walletPassGallery/components/passList/index.js +9 -3
  157. package/lib/plus/walletPassGallery/index.js +0 -29
  158. package/lib/pro/Selector/Selector.d.ts +1 -1
  159. package/lowcode/eco-cup-list/meta.ts +1 -1
  160. package/lowcode/eco-customer-list/meta.ts +1 -1
  161. package/lowcode/pisell-sales-management/meta.ts +88 -0
  162. package/package.json +4 -4
@@ -0,0 +1,700 @@
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/plus/pisellSalesManagement/hooks/useOrderPerspective.tsx
30
+ var useOrderPerspective_exports = {};
31
+ __export(useOrderPerspective_exports, {
32
+ useOrderPerspective: () => useOrderPerspective
33
+ });
34
+ module.exports = __toCommonJS(useOrderPerspective_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_materials = require("@pisell/materials");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
39
+ var import_clientName = __toESM(require("../../clientName"));
40
+ var import_order = require("../config/order");
41
+ var import_config = require("../config");
42
+ var import_perspectiveUtils = require("./perspectiveUtils");
43
+ var import_BookingNotesPreview = __toESM(require("../components/BookingNotesPreview"));
44
+ var import_serve = require("../serve");
45
+ var useOrderPerspective = () => {
46
+ var _a, _b, _c, _d, _e;
47
+ const context = (0, import_useEngineContext.default)();
48
+ const app = (_c = (_b = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils) == null ? void 0 : _b.getApp) == null ? void 0 : _c.call(_b);
49
+ const locale = (_e = (_d = context == null ? void 0 : context.engine) == null ? void 0 : _d.props) == null ? void 0 : _e.locale;
50
+ const staticData = (0, import_react.useMemo)(() => {
51
+ const PAYMENT_STATUS_LABEL_MAP = (0, import_order.getPaymentStatusMap)();
52
+ const PLATFORM_LABEL_MAP = (0, import_order.getPlatformMap)();
53
+ const ORDER_STATUS_LABEL_MAP = (0, import_order.getOrderStatusMap)();
54
+ const SHIPPING_STATUS_LABEL_MAP = (0, import_order.getShippingStatusMap)();
55
+ const DELIVERY_TYPE_LABEL_MAP = (0, import_order.getDeliveryTypeMap)();
56
+ const SHOP_SERVICE_TYPE_LABEL_MAP = (0, import_order.getShopServiceTypeMap)();
57
+ const BUSINESS_LABEL_MAP = (0, import_config.getBusinessLabelMap)();
58
+ const orderLabels = (0, import_order.getOrderHeaderLabels)();
59
+ const amountLabels = {
60
+ total: import_utils.locales.getText("pisell2.orderList.common.totalAmount"),
61
+ paid: import_utils.locales.getText("pisell2.orderList.common.paidAmount"),
62
+ due: import_utils.locales.getText("pisell2.orderList.common.dueAmount"),
63
+ refunded: import_utils.locales.getText("pisell2.orderList.common.refundedAmount"),
64
+ items: import_utils.locales.getText("pisell2.orderList.common.itemsCount")
65
+ };
66
+ return {
67
+ PAYMENT_STATUS_LABEL_MAP,
68
+ PLATFORM_LABEL_MAP,
69
+ ORDER_STATUS_LABEL_MAP,
70
+ SHIPPING_STATUS_LABEL_MAP,
71
+ DELIVERY_TYPE_LABEL_MAP,
72
+ SHOP_SERVICE_TYPE_LABEL_MAP,
73
+ BUSINESS_LABEL_MAP,
74
+ orderLabels,
75
+ amountLabels
76
+ };
77
+ }, [locale]);
78
+ const buildColumns = (0, import_react.useCallback)(
79
+ (ctx) => {
80
+ const {
81
+ PAYMENT_STATUS_LABEL_MAP,
82
+ PLATFORM_LABEL_MAP,
83
+ ORDER_STATUS_LABEL_MAP,
84
+ SHIPPING_STATUS_LABEL_MAP,
85
+ DELIVERY_TYPE_LABEL_MAP,
86
+ SHOP_SERVICE_TYPE_LABEL_MAP,
87
+ BUSINESS_LABEL_MAP,
88
+ orderLabels,
89
+ amountLabels
90
+ } = staticData;
91
+ return [
92
+ {
93
+ title: orderLabels.saleBrief,
94
+ key: "sale_brief",
95
+ width: 225,
96
+ // fixed: 'left',
97
+ render: (_, record) => {
98
+ const orderCode = record == null ? void 0 : record.shop_full_order_number;
99
+ const currencySymbol = record == null ? void 0 : record.currency_symbol;
100
+ const totalAmount = record == null ? void 0 : record.total_amount;
101
+ const paymentStatus = record == null ? void 0 : record.payment_status;
102
+ const orderNote = record == null ? void 0 : record.note;
103
+ const internalNotes = record == null ? void 0 : record.internal_note;
104
+ const noteApis = (0, import_serve.createNoteApis)(
105
+ (record == null ? void 0 : record.id) || (record == null ? void 0 : record.order_id) || (record == null ? void 0 : record.orderId)
106
+ );
107
+ const tags = (record == null ? void 0 : record.tag) || (record == null ? void 0 : record.tags) || [];
108
+ const paymentLabel = PAYMENT_STATUS_LABEL_MAP[paymentStatus] || paymentStatus || "-";
109
+ const paymentColor = import_order.PAYMENT_STATUS_COLOR_MAP[paymentStatus] || "";
110
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", flexDirection: "column" } }, /* @__PURE__ */ import_react.default.createElement(
111
+ "div",
112
+ {
113
+ style: {
114
+ fontWeight: "bold",
115
+ textDecoration: "underline",
116
+ color: "var(--theme-color, #7f56d9)"
117
+ }
118
+ },
119
+ orderCode
120
+ ), Array.isArray(tags) && tags.length > 0 ? /* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", gap: 4, flexWrap: "wrap" } }, tags.map((item) => /* @__PURE__ */ import_react.default.createElement(
121
+ import_perspectiveUtils.Tag,
122
+ {
123
+ key: `${item == null ? void 0 : item.id}`,
124
+ style: {
125
+ margin: 0,
126
+ maxWidth: 160,
127
+ whiteSpace: "nowrap",
128
+ overflow: "hidden",
129
+ textOverflow: "ellipsis",
130
+ fontWeight: 500
131
+ }
132
+ },
133
+ item == null ? void 0 : item.name
134
+ ))) : null, /* @__PURE__ */ import_react.default.createElement("div", { style: { fontWeight: "bold" } }, /* @__PURE__ */ import_react.default.createElement("span", { style: { marginRight: 6 } }, amountLabels.total, ":"), /* @__PURE__ */ import_react.default.createElement("span", null, (0, import_perspectiveUtils.formatAmount)(totalAmount, currencySymbol))), /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
135
+ import_perspectiveUtils.Tag,
136
+ {
137
+ style: {
138
+ backgroundColor: paymentColor,
139
+ whiteSpace: "nowrap",
140
+ border: "none",
141
+ fontWeight: 500
142
+ }
143
+ },
144
+ paymentLabel
145
+ )), /* @__PURE__ */ import_react.default.createElement(
146
+ import_BookingNotesPreview.default,
147
+ {
148
+ dataSource: {
149
+ note: orderNote,
150
+ internalNotes,
151
+ apis: noteApis,
152
+ onChange: (value, type, noteType) => {
153
+ ctx.refresh();
154
+ }
155
+ },
156
+ labels: {
157
+ orderNote: orderLabels.orderNote,
158
+ internalNote: orderLabels.internalNote
159
+ },
160
+ style: {
161
+ maxWidth: 160
162
+ }
163
+ }
164
+ ));
165
+ }
166
+ },
167
+ {
168
+ title: orderLabels.customer,
169
+ key: "customer",
170
+ align: "center",
171
+ width: 150,
172
+ uniformCompare: (value, record) => {
173
+ const customer = record == null ? void 0 : record.customer;
174
+ if (!customer) return "-";
175
+ const guestCode = customer == null ? void 0 : customer.guest_code;
176
+ if (guestCode) return `${guestCode}`;
177
+ if (customer.user_id === 1) return "walk-in";
178
+ return customer;
179
+ },
180
+ render: (_, record) => {
181
+ const customer = record == null ? void 0 : record.customer;
182
+ if (!customer) return "-";
183
+ const guestCode = customer == null ? void 0 : customer.guest_code;
184
+ if (guestCode) {
185
+ return /* @__PURE__ */ import_react.default.createElement(
186
+ "div",
187
+ {
188
+ style: {
189
+ display: "flex",
190
+ flexDirection: "column",
191
+ alignItems: "center",
192
+ textAlign: "center"
193
+ }
194
+ },
195
+ /* @__PURE__ */ import_react.default.createElement("div", { style: { fontWeight: "bold" } }, orderLabels.guest)
196
+ );
197
+ }
198
+ const phone = (0, import_perspectiveUtils.formatPhone)(
199
+ (customer == null ? void 0 : customer.phone) || (record == null ? void 0 : record.phone),
200
+ (customer == null ? void 0 : customer.country_calling_code) || (record == null ? void 0 : record.country_calling_code)
201
+ );
202
+ const lines = (0, import_perspectiveUtils.getDisplayLines)([phone, customer == null ? void 0 : customer.email]);
203
+ return /* @__PURE__ */ import_react.default.createElement(
204
+ "div",
205
+ {
206
+ style: {
207
+ display: "flex",
208
+ flexDirection: "column",
209
+ alignItems: "center",
210
+ textAlign: "center"
211
+ }
212
+ },
213
+ /* @__PURE__ */ import_react.default.createElement(import_clientName.default, { dataSource: customer, style: { fontSize: 14 } }),
214
+ lines.map((line, index) => /* @__PURE__ */ import_react.default.createElement("div", { key: `${line}-${index}`, style: import_perspectiveUtils.textStyles.text }, line))
215
+ );
216
+ }
217
+ },
218
+ {
219
+ title: orderLabels.contact,
220
+ dataIndex: "contacts_info",
221
+ key: "contacts_info",
222
+ align: "center",
223
+ width: 150,
224
+ uniformCompare: (value, record) => {
225
+ if (!value) return "-";
226
+ return value;
227
+ },
228
+ render: (value) => {
229
+ if (!value) return "-";
230
+ const info = (value == null ? void 0 : value.value) || {};
231
+ const phone = (0, import_perspectiveUtils.formatPhone)(info == null ? void 0 : info.phone);
232
+ const lines = (0, import_perspectiveUtils.getDisplayLines)([phone, info == null ? void 0 : info.email]);
233
+ return /* @__PURE__ */ import_react.default.createElement(
234
+ "div",
235
+ {
236
+ style: {
237
+ display: "flex",
238
+ flexDirection: "column",
239
+ alignItems: "center",
240
+ textAlign: "center"
241
+ }
242
+ },
243
+ /* @__PURE__ */ import_react.default.createElement(import_clientName.default, { dataSource: info, style: { fontSize: 14 } }),
244
+ lines.map((line, index) => /* @__PURE__ */ import_react.default.createElement("div", { key: `${line}-${index}`, style: import_perspectiveUtils.textStyles.text }, line))
245
+ );
246
+ }
247
+ },
248
+ {
249
+ title: orderLabels.paymentInfo,
250
+ key: "payment_info",
251
+ width: 124,
252
+ align: "center",
253
+ render: (_, record) => {
254
+ const value = record == null ? void 0 : record.payment_status;
255
+ const currencySymbol = record == null ? void 0 : record.currency_symbol;
256
+ const totalAmount = Number((record == null ? void 0 : record.total_amount) || 0);
257
+ const paidAmount = Number((record == null ? void 0 : record.paid_amount) || 0);
258
+ const refundedAmount = Number((record == null ? void 0 : record.total_refund_amount) || 0);
259
+ const dueAmount = totalAmount - paidAmount;
260
+ const amountStyles = {
261
+ due: {
262
+ fontWeight: "bold",
263
+ color: "#D92D20"
264
+ },
265
+ refunded: {
266
+ color: "#CA8504",
267
+ fontWeight: "bold"
268
+ }
269
+ };
270
+ const lines = [];
271
+ if (["payment_processing", "unpaid"].includes(value)) {
272
+ lines.push({
273
+ label: amountLabels.due,
274
+ value: (0, import_perspectiveUtils.formatAmount)(dueAmount, currencySymbol),
275
+ bold: true,
276
+ kind: "due"
277
+ });
278
+ lines.push({
279
+ label: amountLabels.total,
280
+ value: (0, import_perspectiveUtils.formatAmount)(totalAmount, currencySymbol),
281
+ kind: "total"
282
+ });
283
+ } else if (value === "partially_paid") {
284
+ lines.push({
285
+ label: amountLabels.due,
286
+ value: (0, import_perspectiveUtils.formatAmount)(dueAmount, currencySymbol),
287
+ bold: true,
288
+ kind: "due"
289
+ });
290
+ lines.push({
291
+ label: amountLabels.paid,
292
+ value: (0, import_perspectiveUtils.formatAmount)(paidAmount, currencySymbol),
293
+ kind: "paid"
294
+ });
295
+ lines.push({
296
+ label: amountLabels.total,
297
+ value: (0, import_perspectiveUtils.formatAmount)(totalAmount, currencySymbol),
298
+ kind: "total"
299
+ });
300
+ } else if (value === "paid") {
301
+ lines.push({
302
+ label: amountLabels.paid,
303
+ value: (0, import_perspectiveUtils.formatAmount)(paidAmount, currencySymbol),
304
+ bold: true,
305
+ kind: "paid"
306
+ });
307
+ lines.push({
308
+ label: amountLabels.total,
309
+ value: (0, import_perspectiveUtils.formatAmount)(totalAmount, currencySymbol),
310
+ kind: "total"
311
+ });
312
+ } else if (["partially_refunded", "refunded"].includes(value)) {
313
+ lines.push({
314
+ label: amountLabels.refunded,
315
+ value: (0, import_perspectiveUtils.formatAmount)(refundedAmount, currencySymbol),
316
+ bold: true,
317
+ kind: "refunded"
318
+ });
319
+ lines.push({
320
+ label: amountLabels.paid,
321
+ value: (0, import_perspectiveUtils.formatAmount)(paidAmount, currencySymbol),
322
+ kind: "paid"
323
+ });
324
+ lines.push({
325
+ label: amountLabels.total,
326
+ value: (0, import_perspectiveUtils.formatAmount)(totalAmount, currencySymbol),
327
+ kind: "total"
328
+ });
329
+ } else if (["voided", "authorized"].includes(value)) {
330
+ lines.push({
331
+ label: amountLabels.total,
332
+ value: (0, import_perspectiveUtils.formatAmount)(totalAmount, currencySymbol),
333
+ bold: true,
334
+ kind: "total"
335
+ });
336
+ } else {
337
+ lines.push({
338
+ label: amountLabels.total,
339
+ value: (0, import_perspectiveUtils.formatAmount)(totalAmount, currencySymbol),
340
+ bold: true,
341
+ kind: "total"
342
+ });
343
+ }
344
+ return /* @__PURE__ */ import_react.default.createElement(
345
+ "div",
346
+ {
347
+ style: {
348
+ display: "flex",
349
+ flexDirection: "column",
350
+ gap: 4,
351
+ alignItems: "flex-start"
352
+ }
353
+ },
354
+ lines.map((line) => /* @__PURE__ */ import_react.default.createElement("div", { key: line.label, style: import_perspectiveUtils.textStyles.text }, /* @__PURE__ */ import_react.default.createElement(
355
+ "span",
356
+ {
357
+ style: {
358
+ whiteSpace: "nowrap",
359
+ ...line.kind && amountStyles[line.kind] ? amountStyles[line.kind] : {}
360
+ }
361
+ },
362
+ line.label,
363
+ ": ",
364
+ line.value
365
+ )))
366
+ );
367
+ }
368
+ },
369
+ {
370
+ title: orderLabels.items,
371
+ key: "product_quantity",
372
+ align: "center",
373
+ width: 120,
374
+ render: (_, record) => {
375
+ const count = (record == null ? void 0 : record.product_quantity) || 0;
376
+ return /* @__PURE__ */ import_react.default.createElement("span", { style: { ...import_perspectiveUtils.textStyles.text, textAlign: "center" } }, count, amountLabels.items);
377
+ }
378
+ },
379
+ {
380
+ title: orderLabels.orderOrigin,
381
+ key: "order_origin",
382
+ width: 138,
383
+ align: "center",
384
+ render: (_, record) => {
385
+ const channel = PLATFORM_LABEL_MAP[record == null ? void 0 : record.order_sales_channel] || PLATFORM_LABEL_MAP[record == null ? void 0 : record.order_platform] || (record == null ? void 0 : record.order_sales_channel) || (record == null ? void 0 : record.order_platform);
386
+ const device = (record == null ? void 0 : record.device_name) || (record == null ? void 0 : record.device) || (record == null ? void 0 : record.terminal);
387
+ const time = (record == null ? void 0 : record.created_at) || (record == null ? void 0 : record.order_time);
388
+ const lines = (0, import_perspectiveUtils.getDisplayLines)([channel, device]);
389
+ if (lines.length === 0) {
390
+ return null;
391
+ }
392
+ const businessLabel = BUSINESS_LABEL_MAP[record.business_code];
393
+ return /* @__PURE__ */ import_react.default.createElement(
394
+ "div",
395
+ {
396
+ style: {
397
+ display: "flex",
398
+ flexDirection: "column",
399
+ alignItems: "flex-start"
400
+ }
401
+ },
402
+ businessLabel ? /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
403
+ import_perspectiveUtils.Tag,
404
+ {
405
+ color: import_config.BUSINESS_COLOR_MAP[record.business_code],
406
+ style: {
407
+ color: "black",
408
+ fontWeight: 500
409
+ }
410
+ },
411
+ businessLabel
412
+ )) : null,
413
+ lines.map((line, index) => /* @__PURE__ */ import_react.default.createElement("div", { key: `${line}-${index}`, style: import_perspectiveUtils.textStyles.text }, line)),
414
+ /* @__PURE__ */ import_react.default.createElement(
415
+ "div",
416
+ {
417
+ style: {
418
+ display: "flex",
419
+ alignItems: "center",
420
+ whiteSpace: "nowrap"
421
+ }
422
+ },
423
+ /* @__PURE__ */ import_react.default.createElement("span", null, orderLabels.createdBy, ":"),
424
+ /* @__PURE__ */ import_react.default.createElement(
425
+ import_clientName.default,
426
+ {
427
+ dataSource: record.create_account,
428
+ style: { fontSize: 14 }
429
+ }
430
+ )
431
+ ),
432
+ /* @__PURE__ */ import_react.default.createElement(
433
+ import_materials.PisellDateTimeDisplay,
434
+ {
435
+ value: time,
436
+ layout: "inline",
437
+ textAlign: "left",
438
+ timeFormat: { padHour: true },
439
+ dateFormat: {
440
+ showYear: false,
441
+ shortMonth: true,
442
+ showRelativeDay: true,
443
+ useCommaBeforeYear: false
444
+ },
445
+ fields: {
446
+ fieldOrder: ["time", "weekday", "date"]
447
+ // inlineSeparators: [' ', ', '],
448
+ },
449
+ style: {
450
+ whiteSpace: "nowrap"
451
+ }
452
+ }
453
+ )
454
+ );
455
+ }
456
+ },
457
+ {
458
+ title: orderLabels.paymentStatus,
459
+ dataIndex: "payment_status",
460
+ key: "payment_status",
461
+ align: "center",
462
+ width: 160,
463
+ render: (value) => {
464
+ const label = PAYMENT_STATUS_LABEL_MAP[value] || value || "-";
465
+ const color = import_order.PAYMENT_STATUS_COLOR_MAP[value] || "";
466
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ import_react.default.createElement(
467
+ import_materials.PisellTags,
468
+ {
469
+ style: {
470
+ backgroundColor: color,
471
+ whiteSpace: "nowrap"
472
+ }
473
+ },
474
+ label
475
+ ));
476
+ }
477
+ },
478
+ {
479
+ title: orderLabels.shippingMethod,
480
+ key: "delivery_type",
481
+ align: "center",
482
+ width: 160,
483
+ render: (_, record) => {
484
+ var _a2, _b2;
485
+ const deliveryType = record == null ? void 0 : record.delivery_type;
486
+ const serverType = (_b2 = (_a2 = record == null ? void 0 : record.metadata) == null ? void 0 : _a2.shop_service_type) == null ? void 0 : _b2.server_type;
487
+ if (!deliveryType && !serverType) return "-";
488
+ const isShopService = deliveryType === "shop_service";
489
+ const label = isShopService ? SHOP_SERVICE_TYPE_LABEL_MAP[serverType] : DELIVERY_TYPE_LABEL_MAP[deliveryType];
490
+ if (!label || !isShopService && deliveryType === "nil")
491
+ return "-";
492
+ const color = isShopService ? import_order.SHOP_SERVICE_TYPE_COLOR_MAP[serverType] : import_order.DELIVERY_TYPE_COLOR_MAP[deliveryType];
493
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ import_react.default.createElement(
494
+ import_perspectiveUtils.Tag,
495
+ {
496
+ style: { whiteSpace: "nowrap", fontWeight: 500 },
497
+ color
498
+ },
499
+ label
500
+ ));
501
+ },
502
+ uniformCompare: (_, record) => {
503
+ var _a2, _b2;
504
+ const deliveryType = (record == null ? void 0 : record.delivery_type) || "";
505
+ const serverType = ((_b2 = (_a2 = record == null ? void 0 : record.metadata) == null ? void 0 : _a2.shop_service_type) == null ? void 0 : _b2.server_type) || "";
506
+ return `${deliveryType}|${serverType}`;
507
+ }
508
+ },
509
+ {
510
+ title: orderLabels.orderStatus,
511
+ dataIndex: "status",
512
+ key: "status",
513
+ align: "center",
514
+ width: 150,
515
+ render: (value) => {
516
+ const color = import_order.ORDER_STATUS_COLOR_MAP[value];
517
+ const label = ORDER_STATUS_LABEL_MAP[value] || value || "-";
518
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ import_react.default.createElement(
519
+ import_materials.PisellTags,
520
+ {
521
+ style: {
522
+ whiteSpace: "nowrap",
523
+ borderColor: color == null ? void 0 : color.borderColor,
524
+ color: color == null ? void 0 : color.textColor
525
+ }
526
+ },
527
+ label
528
+ ));
529
+ }
530
+ },
531
+ {
532
+ title: orderLabels.fulfillmentStatus,
533
+ dataIndex: "shipping_status",
534
+ key: "shipping_status",
535
+ align: "center",
536
+ width: 160,
537
+ render: (value) => {
538
+ const color = import_order.FULFILLMENT_STATUS_COLOR_MAP[value];
539
+ const label = SHIPPING_STATUS_LABEL_MAP[value] || value || "-";
540
+ return /* @__PURE__ */ import_react.default.createElement("div", { style: { textAlign: "center" } }, /* @__PURE__ */ import_react.default.createElement(
541
+ import_materials.PisellTags,
542
+ {
543
+ style: {
544
+ whiteSpace: "nowrap",
545
+ borderColor: color == null ? void 0 : color.borderColor,
546
+ color: color == null ? void 0 : color.textColor
547
+ }
548
+ },
549
+ label
550
+ ));
551
+ }
552
+ },
553
+ {
554
+ title: orderLabels.updated,
555
+ key: "last_edit_account",
556
+ width: 132,
557
+ align: "center",
558
+ render: (_, record) => {
559
+ const editor = record == null ? void 0 : record.last_edit_account;
560
+ const time = (editor == null ? void 0 : editor.created_at) || (record == null ? void 0 : record.updated_at);
561
+ const channel = PLATFORM_LABEL_MAP[record == null ? void 0 : record.order_platform] || (record == null ? void 0 : record.order_platform);
562
+ const lines = (0, import_perspectiveUtils.getDisplayLines)([channel]);
563
+ return /* @__PURE__ */ import_react.default.createElement(
564
+ "div",
565
+ {
566
+ style: {
567
+ display: "flex",
568
+ flexDirection: "column",
569
+ alignItems: "flex-start"
570
+ }
571
+ },
572
+ /* @__PURE__ */ import_react.default.createElement(
573
+ import_clientName.default,
574
+ {
575
+ dataSource: editor || record.create_account,
576
+ style: { fontSize: 14 }
577
+ }
578
+ ),
579
+ /* @__PURE__ */ import_react.default.createElement(
580
+ import_materials.PisellDateTimeDisplay,
581
+ {
582
+ value: time,
583
+ layout: "inline",
584
+ textAlign: "left",
585
+ timeFormat: { padHour: true },
586
+ dateFormat: {
587
+ showYear: false,
588
+ shortMonth: true,
589
+ showRelativeDay: true,
590
+ useCommaBeforeYear: false
591
+ },
592
+ fields: {
593
+ fieldOrder: ["time", "weekday", "date"]
594
+ // inlineSeparators: [' ', ', '],
595
+ },
596
+ style: {
597
+ whiteSpace: "nowrap"
598
+ }
599
+ }
600
+ ),
601
+ lines.map((line, index) => /* @__PURE__ */ import_react.default.createElement("div", { key: `${line}-${index}`, style: import_perspectiveUtils.textStyles.text }, line))
602
+ );
603
+ }
604
+ },
605
+ {
606
+ title: orderLabels.orderId,
607
+ dataIndex: "id",
608
+ key: "id",
609
+ align: "center",
610
+ width: 100,
611
+ render: (value) => /* @__PURE__ */ import_react.default.createElement("span", { style: { ...import_perspectiveUtils.textStyles.text, textAlign: "center" } }, value)
612
+ }
613
+ ];
614
+ },
615
+ [staticData]
616
+ );
617
+ const _perspective = (0, import_react.useMemo)(
618
+ () => ({
619
+ key: "handle",
620
+ label: "Handle",
621
+ getChildComponentProps: (ctx) => ({
622
+ grid: {
623
+ bordered: true,
624
+ collapseUniformColumns: true,
625
+ columns: buildColumns(ctx),
626
+ defaultHiddenColumnKeys: [
627
+ "order_origin",
628
+ "payment_status",
629
+ "delivery_type",
630
+ "status",
631
+ "shipping_status",
632
+ "last_edit_account",
633
+ "id"
634
+ ],
635
+ scroll: {
636
+ x: "max-content",
637
+ autoCalc: true,
638
+ scrollToFirstRowOnChange: true
639
+ },
640
+ rowSelection: {
641
+ fixed: true,
642
+ columnWidth: 48
643
+ },
644
+ onRow: (record) => ({
645
+ onClick: () => {
646
+ var _a2, _b2, _c2, _d2;
647
+ const pathname = encodeURIComponent(
648
+ ((_c2 = (_b2 = (_a2 = app == null ? void 0 : app.history) == null ? void 0 : _a2.instance) == null ? void 0 : _b2.location) == null ? void 0 : _c2.pathname) || ""
649
+ );
650
+ (_d2 = app == null ? void 0 : app.history) == null ? void 0 : _d2.push(
651
+ `/order-detail?id=${record.id}&goback=${pathname}`
652
+ );
653
+ }
654
+ })
655
+ },
656
+ toolBar: {
657
+ search: { showConfirmButton: false },
658
+ sort: { list: (0, import_order.getSortList)() },
659
+ quickFilter: {
660
+ filterList: [
661
+ {
662
+ type: "rangePicker",
663
+ name: "orderDate",
664
+ key: "orderDate",
665
+ props: {
666
+ placeholder: import_utils.locales.getText(
667
+ "pisell2.orderList.quickFilter.orderDate.label"
668
+ )
669
+ }
670
+ }
671
+ ]
672
+ },
673
+ filter: {
674
+ hiddenQuickFilter: true,
675
+ defaultFilterValue: {
676
+ quickFilter: [],
677
+ otherFilter: (0, import_order.getFilterButtonList)(),
678
+ values: {}
679
+ }
680
+ }
681
+ },
682
+ batchActionBar: {
683
+ overflowThreshold: 2,
684
+ defaultActions: {
685
+ showSelectAll: false,
686
+ showClear: false,
687
+ showInvert: false,
688
+ showDelete: false
689
+ }
690
+ }
691
+ })
692
+ }),
693
+ [buildColumns, app, locale]
694
+ );
695
+ return _perspective;
696
+ };
697
+ // Annotate the CommonJS export names for ESM import in node:
698
+ 0 && (module.exports = {
699
+ useOrderPerspective
700
+ });