umwd-components 0.1.835 → 0.1.836

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.
@@ -13,9 +13,10 @@ import TableCell from '@mui/material/TableCell';
13
13
  import TableBody from '@mui/material/TableBody';
14
14
  import { OpoSummary } from './OpoSummary.js';
15
15
  import { PaymentStatusIndicator } from './PaymentStatusIndicator.js';
16
+ import { ShippingStatusIndicator } from './ShippingStatusIndicator.js';
16
17
 
17
18
  function OpoDisplay({ opo }) {
18
- return (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Order Details" }), jsxs(Table, { children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Order number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Payment status" })] }) }), jsx(TableBody, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: opo.opo_number }), jsx(TableCell, { children: opo.order_date }), jsx(TableCell, { children: jsx(PaymentStatusIndicator, { payment_status: opo?.payments?.[0]?.payment_status, provider_id: opo?.payments?.[0]?.provider_id }) })] }) })] }), jsx(Typography, { variant: "body1", sx: { mt: 2 }, children: "Contents of the order:" }), jsx(OpoSummary, { opo: opo })] }));
19
+ return (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Order Details" }), jsxs(Table, { children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Order number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Payment status" }), jsx(TableCell, { children: "Shipping status" })] }) }), jsx(TableBody, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: opo.opo_number }), jsx(TableCell, { children: opo.order_date }), jsx(TableCell, { children: jsx(PaymentStatusIndicator, { payment_status: opo?.payments?.[0]?.payment_status, provider_id: opo?.payments?.[0]?.provider_id }) }), jsx(TableCell, { children: jsx(ShippingStatusIndicator, { shipping_status: opo?.parcel_reference?.parcel_status, provider_id: opo?.parcel_reference?.external_id }) })] }) })] }), jsx(Typography, { variant: "body1", sx: { mt: 2 }, children: "Contents of the order:" }), jsx(OpoSummary, { opo: opo })] }));
19
20
  }
20
21
 
21
22
  export { OpoDisplay as default };
@@ -0,0 +1,27 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import { jsx } from 'react/jsx-runtime';
8
+ import Chip from '@mui/material/Chip';
9
+
10
+ const statusColorArray = [
11
+ { status: "open", color: "warning" },
12
+ { status: "pending", color: "warning" },
13
+ { status: "authorized", color: "info" },
14
+ { status: "paid", color: "success" },
15
+ { status: "canceled", color: "error" },
16
+ { status: "expired", color: "error" },
17
+ { status: "failed", color: "error" },
18
+ ];
19
+ const ShippingStatusIndicator = ({ shipping_status, provider_id = "" }) => {
20
+ const readableStatus = shipping_status
21
+ ? shipping_status.charAt(0).toUpperCase() + shipping_status.slice(1)
22
+ : "Unknown";
23
+ return (jsx(Chip, { label: readableStatus, color: statusColorArray.find((s) => s.status === shipping_status)?.color ||
24
+ "default" }));
25
+ };
26
+
27
+ export { ShippingStatusIndicator };
@@ -78,6 +78,7 @@ filters = {}) {
78
78
  iros: {
79
79
  fields: ["id", "uuid", "internal_status"],
80
80
  },
81
+ parcel_reference: true,
81
82
  },
82
83
  pagination: {
83
84
  pageSize: rowsPerPage || 10,
@@ -222,3 +222,4 @@ export { getAllMinioReferences } from './data/loaders/common/media/minio/getAllM
222
222
  export { MinioItemList } from './components/common/media/minio/MinioItemList.js';
223
223
  export { MinioDisplay } from './components/common/media/minio/MinioDisplay.js';
224
224
  export { contactFormAction } from './data/actions/e-commerce/lead/contactFormAction.js';
225
+ export { ShippingStatusIndicator } from './components/e-commerce/opo/ShippingStatusIndicator.js';