umwd-components 0.1.799 → 0.1.800
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/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualOpoItemUpdater.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/AddIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/data/actions/e-commerce/opo/createOpoAction.js +1 -1
- package/dist/cjs/src/data/actions/logistics/ipo/createIPOAction.js +1 -1
- package/dist/cjs/src/data/actions/logistics/ipo/updateIpoAction.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +2 -2
- package/dist/esm/src/components/e-commerce/opo/TextualOpoItemUpdater.js +2 -2
- package/dist/esm/src/components/logistics/ipo/AddIPOForm.js +0 -1
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +8 -5
- package/dist/esm/src/data/actions/e-commerce/opo/createOpoAction.js +0 -1
- package/dist/esm/src/data/actions/logistics/ipo/createIPOAction.js +0 -1
- package/dist/esm/src/data/actions/logistics/ipo/updateIpoAction.js +0 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -133,8 +133,8 @@ function TextualManageOPOForm({ opo, sx, revalidateCallback, handleClose, role,
|
|
|
133
133
|
const newItems = [...items];
|
|
134
134
|
const itemIndex = newItems.findIndex((item) => item.documentId === itemID);
|
|
135
135
|
const reportsOnItem = newItems[itemIndex]?.reports || [];
|
|
136
|
-
const dbReports = reportsOnItem.filter((report) => "
|
|
137
|
-
const preReports = reportsOnItem.filter((report) => !("
|
|
136
|
+
const dbReports = reportsOnItem.filter((report) => "id" in report);
|
|
137
|
+
const preReports = reportsOnItem.filter((report) => !("id" in report));
|
|
138
138
|
preReports.splice(index, 1);
|
|
139
139
|
const newReports = [...dbReports, ...preReports];
|
|
140
140
|
newItems[itemIndex].reports = newReports;
|
|
@@ -23,7 +23,7 @@ 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
|
-
Array.isArray(reports) && reports.length > 0
|
|
26
|
+
const picked_reports_quantity = 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)
|
|
@@ -41,7 +41,7 @@ function TextualOpoItemUpdater({ item, index, handleAddReport, handleUpdateQuant
|
|
|
41
41
|
const dbReports = item.reports?.filter((report) => "id" in report) || [];
|
|
42
42
|
const preReports = item.reports?.filter((report) => Boolean("id" in report) === false) ||
|
|
43
43
|
[];
|
|
44
|
-
return (jsx(Stack, { spacing: 1, children: item && (jsxs(Fragment, { children: [jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 1 }, children: [jsxs(Typography, { variant: "body1", children: ["Line Item Number: ", line_item_number] }), jsxs(Typography, { variant: "body1", children: ["Part Number: ", product?.product_number] }), image && (jsx(Fragment, { children: jsx(ImagePreviewTooltip, { image: image, label: product?.title }) }))] }), jsx(Divider, { sx: { mb: 1 } }), showing && showing.includes("picked") && (jsxs(Fragment, { children: [jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 1 }, children: [jsx(Typography, { variant: "body2", children: "Picked" }), jsx(TextualAmountUpdater, { label: "Picked", currentValue: picked_quantity, totalValue: ordered_quantity, minnewvalue: 0, maxnewvalue: ordered_quantity, color: "info", handleChange: (newValue) => {
|
|
44
|
+
return (jsx(Stack, { spacing: 1, children: item && (jsxs(Fragment, { children: [jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 1 }, children: [jsxs(Typography, { variant: "body1", children: ["Line Item Number: ", line_item_number] }), jsxs(Typography, { variant: "body1", children: ["Part Number: ", product?.product_number] }), image && (jsx(Fragment, { children: jsx(ImagePreviewTooltip, { image: image, label: product?.title }) }))] }), jsx(Divider, { sx: { mb: 1 } }), showing && showing.includes("picked") && (jsxs(Fragment, { children: [jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { mb: 1 }, children: [jsx(Typography, { variant: "body2", children: "Picked" }), jsx(TextualAmountUpdater, { label: "Picked", currentValue: picked_quantity, totalValue: ordered_quantity, minnewvalue: 0, maxnewvalue: ordered_quantity + picked_reports_quantity, color: "info", handleChange: (newValue) => {
|
|
45
45
|
handleUpdateQuantity(newValue, item.documentId, "picked_quantity");
|
|
46
46
|
} })] }), jsx(Divider, { sx: { mb: 2 } })] })), showing && showing.includes("packed") && (jsxs(Fragment, { children: [jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [jsx(Typography, { variant: "body2", children: "Packed" }), jsx(TextualAmountUpdater, { label: "Packed", currentValue: packed_quantity, totalValue: ordered_quantity + packed_reports_quantity, minnewvalue: 0 + shipped_quantity, maxnewvalue: picked_quantity + packed_reports_quantity, color: "info", handleChange: (newValue) => {
|
|
47
47
|
handleUpdateQuantity(newValue, item.documentId, "packed_quantity");
|
|
@@ -65,7 +65,6 @@ function AddIPOForm({ vendorNamesArr, sx, revalidateCallback, handleClose, }) {
|
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
const vendor = await getSingleVendor(selectedVendorID);
|
|
68
|
-
console.log("vendor", vendor);
|
|
69
68
|
const vendorProducts = vendor?.products.filter((product) => !product.product_number.startsWith("r")) || [];
|
|
70
69
|
setProductsArr(vendorProducts);
|
|
71
70
|
};
|
|
@@ -140,6 +140,7 @@ function TextualManageIPOForm({ data, sx, revalidateCallback, handleClose, role,
|
|
|
140
140
|
released_quantity: item.released_quantity,
|
|
141
141
|
reports: item.reports?.map((report) => {
|
|
142
142
|
return {
|
|
143
|
+
id: "id" in report ? report.id : undefined,
|
|
143
144
|
documentId: "documentId" in report ? report.documentId : undefined,
|
|
144
145
|
quantity: report.quantity,
|
|
145
146
|
content: report.content,
|
|
@@ -186,10 +187,12 @@ function TextualManageIPOForm({ data, sx, revalidateCallback, handleClose, role,
|
|
|
186
187
|
message: "Ipo Updated",
|
|
187
188
|
severity: "success",
|
|
188
189
|
});
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
if (formState.severity === "success") {
|
|
191
|
+
revalidateCallback && revalidateCallback();
|
|
192
|
+
handleClose && handleClose();
|
|
193
|
+
}
|
|
191
194
|
}
|
|
192
|
-
}, [formState]);
|
|
195
|
+
}, [formState?.message]);
|
|
193
196
|
useEffect(() => {
|
|
194
197
|
if (formState?.strapiErrors) {
|
|
195
198
|
handleAddMessage({
|
|
@@ -223,12 +226,12 @@ function TextualManageIPOForm({ data, sx, revalidateCallback, handleClose, role,
|
|
|
223
226
|
else {
|
|
224
227
|
setShowing(showing.filter((item) => item !== option));
|
|
225
228
|
}
|
|
226
|
-
} }), label: jsx(Typography, { variant: "body2", color: "text.secondary", children: option.charAt(0).toUpperCase() + option.slice(1) }), sx: { mr: 0 } }, option)))] }), data.internal_status === "placed" && (jsx(Alert, { severity: "warning", children: "Before confirmation you cannot update the items" })), jsx(Divider, {}), jsxs("form", { action: formAction, children: [items &&
|
|
229
|
+
} }), label: jsx(Typography, { variant: "body2", color: "text.secondary", children: option.charAt(0).toUpperCase() + option.slice(1) }), sx: { mr: 0 } }, option)))] }), data.internal_status === "placed" && (jsx(Alert, { severity: "warning", children: "Before confirmation you cannot update the items" })), jsx(Divider, {}), jsxs("form", { action: formAction, children: [jsx("input", { type: "hidden", name: "items", value: JSON.stringify(parseItems(items)) }), items &&
|
|
227
230
|
items.map((item, index) => {
|
|
228
231
|
return (jsx(Paper, { sx: { p: 2, mb: 2 }, children: data.internal_status === "placed" ||
|
|
229
232
|
data.internal_status === "cancelled" ||
|
|
230
233
|
data.internal_status === "done" ? (jsx(ItemDisplay, { item: item, index: index, image: item?.product?.image })) : (jsx(TextualIPOItemUpdater, { item: item, index: index, handleUpdateQuantity: handleUpdateQuantity, handleAddReport: handleAddReport, image: item?.product?.image, handleRemoveReportAtIndex: handleRemoveReportAtIndex, revalidateCallback: revalidateCallback, showing: showing })) }, index));
|
|
231
|
-
}), jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { variant: "contained", text: "Update items", loadingText: "Loading..." })] })
|
|
234
|
+
}), jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { variant: "contained", text: "Update items", loadingText: "Loading..." })] })] })] }) })] }) }));
|
|
232
235
|
}
|
|
233
236
|
|
|
234
237
|
export { TextualManageIPOForm as default };
|
|
@@ -16,7 +16,6 @@ import { parseFormData } from '../../../../lib/parseFormData.js';
|
|
|
16
16
|
async function createOpoAction(prevState, formData) {
|
|
17
17
|
Object.fromEntries(formData);
|
|
18
18
|
const parsedFormData = parseFormData(formData);
|
|
19
|
-
console.log("createOpoAction parsedFormData", parsedFormData);
|
|
20
19
|
const responseData = await mutateData("POST", `/api/opos/createAdmin`, parsedFormData);
|
|
21
20
|
if (!responseData) {
|
|
22
21
|
return {
|
|
@@ -12,7 +12,6 @@ import dayjs from '../../../../../node_modules/dayjs/dayjs.min.js';
|
|
|
12
12
|
|
|
13
13
|
async function createIPOAction(prevState, formData) {
|
|
14
14
|
const parsedFormData = parseFormData(formData);
|
|
15
|
-
console.log("createIPOAction parsedFormData", parsedFormData);
|
|
16
15
|
if (!parsedFormData.data.order_date) {
|
|
17
16
|
return {
|
|
18
17
|
...prevState,
|
|
@@ -11,7 +11,6 @@ import { parseFormData } from '../../../../lib/parseFormData.js';
|
|
|
11
11
|
|
|
12
12
|
async function updateIpoAction(documentId, prevState, formData) {
|
|
13
13
|
const parsedFormData = parseFormData(formData);
|
|
14
|
-
console.log("updateIpoAction", documentId, parsedFormData);
|
|
15
14
|
const responseData = await mutateData("PUT", `/api/ipos/${documentId}`, parsedFormData);
|
|
16
15
|
if (!responseData) {
|
|
17
16
|
return {
|