umwd-components 0.1.719 → 0.1.721

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.
@@ -28,7 +28,7 @@ function EnhancedTable(props) {
28
28
  const pathname = usePathname();
29
29
  const searchParams = useSearchParams();
30
30
  const [order, setOrder] = useState("asc");
31
- const [orderBy, setOrderBy] = useState("id");
31
+ const [orderBy, setOrderBy] = useState("createdAt");
32
32
  const [selected, setSelected] = useState([]);
33
33
  const [page, setPage] = useState(0);
34
34
  const [dense, setDense] = useState(false);
@@ -56,7 +56,7 @@ function EnhancedTable(props) {
56
56
  const handleSelectAllClick = (e) => {
57
57
  const target = e.target;
58
58
  if (target.checked) {
59
- const newSelected = data.map((n) => n.id);
59
+ const newSelected = data.map((n) => n.documentId);
60
60
  setSelected(newSelected);
61
61
  return;
62
62
  }
@@ -159,7 +159,7 @@ function EnhancedTable(props) {
159
159
  });
160
160
  }
161
161
  }, [order, orderBy, page, rowsPerPage, filters]);
162
- return (jsxs(Box, { sx: { width: "100%" }, children: [jsxs(Paper, { sx: { width: "100%", mb: 2 }, children: [jsx(EnhancedTableToolbar, { selected: selected, setSelected: setSelected, title: title, functions: functions, selectFunctions: selectFunctions, showFilters: showFilters, onToggleFilters: () => setShowFilters(!showFilters), hasFilterableColumns: hasFilterableColumns }), jsx(TableContainer, { children: jsxs(Table, { sx: { minWidth: 750 }, "aria-labelledby": "tableTitle", size: dense ? "small" : "medium", children: [jsx(EnhancedTableHead, { numSelected: selected.length, order: order, orderBy: orderBy, onSelectAllClick: handleSelectAllClick, onRequestSort: handleRequestSort, rowCount: data.length, headCells: headCells, withSelection: withSelection, withSubRows: !!subHeadCells }), jsxs(TableBody, { children: [showFilters && (jsx(EnhancedTableFilterRow, { headCells: headCells, filters: filters, onFilterChange: handleFilterChange, withSelection: withSelection, withSubRows: !!subHeadCells })), data.map((row, index) => (jsx(EnhancedTableRow, { row: row, headCells: headCells, subHeadCells: subHeadCells, withSelection: withSelection, isSelected: selected.includes(row.id), handleSelectClick: handleSelectClick, subTitle: subTitle }, row.id))), emptyRows > 0 && (jsx(TableRow, { style: {
162
+ return (jsxs(Box, { sx: { width: "100%" }, children: [jsxs(Paper, { sx: { width: "100%", mb: 2 }, children: [jsx(EnhancedTableToolbar, { selected: selected, setSelected: setSelected, title: title, functions: functions, selectFunctions: selectFunctions, showFilters: showFilters, onToggleFilters: () => setShowFilters(!showFilters), hasFilterableColumns: hasFilterableColumns }), jsx(TableContainer, { children: jsxs(Table, { sx: { minWidth: 750 }, "aria-labelledby": "tableTitle", size: dense ? "small" : "medium", children: [jsx(EnhancedTableHead, { numSelected: selected.length, order: order, orderBy: orderBy, onSelectAllClick: handleSelectAllClick, onRequestSort: handleRequestSort, rowCount: data.length, headCells: headCells, withSelection: withSelection, withSubRows: !!subHeadCells }), jsxs(TableBody, { children: [showFilters && (jsx(EnhancedTableFilterRow, { headCells: headCells, filters: filters, onFilterChange: handleFilterChange, withSelection: withSelection, withSubRows: !!subHeadCells })), data.map((row, index) => (jsx(EnhancedTableRow, { row: row, headCells: headCells, subHeadCells: subHeadCells, withSelection: withSelection, isSelected: selected.includes(row.documentId), handleSelectClick: handleSelectClick, subTitle: subTitle }, row.id))), emptyRows > 0 && (jsx(TableRow, { style: {
163
163
  height: (dense ? 33 : 53) * emptyRows,
164
164
  }, children: jsx(TableCell, { colSpan: headCells.length +
165
165
  (withSelection ? 1 : 0) +
@@ -27,7 +27,7 @@ function EnhancedTableRow(props, index) {
27
27
  const colspan = headCells.length + (withSelection ? 1 : 0) + (subHeadCells ? 1 : 0);
28
28
  return (jsxs(Fragment, { children: [jsxs(TableRow, { sx: { "& > *": { borderBottom: "unset" } }, children: [withSelection && (jsx(TableCell, { padding: "checkbox", children: jsx(Checkbox, { color: "primary", checked: isSelected, inputProps: {
29
29
  "aria-labelledby": labelId,
30
- }, onClick: (event) => handleSelectClick && handleSelectClick(event, row.id) }) })), subRows && subHeadCells && (jsx(TableCell, { children: jsx(IconButton, { "aria-label": "expand row", size: "small", onClick: () => setOpen(!open), children: open ? jsx(KeyboardArrowUpIcon, {}) : jsx(KeyboardArrowDownIcon, {}) }) })), headCells.map((cell) => (jsx(TableCell, { align: cell.numeric ? "right" : "left", padding: cell.disablePadding ? "none" : "normal", children: row[cell.id] }, cell.id)))] }), subRows && subHeadCells && (jsx(TableRow, { children: jsx(TableCell, { style: { paddingBottom: 0, paddingTop: 0 }, colSpan: colspan, children: jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: jsxs(Box, { sx: { margin: 1 }, children: [jsx(Typography, { variant: "h6", gutterBottom: true, component: "div", children: subTitle }), jsxs(Table, { size: "small", "aria-label": "purchases", children: [jsx(TableHead, { children: jsx(TableRow, { children: subHeadCells.map((cell) => (jsx(TableCell, { align: cell.numeric ? "right" : "left", padding: cell.disablePadding ? "none" : "normal", children: cell.label }, `${cell.id}${cell.label}`))) }) }), jsx(TableBody, { children: subRows.map((subRow, index) => (jsx(TableRow, { children: subHeadCells.map((cell, index) => (jsx(TableCell, { align: cell.numeric ? "right" : "left", padding: cell.disablePadding ? "none" : "normal", children: subRow[cell.id] }, `${index}${cell.label}`))) }, `${subRow.key}${index}`))) })] })] }) }) }) }))] }));
30
+ }, onClick: (event) => handleSelectClick && handleSelectClick(event, row.documentId) }) })), subRows && subHeadCells && (jsx(TableCell, { children: jsx(IconButton, { "aria-label": "expand row", size: "small", onClick: () => setOpen(!open), children: open ? jsx(KeyboardArrowUpIcon, {}) : jsx(KeyboardArrowDownIcon, {}) }) })), headCells.map((cell) => (jsx(TableCell, { align: cell.numeric ? "right" : "left", padding: cell.disablePadding ? "none" : "normal", children: row[cell.id] }, cell.id)))] }), subRows && subHeadCells && (jsx(TableRow, { children: jsx(TableCell, { style: { paddingBottom: 0, paddingTop: 0 }, colSpan: colspan, children: jsx(Collapse, { in: open, timeout: "auto", unmountOnExit: true, children: jsxs(Box, { sx: { margin: 1 }, children: [jsx(Typography, { variant: "h6", gutterBottom: true, component: "div", children: subTitle }), jsxs(Table, { size: "small", "aria-label": "purchases", children: [jsx(TableHead, { children: jsx(TableRow, { children: subHeadCells.map((cell) => (jsx(TableCell, { align: cell.numeric ? "right" : "left", padding: cell.disablePadding ? "none" : "normal", children: cell.label }, `${cell.id}${cell.label}`))) }) }), jsx(TableBody, { children: subRows.map((subRow, index) => (jsx(TableRow, { children: subHeadCells.map((cell, index) => (jsx(TableCell, { align: cell.numeric ? "right" : "left", padding: cell.disablePadding ? "none" : "normal", children: subRow[cell.id] }, `${index}${cell.label}`))) }, `${subRow.key}${index}`))) })] })] }) }) }) }))] }));
31
31
  }
32
32
 
33
33
  export { EnhancedTableRow as default };
@@ -28,29 +28,30 @@ function FeatureSection({ data, }) {
28
28
  [theme.breakpoints.up("sm")]: {
29
29
  flexDirection: "row",
30
30
  },
31
- }, useFlexGap: true, children: feature.map((feature) => {
32
- const Icon = getIcon(feature.icon);
33
- return (jsx(Card, { id: feature.anchor || "", sx: {
34
- display: "flex",
35
- flexDirection: "column",
36
- justifyContent: "space-between",
37
- flex: 1,
38
- minWidth: 275,
39
- }, children: jsxs(CardContent, { children: [jsx(Box, { sx: {
40
- height: 100,
41
- display: "grid",
42
- alignItems: "center",
43
- justifyContent: "center",
44
- }, children: Icon !== null && (jsx(Icon, { sx: {
45
- mr: 2,
46
- mt: 0.2,
47
- width: "75px",
48
- height: "75px",
49
- fill: "none",
50
- stroke: "currentColor",
51
- strokeWidth: 0.5,
52
- } })) }), jsx(Typography, { variant: "h5", align: "center", component: "div", sx: { mb: 2, height: "4rem" }, children: feature.heading }), jsx(Typography, { variant: "h6", align: "center", component: "div", sx: { mb: 2, height: "4rem" }, children: feature.subHeading }), feature.text && jsx(MuiMarkdown, { children: feature.text })] }) }, feature.id));
53
- }) }) }));
31
+ }, useFlexGap: true, children: feature &&
32
+ feature.map((feature) => {
33
+ const Icon = getIcon(feature.icon);
34
+ return (jsx(Card, { id: feature.anchor || "", sx: {
35
+ display: "flex",
36
+ flexDirection: "column",
37
+ justifyContent: "space-between",
38
+ flex: 1,
39
+ minWidth: 275,
40
+ }, children: jsxs(CardContent, { children: [jsx(Box, { sx: {
41
+ height: 100,
42
+ display: "grid",
43
+ alignItems: "center",
44
+ justifyContent: "center",
45
+ }, children: Icon !== null && (jsx(Icon, { sx: {
46
+ mr: 2,
47
+ mt: 0.2,
48
+ width: "75px",
49
+ height: "75px",
50
+ fill: "none",
51
+ stroke: "currentColor",
52
+ strokeWidth: 0.5,
53
+ } })) }), jsx(Typography, { variant: "h5", align: "center", component: "div", sx: { mb: 2, height: "4rem" }, children: feature.heading }), jsx(Typography, { variant: "h6", align: "center", component: "div", sx: { mb: 2, height: "4rem" }, children: feature.subHeading }), feature.text && jsx(MuiMarkdown, { children: feature.text })] }) }, feature.id));
54
+ }) }) }));
54
55
  }
55
56
 
56
57
  export { FeatureSection };
@@ -32,7 +32,7 @@ filters = {}) {
32
32
  },
33
33
  ...processedFilters,
34
34
  },
35
- sort: `${orderBy || "id"}:${order || "desc"}`,
35
+ sort: `${orderBy || "createdAt"}:${order || "desc"}`,
36
36
  populate: {
37
37
  opo_items: {
38
38
  populate: {
@@ -17,7 +17,7 @@ const baseUrl = getStrapiURL();
17
17
  * INFO Fetch all IROs
18
18
  * used by the IROs table in the admin panel
19
19
  */
20
- async function getAllIros(currentPage, rowsPerPage, order, orderBy, is_archive = [false], // default to only non-archived OPOs
20
+ async function getAllIros(currentPage, rowsPerPage, order, orderBy = "createdAt", is_archive = [false], // default to only non-archived OPOs
21
21
  filters = {}) {
22
22
  unstable_noStore();
23
23
  const user = await getUserRole();
@@ -32,7 +32,7 @@ filters = {}) {
32
32
  },
33
33
  ...processedFilters,
34
34
  },
35
- sort: `${orderBy || "id"}:${order || "desc"}`,
35
+ sort: `${orderBy || "createdAt"}:${order || "desc"}`,
36
36
  populate: {
37
37
  iro_items: {
38
38
  populate: {
@@ -79,65 +79,71 @@ async function getAllPages() {
79
79
  unstable_noStore();
80
80
  const url = new URL("/api/pages", baseUrl);
81
81
  url.search = qs.stringify({
82
+ // populate: "*", // Populate all fields
82
83
  populate: {
83
84
  blocks: {
85
+ populate: "*",
86
+ },
87
+ },
88
+ /* populate: {
89
+ blocks: {
90
+ populate: {
91
+ bgImage: {
92
+ populate: true,
93
+ // fields: ["url", "alternativeText"],
94
+ },
95
+ logoImage: {
96
+ populate: true,
97
+ // fields: ["url", "alternativeText"],
98
+ },
99
+ image: {
100
+ populate: true,
101
+ // fields: ["url", "alternativeText"],
102
+ },
103
+ link: {
104
+ populate: true,
105
+ },
106
+ feature: {
107
+ populate: true,
108
+ },
109
+ icon: {
110
+ populate: true,
111
+ },
112
+ airplane: {
84
113
  populate: {
85
- bgImage: {
86
- populate: true,
87
- // fields: ["url", "alternativeText"],
88
- },
89
- logoImage: {
90
- populate: true,
91
- // fields: ["url", "alternativeText"],
92
- },
93
- image: {
94
- populate: true,
95
- // fields: ["url", "alternativeText"],
96
- },
97
- link: {
98
- populate: true,
99
- },
100
- feature: {
101
- populate: true,
102
- },
103
- icon: {
104
- populate: true,
105
- },
106
- airplane: {
107
- populate: {
108
- floorplan: true,
109
- },
110
- },
111
- column: {
112
- populate: true,
113
- },
114
- partner: {
115
- populate: {
116
- text: true,
117
- photo: true,
118
- links: true,
119
- },
120
- },
121
- pictures: true,
122
- companies: {
123
- populate: {
124
- logo: true,
125
- },
126
- },
127
- textV2: true,
128
- category: {
129
- populate: {
130
- products: {
131
- populate: {
132
- image: true,
133
- price: true,
134
- },
135
- },
136
- },
114
+ floorplan: true,
115
+ },
116
+ },
117
+ column: {
118
+ populate: true,
119
+ },
120
+ partner: {
121
+ populate: {
122
+ text: true,
123
+ photo: true,
124
+ links: true,
125
+ },
126
+ },
127
+ pictures: true,
128
+ companies: {
129
+ populate: {
130
+ logo: true,
131
+ },
132
+ },
133
+ textV2: true,
134
+ category: {
135
+ populate: {
136
+ products: {
137
+ populate: {
138
+ image: true,
139
+ price: true,
137
140
  },
141
+ },
138
142
  },
143
+ },
139
144
  },
140
- },
145
+ },
146
+ }, */
141
147
  });
142
148
  return await fetchData(url.href);
143
149
  }
@@ -20,61 +20,62 @@ async function getSinglePage(slug) {
20
20
  url.search = qs.stringify({
21
21
  populate: {
22
22
  blocks: {
23
- populate: {
24
- logoImage: {
25
- populate: true,
26
- // fields: ["url", "alternativeText"],
23
+ populate: "*",
24
+ /* {
25
+ logoImage: {
26
+ populate: true,
27
+ // fields: ["url", "alternativeText"],
28
+ },
29
+ bgImage: {
30
+ populate: true,
31
+ // fields: ["url", "alternativeText"],
32
+ },
33
+ image: {
34
+ populate: true,
35
+ // fields: ["url", "alternativeText"],
36
+ },
37
+ link: {
38
+ populate: true,
39
+ },
40
+ feature: {
41
+ populate: true,
42
+ },
43
+ icon: {
44
+ populate: true,
45
+ },
46
+ airplane: {
47
+ populate: {
48
+ floorplan: true,
27
49
  },
28
- bgImage: {
29
- populate: true,
30
- // fields: ["url", "alternativeText"],
50
+ },
51
+ column: {
52
+ populate: true,
53
+ },
54
+ partner: {
55
+ populate: {
56
+ text: true,
57
+ photo: true,
58
+ links: true,
31
59
  },
32
- image: {
33
- populate: true,
34
- // fields: ["url", "alternativeText"],
60
+ },
61
+ pictures: true,
62
+ companies: {
63
+ populate: {
64
+ logo: true,
35
65
  },
36
- link: {
37
- populate: true,
38
- },
39
- feature: {
40
- populate: true,
41
- },
42
- icon: {
43
- populate: true,
44
- },
45
- airplane: {
46
- populate: {
47
- floorplan: true,
48
- },
49
- },
50
- column: {
51
- populate: true,
52
- },
53
- partner: {
54
- populate: {
55
- text: true,
56
- photo: true,
57
- links: true,
58
- },
59
- },
60
- pictures: true,
61
- companies: {
62
- populate: {
63
- logo: true,
64
- },
65
- },
66
- textV2: true,
67
- category: {
66
+ },
67
+ textV2: true,
68
+ category: {
69
+ populate: {
70
+ products: {
68
71
  populate: {
69
- products: {
70
- populate: {
71
- image: true,
72
- price: true,
73
- },
74
- },
72
+ image: true,
73
+ price: true,
75
74
  },
75
+ },
76
76
  },
77
- },
77
+ },
78
+ }, */
78
79
  },
79
80
  },
80
81
  });
@@ -11,48 +11,57 @@ import { getStrapiURL } from '../../lib/utils.js';
11
11
  import { unstable_noStore } from 'next/cache';
12
12
 
13
13
  const baseUrl = getStrapiURL();
14
+ /*
15
+ broken after updating cms to strapi v5
14
16
  const query = qs.stringify({
15
- populate: {
16
- customer_profile: {
17
- populate: {
18
- company_address: true,
19
- delivery_address: true,
20
- billing_address: true,
21
- business_credentials: {
22
- populate: {
23
- vat_validate_response: true,
24
- eori_validate_response: true,
25
- },
26
- },
27
- orders: {
28
- populate: {
29
- opo_items: {
30
- populate: {
31
- product: {
32
- populate: {
33
- price: true,
34
- image: true,
35
- },
36
- },
37
- },
38
- },
39
- },
17
+ populate: {
18
+ customer_profile: {
19
+ populate: {
20
+ company_address: true,
21
+ delivery_address: true,
22
+ billing_address: true,
23
+ business_credentials: {
24
+ populate: {
25
+ vat_validate_response: true,
26
+ eori_validate_response: true,
27
+ },
28
+ },
29
+ orders: {
30
+ populate: {
31
+ opo_items: {
32
+ populate: {
33
+ product: {
34
+ populate: {
35
+ price: true,
36
+ image: true,
37
+ },
40
38
  },
41
- returns: {
42
- populate: {
43
- iro_items: {
44
- populate: {
45
- product: {
46
- populate: {
47
- price: true,
48
- image: true,
49
- },
50
- },
51
- },
52
- },
53
- },
39
+ },
40
+ },
41
+ },
42
+ },
43
+ returns: {
44
+ populate: {
45
+ iro_items: {
46
+ populate: {
47
+ product: {
48
+ populate: {
49
+ price: true,
50
+ image: true,
51
+ },
54
52
  },
53
+ },
55
54
  },
55
+ },
56
+ },
57
+ },
58
+ },
59
+ },
60
+ }); */
61
+ const query = qs.stringify({
62
+ populate: {
63
+ customer_profile: {
64
+ populate: "*",
56
65
  },
57
66
  },
58
67
  });