umwd-components 0.1.723 → 0.1.724
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/media/UploadBase64MediaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/common/media/UploadBase64MediaForm.js +2 -2
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
- package/dist/esm/src/components/e-commerce/opo/ManageOpoForm.js +8 -6
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +6 -4
- package/dist/esm/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/esm/src/components/logistics/ipo/ManageIPOForm.js +2 -2
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +2 -2
- package/dist/esm/src/data/actions/e-commerce/opo/updateOpoAction.js +2 -2
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/data/actions/e-commerce/opo/updateOpoAction.d.ts +1 -1
- package/dist/esm/types/data/actions/media/uploadBase64MediaAction.d.ts +1 -1
- package/dist/esm/types/types/common/media/types.d.ts +1 -1
- package/dist/esm/types/types/logistics/Note.d.ts +1 -1
- package/package.json +1 -1
|
@@ -23,10 +23,10 @@ const INITIAL_STATE = {
|
|
|
23
23
|
data: null,
|
|
24
24
|
message: null,
|
|
25
25
|
};
|
|
26
|
-
function UploadBase64MediaForm({ reference, refID
|
|
26
|
+
function UploadBase64MediaForm({ reference, refID, field, multiple = true, accept = "image/*", path = "api/ipos", componentName = "", componentReference, revalidateCallback, }) {
|
|
27
27
|
const [filePreviews, setFilePreviews] = useState(null);
|
|
28
28
|
const [fileList, setFileList] = useState(null);
|
|
29
|
-
const uploadBase64MediaActionWithParams = uploadBase64MediaAction.bind(null, path, refID, componentName);
|
|
29
|
+
const uploadBase64MediaActionWithParams = uploadBase64MediaAction.bind(null, path, refID || "", componentName);
|
|
30
30
|
const [formState, formAction] = useFormState(uploadBase64MediaActionWithParams, INITIAL_STATE);
|
|
31
31
|
const fileInput = useRef(null);
|
|
32
32
|
useEffect(() => {
|
|
@@ -143,7 +143,7 @@ function RmaForm({ opo, sx, revalidateCallback, handleClose, }) {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
}, [formState?.strapiErrors]);
|
|
146
|
-
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h6", children: "RMA Form" }) }), jsx("input", { type: "hidden", name: "opos", value: JSON.stringify([opo.
|
|
146
|
+
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h6", children: "RMA Form" }) }), jsx("input", { type: "hidden", name: "opos", value: JSON.stringify([opo.documentId]) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "body1", children: "Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned." }), jsx(Alert, { severity: "warning", children: "We urge you to carefully photograph the items you are returning. These pictures can be requested at a later time by our team to verify the condition of the items." })] }) }), jsx(Grid, { item: true, xs: 12, children: opo.opo_items ? (jsx(Stack, { spacing: 1, children: opo.opo_items && (jsx(ItemLines, { items: opo.opo_items, itemsToReturn: itemsToReturn, setItemsToReturn: setItemsToReturn, selectedItems: selectedItems, setSelectedItems: setSelectedItems })) })) : (jsx(Typography, { variant: "body1", children: "No items" })) }), jsx(ConfirmRMADialog, { formState: formState, open: open, items: itemsToReturn.filter((item) => item.returned_quantity > 0), onClose: () => setOpen(!open), submitCallback: () => {
|
|
147
147
|
console.log("submit callback");
|
|
148
148
|
const formElement = document.querySelector("form");
|
|
149
149
|
if (formElement) {
|
|
@@ -52,7 +52,7 @@ function CreateOpoForm({ sx, revalidateCallback, handleClose, customerLabels, pr
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
}, [formState?.strapiErrors]);
|
|
55
|
-
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Stack, { spacing: 2, children: jsx(Typography, { variant: "h3", component: "h1", children: "Create new order" }) }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Choose a customer" }), jsx(CustomerSelector, { customerLabels: customerLabels })] }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Customer reference" }), jsx(Typography, { children: "If the customer utilizes a custom reference for inbound order management it should be left here" }), jsx(TextField, { id: "customer_reference", name: "customer_reference", sx: { width: "100%" } })] }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Choose products for this order" }), jsx(OPOItemFields, { productsArr: productLabels })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Confirm Order" }), jsx(Typography, { children: "Are you sure you want to confirm this order? Creating a order this way will not create a shipping label nor will it invoke a payment. It does however create an invoice which you can find under invoices" }), jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [jsx(Checkbox, { value: orderConfirmed, checked: orderConfirmed, onChange: () => setOrderConfirmed(!orderConfirmed) }), orderConfirmed && (jsx(Typography, { color: "primary", children: "I am sure I want to confirm this order" }))] }), jsx("input", { name: "
|
|
55
|
+
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsx("form", { action: formAction, children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Stack, { spacing: 2, children: jsx(Typography, { variant: "h3", component: "h1", children: "Create new order" }) }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Choose a customer" }), jsx(CustomerSelector, { customerLabels: customerLabels })] }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h6", children: "Customer reference" }), jsx(Typography, { children: "If the customer utilizes a custom reference for inbound order management it should be left here" }), jsx(TextField, { id: "customer_reference", name: "customer_reference", sx: { width: "100%" } })] }) }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Choose products for this order" }), jsx(OPOItemFields, { productsArr: productLabels })] }), jsxs(Grid, { item: true, xs: 12, children: [jsx(Typography, { variant: "h6", children: "Confirm Order" }), jsx(Typography, { children: "Are you sure you want to confirm this order? Creating a order this way will not create a shipping label nor will it invoke a payment. It does however create an invoice which you can find under invoices" }), jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [jsx(Checkbox, { value: orderConfirmed, checked: orderConfirmed, onChange: () => setOrderConfirmed(!orderConfirmed) }), orderConfirmed && (jsx(Typography, { color: "primary", children: "I am sure I want to confirm this order" }))] }), jsx("input", { name: "internal_status", type: "hidden", value: orderConfirmed ? "ordered" : "placed" })] }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Confirm", loadingText: "Loading...", variant: "contained" })] }) })] }) }) }));
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export { CreateOpoForm as default };
|
|
@@ -56,7 +56,7 @@ function ConfirmFormDialog({
|
|
|
56
56
|
}: {
|
|
57
57
|
open: boolean;
|
|
58
58
|
handleClose: () => void;
|
|
59
|
-
orderID:
|
|
59
|
+
orderID: string;
|
|
60
60
|
currentStatus: "placed" | "external_shipping_process";
|
|
61
61
|
revalidateCallback?: () => void;
|
|
62
62
|
}) {
|
|
@@ -77,7 +77,7 @@ function ConfirmFormDialog({
|
|
|
77
77
|
<form action={formAction}>
|
|
78
78
|
<input name="id" type="hidden" value={orderID} />
|
|
79
79
|
<input
|
|
80
|
-
name="
|
|
80
|
+
name="internal_status"
|
|
81
81
|
type="hidden"
|
|
82
82
|
value={currentStatus === "placed" ? "ordered" : "done"}
|
|
83
83
|
/>
|
|
@@ -117,7 +117,7 @@ function ManageOPOForm({ opo, sx,
|
|
|
117
117
|
// revalidates the selectedOpo from the database
|
|
118
118
|
revalidateCallback, handleClose, role, }) {
|
|
119
119
|
// TODO bind to id of OPO
|
|
120
|
-
const boundUpdateOpoAction = (prevState, formData) => updateOpoAction(opo.
|
|
120
|
+
const boundUpdateOpoAction = (prevState, formData) => updateOpoAction(opo.documentId, prevState, formData);
|
|
121
121
|
const [formState, formAction] = useFormState(boundUpdateOpoAction, INITIAL_STATE);
|
|
122
122
|
const { handleAddMessage } = useSnackbar();
|
|
123
123
|
const [items, setItems] = useState(opo.opo_items ? opo.opo_items : []);
|
|
@@ -167,11 +167,13 @@ revalidateCallback, handleClose, role, }) {
|
|
|
167
167
|
return (jsx(Box, { sx: [
|
|
168
168
|
// You cannot spread `sx` directly because `SxProps` (typeof sx) can be an array.
|
|
169
169
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
170
|
-
], children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", children: [jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Manage Outbound Purchase Order" }), jsx(Typography, { variant: "body1", children: "Manage picking, packing and shipping of purchase order" })] }), jsx(NoteTakingComponent, { content: "", related: [
|
|
170
|
+
], children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", children: [jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Manage Outbound Purchase Order" }), jsx(Typography, { variant: "body1", children: "Manage picking, packing and shipping of purchase order" })] }), jsx(NoteTakingComponent, { content: "", related: [
|
|
171
|
+
{ id: opo.documentId, __type: "api::e-commerce.opo" },
|
|
172
|
+
], revalidateCallback: revalidateCallback })] }), jsx(Divider, {})] }) }), jsx(Grid, { item: true, xs: 6, children: jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h5", children: "Details" }), jsxs(Stack, { direction: "row", spacing: 2, children: [jsx(Typography, { variant: "body1", width: "250px", children: "Purchase Order Number" }), jsx(Typography, { variant: "body2", children: opo.opo_number })] }), jsxs(Stack, { direction: "row", spacing: 2, children: [jsx(Typography, { variant: "body1", width: "250px", children: "Custom reference" }), jsx(Typography, { variant: "body2", children: opo.customer_reference })] }), jsxs(Stack, { direction: "row", spacing: 2, children: [jsx(Typography, { variant: "body1", width: "250px", children: "Order Date" }), jsx(Typography, { variant: "body2", children: opo.order_date })] }), jsxs(Stack, { direction: "row", spacing: 2, children: [jsx(Typography, { variant: "body1", width: "250px", children: "Customer" }), jsx(Typography, { variant: "body2", children: opo.customer?.business_credentials?.company_name })] }), jsxs(Stack, { direction: "row", spacing: 2, children: [jsx(Typography, { variant: "body1", width: "250px", children: "Order Status" }), jsx(Typography, { variant: "body2", width: "250px", children: opo.internal_status })] }), (opo.internal_status === "placed" ||
|
|
171
173
|
opo.internal_status === "external_shipping_process") &&
|
|
172
174
|
role === "enduser" && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "primary", onClick: () => setConfirmDialogOpen(true), children: "Confirm order" }), jsx(Alert, { severity: "warning", children: "Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher" }), jsx(ConfirmFormDialog, { open: confirmDialogOpen, handleClose: () => setConfirmDialogOpen(false), orderID: opo.documentId, currentStatus: opo.internal_status, revalidateCallback: revalidateCallback })] }))] }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Documents" }), jsx(Paper, { sx: { p: 2 }, children: jsx(Stack, { spacing: 1, children: opo.delivery_note ? (jsxs(Fragment, { children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(Typography, { children: opo.delivery_note?.name }), jsx(Button, { variant: "contained", onClick: () => {
|
|
173
|
-
downloadBase64File(`api/opos/${opo.
|
|
174
|
-
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the delivery note for this order" }), jsx(Divider, {}), jsx(UploadBase64MediaForm, { reference: "api::e-commerce.opo", refID: opo.
|
|
175
|
+
downloadBase64File(`api/opos/${opo.documentId}`, "delivery_note");
|
|
176
|
+
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the delivery note for this order" }), jsx(Divider, {}), jsx(UploadBase64MediaForm, { reference: "api::e-commerce.opo", refID: opo.documentId, field: "delivery_note", multiple: false, accept: "text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", path: "api/opos", componentName: "delivery_note", componentReference: "common.base64-encoded-media", revalidateCallback: revalidateCallback })] })) }) })] }) }), opo?.notes?.length > 0 && (jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Notes" }), jsx(NotesDisplay, { notes: opo.notes }), jsx(Divider, {})] }) })), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h5", children: "Items" }), opo.internal_status === "placed" && (jsx(Alert, { severity: "warning", children: "Before confirmation you cannot update the items" })), jsx(Divider, {}), jsxs("form", { action: formAction, children: [jsx("input", { name: "id", type: "hidden", value: opo.documentId }), items &&
|
|
175
177
|
items.map((item, index) => {
|
|
176
178
|
console.log("item", item);
|
|
177
179
|
return (jsx(Paper, { sx: { p: 2, mb: 2 }, children: opo.internal_status === "placed" ? (jsx(OpoItemDisplay, { item: item, index: index, image: item?.product?.image })) : (jsx(OpoItemUpdater, { item: item, index: index, handleUpdateQuantity: handleUpdateQuantity, image: item?.product?.image, revalidateCallback: revalidateCallback })) }, index));
|
|
@@ -82,7 +82,7 @@ function CancelOpoDialog({ open, handleClose, orderID, revalidateCallback, }) {
|
|
|
82
82
|
return (jsxs(Dialog, { open: open, onClose: handleClose, children: [jsx(DialogTitle, { children: "Cancel Return" }), jsx(DialogContent, { children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { children: "Are you sure you want to cancel this order?" }), jsxs(List, { children: [jsx(ListItem, { children: "By cancelling this order you will update it's status from ordered to cancelled" }), jsx(ListItem, { children: "Please provide a reason for the cancellation" }), jsx(ListItem, { children: "The customer will be notified about the cancellation and of the reason for the cancellation" })] }), jsx(TextField, { label: "Cancellation reason", name: "reason", multiline: true, rows: 4, fullWidth: true, variant: "outlined", value: reason, onChange: (e) => setRoason(e.target.value), placeholder: "Please provide a reason for the cancellation", error: !!reasonError, helperText: reasonError })] }) }), jsxs(DialogActions, { children: [jsx(Button, { variant: "outlined", onClick: handleClose, children: "Close" }), jsx(Button, { variant: "contained", color: "error", onClick: handleCancel, children: "Confirm Cancellation" })] })] }));
|
|
83
83
|
}
|
|
84
84
|
function TextualManageOPOForm({ opo, sx, revalidateCallback, handleClose, role, }) {
|
|
85
|
-
const updateOpoWithIdAction = updateOpoAction.bind(null, opo.
|
|
85
|
+
const updateOpoWithIdAction = updateOpoAction.bind(null, opo.documentId);
|
|
86
86
|
const [formState, formAction] = useFormState(updateOpoWithIdAction, INITIAL_STATE);
|
|
87
87
|
const { handleAddMessage } = useSnackbar();
|
|
88
88
|
const [items, setItems] = useState(opo.opo_items ? opo.opo_items : []);
|
|
@@ -167,11 +167,13 @@ function TextualManageOPOForm({ opo, sx, revalidateCallback, handleClose, role,
|
|
|
167
167
|
newItems[itemIndex].reports = newReports;
|
|
168
168
|
setItems(newItems);
|
|
169
169
|
};
|
|
170
|
-
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", children: [jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Management Outbound Purchase Order" }), jsx(Typography, { variant: "body1", children: "Manage picking, packing and shipping of purchase order" })] }), jsx(NoteTakingComponent, { content: "", related: [
|
|
170
|
+
return (jsx(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "space-between", children: [jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h3", component: "h1", children: "Management Outbound Purchase Order" }), jsx(Typography, { variant: "body1", children: "Manage picking, packing and shipping of purchase order" })] }), jsx(NoteTakingComponent, { content: "", related: [
|
|
171
|
+
{ id: opo.documentId, __type: "api::e-commerce.opo" },
|
|
172
|
+
], revalidateCallback: revalidateCallback })] }), jsx(Divider, {})] }) }), jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h5", sx: { py: 1 }, children: "Details" }) }), jsx(Grid, { item: true, xs: 6, children: jsx(Paper, { elevation: 2, sx: { p: 2, height: "100%" }, children: jsxs(Stack, { spacing: 2, children: [jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(NumbersIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Purchase Order Number" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: opo.opo_number })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(DescriptionIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Custom reference" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: opo.customer_reference })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(CalendarTodayIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Order Date" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: opo.order_date })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(BusinessIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Customer" }), jsx(Typography, { variant: "body1", fontWeight: "medium", children: opo.customer?.business_credentials?.company_name })] }), jsxs(Stack, { direction: "row", spacing: 2, alignItems: "center", children: [jsx(UpdateIcon, { color: "primary" }), jsx(Typography, { variant: "subtitle1", color: "text.secondary", width: "200px", children: "Order Status" }), jsx(OpoStatusIndicator, { status: opo.internal_status })] })] }) }) }), role === "enduser" && (jsx(Grid, { item: true, xs: 6, children: jsx(Paper, { elevation: 2, sx: { p: 2, height: "100%" }, children: jsxs(Stack, { spacing: 2, children: [(opo.internal_status === "placed" ||
|
|
171
173
|
opo.internal_status === "external_shipping_process") && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "primary", onClick: () => setConfirmDialogOpen(true), children: "Confirm order" }), jsx(Alert, { severity: "warning", children: "Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher" }), jsx(ConfirmFormDialog, { open: confirmDialogOpen, handleClose: () => setConfirmDialogOpen(false), orderID: opo.documentId, currentStatus: opo.internal_status, revalidateCallback: revalidateCallback })] })), (opo.internal_status === "placed" ||
|
|
172
174
|
opo.internal_status === "ordered") && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "error", onClick: () => setCancelDialogOpen(true), children: "Cancel order" }), jsx(CancelOpoDialog, { open: cancelDialogOpen, handleClose: () => setCancelDialogOpen(false), orderID: opo.documentId, revalidateCallback: revalidateCallback })] }))] }) }) })), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Documents" }), jsx(Paper, { sx: { p: 2 }, children: jsx(Stack, { spacing: 1, children: opo.delivery_note ? (jsxs(Fragment, { children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(Typography, { children: opo.delivery_note?.name }), jsx(Button, { variant: "contained", onClick: () => {
|
|
173
|
-
downloadBase64File(`api/
|
|
174
|
-
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the delivery note for this order" }), jsx(Divider, {}), jsx(UploadBase64MediaForm, { reference: "api::e-commerce.opo", refID: opo.
|
|
175
|
+
downloadBase64File(`api/opos/${opo.documentId}`, "delivery_note");
|
|
176
|
+
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the delivery note for this order" }), jsx(Divider, {}), jsx(UploadBase64MediaForm, { reference: "api::e-commerce.opo", refID: opo.documentId, field: "delivery_note", multiple: false, accept: "text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", path: "api/ipos", componentName: "delivery_note", componentReference: "common.base64-encoded-media", revalidateCallback: revalidateCallback })] })) }) })] }) }), opo?.notes?.length > 0 && (jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Notes" }), jsx(NotesDisplay, { notes: opo.notes }), jsx(Divider, {})] }) })), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h5", children: "Items" }), jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", spacing: 2, component: Paper, p: 1, children: [jsx(Typography, { variant: "body1", children: "Show:" }), options.map((option) => (jsx(FormControlLabel, { control: jsx(Checkbox, { checked: showing.includes(option), onChange: (e) => {
|
|
175
177
|
if (e.target.checked) {
|
|
176
178
|
setShowing([...showing, option]);
|
|
177
179
|
}
|
|
@@ -60,7 +60,7 @@ function EditStockForm({ data, revalidateCallback, handleClose, sx, }) {
|
|
|
60
60
|
}
|
|
61
61
|
}, [formState?.strapiErrors, handleAddMessage]);
|
|
62
62
|
return (jsxs(Box, { sx: [...(Array.isArray(sx) ? sx : [sx])], children: [jsxs(Grid, { container: true, spacing: 2, children: [jsx(Grid, { item: true, xs: 12, children: jsx(Typography, { variant: "h6", children: title }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(TableContainer, { component: Paper, children: [jsx(Typography, { variant: "h6", sx: { pl: 2 }, children: "Incoming orders" }), jsxs(Table, { size: "small", children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Line Item Number" }), jsx(TableCell, { children: "Ordered Quantity" }), jsx(TableCell, { children: "Received Quantity" }), jsx(TableCell, { children: "Registered Quantity" }), jsx(TableCell, { children: "Released Quantity" })] }) }), jsx(TableBody, { children: ipos.map((ipo) => (jsx(Fragment, { children: ipo.items.map((item) => (jsxs(TableRow, { children: [jsx(TableCell, { children: ipo.ipo_number }), jsx(TableCell, { children: ipo.order_date }), jsx(TableCell, { children: item.line_item_number }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.ordered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.received_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.registered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.released_quantity, maxValue: item.ordered_quantity, color: "primary" }) })] }, ipo.id))) }))) }), jsx(TableFooter, { children: jsxs(TableRow, { children: [jsx(TableCell, { colSpan: 6, align: "right", children: "Total added to stock:" }), jsx(TableCell, { children: ipos.reduce((total, ipo) => total +
|
|
63
|
-
ipo.items.reduce((itemTotal, item) => itemTotal + item.released_quantity, 0), 0) })] }) })] }), jsx(Typography, { variant: "h6", sx: { pl: 2 }, children: "Outgoing orders" }), jsxs(Table, { size: "small", children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Line Item Number" }), jsx(TableCell, { children: "Ordered Quantity" }), jsx(TableCell, { children: "Picked Quantity" }), jsx(TableCell, { children: "Packed Quantity" }), jsx(TableCell, { children: "Shipped Quantity" })] }) }), jsx(TableBody, { children: opos.map((opo) => (jsx(Fragment, { children: opo.opo_items.map((item) => (jsxs(TableRow, { children: [jsx(TableCell, { children: opo.opo_number }), jsx(TableCell, { children: opo.order_date }), jsx(TableCell, { children: item.line_item_number }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.ordered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.picked_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.packed_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.shipped_quantity, maxValue: item.ordered_quantity, color: "primary" }) })] }, opo.
|
|
63
|
+
ipo.items.reduce((itemTotal, item) => itemTotal + item.released_quantity, 0), 0) })] }) })] }), jsx(Typography, { variant: "h6", sx: { pl: 2 }, children: "Outgoing orders" }), jsxs(Table, { size: "small", children: [jsx(TableHead, { children: jsxs(TableRow, { children: [jsx(TableCell, { children: "Number" }), jsx(TableCell, { children: "Order Date" }), jsx(TableCell, { children: "Line Item Number" }), jsx(TableCell, { children: "Ordered Quantity" }), jsx(TableCell, { children: "Picked Quantity" }), jsx(TableCell, { children: "Packed Quantity" }), jsx(TableCell, { children: "Shipped Quantity" })] }) }), jsx(TableBody, { children: opos.map((opo) => (jsx(Fragment, { children: opo.opo_items.map((item) => (jsxs(TableRow, { children: [jsx(TableCell, { children: opo.opo_number }), jsx(TableCell, { children: opo.order_date }), jsx(TableCell, { children: item.line_item_number }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.ordered_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.picked_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.packed_quantity, maxValue: item.ordered_quantity, color: "primary" }) }), jsx(TableCell, { children: jsx(AmountIndicator, { value: item.shipped_quantity, maxValue: item.ordered_quantity, color: "primary" }) })] }, opo.documentId))) }))) }), jsx(TableFooter, { children: jsxs(TableRow, { children: [jsx(TableCell, { colSpan: 3, align: "right", children: "Total reduced from stock:" }), jsx(TableCell, { children: opos.reduce((total, opo) => total +
|
|
64
64
|
opo.opo_items.reduce((itemTotal, item) => itemTotal + item.ordered_quantity, 0), 0) })] }) })] }), jsxs(Table, { size: "small", children: [jsxs(TableRow, { children: [jsx(TableCell, { align: "right", children: "Total added to stock:" }), jsx(TableCell, { children: ipos.reduce((total, ipo) => total +
|
|
65
65
|
ipo.items.reduce((itemTotal, item) => itemTotal + item.released_quantity, 0), 0) })] }), jsxs(TableRow, { children: [jsx(TableCell, { align: "right", children: "Total reduced from stock:" }), jsx(TableCell, { children: opos.reduce((total, opo) => total +
|
|
66
66
|
opo.opo_items.reduce((itemTotal, item) => itemTotal + item.ordered_quantity, 0), 0) })] }), jsxs(TableRow, { children: [jsx(TableCell, { align: "right", children: "Corrections:" }), jsx(TableCell, { children: jsx(Tooltip, { title: "Total stock corrections", children: jsx(Typography, { children: reports
|
|
@@ -89,9 +89,9 @@ function ManageIPOForm({ data, sx, revalidateCallback, handleClose, role, }) {
|
|
|
89
89
|
data.internal_status === "released_on_stock") &&
|
|
90
90
|
role === "enduser" && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "primary", onClick: () => setConfirmDialogOpen(true), children: "Confirm order" }), jsx(Alert, { severity: "warning", children: "Please confirm the order as soon as possible. Only upon confirmation will this order be available to the dispatcher." }), jsx(ConfirmFormDialog, { open: confirmDialogOpen, handleClose: () => setConfirmDialogOpen(false), orderID: data.documentId, currentStatus: data.internal_status, revalidateCallback: revalidateCallback })] }))] }) }), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Documents" }), jsx(Paper, { sx: { p: 2 }, children: jsxs(Stack, { spacing: 1, children: [role === "enduser" && (jsx(Fragment, { children: data.order_confirmation ? (jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h6", children: "Order Confirmation" }), jsx(Typography, { children: data.order_confirmation?.name }), jsx(Button, { variant: "contained", onClick: () => {
|
|
91
91
|
downloadBase64File(`api/ipos/${data.id}`, "order_confirmation");
|
|
92
|
-
}, children: "Download" })] })) : (jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h6", children: "Order Confirmation" }), jsx(Typography, { variant: "body1", children: "Upload the order confirmation for this order" }), jsx(UploadBase64MediaForm, { reference: "api::logistics.ipo", refID: data.
|
|
92
|
+
}, children: "Download" })] })) : (jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h6", children: "Order Confirmation" }), jsx(Typography, { variant: "body1", children: "Upload the order confirmation for this order" }), jsx(UploadBase64MediaForm, { reference: "api::logistics.ipo", refID: data.documentId, field: "order_confirmation", multiple: false, accept: "text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", path: "api/ipos", componentName: "order_confirmation", componentReference: "common.base64-encoded-media", revalidateCallback: revalidateCallback })] })) })), data.delivery_note ? (jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(Typography, { children: data.delivery_note?.name }), jsx(Button, { variant: "contained", onClick: () => {
|
|
93
93
|
downloadBase64File(`api/ipos/${data.id}`, "delivery_note");
|
|
94
|
-
}, children: "Download" })] })) : (jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Upload the delivery note for this order" }), jsx(UploadBase64MediaForm, { reference: "api::logistics.ipo", refID: data.
|
|
94
|
+
}, children: "Download" })] })) : (jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Upload the delivery note for this order" }), jsx(UploadBase64MediaForm, { reference: "api::logistics.ipo", refID: data.documentId, field: "delivery_note", multiple: false, accept: "text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", path: "api/ipos", componentName: "delivery_note", componentReference: "common.base64-encoded-media", revalidateCallback: revalidateCallback })] }))] }) })] }) }), data?.notes?.length > 0 && (jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Notes" }), jsx(NotesDisplay, { notes: data.notes }), jsx(Divider, {})] }) })), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Items" }), data.internal_status === "placed" && (jsx(Alert, { severity: "warning", children: "Items cannot be updated before order confirmation" })), jsxs("form", { action: formAction, children: [jsx("input", { name: "id", type: "hidden", value: data.id }), jsx("input", { type: "hidden", name: "items", value: JSON.stringify(parseItems(items)) }), jsxs(Stack, { spacing: 2, children: [data?.items &&
|
|
95
95
|
data.items.map((item, index) => (jsx(Paper, { sx: { p: 2 }, children: data.internal_status === "placed" ? (jsx(ItemDisplay, { item: item, index: index, image: item?.product?.image })) : (jsx(ItemUpdater, { item: item, index: index, handleUpdateQuantity: handleUpdateQuantity, image: item?.product?.image,
|
|
96
96
|
// handleRemoveReportAtIndex={handleRemoveReportAtIndex}
|
|
97
97
|
revalidateCallback: revalidateCallback })) }, index))), data.internal_status !== "placed" && (jsx(Paper, { sx: { p: 2 }, children: jsxs(Stack, { direction: "row", justifyContent: "flex-end", spacing: 2, children: [handleClose && (jsx(Button, { onClick: handleClose, variant: "outlined", children: "Cancel" })), jsx(SubmitButton, { text: "Update Items", loadingText: "Updating...", variant: "contained" })] }) }))] })] })] }) })] }) }));
|
|
@@ -211,9 +211,9 @@ function TextualManageIPOForm({ data, sx, revalidateCallback, handleClose, role,
|
|
|
211
211
|
data.internal_status === "released_on_stock") && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "primary", onClick: () => setConfirmDialogOpen(true), children: "Confirm order" }), jsx(Alert, { severity: "warning", children: "Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher" }), jsx(ConfirmFormDialog, { open: confirmDialogOpen, handleClose: () => setConfirmDialogOpen(false), orderID: data.documentId, currentStatus: data.internal_status, revalidateCallback: revalidateCallback })] })), (data.internal_status === "placed" ||
|
|
212
212
|
data.internal_status === "ordered") && (jsxs(Fragment, { children: [jsx(Button, { variant: "contained", color: "error", onClick: () => setCancelDialogOpen(true), children: "Cancel order" }), jsx(CancelIpoDialog, { open: cancelDialogOpen, handleClose: () => setCancelDialogOpen(false), orderID: data.documentId, revalidateCallback: revalidateCallback })] }))] }) }) })), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Documents" }), jsx(Paper, { sx: { p: 2 }, children: jsxs(Stack, { spacing: 1, children: [role === "enduser" && (jsx(Fragment, { children: data.order_confirmation ? (jsxs(Fragment, { children: [jsx(Typography, { variant: "h6", children: "Order Confirmation" }), jsx(Typography, { children: data.order_confirmation?.name }), jsx(Button, { variant: "contained", onClick: () => {
|
|
213
213
|
downloadBase64File(`api/ipos/${data.id}`, "order_confirmation");
|
|
214
|
-
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Order Confirmation" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the order confirmation for this order" }), jsx(Typography, { variant: "body1", children: "FileUpload" }), jsx(Divider, {}), jsx(UploadBase64MediaForm /* This form manages it's own state internally */, { reference: "api::logistics.ipo", refID: data.
|
|
214
|
+
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Order Confirmation" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the order confirmation for this order" }), jsx(Typography, { variant: "body1", children: "FileUpload" }), jsx(Divider, {}), jsx(UploadBase64MediaForm /* This form manages it's own state internally */, { reference: "api::logistics.ipo", refID: data.documentId, field: "order_confirmation", multiple: false, accept: "text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", path: "api/ipos", componentName: "order_confirmation", componentReference: "common.base64-encoded-media", revalidateCallback: revalidateCallback })] })) })), data.delivery_note ? (jsxs(Fragment, { children: [jsx(Typography, { variant: "h6", children: "Delivery Note" }), jsx(Typography, { children: data.delivery_note?.name }), jsx(Button, { variant: "contained", onClick: () => {
|
|
215
215
|
downloadBase64File(`api/ipos/${data.id}`, "delivery_note");
|
|
216
|
-
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the delivery note for this order" }), jsx(Divider, {}), jsx(UploadBase64MediaForm, { reference: "api::logistics.ipo", refID: data.
|
|
216
|
+
}, children: "Download" })] })) : (jsxs(Fragment, { children: [jsx(Typography, { variant: "h5", children: "Delivery Note" }), jsx(Typography, { variant: "body1", children: "Here you can upload the the delivery note for this order" }), jsx(Divider, {}), jsx(UploadBase64MediaForm, { reference: "api::logistics.ipo", refID: data.documentId, field: "delivery_note", multiple: false, accept: "text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", path: "api/ipos", componentName: "delivery_note", componentReference: "common.base64-encoded-media", revalidateCallback: revalidateCallback })] }))] }) })] }) }), data?.notes?.length > 0 && (jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 2, children: [jsx(Typography, { variant: "h5", children: "Notes" }), jsx(NotesDisplay, { notes: data.notes }), jsx(Divider, {})] }) })), jsx(Grid, { item: true, xs: 12, children: jsxs(Stack, { spacing: 1, children: [jsx(Typography, { variant: "h5", children: "Items" }), jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "flex-end", spacing: 2, component: Paper, p: 1, sx: {
|
|
217
217
|
bgcolor: "background.default",
|
|
218
218
|
border: "1px solid",
|
|
219
219
|
borderColor: "divider",
|
|
@@ -9,11 +9,11 @@ import { mutateData } from '../../../services/mutate-data.js';
|
|
|
9
9
|
import { flattenAttributes } from '../../../../lib/utils.js';
|
|
10
10
|
import { parseFormData } from '../../../../lib/parseFormData.js';
|
|
11
11
|
|
|
12
|
-
async function updateOpoAction(
|
|
12
|
+
async function updateOpoAction(documentId, prevState, formData) {
|
|
13
13
|
Object.fromEntries(formData);
|
|
14
14
|
const parsedFormData = parseFormData(formData);
|
|
15
15
|
console.log("parsedFormData", parsedFormData);
|
|
16
|
-
const responseData = await mutateData("PUT", `/api/opos/${
|
|
16
|
+
const responseData = await mutateData("PUT", `/api/opos/${documentId}`, parsedFormData);
|
|
17
17
|
if (!responseData) {
|
|
18
18
|
return {
|
|
19
19
|
...prevState,
|