umwd-components 0.1.726 → 0.1.728
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/cjs/src/components/common/EnhancedTable/EnhancedTable.js +1 -1
- package/dist/cjs/src/components/common/EnhancedTable/EnhancedTableRow.js +1 -1
- package/dist/cjs/src/components/e-commerce/customer/CustomerSelector.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualOpoItemUpdater.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getCustomerLabels.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getProductNames.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getSingleOpo.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/common/EnhancedTable/EnhancedTable.js +2 -1
- package/dist/esm/src/components/common/EnhancedTable/EnhancedTableRow.js +1 -1
- package/dist/esm/src/components/e-commerce/customer/CustomerSelector.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/CreateOpoForm.js +1 -0
- package/dist/esm/src/components/e-commerce/opo/TextualOpoItemUpdater.js +3 -3
- package/dist/esm/src/data/loaders/e-commerce/getCustomerLabels.js +10 -0
- package/dist/esm/src/data/loaders/e-commerce/getProductNames.js +2 -1
- package/dist/esm/src/data/loaders/e-commerce/getSingleOpo.js +4 -7
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -57,6 +57,7 @@ function EnhancedTable(props) {
|
|
|
57
57
|
const target = e.target;
|
|
58
58
|
if (target.checked) {
|
|
59
59
|
const newSelected = data.map((n) => n.documentId);
|
|
60
|
+
console.log("newSelected", newSelected);
|
|
60
61
|
setSelected(newSelected);
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
@@ -159,7 +160,7 @@ function EnhancedTable(props) {
|
|
|
159
160
|
});
|
|
160
161
|
}
|
|
161
162
|
}, [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.documentId), handleSelectClick: handleSelectClick, subTitle: subTitle }, row.
|
|
163
|
+
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.documentId || index))), emptyRows > 0 && (jsx(TableRow, { style: {
|
|
163
164
|
height: (dense ? 33 : 53) * emptyRows,
|
|
164
165
|
}, children: jsx(TableCell, { colSpan: headCells.length +
|
|
165
166
|
(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.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 }, `${
|
|
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, index) => (jsx(TableCell, { align: cell.numeric ? "right" : "left", padding: cell.disablePadding ? "none" : "normal", children: row[cell.id] }, cell.id + index)))] }), 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 }, `${row.documentId}${cell.id}`))) }) }), 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] }, `${subRow.documentId}${index}`))) }, `${subRow.documentId}`))) })] })] }) }) }) }))] }));
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export { EnhancedTableRow as default };
|
|
@@ -33,7 +33,7 @@ const CustomerSelector = ({ customerLabels, currentValue, multiple = false, onCh
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
return (jsxs(Fragment, { children: [jsx(Autocomplete, { multiple: multiple, options: customerLabels, getOptionLabel: (option) => option.title, filterSelectedOptions: true, onChange: handleCustomerChange, renderOption: (props, option) => {
|
|
36
|
-
return (createElement("li", { ...props, key: option.
|
|
36
|
+
return (createElement("li", { ...props, key: option.documentId }, option.title));
|
|
37
37
|
}, renderInput: (params) => jsx(TextField, { ...params, label: "Customer" }), value: customerLabels.filter((customer) => selectedValues.includes(customer.documentId))[0] || null }), jsx("input", { type: "hidden", name: "customer", value: multiple
|
|
38
38
|
? JSON.stringify(selectedValues) || ""
|
|
39
39
|
: selectedValues[0] || "" })] }));
|
|
@@ -32,6 +32,7 @@ function CreateOpoForm({ sx, revalidateCallback, handleClose, customerLabels, pr
|
|
|
32
32
|
const [orderConfirmed, setOrderConfirmed] = useState(false);
|
|
33
33
|
const [formState, formAction] = useFormState(createOpoAction, INITIAL_STATE);
|
|
34
34
|
const { handleAddMessage } = useSnackbar();
|
|
35
|
+
console.log(customerLabels, productLabels);
|
|
35
36
|
useEffect(() => {
|
|
36
37
|
if (formState?.message) {
|
|
37
38
|
handleAddMessage({
|
|
@@ -23,17 +23,17 @@ function TextualOpoItemUpdater({ item, index, handleAddReport, handleUpdateQuant
|
|
|
23
23
|
const { line_item_number, product, ordered_quantity, picked_quantity, packed_quantity, shipped_quantity, reports, } = item;
|
|
24
24
|
const [open, setOpen] = useState(false);
|
|
25
25
|
// these values where wrapped with useMemo before but that did not work well while updating values
|
|
26
|
-
reports
|
|
26
|
+
Array.isArray(reports) && reports.length > 0
|
|
27
27
|
? reports
|
|
28
28
|
.filter((report) => report.type === "picked")
|
|
29
29
|
.reduce((a, b) => a + b.quantity, 0)
|
|
30
30
|
: 0;
|
|
31
|
-
const packed_reports_quantity = reports
|
|
31
|
+
const packed_reports_quantity = Array.isArray(reports) && reports.length > 0
|
|
32
32
|
? reports
|
|
33
33
|
.filter((report) => report.type === "packed")
|
|
34
34
|
.reduce((a, b) => a + b.quantity, 0)
|
|
35
35
|
: 0;
|
|
36
|
-
reports
|
|
36
|
+
Array.isArray(reports) && reports.length > 0
|
|
37
37
|
? reports
|
|
38
38
|
.filter((report) => report.type === "shipped")
|
|
39
39
|
.reduce((a, b) => a + b.quantity, 0)
|
|
@@ -21,8 +21,18 @@ async function getCustomerLabels() {
|
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
23
|
const labels = await fetchData(url.href);
|
|
24
|
+
console.log("Fetched customer labels:", labels.data[0], labels.data[1], labels.data[2]);
|
|
25
|
+
if (!labels || !labels.data) {
|
|
26
|
+
console.error("No customer labels found");
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
if (labels.data.length === 0) {
|
|
30
|
+
console.warn("No customer labels available");
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
24
33
|
return labels.data.map((label) => ({
|
|
25
34
|
id: label.id,
|
|
35
|
+
documentId: label.documentId,
|
|
26
36
|
title: label.first_name && label.last_name
|
|
27
37
|
? `${label.first_name} ${label.last_name}`
|
|
28
38
|
: `${label.email}`,
|
|
@@ -24,9 +24,6 @@ async function getSingleOpo(documentId, filters = {}) {
|
|
|
24
24
|
image: true,
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
|
-
picked_reports: true,
|
|
28
|
-
packed_reports: true,
|
|
29
|
-
shipped_reports: true,
|
|
30
27
|
reports: {
|
|
31
28
|
populate: {
|
|
32
29
|
author: true,
|
|
@@ -35,13 +32,13 @@ async function getSingleOpo(documentId, filters = {}) {
|
|
|
35
32
|
},
|
|
36
33
|
},
|
|
37
34
|
customer: {
|
|
38
|
-
populate:
|
|
35
|
+
populate: {
|
|
36
|
+
business_credentials: true,
|
|
37
|
+
},
|
|
39
38
|
},
|
|
40
39
|
notes: {
|
|
41
40
|
populate: {
|
|
42
|
-
author:
|
|
43
|
-
populate: true,
|
|
44
|
-
},
|
|
41
|
+
author: true,
|
|
45
42
|
},
|
|
46
43
|
},
|
|
47
44
|
},
|