umwd-components 0.1.546 → 0.1.548

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;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};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import{useFormState as n}from"react-dom";import{updateOpoAction as i}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import o from"./OpoItemUpdater.js";import l from"./OpoItemDisplay.js";import m from"../../logistics/note/NotesDisplay.js";import c from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as s}from"../../StrapiErrors.js";import{SubmitButton as d}from"../../SubmitButton.js";import u from"@mui/material/Alert";import p from"@mui/material/Dialog";import E from"@mui/material/DialogActions";import v from"@mui/material/DialogContent";import f from"@mui/material/DialogTitle";import g from"@mui/material/Typography";import y from"@mui/material/Button";import h from"@mui/material/Grid";import b from"@mui/material/Box";import x from"@mui/material/Paper";import C from"@mui/material/Stack";import _ from"@mui/material/Divider";import w from"@mui/material/Card";import k from"@mui/material/CardContent";import{confirmationService as D}from"../../../data/services/logistics/ipo/confirmation-service.js";var O={zodErrors:null,strapiErrors:null,data:null,message:null};function j(e){var t=e.open,a=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return r.createElement(p,{open:t},r.createElement(f,null,"Confirm Order"),r.createElement(v,null,r.createElement(C,{spacing:2},r.createElement(g,null,"Are you sure you want to confirm this order?"),r.createElement(g,null,"Current status: ",i))),r.createElement(E,null,r.createElement(y,{variant:"contained",onClick:function(e){D("opos",[n]),o&&o()}},"Confirm"),r.createElement(y,{variant:"contained",onClick:a},"Cancel")))}function q(p){var E,v,f,D,q,A=p.opo,I=p.sx,S=p.revalidateCallback;p.handleClose;var N=p.role,T=e(n(i,O),2),B=T[0],P=T[1],R=e(a(A.opo_items.data?A.opo_items.data:[]),2),U=R[0],M=R[1],z=e(a(!1),2),F=z[0],G=z[1],J=function(r,a,n){var i=t([],e(U),!1),o=i.findIndex((function(e){return e.id===a}));i[o][n]=r,M(i)},L=function(e,t){console.log(U),console.log(e,t),console.log("handleRemoveReportAtIndex")};return r.createElement(b,{sx:t([],e(Array.isArray(I)?I:[I]),!1)},r.createElement(h,{container:!0,spacing:2},r.createElement(h,{item:!0,xs:12},r.createElement(C,{spacing:2},r.createElement(C,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(C,{spacing:2},r.createElement(g,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(g,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(c,{content:"",related:[{id:A.id,__type:"api::e-commerce.opo"}],revalidateCallback:S})),r.createElement(_,null))),r.createElement(h,{item:!0,xs:12},r.createElement(g,{variant:"h4"},"Purchase Order Number ",A.opo_number)),r.createElement(h,{item:!0,xs:6},r.createElement(C,{spacing:1},r.createElement(g,{variant:"h5"},"Details"),r.createElement(C,{direction:"row",spacing:2},r.createElement(g,{variant:"body1",width:"150px"},"Custom reference"),r.createElement(g,{variant:"body2"},A.customer_inhouse_reference)),r.createElement(C,{direction:"row",spacing:2},r.createElement(g,{variant:"body1",width:"150px"},"Order Date"),r.createElement(g,{variant:"body2"},A.order_date)),r.createElement(C,{direction:"row",spacing:2},r.createElement(g,{variant:"body1",width:"150px"},"Customer"),r.createElement(g,{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(C,{direction:"row",spacing:2},r.createElement(g,{variant:"body1",width:"150px"},"Order Status"),r.createElement(g,{variant:"body2",width:"150px"},A.status)),("placed"===A.status||"external_shipping_process"===A.status)&&"enduser"===N&&r.createElement(r.Fragment,null,r.createElement(y,{variant:"contained",color:"primary",onClick:function(){return G(!0)}},"Confirm order"),r.createElement(u,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(j,{open:F,handleClose:function(){return G(!1)},orderID:A.id,currentStatus:A.status,revalidateCallback:S})))),r.createElement(h,{item:!0,xs:12},r.createElement(C,{spacing:2},r.createElement(g,{variant:"h5"},"Documents"),r.createElement(w,{variant:"outlined"},r.createElement(k,null,r.createElement(C,{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===(D=null===(f=null==A?void 0:A.notes)||void 0===f?void 0:f.data)||void 0===D?void 0:D.length)>0&&r.createElement(h,{item:!0,xs:12},r.createElement(C,{spacing:2},r.createElement(g,{variant:"h5"},"Notes"),r.createElement(m,{notes:A.notes.data}),r.createElement(_,null))),r.createElement(h,{item:!0,xs:12},r.createElement(C,{spacing:1},r.createElement(g,{variant:"h5"},"Items"),"placed"===A.status&&r.createElement(u,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(_,null),r.createElement("form",{action:P},r.createElement("input",{name:"id",type:"hidden",value:A.id}),(null===(q=null==A?void 0:A.opo_items)||void 0===q?void 0:q.data)&&A.opo_items.data.map((function(e,t){var a,n;return console.log("item",e),r.createElement(x,{sx:{p:2,mb:2},key:t},"placed"===A.status?r.createElement(l,{item:e,index:t,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image}):r.createElement(o,{item:e,index:t,handleUpdateQuantity:J,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:L,revalidateCallback:S}))})),r.createElement(x,{sx:{p:2}},r.createElement(C,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(d,{text:"Update items",loadingText:"Loading..."}),r.createElement(s,{error:null==B?void 0:B.strapiErrors}),(null==B?void 0:B.message)&&r.createElement(u,{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{q as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a}from"react";import r from"@mui/material/Stack";import n from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../../logistics/reportV2/ReportMakingComponent.js";import p from"../../logistics/reportV2/ReportsDisplay.js";function s(s){var f=s.item,y=s.index,E=s.handleUpdateQuantity,g=s.image;s.handleRemoveReportAtIndex;var v=s.revalidateCallback,b=f.line_item_number,h=f.product,k=f.ordered_quantity,V=f.picked_quantity,w=f.packed_quantity,_=f.shipped_quantity,q=f.reports,C=e(a(!1),2),N=C[0],x=C[1],j=void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter((function(e){return"picked"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0,I=void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter((function(e){return"packed"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0;return void 0!==(null==q?void 0:q.data)&&q.data.length>0&&q.data.filter((function(e){return"shipped"===e.type})).reduce((function(e,t){return e+t.quantity}),0),t.createElement(r,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(r,{direction:"row",justifyContent:"space-between"},t.createElement(r,{spacing:1},t.createElement(n,{variant:"body1"},"Line Item Number: ",b),t.createElement(n,{variant:"body1"},"Part Number: ",null==h?void 0:h.product_number)),g&&t.createElement(t.Fragment,null,t.createElement(u,{image:g,label:null==h?void 0:h.title}))),t.createElement(n,{variant:"body2"},"Picked"),t.createElement(m,{currentValue:V,totalValue:k+j,minNewValue:0+w+I,maxNewValue:k+j,color:"info",handleChange:function(e){E(e,f.id,"picked_quantity")}}),t.createElement(n,{variant:"body2"},"Packed"),t.createElement(m,{currentValue:w,totalValue:k+j,minNewValue:0+_,maxNewValue:V+I,color:"info",handleChange:function(e){E(e,f.id,"packed_quantity")},offsetEnd:I}),t.createElement(o,{sx:{p:0}},t.createElement(r,{direction:"row",spacing:1,alignItems:"center"},t.createElement(n,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return x(!N)}},t.createElement(c,null)))),t.createElement(l,{in:N},t.createElement(r,{spacing:2},t.createElement(n,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(p,{reports:q.data}),t.createElement(d,{content:"content",quantity:0,type:"picked",related:[{id:f.id,__type:"api::e-commerce.opo-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Shipped"),t.createElement(m,{currentValue:_,totalValue:k+j+I,minNewValue:0,maxNewValue:w,color:"info",handleChange:function(e){E(e,f.id,"shipped_quantity")}})))}export{s as default};
6
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a}from"react";import r from"@mui/material/Stack";import n from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../../logistics/reportV2/ReportMakingComponent.js";import p from"../../logistics/reportV2/ReportsDisplay.js";function s(s){var f=s.item,y=s.index,E=s.handleUpdateQuantity,g=s.image;s.handleRemoveReportAtIndex;var v=s.revalidateCallback,b=f.line_item_number,h=f.product,k=f.ordered_quantity,V=f.picked_quantity,w=f.packed_quantity,_=f.shipped_quantity,q=f.reports,C=e(a(!1),2),N=C[0],x=C[1];void 0!==(null==q?void 0:q.data)&&q.data.length>0&&q.data.filter((function(e){return"picked"===e.type})).reduce((function(e,t){return e+t.quantity}),0);var j=void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter((function(e){return"packed"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0;return void 0!==(null==q?void 0:q.data)&&q.data.length>0&&q.data.filter((function(e){return"shipped"===e.type})).reduce((function(e,t){return e+t.quantity}),0),t.createElement(r,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(r,{direction:"row",justifyContent:"space-between"},t.createElement(r,{spacing:1},t.createElement(n,{variant:"body1"},"Line Item Number: ",b),t.createElement(n,{variant:"body1"},"Part Number: ",null==h?void 0:h.product_number)),g&&t.createElement(t.Fragment,null,t.createElement(u,{image:g,label:null==h?void 0:h.title}))),t.createElement(n,{variant:"body2"},"Picked"),t.createElement(m,{currentValue:V,totalValue:k+-j,minNewValue:0+w+-j,maxNewValue:k+-j,color:"info",handleChange:function(e){E(e,f.id,"picked_quantity")}}),t.createElement(n,{variant:"body2"},"Packed"),t.createElement(m,{currentValue:w,totalValue:k,minNewValue:0+_,maxNewValue:V+j,color:"info",handleChange:function(e){E(e,f.id,"packed_quantity")},offsetEnd:j}),t.createElement(o,{sx:{p:0}},t.createElement(r,{direction:"row",spacing:1,alignItems:"center"},t.createElement(n,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return x(!N)}},t.createElement(c,null)))),t.createElement(l,{in:N},t.createElement(r,{spacing:2},t.createElement(n,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(p,{reports:q.data}),t.createElement(d,{content:"content",quantity:0,type:"packed",related:[{id:f.id,__type:"api::e-commerce.opo-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Shipped"),t.createElement(m,{currentValue:_,totalValue:k,minNewValue:0,maxNewValue:w,color:"info",handleChange:function(e){E(e,f.id,"shipped_quantity")}})))}export{s as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n}from"react";import l from"@mui/material/Paper";import a from"@mui/material/Box";import c from"@mui/material/Stack";import u from"@mui/material/Alert";import i from"@mui/material/Typography";import{SubmitButton as m}from"../../SubmitButton.js";import{useFormState as o}from"react-dom";import{StrapiErrors as d}from"../../StrapiErrors.js";import{updateProductAction as E}from"../../../data/actions/e-commerce/product/updateProductAction.js";import s from"@mui/material/Grid";import p from"../../logistics/reportV2/ReportsDisplay.js";import y from"../../logistics/reportV2/ReportMakingComponent.js";import{TableContainer as f,Table as _,TableHead as g,TableRow as v,TableCell as q,TableBody as k,TableFooter as x,Tooltip as b}from"@mui/material";import{AmountIndicator as h}from"../../common/AmountIndicator.js";var T={zodErrors:null,strapiErrors:null,data:null,message:null};function V(V){var S,Q,j=V.data,A=V.sx,O=j.id,I=j.title;j.product_number,j.stock;var N=j.ipos,z=j.opos,D=(null===(S=null==j?void 0:j.stock_reports)||void 0===S?void 0:S.data)||[],P=e(n(null!=(null===(Q=null==j?void 0:j.stock_reports)||void 0===Q?void 0:Q.data)?j.stock_reports.data:[]),2),R=P[0];P[1];var w=e(o(E,T),2),B=w[0],C=w[1];return r.createElement(a,{sx:t([{p:2}],e(Array.isArray(A)?A:[A]),!1),component:l},r.createElement(s,{container:!0,spacing:2},r.createElement(s,{item:!0,xs:12},r.createElement(i,{variant:"h6"},I)),r.createElement(s,{item:!0,xs:12},r.createElement(f,{component:l},r.createElement(i,{variant:"h6"},"Incoming orders"),r.createElement(_,{size:"small"},r.createElement(g,null,r.createElement(v,null,r.createElement(q,null,"Number"),r.createElement(q,null,"Order Date"),r.createElement(q,null,"Line Item Number"),r.createElement(q,null,"Ordered Quantity"),r.createElement(q,null,"Arrived Quantity"),r.createElement(q,null,"Registered Quantity"),r.createElement(q,null,"Recieved Quantity"))),r.createElement(k,null,N.map((function(e){return r.createElement(r.Fragment,null,e.items.map((function(t){return r.createElement(v,{key:e.id},r.createElement(q,null,e.ipo_number),r.createElement(q,null,e.order_date),r.createElement(q,null,t.line_item_number),r.createElement(q,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.arrived_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.registered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.recieved_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(x,null,r.createElement(v,null,r.createElement(q,{colSpan:6,align:"right"},"Total added to stock:"),r.createElement(q,null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.recieved_quantity}),0)}),0))))),r.createElement(i,{variant:"h6"},"Outgoing orders"),r.createElement(_,{size:"small"},r.createElement(g,null,r.createElement(v,null,r.createElement(q,null,"Number"),r.createElement(q,null,"Order Date"),r.createElement(q,null,"Line Item Number"),r.createElement(q,null,"Ordered Quantity"),r.createElement(q,null,"Picked Quantity"),r.createElement(q,null,"Packed Quantity"),r.createElement(q,null,"Shipped Quantity"))),r.createElement(k,null,z.map((function(e){return r.createElement(r.Fragment,null,e.opo_items.map((function(t){return r.createElement(v,{key:e.id},r.createElement(q,null,e.opo_number),r.createElement(q,null,e.order_date),r.createElement(q,null,t.line_item_number),r.createElement(q,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.picked_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.packed_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.shipped_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(x,null,r.createElement(v,null,r.createElement(q,{colSpan:3,align:"right"},"Total reduced from stock:"),r.createElement(q,null,z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))))),r.createElement(_,{size:"small"},r.createElement(v,null,r.createElement(q,{align:"right"},"Total added to stock:"),r.createElement(q,null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.recieved_quantity}),0)}),0))),r.createElement(v,null,r.createElement(q,{align:"right"},"Total reduced from stock:"),r.createElement(q,null,z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))),r.createElement(v,null,r.createElement(q,{align:"right"},"Corrections:"),r.createElement(q,null,r.createElement(b,{title:"Total stock corrections"},r.createElement(i,null,D.reduce((function(e,t){return e+t.quantity}),0)))),r.createElement(q,null,r.createElement(b,{title:"Total stock corrections after updating"},r.createElement("b",null,R.reduce((function(e,t){return e+t.quantity}),0))))),r.createElement(v,null,r.createElement(q,{align:"right"},"Stock:"),r.createElement(q,null,r.createElement(b,{title:"Total stock"},r.createElement(i,null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.recieved_quantity}),0)}),0)-z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+D.reduce((function(e,t){return e+t.quantity}),0)))),r.createElement(q,null,r.createElement(b,{title:"Total stock after updating"},r.createElement("b",null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.recieved_quantity}),0)}),0)-z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+R.reduce((function(e,t){return e+t.quantity}),0))))))))),r.createElement("form",{action:C},O&&r.createElement("input",{id:"id",type:"hidden",name:"id",value:O}),r.createElement("input",{id:"stock_reports",type:"hidden",name:"stock_reports",value:JSON.stringify(R)}),r.createElement(s,{container:!0,spacing:2},r.createElement(s,{item:!0,xs:12,sx:{mt:2}},r.createElement(c,{spacing:2},r.createElement(i,{variant:"h5"},"Stock corrections"),r.createElement(i,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),r.createElement(p,{reports:R}),r.createElement(y,{content:"content",quantity:0,type:"registered",related:[{id:O,__type:"api::e-commerce.product"}]}))),r.createElement(s,{item:!0,xs:12},r.createElement(c,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},r.createElement(m,{text:"update stock",loadingText:"loading"}),(null==B?void 0:B.strapiErrors)&&r.createElement(d,{error:null==B?void 0:B.strapiErrors}),(null==B?void 0:B.message)&&r.createElement(u,{severity:"error"},null==B?void 0:B.message))))))}export{V as EditStockForm};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n}from"react";import l from"@mui/material/Paper";import a from"@mui/material/Box";import c from"@mui/material/Stack";import u from"@mui/material/Alert";import i from"@mui/material/Typography";import{SubmitButton as m}from"../../SubmitButton.js";import{useFormState as o}from"react-dom";import{StrapiErrors as d}from"../../StrapiErrors.js";import{updateProductAction as E}from"../../../data/actions/e-commerce/product/updateProductAction.js";import s from"@mui/material/Grid";import p from"../../logistics/reportV2/ReportsDisplay.js";import y from"../../logistics/reportV2/ReportMakingComponent.js";import{TableContainer as f,Table as _,TableHead as g,TableRow as v,TableCell as q,TableBody as k,TableFooter as x,Tooltip as b}from"@mui/material";import{AmountIndicator as h}from"../../common/AmountIndicator.js";var T={zodErrors:null,strapiErrors:null,data:null,message:null};function V(V){var S,Q,j=V.data,A=V.sx,O=j.id,I=j.title;j.product_number,j.stock;var N=j.ipos,z=j.opos,D=(null===(S=null==j?void 0:j.stock_reports)||void 0===S?void 0:S.data)||[],P=e(n(null!=(null===(Q=null==j?void 0:j.stock_reports)||void 0===Q?void 0:Q.data)?j.stock_reports.data:[]),2),R=P[0];P[1];var w=e(o(E,T),2),B=w[0],C=w[1];return r.createElement(a,{sx:t([{p:2}],e(Array.isArray(A)?A:[A]),!1),component:l},r.createElement(s,{container:!0,spacing:2},r.createElement(s,{item:!0,xs:12},r.createElement(i,{variant:"h6"},I)),r.createElement(s,{item:!0,xs:12},r.createElement(f,{component:l},r.createElement(i,{variant:"h6"},"Incoming orders"),r.createElement(_,{size:"small"},r.createElement(g,null,r.createElement(v,null,r.createElement(q,null,"Number"),r.createElement(q,null,"Order Date"),r.createElement(q,null,"Line Item Number"),r.createElement(q,null,"Ordered Quantity"),r.createElement(q,null,"Arrived Quantity"),r.createElement(q,null,"Registered Quantity"),r.createElement(q,null,"Recieved Quantity"))),r.createElement(k,null,N.map((function(e){return r.createElement(r.Fragment,null,e.items.map((function(t){return r.createElement(v,{key:e.id},r.createElement(q,null,e.ipo_number),r.createElement(q,null,e.order_date),r.createElement(q,null,t.line_item_number),r.createElement(q,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.arrived_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.registered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.received_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(x,null,r.createElement(v,null,r.createElement(q,{colSpan:6,align:"right"},"Total added to stock:"),r.createElement(q,null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0))))),r.createElement(i,{variant:"h6"},"Outgoing orders"),r.createElement(_,{size:"small"},r.createElement(g,null,r.createElement(v,null,r.createElement(q,null,"Number"),r.createElement(q,null,"Order Date"),r.createElement(q,null,"Line Item Number"),r.createElement(q,null,"Ordered Quantity"),r.createElement(q,null,"Picked Quantity"),r.createElement(q,null,"Packed Quantity"),r.createElement(q,null,"Shipped Quantity"))),r.createElement(k,null,z.map((function(e){return r.createElement(r.Fragment,null,e.opo_items.map((function(t){return r.createElement(v,{key:e.id},r.createElement(q,null,e.opo_number),r.createElement(q,null,e.order_date),r.createElement(q,null,t.line_item_number),r.createElement(q,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.picked_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.packed_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(h,{value:t.shipped_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(x,null,r.createElement(v,null,r.createElement(q,{colSpan:3,align:"right"},"Total reduced from stock:"),r.createElement(q,null,z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))))),r.createElement(_,{size:"small"},r.createElement(v,null,r.createElement(q,{align:"right"},"Total added to stock:"),r.createElement(q,null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0))),r.createElement(v,null,r.createElement(q,{align:"right"},"Total reduced from stock:"),r.createElement(q,null,z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))),r.createElement(v,null,r.createElement(q,{align:"right"},"Corrections:"),r.createElement(q,null,r.createElement(b,{title:"Total stock corrections"},r.createElement(i,null,D.reduce((function(e,t){return e+t.quantity}),0)))),r.createElement(q,null,r.createElement(b,{title:"Total stock corrections after updating"},r.createElement("b",null,R.reduce((function(e,t){return e+t.quantity}),0))))),r.createElement(v,null,r.createElement(q,{align:"right"},"Stock:"),r.createElement(q,null,r.createElement(b,{title:"Total stock"},r.createElement(i,null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0)-z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+D.reduce((function(e,t){return e+t.quantity}),0)))),r.createElement(q,null,r.createElement(b,{title:"Total stock after updating"},r.createElement("b",null,N.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0)-z.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+R.reduce((function(e,t){return e+t.quantity}),0))))))))),r.createElement("form",{action:C},O&&r.createElement("input",{id:"id",type:"hidden",name:"id",value:O}),r.createElement("input",{id:"stock_reports",type:"hidden",name:"stock_reports",value:JSON.stringify(R)}),r.createElement(s,{container:!0,spacing:2},r.createElement(s,{item:!0,xs:12,sx:{mt:2}},r.createElement(c,{spacing:2},r.createElement(i,{variant:"h5"},"Stock corrections"),r.createElement(i,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),r.createElement(p,{reports:R}),r.createElement(y,{content:"content",quantity:0,type:"registered",related:[{id:O,__type:"api::e-commerce.product"}]}))),r.createElement(s,{item:!0,xs:12},r.createElement(c,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},r.createElement(m,{text:"update stock",loadingText:"loading"}),(null==B?void 0:B.strapiErrors)&&r.createElement(d,{error:null==B?void 0:B.strapiErrors}),(null==B?void 0:B.message)&&r.createElement(u,{severity:"error"},null==B?void 0:B.message))))))}export{V as EditStockForm};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import a from"@mui/material/Stack";import n from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../reportV2/ReportMakingComponent.js";import p from"../reportV2/ReportsDisplay.js";function s(s){var f=s.item,y=s.index,g=s.handleUpdateQuantity,E=s.image,v=s.revalidateCallback,b=f.line_item_number,V=f.product,w=f.arrived_quantity,_=f.registered_quantity,h=f.recieved_quantity,q=f.ordered_quantity,C=f.reports,N=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter((function(e){return"arrived"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0,k=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter((function(e){return"registered"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0,j=e(r(!1),2),x=j[0],D=j[1];return t.createElement(a,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between"},t.createElement(a,{spacing:1},t.createElement(n,{variant:"body1"},"Line Item Number: ",b),t.createElement(n,{variant:"body1"},"Part Number: ",V.product_number)),E&&t.createElement(t.Fragment,null,t.createElement(u,{image:E,label:f.product.title}))),t.createElement(n,{variant:"body2"},"Arrived"),t.createElement(m,{currentValue:w,totalValue:q+N,minNewValue:0+_+k,maxNewValue:q+N,color:"info",handleChange:function(e){g(e,f.id,"arrived_quantity")}}),t.createElement(n,{variant:"body2"},"Registered"),t.createElement(m,{currentValue:_,totalValue:q+N,minNewValue:0+h,maxNewValue:w+k,color:"info",handleChange:function(e){g(e,f.id,"registered_quantity")},offsetEnd:k}),t.createElement(o,{sx:{p:0}},t.createElement(a,{direction:"row",spacing:1,alignItems:"center"},t.createElement(n,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return D(!x)}},t.createElement(c,null)))),t.createElement(l,{in:x},t.createElement(a,{spacing:2},t.createElement(n,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(p,{reports:C.data}),t.createElement(d,{content:"content",quantity:0,type:"registered",related:[{id:f.id,__type:"api::logistics.ipo-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Recieved"),t.createElement(m,{currentValue:h,totalValue:q+N+k,minNewValue:0,maxNewValue:_,color:"info",handleChange:function(e){g(e,f.id,"recieved_quantity")}})))}export{s as default};
6
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import a from"@mui/material/Stack";import n from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../reportV2/ReportMakingComponent.js";import p from"../reportV2/ReportsDisplay.js";function s(s){var f=s.item,y=s.index,g=s.handleUpdateQuantity,E=s.image,v=s.revalidateCallback,b=f.line_item_number,V=f.product,w=f.arrived_quantity,_=f.registered_quantity,h=f.received_quantity,q=f.ordered_quantity,C=f.reports,N=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter((function(e){return"arrived"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0,k=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter((function(e){return"registered"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0,j=e(r(!1),2),x=j[0],D=j[1];return t.createElement(a,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between"},t.createElement(a,{spacing:1},t.createElement(n,{variant:"body1"},"Line Item Number: ",b),t.createElement(n,{variant:"body1"},"Part Number: ",V.product_number)),E&&t.createElement(t.Fragment,null,t.createElement(u,{image:E,label:f.product.title}))),t.createElement(n,{variant:"body2"},"Arrived"),t.createElement(m,{currentValue:w,totalValue:q+N,minNewValue:0+_+k,maxNewValue:q+N,color:"info",handleChange:function(e){g(e,f.id,"arrived_quantity")}}),t.createElement(n,{variant:"body2"},"Registered"),t.createElement(m,{currentValue:_,totalValue:q+N,minNewValue:0+h,maxNewValue:w+k,color:"info",handleChange:function(e){g(e,f.id,"registered_quantity")},offsetEnd:k}),t.createElement(o,{sx:{p:0}},t.createElement(a,{direction:"row",spacing:1,alignItems:"center"},t.createElement(n,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return D(!x)}},t.createElement(c,null)))),t.createElement(l,{in:x},t.createElement(a,{spacing:2},t.createElement(n,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(p,{reports:C.data}),t.createElement(d,{content:"content",quantity:0,type:"registered",related:[{id:f.id,__type:"api::logistics.ipo-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Recieved"),t.createElement(m,{currentValue:h,totalValue:q+N+k,minNewValue:0,maxNewValue:_,color:"info",handleChange:function(e){g(e,f.id,"received_quantity")}})))}export{s as default};
@@ -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{updateIpoAction as o}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./ItemUpdater.js";import d from"./ItemDisplay.js";import s from"../note/NotesDisplay.js";import u from"../note/NoteTakingComponent.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{SubmitButton as v}from"../../SubmitButton.js";import E from"@mui/material/Alert";import f from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import h from"@mui/material/DialogTitle";import b from"@mui/material/Typography";import x from"@mui/material/Button";import C from"@mui/material/Grid";import _ from"@mui/material/Box";import w from"@mui/material/Paper";import D from"@mui/material/Stack";import k from"@mui/material/Divider";import I from"@mui/material/Card";import j from"@mui/material/CardContent";var F={zodErrors:null,strapiErrors:null,data:null,message:null},N={zodErrors:null,strapiErrors:null,data:null,message:null};function A(t){var a=t.open,l=t.handleClose,m=t.orderID,c=t.currentStatus,d=t.revalidateCallback,s=e(i(o,N),2),u=s[0],C=s[1];return n((function(){"Ipo Updated"===(null==u?void 0:u.message)&&(d&&d(),l())}),[null==u?void 0:u.message]),r.createElement(f,{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(h,null,"Confirm Order"),r.createElement(y,null,r.createElement(D,{spacing:2},r.createElement(b,null,"Are you sure you want to confirm this order?"),r.createElement(b,null,"Current status: ",c))),r.createElement(g,null,r.createElement(v,{text:"Confirm",loadingText:"Loading..."}),r.createElement(p,{error:null==u?void 0:u.strapiErrors}),(null==u?void 0:u.message)&&r.createElement(E,{severity:"error"},null==u?void 0:u.message),r.createElement(x,{variant:"contained",color:"secondary",onClick:l},"Cancel"))))}function O(n){var f,g,y,h,N,O,S,q=n.data,B=n.sx,R=n.revalidateCallback;n.handleClose;var U=n.role,T=e(i(o,F),2),P=T[0],M=T[1],z=e(a(q.items.data?q.items.data:[]),2),H=z[0],L=z[1],G=e(a(!1),2),J=G[0],Q=G[1],K=function(r,a,n){var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===a}));i[o][n]=r,L(i)},V=function(e,t){console.log(H),console.log(e,t),console.log("handleRemoveReportAtIndex")};return r.createElement(_,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},r.createElement(C,{container:!0,spacing:2},r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(D,{spacing:2},r.createElement(b,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),r.createElement(b,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),r.createElement(u,{content:"",related:[{id:q.id,__type:"api::logistics.ipo"}],revalidateCallback:R})),r.createElement(k,null))),r.createElement(C,{item:!0,xs:12},r.createElement(b,{variant:"h4"},"Purchase Order Number ",q.ipo_number)),r.createElement(C,{item:!0,xs:6},r.createElement(D,{spacing:1},r.createElement(b,{variant:"h5"},"Details"),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Custom reference"),r.createElement(b,{variant:"body2"},q.custom_reference)),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Order Date"),r.createElement(b,{variant:"body2"},q.order_date)),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Supplier"),r.createElement(b,{variant:"body2"},null===(g=null===(f=q.vendor_profile)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),r.createElement(D,{direction:"row",spacing:2},r.createElement(b,{variant:"body1",width:"150px"},"Order Status"),r.createElement(b,{variant:"body2",width:"150px"},q.status)),("placed"===q.status||"received_on_stock"===q.status)&&"enduser"===U&&r.createElement(r.Fragment,null,r.createElement(x,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),r.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(A,{open:J,handleClose:function(){return Q(!1)},orderID:q.id,currentStatus:q.status,revalidateCallback:R})))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(b,{variant:"h5"},"Documents"),r.createElement(I,{variant:"outlined"},r.createElement(j,null,r.createElement(D,{spacing:1},"enduser"===U&&r.createElement(r.Fragment,null,q.order_confirmation?r.createElement(r.Fragment,null,r.createElement(b,{variant:"h6"},"Order Confirmation"),r.createElement(b,null,null===(y=q.order_confirmation)||void 0===y?void 0:y.name),r.createElement(x,{variant:"contained",onClick:function(){m("api/ipos/".concat(q.id),"order_confirmation")}},"Download")):r.createElement(r.Fragment,null,r.createElement(b,{variant:"h5"},"Order Confirmation"),r.createElement(b,{variant:"body1"},"Here you can upload the the order confirmation for this order"),r.createElement(b,{variant:"body1"},"FileUpload"),r.createElement(k,null),r.createElement(l,{reference:"api::logistics.ipo",refID:q.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:R}))),q.delivery_note?r.createElement(r.Fragment,null,r.createElement(b,{variant:"h6"},"Delivery Note"),r.createElement(b,null,null===(h=q.delivery_note)||void 0===h?void 0:h.name),r.createElement(x,{variant:"contained",onClick:function(){m("api/ipos/".concat(q.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(b,{variant:"h5"},"Delivery Note"),r.createElement(b,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(k,null),r.createElement(l,{reference:"api::logistics.ipo",refID:q.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:R}))))))),(null===(O=null===(N=null==q?void 0:q.notes)||void 0===N?void 0:N.data)||void 0===O?void 0:O.length)>0&&r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(b,{variant:"h5"},"Notes"),r.createElement(s,{notes:q.notes.data}),r.createElement(k,null))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:1},r.createElement(b,{variant:"h5"},"Items"),"placed"===q.status&&r.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(k,null),r.createElement("form",{action:M},r.createElement("input",{name:"id",type:"hidden",value:q.id}),(null===(S=null==q?void 0:q.items)||void 0===S?void 0:S.data)&&q.items.data.map((function(e,t){var a,n;return console.log("item",e),r.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===q.status?r.createElement(d,{item:e,index:t,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image}):r.createElement(c,{item:e,index:t,handleUpdateQuantity:K,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:V,revalidateCallback:R}))})),r.createElement(w,{sx:{p:2}},r.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(v,{text:"Update items",loadingText:"Loading..."}),r.createElement(p,{error:null==P?void 0:P.strapiErrors}),(null==P?void 0:P.message)&&r.createElement(E,{severity:"error"},null==P?void 0:P.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,arrived_quantity:e.arrived_quantity,registered_quantity:e.registered_quantity,recieved_quantity:e.recieved_quantity}}))}(H))}))))))}export{O as default};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import{useFormState as n}from"react-dom";import{updateIpoAction as i}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as o}from"../../common/media/UploadBase64MediaForm.js";import l from"../../../data/loaders/common/media/downloadBase64File.js";import m from"./ItemUpdater.js";import c from"./ItemDisplay.js";import d from"../note/NotesDisplay.js";import s from"../note/NoteTakingComponent.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{SubmitButton as u}from"../../SubmitButton.js";import v from"@mui/material/Alert";import E from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import C from"@mui/material/Grid";import x from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import D from"@mui/material/Divider";import k from"@mui/material/Card";import j from"@mui/material/CardContent";import{confirmationService as I}from"../../../data/services/logistics/ipo/confirmation-service.js";var F={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(E,{open:t},a.createElement(y,null,"Confirm Order"),a.createElement(g,null,a.createElement(w,{spacing:2},a.createElement(h,null,"Are you sure you want to confirm this order?"),a.createElement(h,null,"Current status: ",i))),a.createElement(f,null,a.createElement(b,{variant:"contained",onClick:function(e){I("ipos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function A(E){var f,g,y,I,A,O,S,q=E.data,B=E.sx,R=E.revalidateCallback;E.handleClose;var U=E.role,P=e(n(i,F),2),T=P[0],M=P[1],H=e(r(q.items.data?q.items.data:[]),2),z=H[0],G=H[1],J=e(r(!1),2),L=J[0],Q=J[1],K=function(a,r,n){var i=t([],e(z),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,G(i)},V=function(e,t){console.log(z),console.log(e,t),console.log("handleRemoveReportAtIndex")};return a.createElement(x,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},a.createElement(C,{container:!0,spacing:2},a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),a.createElement(h,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),a.createElement(s,{content:"",related:[{id:q.id,__type:"api::logistics.ipo"}],revalidateCallback:R})),a.createElement(D,null))),a.createElement(C,{item:!0,xs:12},a.createElement(h,{variant:"h4"},"Purchase Order Number ",q.ipo_number)),a.createElement(C,{item:!0,xs:6},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Details"),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"150px"},"Custom reference"),a.createElement(h,{variant:"body2"},q.custom_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"150px"},"Order Date"),a.createElement(h,{variant:"body2"},q.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"150px"},"Supplier"),a.createElement(h,{variant:"body2"},null===(g=null===(f=q.vendor_profile)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"150px"},"Order Status"),a.createElement(h,{variant:"body2",width:"150px"},q.status)),("placed"===q.status||"received_on_stock"===q.status)&&"enduser"===U&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),a.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(N,{open:L,handleClose:function(){return Q(!1)},orderID:q.id,currentStatus:q.status,revalidateCallback:R})))),a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(k,{variant:"outlined"},a.createElement(j,null,a.createElement(w,{spacing:1},"enduser"===U&&a.createElement(a.Fragment,null,q.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=q.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(q.id),"order_confirmation")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Order Confirmation"),a.createElement(h,{variant:"body1"},"Here you can upload the the order confirmation for this order"),a.createElement(h,{variant:"body1"},"FileUpload"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:q.id,field:"order_confirmation",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"order_confirmation",componentReference:"common.base64-encoded-media",revalidateCallback:R}))),q.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(I=q.delivery_note)||void 0===I?void 0:I.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(q.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Delivery Note"),a.createElement(h,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(o,{reference:"api::logistics.ipo",refID:q.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/ipos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:R}))))))),(null===(O=null===(A=null==q?void 0:q.notes)||void 0===A?void 0:A.data)||void 0===O?void 0:O.length)>0&&a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:q.notes.data}),a.createElement(D,null))),a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===q.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:M},a.createElement("input",{name:"id",type:"hidden",value:q.id}),(null===(S=null==q?void 0:q.items)||void 0===S?void 0:S.data)&&q.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===q.status?a.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(m,{item:e,index:t,handleUpdateQuantity:K,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:V,revalidateCallback:R}))})),a.createElement(_,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(u,{text:"Update items",loadingText:"Loading..."}),a.createElement(p,{error:null==T?void 0:T.strapiErrors}),(null==T?void 0:T.message)&&a.createElement(v,{severity:"error"},null==T?void 0:T.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,arrived_quantity:e.arrived_quantity,registered_quantity:e.registered_quantity,received_quantity:e.received_quantity}}))}(z))}))))))}export{A as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import e from"react";import t from"@mui/material/Typography";import r from"@mui/material/Stack";import a from"@mui/material/Chip";import m from"@mui/material/Grid";import n from"../../common/markdown/MarkdownDisplay.js";import{Divider as i}from"@mui/material";var l=function(l){var o=l.reports;return e.createElement(r,{spacing:2},o&&o.length>0&&o.map((function(r,l){var o;return e.createElement(m,{container:!0,key:l},e.createElement(m,{item:!0,xs:2},e.createElement(a,{label:"".concat(r.quantity>0&&"+"," ").concat(r.quantity),color:r.quantity>0?"success":"error"})),e.createElement(m,{item:!0,xs:7},e.createElement(n,null,r.content)),e.createElement(m,{item:!0,xs:1},e.createElement(t,null," ",r.date)),e.createElement(m,{item:!0,xs:1},e.createElement(t,{align:"right"},null===(o=r.author)||void 0===o?void 0:o.username)),e.createElement(m,{item:!0,xs:1},e.createElement(t,{align:"right"},"delete")),e.createElement(m,{item:!0,xs:12},e.createElement(i,null)))})))};export{l as default};
6
+ import e from"react";import t from"@mui/material/Typography";import r from"@mui/material/Stack";import a from"@mui/material/Chip";import m from"@mui/material/Grid";import n from"../../common/markdown/MarkdownDisplay.js";import{Divider as i}from"@mui/material";var o=function(o){var l=o.reports;return e.createElement(r,{spacing:2},l&&l.length>0&&l.map((function(r,o){var l;return e.createElement(m,{container:!0,key:o},e.createElement(m,{item:!0,xs:2},e.createElement(a,{label:"".concat(r.quantity>0?"+":""," ").concat(r.quantity),color:r.quantity>0?"success":"error"})),e.createElement(m,{item:!0,xs:7},e.createElement(n,null,r.content)),e.createElement(m,{item:!0,xs:1},e.createElement(t,null," ",r.date)),e.createElement(m,{item:!0,xs:2},e.createElement(t,{align:"right"},null===(l=r.author)||void 0===l?void 0:l.username)),e.createElement(m,{item:!0,xs:12},e.createElement(i,null)))})))};export{o as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as e,__generator as r}from"../../../../node_modules/tslib/tslib.es6.js";import o from"../../../../node_modules/qs/lib/index.js";import{fetchData as t}from"../loaders.js";import{getStrapiURL as i}from"../../../lib/utils.js";import{unstable_noStore as s}from"next/cache";var p=i();function a(i){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return s(),(e=new URL("/api/ipos/".concat(i),p)).search=o.stringify({populate:{vendor_profile:{populate:{business_credentials:!0}},items:{populate:{product:{populate:{image:!0}},ordered_bad_reports:!0,arrived_bad_reports:!0,registered_bad_reports:!0,recieved_bad_reports:!0,reports:{populate:{author:!0}}}},order_confirmation:!0,delivery_note:!0,notes:{populate:{author:{populate:!0}}}}}),console.log(e.href),[4,t(e.href)];case 1:return[2,r.sent()]}}))}))}export{a as getSingleIpo};
7
+ import{__awaiter as e,__generator as r}from"../../../../node_modules/tslib/tslib.es6.js";import o from"../../../../node_modules/qs/lib/index.js";import{fetchData as t}from"../loaders.js";import{getStrapiURL as i}from"../../../lib/utils.js";import{unstable_noStore as s}from"next/cache";var p=i();function a(i){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return s(),(e=new URL("/api/ipos/".concat(i),p)).search=o.stringify({populate:{vendor_profile:{populate:{business_credentials:!0}},items:{populate:{product:{populate:{image:!0}},ordered_bad_reports:!0,arrived_bad_reports:!0,registered_bad_reports:!0,received_bad_reports:!0,reports:{populate:{author:!0}}}},order_confirmation:!0,delivery_note:!0,notes:{populate:{author:{populate:!0}}}}}),console.log(e.href),[4,t(e.href)];case 1:return[2,r.sent()]}}))}))}export{a as getSingleIpo};