umwd-components 0.1.543 → 0.1.544
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.
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import l from"./OpoItemUpdater.js";import m from"./OpoItemDisplay.js";import c from"../../logistics/note/NotesDisplay.js";import d from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as s}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import p from"@mui/material/Alert";import E from"@mui/material/Dialog";import v from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import f from"@mui/material/DialogTitle";import y from"@mui/material/Typography";import h from"@mui/material/Button";import b from"@mui/material/Grid";import x from"@mui/material/Box";import C from"@mui/material/Paper";import _ from"@mui/material/Stack";import w from"@mui/material/Divider";import k from"@mui/material/Card";import D from"@mui/material/CardContent";var O={zodErrors:null,strapiErrors:null,data:null,message:null},j={zodErrors:null,strapiErrors:null,data:null,message:null};function q(t){var a=t.open,l=t.handleClose,m=t.orderID,c=t.currentStatus,d=t.revalidateCallback,b=e(i(o,j),2),x=b[0],C=b[1];return n((function(){"Opo Updated"===(null==x?void 0:x.message)&&(d&&d(),l())}),[null==x?void 0:x.message]),r.createElement(E,{open:a},r.createElement("form",{action:C},r.createElement("input",{name:"id",type:"hidden",value:m}),r.createElement("input",{name:"status",type:"hidden",value:"placed"===c?"ordered":"done"}),r.createElement(f,null,"Confirm Order"),r.createElement(g,null,r.createElement(_,{spacing:2},r.createElement(y,null,"Are you sure you want to confirm this order?"),r.createElement(y,null,"Current status: ",c))),r.createElement(v,null,r.createElement(u,{text:"Confirm",loadingText:"Loading..."}),r.createElement(s,{error:null==x?void 0:x.strapiErrors}),(null==x?void 0:x.message)&&r.createElement(p,{severity:"error"},null==x?void 0:x.message),r.createElement(h,{variant:"contained",color:"secondary",onClick:l},"Cancel"))))}function A(n){var E,v,g,f,j,A=n.opo,I=n.sx,S=n.revalidateCallback
|
|
6
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import l from"./OpoItemUpdater.js";import m from"./OpoItemDisplay.js";import c from"../../logistics/note/NotesDisplay.js";import d from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as s}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import p from"@mui/material/Alert";import E from"@mui/material/Dialog";import v from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import f from"@mui/material/DialogTitle";import y from"@mui/material/Typography";import h from"@mui/material/Button";import b from"@mui/material/Grid";import x from"@mui/material/Box";import C from"@mui/material/Paper";import _ from"@mui/material/Stack";import w from"@mui/material/Divider";import k from"@mui/material/Card";import D from"@mui/material/CardContent";var O={zodErrors:null,strapiErrors:null,data:null,message:null},j={zodErrors:null,strapiErrors:null,data:null,message:null};function q(t){var a=t.open,l=t.handleClose,m=t.orderID,c=t.currentStatus,d=t.revalidateCallback,b=e(i(o,j),2),x=b[0],C=b[1];return n((function(){"Opo Updated"===(null==x?void 0:x.message)&&(d&&d(),l())}),[null==x?void 0:x.message]),r.createElement(E,{open:a},r.createElement("form",{action:C},r.createElement("input",{name:"id",type:"hidden",value:m}),r.createElement("input",{name:"status",type:"hidden",value:"placed"===c?"ordered":"done"}),r.createElement(f,null,"Confirm Order"),r.createElement(g,null,r.createElement(_,{spacing:2},r.createElement(y,null,"Are you sure you want to confirm this order?"),r.createElement(y,null,"Current status: ",c))),r.createElement(v,null,r.createElement(u,{text:"Confirm",loadingText:"Loading..."}),r.createElement(s,{error:null==x?void 0:x.strapiErrors}),(null==x?void 0:x.message)&&r.createElement(p,{severity:"error"},null==x?void 0:x.message),r.createElement(h,{variant:"contained",color:"secondary",onClick:l},"Cancel"))))}function A(n){var E,v,g,f,j,A=n.opo,I=n.sx,S=n.revalidateCallback;n.handleClose;var T=n.role,N=e(i(o,O),2),B=N[0],P=N[1],R=e(a(A.opo_items.data?A.opo_items.data:[]),2),U=R[0],z=R[1],L=e(a(!1),2),M=L[0],F=L[1],G=function(r,a,n){var i=t([],e(U),!1),o=i.findIndex((function(e){return e.id===a}));i[o][n]=r,z(i)},J=function(e,t){console.log(U),console.log(e,t),console.log("handleRemoveReportAtIndex")};return r.createElement(x,{sx:t([],e(Array.isArray(I)?I:[I]),!1)},r.createElement(b,{container:!0,spacing:2},r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:2},r.createElement(_,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(_,{spacing:2},r.createElement(y,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(y,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(d,{content:"",related:[{id:A.id,__type:"api::e-commerce.opo"}],revalidateCallback:S})),r.createElement(w,null))),r.createElement(b,{item:!0,xs:12},r.createElement(y,{variant:"h4"},"Purchase Order Number ",A.opo_number)),r.createElement(b,{item:!0,xs:6},r.createElement(_,{spacing:1},r.createElement(y,{variant:"h5"},"Details"),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"150px"},"Custom reference"),r.createElement(y,{variant:"body2"},A.customer_inhouse_reference)),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"150px"},"Order Date"),r.createElement(y,{variant:"body2"},A.order_date)),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"150px"},"Customer"),r.createElement(y,{variant:"body2"},null===(v=null===(E=A.customer)||void 0===E?void 0:E.business_credentials)||void 0===v?void 0:v.company_name)),r.createElement(_,{direction:"row",spacing:2},r.createElement(y,{variant:"body1",width:"150px"},"Order Status"),r.createElement(y,{variant:"body2",width:"150px"},A.status)),("placed"===A.status||"external_shipping_process"===A.status)&&"enduser"===T&&r.createElement(r.Fragment,null,r.createElement(h,{variant:"contained",color:"primary",onClick:function(){return F(!0)}},"Confirm order"),r.createElement(p,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(q,{open:M,handleClose:function(){return F(!1)},orderID:A.id,currentStatus:A.status,revalidateCallback:S})))),r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:2},r.createElement(y,{variant:"h5"},"Documents"),r.createElement(k,{variant:"outlined"},r.createElement(D,null,r.createElement(_,{spacing:1},"// TODO - Should we add options to upload a shipping label and a delivery note?? where do these notes come from? are they generated by the system or are they uploaded by the enduser?"))))),(null===(f=null===(g=null==A?void 0:A.notes)||void 0===g?void 0:g.data)||void 0===f?void 0:f.length)>0&&r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:2},r.createElement(y,{variant:"h5"},"Notes"),r.createElement(c,{notes:A.notes.data}),r.createElement(w,null))),r.createElement(b,{item:!0,xs:12},r.createElement(_,{spacing:1},r.createElement(y,{variant:"h5"},"Items"),"placed"===A.status&&r.createElement(p,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(w,null),r.createElement("form",{action:P},r.createElement("input",{name:"id",type:"hidden",value:A.id}),(null===(j=null==A?void 0:A.opo_items)||void 0===j?void 0:j.data)&&A.opo_items.data.map((function(e,t){var a,n;return console.log("item",e),r.createElement(C,{sx:{p:2,mb:2},key:t},"placed"===A.status?r.createElement(m,{item:e,index:t,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image}):r.createElement(l,{item:e,index:t,handleUpdateQuantity:G,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:J}))})),r.createElement(C,{sx:{p:2}},r.createElement(_,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(u,{text:"Update items",loadingText:"Loading..."}),r.createElement(s,{error:null==B?void 0:B.strapiErrors}),(null==B?void 0:B.message)&&r.createElement(p,{severity:"error"},null==B?void 0:B.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity}}))}(U))}))))))}export{A as default};
|