@reeboot/strapi-payment-plugin 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{Analytics-nBSdLT2v.js → Analytics-CLjtRWYA.js} +68 -51
- package/dist/_chunks/{Analytics-DSJqY9ng.mjs → Analytics-CQmAVKsq.mjs} +68 -51
- package/dist/_chunks/App-DXN62SV6.mjs +118 -0
- package/dist/_chunks/App-Dk7XtjNA.js +120 -0
- package/dist/_chunks/{Customers-BpFzfglV.js → Customers-BNDi4QBH.js} +113 -51
- package/dist/_chunks/{Customers-C6FH7-zG.mjs → Customers-BQzVBQDT.mjs} +114 -52
- package/dist/_chunks/Dashboard-CuHC-dit.mjs +311 -0
- package/dist/_chunks/Dashboard-UUwohHZa.js +311 -0
- package/dist/_chunks/{Orders-CBkT2YfP.mjs → Orders-65mNfu2i.mjs} +140 -80
- package/dist/_chunks/{Orders-OG-pwV-B.js → Orders-CitNCdWE.js} +139 -79
- package/dist/_chunks/PaymentList-B0CAzInT.mjs +137 -0
- package/dist/_chunks/PaymentList-Dy1BAFoD.js +136 -0
- package/dist/_chunks/{Payments-DSDJ-HWm.mjs → Payments-FnhoV_2B.mjs} +175 -136
- package/dist/_chunks/{Payments-BLen1P9N.js → Payments-TOnygGIW.js} +173 -134
- package/dist/_chunks/Settings-BJtDagUs.js +644 -0
- package/dist/_chunks/Settings-EoLSuZLe.mjs +644 -0
- package/dist/_chunks/{index-DS_PYNkf.mjs → index-2Zd_T7bD.mjs} +1 -1
- package/dist/_chunks/{index-BqqrpI6D.js → index-CHEgJ7e5.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/CustomerList.d.ts +1 -13
- package/dist/admin/src/components/IntegrationModal.d.ts +7 -0
- package/dist/admin/src/components/OrderList.d.ts +1 -19
- package/dist/admin/src/components/PaymentCard.d.ts +2 -33
- package/dist/admin/src/components/PaymentList.d.ts +3 -11
- package/dist/admin/src/components/RefundModal.d.ts +2 -8
- package/dist/admin/src/types/index.d.ts +47 -0
- package/dist/server/index.js +241 -96
- package/dist/server/index.mjs +241 -96
- package/dist/server/src/content-types/index.d.ts +9 -2
- package/dist/server/src/content-types/order/index.d.ts +8 -1
- package/dist/server/src/content-types/payment/index.d.ts +1 -1
- package/dist/server/src/index.d.ts +9 -2
- package/dist/server/src/types/api.d.ts +31 -0
- package/dist/server/src/types/customer.d.ts +2 -0
- package/dist/server/src/types/index.d.ts +4 -179
- package/dist/server/src/types/order.d.ts +2 -0
- package/dist/server/src/types/payment.d.ts +2 -0
- package/package.json +8 -7
- package/dist/_chunks/App-B83DZ9NG.js +0 -70
- package/dist/_chunks/App-BUSTbkyy.mjs +0 -68
- package/dist/_chunks/Dashboard-CNMTzSyc.js +0 -180
- package/dist/_chunks/Dashboard-Dbwl0ZBo.mjs +0 -180
- package/dist/_chunks/Settings-Dq1xy32B.js +0 -357
- package/dist/_chunks/Settings-jmGslDsB.mjs +0 -357
- package/dist/admin/src/pages/HomePage.d.ts +0 -2
|
@@ -1,9 +1,117 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import { Box,
|
|
3
|
+
import { Box, Typography, Table, Thead, Tr, Th, Tbody, Td, Flex, Badge, Loader, EmptyStateLayout, Button, Card, Grid, TextInput, SingleSelect, SingleSelectOption, Pagination } from "@strapi/design-system";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
5
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
6
|
-
import { P as PLUGIN_ID } from "./index-
|
|
6
|
+
import { P as PLUGIN_ID } from "./index-2Zd_T7bD.mjs";
|
|
7
|
+
const OrderList = ({ orders, onOrderClick, compact = false }) => {
|
|
8
|
+
const { formatMessage } = useIntl();
|
|
9
|
+
console.log("Orders:", orders);
|
|
10
|
+
const formatCurrency = (amount, currency = "usd") => {
|
|
11
|
+
return new Intl.NumberFormat("en-US", {
|
|
12
|
+
style: "currency",
|
|
13
|
+
currency: currency.toUpperCase()
|
|
14
|
+
}).format(amount);
|
|
15
|
+
};
|
|
16
|
+
const getStatusBadge = (status, type) => {
|
|
17
|
+
const configs = {
|
|
18
|
+
order: {
|
|
19
|
+
pending: { color: "warning", label: "Pending" },
|
|
20
|
+
processing: { color: "info", label: "Processing" },
|
|
21
|
+
shipped: { color: "secondary", label: "Shipped" },
|
|
22
|
+
delivered: { color: "success", label: "Delivered" },
|
|
23
|
+
cancelled: { color: "danger", label: "Cancelled" },
|
|
24
|
+
refunded: { color: "neutral", label: "Refunded" }
|
|
25
|
+
},
|
|
26
|
+
payment: {
|
|
27
|
+
unpaid: { color: "danger", label: "Unpaid" },
|
|
28
|
+
paid: { color: "success", label: "Paid" },
|
|
29
|
+
partially_paid: { color: "warning", label: "Partially Paid" },
|
|
30
|
+
refunded: { color: "neutral", label: "Refunded" }
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
let config;
|
|
34
|
+
if (type === "order") {
|
|
35
|
+
config = configs.order[status] || configs.order.pending;
|
|
36
|
+
} else {
|
|
37
|
+
config = configs.payment[status] || configs.payment.unpaid;
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx(Badge, { size: compact ? "S" : "M", backgroundColor: config.color, children: config.label });
|
|
40
|
+
};
|
|
41
|
+
const handleOrderClick = (order) => {
|
|
42
|
+
if (onOrderClick) {
|
|
43
|
+
onOrderClick(order);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
if (orders.length === 0) {
|
|
47
|
+
return /* @__PURE__ */ jsx(Box, { padding: 4, textAlign: "center", children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.orderList.empty", defaultMessage: "No orders found" }) }) });
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsxs(Table, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.orderNumber", defaultMessage: "Order #" }) }) }),
|
|
52
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.customer", defaultMessage: "Customer" }) }) }),
|
|
53
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.items", defaultMessage: "Items" }) }) }),
|
|
54
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.total", defaultMessage: "Total" }) }) }),
|
|
55
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.status", defaultMessage: "Status" }) }) }),
|
|
56
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.paymentStatus", defaultMessage: "Payment" }) }) })
|
|
57
|
+
] }) }),
|
|
58
|
+
/* @__PURE__ */ jsx(Tbody, { children: orders.map((order) => /* @__PURE__ */ jsxs(
|
|
59
|
+
Tr,
|
|
60
|
+
{
|
|
61
|
+
onClick: () => handleOrderClick(order),
|
|
62
|
+
style: { cursor: onOrderClick ? "pointer" : "default" },
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
65
|
+
Typography,
|
|
66
|
+
{
|
|
67
|
+
textColor: "neutral800",
|
|
68
|
+
fontWeight: "bold",
|
|
69
|
+
fontFamily: "monospace",
|
|
70
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
71
|
+
children: order.order_number
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, children: [
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
Typography,
|
|
77
|
+
{
|
|
78
|
+
textColor: "neutral800",
|
|
79
|
+
fontWeight: compact ? "normal" : "bold",
|
|
80
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
81
|
+
children: order.customerName || "Unknown"
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
compact && /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", fontSize: "0.75rem", children: order.customerEmail })
|
|
85
|
+
] }) }),
|
|
86
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(
|
|
87
|
+
Typography,
|
|
88
|
+
{
|
|
89
|
+
textColor: "neutral600",
|
|
90
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
91
|
+
children: [
|
|
92
|
+
order.items ? order.items.length : 0,
|
|
93
|
+
" ",
|
|
94
|
+
order.items && order.items.length === 1 ? "item" : "items"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
) }),
|
|
98
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
99
|
+
Typography,
|
|
100
|
+
{
|
|
101
|
+
textColor: "neutral800",
|
|
102
|
+
fontWeight: "bold",
|
|
103
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
104
|
+
children: formatCurrency(order.total_amount, order.currency)
|
|
105
|
+
}
|
|
106
|
+
) }),
|
|
107
|
+
/* @__PURE__ */ jsx(Td, { children: getStatusBadge(order.order_status, "order") }),
|
|
108
|
+
/* @__PURE__ */ jsx(Td, { children: getStatusBadge(order.paymentStatus, "payment") })
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
order.id
|
|
112
|
+
)) })
|
|
113
|
+
] });
|
|
114
|
+
};
|
|
7
115
|
const Orders = () => {
|
|
8
116
|
const { formatMessage } = useIntl();
|
|
9
117
|
const { get } = useFetchClient();
|
|
@@ -15,7 +123,7 @@ const Orders = () => {
|
|
|
15
123
|
const [pageSize, setPageSize] = useState(25);
|
|
16
124
|
const [totalCount, setTotalCount] = useState(0);
|
|
17
125
|
const [filters, setFilters] = useState({
|
|
18
|
-
|
|
126
|
+
order_status: "",
|
|
19
127
|
paymentStatus: "",
|
|
20
128
|
dateRange: { from: null, to: null },
|
|
21
129
|
search: "",
|
|
@@ -33,22 +141,17 @@ const Orders = () => {
|
|
|
33
141
|
const queryParams = new URLSearchParams({
|
|
34
142
|
page: currentPage.toString(),
|
|
35
143
|
pageSize: pageSize.toString(),
|
|
36
|
-
...filters.
|
|
144
|
+
...filters.order_status && { order_status: filters.order_status }
|
|
37
145
|
});
|
|
38
146
|
const { data } = await get(`/${PLUGIN_ID}/admin/orders?${queryParams}`);
|
|
39
147
|
if (data.success && data.data) {
|
|
40
148
|
const formattedOrders = data.data.map((o) => ({
|
|
149
|
+
...o,
|
|
41
150
|
id: o.documentId,
|
|
42
|
-
orderNumber: o.order_number,
|
|
43
151
|
customerEmail: o.customer?.email || "N/A",
|
|
44
|
-
customerName: o.customer ? `${o.customer.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
currency: o.currency,
|
|
48
|
-
paymentStatus: o.status === "completed" ? "paid" : "unpaid",
|
|
49
|
-
items: Array.isArray(o.items) ? o.items : [],
|
|
50
|
-
createdAt: o.createdAt,
|
|
51
|
-
updatedAt: o.updatedAt
|
|
152
|
+
customerName: o.customer ? `${o.customer.first_name || ""} ${o.customer.last_name || ""}`.trim() : "N/A",
|
|
153
|
+
paymentStatus: o.payment_status || (o.order_status === "completed" ? "paid" : "unpaid"),
|
|
154
|
+
items: Array.isArray(o.items) ? o.items : []
|
|
52
155
|
}));
|
|
53
156
|
setOrders(formattedOrders);
|
|
54
157
|
setTotalCount(data.meta.pagination.total);
|
|
@@ -64,11 +167,11 @@ const Orders = () => {
|
|
|
64
167
|
if (filters.search) {
|
|
65
168
|
const searchLower = filters.search.toLowerCase();
|
|
66
169
|
filtered = filtered.filter(
|
|
67
|
-
(order) => order.
|
|
170
|
+
(order) => order.order_number && order.order_number.toLowerCase().includes(searchLower) || order.customerEmail && order.customerEmail.toLowerCase().includes(searchLower) || order.customerName && order.customerName.toLowerCase().includes(searchLower)
|
|
68
171
|
);
|
|
69
172
|
}
|
|
70
|
-
if (filters.
|
|
71
|
-
filtered = filtered.filter((order) => order.
|
|
173
|
+
if (filters.order_status) {
|
|
174
|
+
filtered = filtered.filter((order) => order.order_status === filters.order_status);
|
|
72
175
|
}
|
|
73
176
|
if (filters.paymentStatus) {
|
|
74
177
|
filtered = filtered.filter((order) => order.paymentStatus === filters.paymentStatus);
|
|
@@ -88,11 +191,8 @@ const Orders = () => {
|
|
|
88
191
|
}
|
|
89
192
|
setFilteredOrders(filtered);
|
|
90
193
|
};
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
style: "currency",
|
|
94
|
-
currency: currency.toUpperCase()
|
|
95
|
-
}).format(amount);
|
|
194
|
+
const handleOrderClick = (order) => {
|
|
195
|
+
console.log("Clicked order:", order);
|
|
96
196
|
};
|
|
97
197
|
const formatDate = (dateString) => {
|
|
98
198
|
return new Date(dateString).toLocaleDateString("en-US", {
|
|
@@ -103,33 +203,13 @@ const Orders = () => {
|
|
|
103
203
|
minute: "2-digit"
|
|
104
204
|
});
|
|
105
205
|
};
|
|
106
|
-
const getStatusBadge = (status, type) => {
|
|
107
|
-
const configs = {
|
|
108
|
-
order: {
|
|
109
|
-
pending: { color: "warning", label: "Pending" },
|
|
110
|
-
processing: { color: "info", label: "Processing" },
|
|
111
|
-
shipped: { color: "secondary", label: "Shipped" },
|
|
112
|
-
delivered: { color: "success", label: "Delivered" },
|
|
113
|
-
cancelled: { color: "danger", label: "Cancelled" },
|
|
114
|
-
refunded: { color: "neutral", label: "Refunded" }
|
|
115
|
-
},
|
|
116
|
-
payment: {
|
|
117
|
-
unpaid: { color: "danger", label: "Unpaid" },
|
|
118
|
-
paid: { color: "success", label: "Paid" },
|
|
119
|
-
partially_paid: { color: "warning", label: "Partially Paid" },
|
|
120
|
-
refunded: { color: "neutral", label: "Refunded" }
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const config = type === "order" ? configs.order[status] || configs.order.pending : configs.payment[status] || configs.payment.unpaid;
|
|
124
|
-
return /* @__PURE__ */ jsx(Badge, { size: "S", backgroundColor: config.color, children: config.label });
|
|
125
|
-
};
|
|
126
206
|
const handleFilterChange = (key, value) => {
|
|
127
207
|
setFilters((prev) => ({ ...prev, [key]: value }));
|
|
128
208
|
setCurrentPage(1);
|
|
129
209
|
};
|
|
130
210
|
const clearFilters = () => {
|
|
131
211
|
setFilters({
|
|
132
|
-
|
|
212
|
+
order_status: "",
|
|
133
213
|
paymentStatus: "",
|
|
134
214
|
dateRange: { from: null, to: null },
|
|
135
215
|
search: "",
|
|
@@ -141,12 +221,12 @@ const Orders = () => {
|
|
|
141
221
|
const csvContent = [
|
|
142
222
|
["Order Number", "Customer Email", "Customer Name", "Status", "Payment Status", "Total Amount", "Currency", "Date"],
|
|
143
223
|
...filteredOrders.map((order) => [
|
|
144
|
-
order.
|
|
145
|
-
order.customerEmail,
|
|
224
|
+
order.order_number || "",
|
|
225
|
+
order.customerEmail || "",
|
|
146
226
|
order.customerName || "",
|
|
147
|
-
order.
|
|
148
|
-
order.paymentStatus,
|
|
149
|
-
|
|
227
|
+
order.order_status,
|
|
228
|
+
order.paymentStatus || "",
|
|
229
|
+
order.total_amount.toString(),
|
|
150
230
|
order.currency,
|
|
151
231
|
formatDate(order.createdAt)
|
|
152
232
|
])
|
|
@@ -164,10 +244,10 @@ const Orders = () => {
|
|
|
164
244
|
const paginatedOrders = filteredOrders.slice(startIndex, endIndex);
|
|
165
245
|
const totalPages = Math.ceil(filteredOrders.length / pageSize);
|
|
166
246
|
if (loading && orders.length === 0) {
|
|
167
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
247
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsx(Loader, {}) }) });
|
|
168
248
|
}
|
|
169
249
|
if (error) {
|
|
170
|
-
return /* @__PURE__ */ jsx(Box, {
|
|
250
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
171
251
|
EmptyStateLayout,
|
|
172
252
|
{
|
|
173
253
|
title: "Error loading orders",
|
|
@@ -176,7 +256,7 @@ const Orders = () => {
|
|
|
176
256
|
}
|
|
177
257
|
) });
|
|
178
258
|
}
|
|
179
|
-
return /* @__PURE__ */ jsxs(Box, {
|
|
259
|
+
return /* @__PURE__ */ jsxs(Box, { children: [
|
|
180
260
|
/* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
181
261
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
182
262
|
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.orders.title", defaultMessage: "Orders" }) }),
|
|
@@ -187,7 +267,7 @@ const Orders = () => {
|
|
|
187
267
|
] }),
|
|
188
268
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
189
269
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: exportOrders, children: formatMessage({ id: "payment-plugin.orders.export", defaultMessage: "Export" }) }),
|
|
190
|
-
/* @__PURE__ */ jsx(Button, { onClick:
|
|
270
|
+
/* @__PURE__ */ jsx(Button, { onClick: fetchOrders })
|
|
191
271
|
] })
|
|
192
272
|
] }) }),
|
|
193
273
|
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
@@ -209,8 +289,8 @@ const Orders = () => {
|
|
|
209
289
|
id: "payment-plugin.orders.status.placeholder",
|
|
210
290
|
defaultMessage: "All Statuses"
|
|
211
291
|
}),
|
|
212
|
-
value: filters.
|
|
213
|
-
onChange: (value) => handleFilterChange("
|
|
292
|
+
value: filters.order_status,
|
|
293
|
+
onChange: (value) => handleFilterChange("order_status", value),
|
|
214
294
|
children: [
|
|
215
295
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "", children: formatMessage({ id: "payment-plugin.orders.all", defaultMessage: "All" }) }),
|
|
216
296
|
/* @__PURE__ */ jsx(SingleSelectOption, { value: "pending", children: formatMessage({ id: "payment-plugin.orders.pending", defaultMessage: "Pending" }) }),
|
|
@@ -266,33 +346,13 @@ const Orders = () => {
|
|
|
266
346
|
total: filteredOrders.length
|
|
267
347
|
}
|
|
268
348
|
) }) }),
|
|
269
|
-
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.orders.paymentStatus", defaultMessage: "Payment Status" }) }) }),
|
|
277
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.orders.date", defaultMessage: "Date" }) }) })
|
|
278
|
-
] }) }),
|
|
279
|
-
/* @__PURE__ */ jsx(Tbody, { children: paginatedOrders.map((order) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
280
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", fontFamily: "monospace", children: order.orderNumber }) }),
|
|
281
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
282
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: order.customerName || "Unknown -" }),
|
|
283
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral600", variant: "epsilon", children: order.customerEmail })
|
|
284
|
-
] }) }),
|
|
285
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Typography, { textColor: "neutral600", children: [
|
|
286
|
-
order.items.length,
|
|
287
|
-
" ",
|
|
288
|
-
order.items.length === 1 ? "item" : "items"
|
|
289
|
-
] }) }),
|
|
290
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(order.totalAmount, order.currency) }) }),
|
|
291
|
-
/* @__PURE__ */ jsx(Td, { children: getStatusBadge(order.status, "order") }),
|
|
292
|
-
/* @__PURE__ */ jsx(Td, { children: getStatusBadge(order.paymentStatus, "payment") }),
|
|
293
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral600", children: formatDate(order.createdAt) }) })
|
|
294
|
-
] }, order.id)) })
|
|
295
|
-
] }) }) }),
|
|
349
|
+
/* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(
|
|
350
|
+
OrderList,
|
|
351
|
+
{
|
|
352
|
+
orders: paginatedOrders,
|
|
353
|
+
onOrderClick: handleOrderClick
|
|
354
|
+
}
|
|
355
|
+
) }),
|
|
296
356
|
totalPages > 1 && /* @__PURE__ */ jsx(Box, { marginTop: 4, children: /* @__PURE__ */ jsx(
|
|
297
357
|
Pagination,
|
|
298
358
|
{
|
|
@@ -5,7 +5,115 @@ const React = require("react");
|
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
|
6
6
|
const reactIntl = require("react-intl");
|
|
7
7
|
const admin = require("@strapi/strapi/admin");
|
|
8
|
-
const index = require("./index-
|
|
8
|
+
const index = require("./index-CHEgJ7e5.js");
|
|
9
|
+
const OrderList = ({ orders, onOrderClick, compact = false }) => {
|
|
10
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
11
|
+
console.log("Orders:", orders);
|
|
12
|
+
const formatCurrency = (amount, currency = "usd") => {
|
|
13
|
+
return new Intl.NumberFormat("en-US", {
|
|
14
|
+
style: "currency",
|
|
15
|
+
currency: currency.toUpperCase()
|
|
16
|
+
}).format(amount);
|
|
17
|
+
};
|
|
18
|
+
const getStatusBadge = (status, type) => {
|
|
19
|
+
const configs = {
|
|
20
|
+
order: {
|
|
21
|
+
pending: { color: "warning", label: "Pending" },
|
|
22
|
+
processing: { color: "info", label: "Processing" },
|
|
23
|
+
shipped: { color: "secondary", label: "Shipped" },
|
|
24
|
+
delivered: { color: "success", label: "Delivered" },
|
|
25
|
+
cancelled: { color: "danger", label: "Cancelled" },
|
|
26
|
+
refunded: { color: "neutral", label: "Refunded" }
|
|
27
|
+
},
|
|
28
|
+
payment: {
|
|
29
|
+
unpaid: { color: "danger", label: "Unpaid" },
|
|
30
|
+
paid: { color: "success", label: "Paid" },
|
|
31
|
+
partially_paid: { color: "warning", label: "Partially Paid" },
|
|
32
|
+
refunded: { color: "neutral", label: "Refunded" }
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
let config;
|
|
36
|
+
if (type === "order") {
|
|
37
|
+
config = configs.order[status] || configs.order.pending;
|
|
38
|
+
} else {
|
|
39
|
+
config = configs.payment[status] || configs.payment.unpaid;
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { size: compact ? "S" : "M", backgroundColor: config.color, children: config.label });
|
|
42
|
+
};
|
|
43
|
+
const handleOrderClick = (order) => {
|
|
44
|
+
if (onOrderClick) {
|
|
45
|
+
onOrderClick(order);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
if (orders.length === 0) {
|
|
49
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, textAlign: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: formatMessage({ id: "payment-plugin.orderList.empty", defaultMessage: "No orders found" }) }) });
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { children: [
|
|
52
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
53
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.orderNumber", defaultMessage: "Order #" }) }) }),
|
|
54
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.customer", defaultMessage: "Customer" }) }) }),
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.items", defaultMessage: "Items" }) }) }),
|
|
56
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.total", defaultMessage: "Total" }) }) }),
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.status", defaultMessage: "Status" }) }) }),
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: compact ? "epsilon" : "delta", children: formatMessage({ id: "payment-plugin.orderList.paymentStatus", defaultMessage: "Payment" }) }) })
|
|
59
|
+
] }) }),
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: orders.map((order) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
61
|
+
designSystem.Tr,
|
|
62
|
+
{
|
|
63
|
+
onClick: () => handleOrderClick(order),
|
|
64
|
+
style: { cursor: onOrderClick ? "pointer" : "default" },
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
designSystem.Typography,
|
|
68
|
+
{
|
|
69
|
+
textColor: "neutral800",
|
|
70
|
+
fontWeight: "bold",
|
|
71
|
+
fontFamily: "monospace",
|
|
72
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
73
|
+
children: order.order_number
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 1, children: [
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
designSystem.Typography,
|
|
79
|
+
{
|
|
80
|
+
textColor: "neutral800",
|
|
81
|
+
fontWeight: compact ? "normal" : "bold",
|
|
82
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
83
|
+
children: order.customerName || "Unknown"
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
compact && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", fontSize: "0.75rem", children: order.customerEmail })
|
|
87
|
+
] }) }),
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
89
|
+
designSystem.Typography,
|
|
90
|
+
{
|
|
91
|
+
textColor: "neutral600",
|
|
92
|
+
fontSize: compact ? "0.75rem" : "0.875rem",
|
|
93
|
+
children: [
|
|
94
|
+
order.items ? order.items.length : 0,
|
|
95
|
+
" ",
|
|
96
|
+
order.items && order.items.length === 1 ? "item" : "items"
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
) }),
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
+
designSystem.Typography,
|
|
102
|
+
{
|
|
103
|
+
textColor: "neutral800",
|
|
104
|
+
fontWeight: "bold",
|
|
105
|
+
fontSize: compact ? "0.875rem" : "1rem",
|
|
106
|
+
children: formatCurrency(order.total_amount, order.currency)
|
|
107
|
+
}
|
|
108
|
+
) }),
|
|
109
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getStatusBadge(order.order_status, "order") }),
|
|
110
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getStatusBadge(order.paymentStatus, "payment") })
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
order.id
|
|
114
|
+
)) })
|
|
115
|
+
] });
|
|
116
|
+
};
|
|
9
117
|
const Orders = () => {
|
|
10
118
|
const { formatMessage } = reactIntl.useIntl();
|
|
11
119
|
const { get } = admin.useFetchClient();
|
|
@@ -17,7 +125,7 @@ const Orders = () => {
|
|
|
17
125
|
const [pageSize, setPageSize] = React.useState(25);
|
|
18
126
|
const [totalCount, setTotalCount] = React.useState(0);
|
|
19
127
|
const [filters, setFilters] = React.useState({
|
|
20
|
-
|
|
128
|
+
order_status: "",
|
|
21
129
|
paymentStatus: "",
|
|
22
130
|
dateRange: { from: null, to: null },
|
|
23
131
|
search: "",
|
|
@@ -35,22 +143,17 @@ const Orders = () => {
|
|
|
35
143
|
const queryParams = new URLSearchParams({
|
|
36
144
|
page: currentPage.toString(),
|
|
37
145
|
pageSize: pageSize.toString(),
|
|
38
|
-
...filters.
|
|
146
|
+
...filters.order_status && { order_status: filters.order_status }
|
|
39
147
|
});
|
|
40
148
|
const { data } = await get(`/${index.PLUGIN_ID}/admin/orders?${queryParams}`);
|
|
41
149
|
if (data.success && data.data) {
|
|
42
150
|
const formattedOrders = data.data.map((o) => ({
|
|
151
|
+
...o,
|
|
43
152
|
id: o.documentId,
|
|
44
|
-
orderNumber: o.order_number,
|
|
45
153
|
customerEmail: o.customer?.email || "N/A",
|
|
46
|
-
customerName: o.customer ? `${o.customer.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
currency: o.currency,
|
|
50
|
-
paymentStatus: o.status === "completed" ? "paid" : "unpaid",
|
|
51
|
-
items: Array.isArray(o.items) ? o.items : [],
|
|
52
|
-
createdAt: o.createdAt,
|
|
53
|
-
updatedAt: o.updatedAt
|
|
154
|
+
customerName: o.customer ? `${o.customer.first_name || ""} ${o.customer.last_name || ""}`.trim() : "N/A",
|
|
155
|
+
paymentStatus: o.payment_status || (o.order_status === "completed" ? "paid" : "unpaid"),
|
|
156
|
+
items: Array.isArray(o.items) ? o.items : []
|
|
54
157
|
}));
|
|
55
158
|
setOrders(formattedOrders);
|
|
56
159
|
setTotalCount(data.meta.pagination.total);
|
|
@@ -66,11 +169,11 @@ const Orders = () => {
|
|
|
66
169
|
if (filters.search) {
|
|
67
170
|
const searchLower = filters.search.toLowerCase();
|
|
68
171
|
filtered = filtered.filter(
|
|
69
|
-
(order) => order.
|
|
172
|
+
(order) => order.order_number && order.order_number.toLowerCase().includes(searchLower) || order.customerEmail && order.customerEmail.toLowerCase().includes(searchLower) || order.customerName && order.customerName.toLowerCase().includes(searchLower)
|
|
70
173
|
);
|
|
71
174
|
}
|
|
72
|
-
if (filters.
|
|
73
|
-
filtered = filtered.filter((order) => order.
|
|
175
|
+
if (filters.order_status) {
|
|
176
|
+
filtered = filtered.filter((order) => order.order_status === filters.order_status);
|
|
74
177
|
}
|
|
75
178
|
if (filters.paymentStatus) {
|
|
76
179
|
filtered = filtered.filter((order) => order.paymentStatus === filters.paymentStatus);
|
|
@@ -90,11 +193,8 @@ const Orders = () => {
|
|
|
90
193
|
}
|
|
91
194
|
setFilteredOrders(filtered);
|
|
92
195
|
};
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
style: "currency",
|
|
96
|
-
currency: currency.toUpperCase()
|
|
97
|
-
}).format(amount);
|
|
196
|
+
const handleOrderClick = (order) => {
|
|
197
|
+
console.log("Clicked order:", order);
|
|
98
198
|
};
|
|
99
199
|
const formatDate = (dateString) => {
|
|
100
200
|
return new Date(dateString).toLocaleDateString("en-US", {
|
|
@@ -105,33 +205,13 @@ const Orders = () => {
|
|
|
105
205
|
minute: "2-digit"
|
|
106
206
|
});
|
|
107
207
|
};
|
|
108
|
-
const getStatusBadge = (status, type) => {
|
|
109
|
-
const configs = {
|
|
110
|
-
order: {
|
|
111
|
-
pending: { color: "warning", label: "Pending" },
|
|
112
|
-
processing: { color: "info", label: "Processing" },
|
|
113
|
-
shipped: { color: "secondary", label: "Shipped" },
|
|
114
|
-
delivered: { color: "success", label: "Delivered" },
|
|
115
|
-
cancelled: { color: "danger", label: "Cancelled" },
|
|
116
|
-
refunded: { color: "neutral", label: "Refunded" }
|
|
117
|
-
},
|
|
118
|
-
payment: {
|
|
119
|
-
unpaid: { color: "danger", label: "Unpaid" },
|
|
120
|
-
paid: { color: "success", label: "Paid" },
|
|
121
|
-
partially_paid: { color: "warning", label: "Partially Paid" },
|
|
122
|
-
refunded: { color: "neutral", label: "Refunded" }
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
const config = type === "order" ? configs.order[status] || configs.order.pending : configs.payment[status] || configs.payment.unpaid;
|
|
126
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { size: "S", backgroundColor: config.color, children: config.label });
|
|
127
|
-
};
|
|
128
208
|
const handleFilterChange = (key, value) => {
|
|
129
209
|
setFilters((prev) => ({ ...prev, [key]: value }));
|
|
130
210
|
setCurrentPage(1);
|
|
131
211
|
};
|
|
132
212
|
const clearFilters = () => {
|
|
133
213
|
setFilters({
|
|
134
|
-
|
|
214
|
+
order_status: "",
|
|
135
215
|
paymentStatus: "",
|
|
136
216
|
dateRange: { from: null, to: null },
|
|
137
217
|
search: "",
|
|
@@ -143,12 +223,12 @@ const Orders = () => {
|
|
|
143
223
|
const csvContent = [
|
|
144
224
|
["Order Number", "Customer Email", "Customer Name", "Status", "Payment Status", "Total Amount", "Currency", "Date"],
|
|
145
225
|
...filteredOrders.map((order) => [
|
|
146
|
-
order.
|
|
147
|
-
order.customerEmail,
|
|
226
|
+
order.order_number || "",
|
|
227
|
+
order.customerEmail || "",
|
|
148
228
|
order.customerName || "",
|
|
149
|
-
order.
|
|
150
|
-
order.paymentStatus,
|
|
151
|
-
|
|
229
|
+
order.order_status,
|
|
230
|
+
order.paymentStatus || "",
|
|
231
|
+
order.total_amount.toString(),
|
|
152
232
|
order.currency,
|
|
153
233
|
formatDate(order.createdAt)
|
|
154
234
|
])
|
|
@@ -166,10 +246,10 @@ const Orders = () => {
|
|
|
166
246
|
const paginatedOrders = filteredOrders.slice(startIndex, endIndex);
|
|
167
247
|
const totalPages = Math.ceil(filteredOrders.length / pageSize);
|
|
168
248
|
if (loading && orders.length === 0) {
|
|
169
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, {
|
|
249
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", alignItems: "center", style: { minHeight: "400px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, {}) }) });
|
|
170
250
|
}
|
|
171
251
|
if (error) {
|
|
172
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, {
|
|
252
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
173
253
|
designSystem.EmptyStateLayout,
|
|
174
254
|
{
|
|
175
255
|
title: "Error loading orders",
|
|
@@ -178,7 +258,7 @@ const Orders = () => {
|
|
|
178
258
|
}
|
|
179
259
|
) });
|
|
180
260
|
}
|
|
181
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, {
|
|
261
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
182
262
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", children: [
|
|
183
263
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
184
264
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: formatMessage({ id: "payment-plugin.orders.title", defaultMessage: "Orders" }) }),
|
|
@@ -189,7 +269,7 @@ const Orders = () => {
|
|
|
189
269
|
] }),
|
|
190
270
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
191
271
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: exportOrders, children: formatMessage({ id: "payment-plugin.orders.export", defaultMessage: "Export" }) }),
|
|
192
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick:
|
|
272
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: fetchOrders })
|
|
193
273
|
] })
|
|
194
274
|
] }) }),
|
|
195
275
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
|
|
@@ -211,8 +291,8 @@ const Orders = () => {
|
|
|
211
291
|
id: "payment-plugin.orders.status.placeholder",
|
|
212
292
|
defaultMessage: "All Statuses"
|
|
213
293
|
}),
|
|
214
|
-
value: filters.
|
|
215
|
-
onChange: (value) => handleFilterChange("
|
|
294
|
+
value: filters.order_status,
|
|
295
|
+
onChange: (value) => handleFilterChange("order_status", value),
|
|
216
296
|
children: [
|
|
217
297
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "", children: formatMessage({ id: "payment-plugin.orders.all", defaultMessage: "All" }) }),
|
|
218
298
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "pending", children: formatMessage({ id: "payment-plugin.orders.pending", defaultMessage: "Pending" }) }),
|
|
@@ -268,33 +348,13 @@ const Orders = () => {
|
|
|
268
348
|
total: filteredOrders.length
|
|
269
349
|
}
|
|
270
350
|
) }) }),
|
|
271
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.orders.paymentStatus", defaultMessage: "Payment Status" }) }) }),
|
|
279
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", children: formatMessage({ id: "payment-plugin.orders.date", defaultMessage: "Date" }) }) })
|
|
280
|
-
] }) }),
|
|
281
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: paginatedOrders.map((order) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
282
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", fontFamily: "monospace", children: order.orderNumber }) }),
|
|
283
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
284
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: order.customerName || "Unknown -" }),
|
|
285
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", variant: "epsilon", children: order.customerEmail })
|
|
286
|
-
] }) }),
|
|
287
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { textColor: "neutral600", children: [
|
|
288
|
-
order.items.length,
|
|
289
|
-
" ",
|
|
290
|
-
order.items.length === 1 ? "item" : "items"
|
|
291
|
-
] }) }),
|
|
292
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", fontWeight: "bold", children: formatCurrency(order.totalAmount, order.currency) }) }),
|
|
293
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getStatusBadge(order.status, "order") }),
|
|
294
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: getStatusBadge(order.paymentStatus, "payment") }),
|
|
295
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatDate(order.createdAt) }) })
|
|
296
|
-
] }, order.id)) })
|
|
297
|
-
] }) }) }),
|
|
351
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Card, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
352
|
+
OrderList,
|
|
353
|
+
{
|
|
354
|
+
orders: paginatedOrders,
|
|
355
|
+
onOrderClick: handleOrderClick
|
|
356
|
+
}
|
|
357
|
+
) }),
|
|
298
358
|
totalPages > 1 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
299
359
|
designSystem.Pagination,
|
|
300
360
|
{
|