umwd-components 0.1.601 → 0.1.602

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.
@@ -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 from"react";import n from"@mui/material/Paper";import l from"@mui/material/Box";import a from"@mui/material/Stack";import c from"@mui/material/Alert";import m from"@mui/material/Typography";import{SubmitButton as u}from"../../SubmitButton.js";import{useFormState as i}from"react-dom";import{StrapiErrors as o}from"../../StrapiErrors.js";import{updateProductAction as d}from"../../../data/actions/e-commerce/product/updateProductAction.js";import E from"@mui/material/Grid";import s from"../../logistics/report/ReportsDisplay.js";import p from"../../logistics/report/ReportMakingComponent.js";import{TableContainer as y,Table as f,TableHead as _,TableRow as g,TableCell as v,TableBody as q,TableFooter as k,Tooltip as x}from"@mui/material";import{AmountIndicator as b}from"../../common/AmountIndicator.js";var h={zodErrors:null,strapiErrors:null,data:null,message:null};function T(T){var S=T.data,Q=T.revalidateCallback,V=T.sx,j=S.id,A=S.title;S.product_number,S.stock;var O=S.ipos,I=S.opos,N=S.reports,z=e(i(d,h),2),C=z[0],D=z[1];return r.createElement(l,{sx:t([{p:2}],e(Array.isArray(V)?V:[V]),!1),component:n},r.createElement(E,{container:!0,spacing:2},r.createElement(E,{item:!0,xs:12},r.createElement(m,{variant:"h6"},A)),r.createElement(E,{item:!0,xs:12},r.createElement(y,{component:n},r.createElement(m,{variant:"h6"},"Incoming orders"),r.createElement(f,{size:"small"},r.createElement(_,null,r.createElement(g,null,r.createElement(v,null,"Number"),r.createElement(v,null,"Order Date"),r.createElement(v,null,"Line Item Number"),r.createElement(v,null,"Ordered Quantity"),r.createElement(v,null,"Arrived Quantity"),r.createElement(v,null,"Registered Quantity"),r.createElement(v,null,"Recieved Quantity"))),r.createElement(q,null,O.map((function(e){return r.createElement(r.Fragment,null,e.items.map((function(t){return r.createElement(g,{key:e.id},r.createElement(v,null,e.ipo_number),r.createElement(v,null,e.order_date),r.createElement(v,null,t.line_item_number),r.createElement(v,null,r.createElement(b,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(v,null,r.createElement(b,{value:t.arrived_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(v,null,r.createElement(b,{value:t.registered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(v,null,r.createElement(b,{value:t.received_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(k,null,r.createElement(g,null,r.createElement(v,{colSpan:6,align:"right"},"Total added to stock:"),r.createElement(v,null,O.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0))))),r.createElement(m,{variant:"h6"},"Outgoing orders"),r.createElement(f,{size:"small"},r.createElement(_,null,r.createElement(g,null,r.createElement(v,null,"Number"),r.createElement(v,null,"Order Date"),r.createElement(v,null,"Line Item Number"),r.createElement(v,null,"Ordered Quantity"),r.createElement(v,null,"Picked Quantity"),r.createElement(v,null,"Packed Quantity"),r.createElement(v,null,"Shipped Quantity"))),r.createElement(q,null,I.map((function(e){return r.createElement(r.Fragment,null,e.opo_items.map((function(t){return r.createElement(g,{key:e.id},r.createElement(v,null,e.opo_number),r.createElement(v,null,e.order_date),r.createElement(v,null,t.line_item_number),r.createElement(v,null,r.createElement(b,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(v,null,r.createElement(b,{value:t.picked_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(v,null,r.createElement(b,{value:t.packed_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(v,null,r.createElement(b,{value:t.shipped_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(k,null,r.createElement(g,null,r.createElement(v,{colSpan:3,align:"right"},"Total reduced from stock:"),r.createElement(v,null,I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))))),r.createElement(f,{size:"small"},r.createElement(g,null,r.createElement(v,{align:"right"},"Total added to stock:"),r.createElement(v,null,O.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0))),r.createElement(g,null,r.createElement(v,{align:"right"},"Total reduced from stock:"),r.createElement(v,null,I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))),r.createElement(g,null,r.createElement(v,{align:"right"},"Corrections:"),r.createElement(v,null,r.createElement(x,{title:"Total stock corrections"},r.createElement(m,null,N?N.reduce((function(e,t){return e+t.quantity}),0):0))),r.createElement(v,null,r.createElement(x,{title:"Total stock corrections after updating"},r.createElement("b",null,N?N.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(g,null,r.createElement(v,{align:"right"},"Stock:"),r.createElement(v,null,r.createElement(x,{title:"Total stock"},r.createElement(m,null,O.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0)-I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(N?N.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(v,null,r.createElement(x,{title:"Total stock after updating"},r.createElement("b",null,O.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.received_quantity}),0)}),0)-I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(N?N.reduce((function(e,t){return e+t.quantity}),0):0))))))))),r.createElement("form",{action:D},j&&r.createElement("input",{id:"id",type:"hidden",name:"id",value:j}),r.createElement("input",{id:"stock_reports",type:"hidden",name:"stock_reports",value:JSON.stringify(N)}),r.createElement(E,{container:!0,spacing:2},r.createElement(E,{item:!0,xs:12,sx:{mt:2}},r.createElement(a,{spacing:2},r.createElement(m,{variant:"h5"},"Stock corrections"),r.createElement(m,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),r.createElement(s,{reports:N}),r.createElement(p,{content:"content",quantity:0,type:"stock",related:[{id:j,__type:"api::e-commerce.product"}],revalidateCallback:Q}))),r.createElement(E,{item:!0,xs:12},r.createElement(a,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},r.createElement(u,{text:"update stock",loadingText:"loading"}),(null==C?void 0:C.strapiErrors)&&r.createElement(o,{error:null==C?void 0:C.strapiErrors}),(null==C?void 0:C.message)&&r.createElement(c,{severity:"error"},null==C?void 0:C.message))))))}export{T as EditStockForm};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r from"react";import n from"@mui/material/Paper";import l from"@mui/material/Box";import a from"@mui/material/Stack";import c from"@mui/material/Alert";import m from"@mui/material/Typography";import{SubmitButton as u}from"../../SubmitButton.js";import{useFormState as i}from"react-dom";import{StrapiErrors as o}from"../../StrapiErrors.js";import{updateProductAction as d}from"../../../data/actions/e-commerce/product/updateProductAction.js";import E from"@mui/material/Grid";import s from"../../logistics/report/ReportsDisplay.js";import p from"../../logistics/report/ReportMakingComponent.js";import{TableContainer as y,Table as f,TableHead as _,TableRow as g,TableCell as q,TableBody as v,TableFooter as k,Tooltip as x}from"@mui/material";import{AmountIndicator as b}from"../../common/AmountIndicator.js";var h={zodErrors:null,strapiErrors:null,data:null,message:null};function T(T){var S=T.data,Q=T.revalidateCallback,V=T.sx,j=S.id,O=S.title;S.product_number,S.stock;var A=S.ipos,I=S.opos,N=S.reports,z=e(i(d,h),2),C=z[0],D=z[1];return r.createElement(l,{sx:t([{p:2}],e(Array.isArray(V)?V:[V]),!1),component:n},r.createElement(E,{container:!0,spacing:2},r.createElement(E,{item:!0,xs:12},r.createElement(m,{variant:"h6"},O)),r.createElement(E,{item:!0,xs:12},r.createElement(y,{component:n},r.createElement(m,{variant:"h6"},"Incoming orders"),r.createElement(f,{size:"small"},r.createElement(_,null,r.createElement(g,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,"received Quantity"),r.createElement(q,null,"Registered Quantity"),r.createElement(q,null,"released Quantity"))),r.createElement(v,null,A.map((function(e){return r.createElement(r.Fragment,null,e.items.map((function(t){return r.createElement(g,{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(b,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(b,{value:t.received_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(b,{value:t.registered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(b,{value:t.released_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(k,null,r.createElement(g,null,r.createElement(q,{colSpan:6,align:"right"},"Total added to stock:"),r.createElement(q,null,A.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))))),r.createElement(m,{variant:"h6"},"Outgoing orders"),r.createElement(f,{size:"small"},r.createElement(_,null,r.createElement(g,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(v,null,I.map((function(e){return r.createElement(r.Fragment,null,e.opo_items.map((function(t){return r.createElement(g,{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(b,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(b,{value:t.picked_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(b,{value:t.packed_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(q,null,r.createElement(b,{value:t.shipped_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(k,null,r.createElement(g,null,r.createElement(q,{colSpan:3,align:"right"},"Total reduced from stock:"),r.createElement(q,null,I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))))),r.createElement(f,{size:"small"},r.createElement(g,null,r.createElement(q,{align:"right"},"Total added to stock:"),r.createElement(q,null,A.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))),r.createElement(g,null,r.createElement(q,{align:"right"},"Total reduced from stock:"),r.createElement(q,null,I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))),r.createElement(g,null,r.createElement(q,{align:"right"},"Corrections:"),r.createElement(q,null,r.createElement(x,{title:"Total stock corrections"},r.createElement(m,null,N?N.reduce((function(e,t){return e+t.quantity}),0):0))),r.createElement(q,null,r.createElement(x,{title:"Total stock corrections after updating"},r.createElement("b",null,N?N.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(g,null,r.createElement(q,{align:"right"},"Stock:"),r.createElement(q,null,r.createElement(x,{title:"Total stock"},r.createElement(m,null,A.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0)-I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(N?N.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(q,null,r.createElement(x,{title:"Total stock after updating"},r.createElement("b",null,A.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0)-I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(N?N.reduce((function(e,t){return e+t.quantity}),0):0))))))))),r.createElement("form",{action:D},j&&r.createElement("input",{id:"id",type:"hidden",name:"id",value:j}),r.createElement("input",{id:"stock_reports",type:"hidden",name:"stock_reports",value:JSON.stringify(N)}),r.createElement(E,{container:!0,spacing:2},r.createElement(E,{item:!0,xs:12,sx:{mt:2}},r.createElement(a,{spacing:2},r.createElement(m,{variant:"h5"},"Stock corrections"),r.createElement(m,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),r.createElement(s,{reports:N}),r.createElement(p,{content:"content",quantity:0,type:"stock",related:[{id:j,__type:"api::e-commerce.product"}],revalidateCallback:Q}))),r.createElement(E,{item:!0,xs:12},r.createElement(a,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},r.createElement(u,{text:"update stock",loadingText:"loading"}),(null==C?void 0:C.strapiErrors)&&r.createElement(o,{error:null==C?void 0:C.strapiErrors}),(null==C?void 0:C.message)&&r.createElement(c,{severity:"error"},null==C?void 0:C.message))))))}export{T as EditStockForm};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import o from"react";import t from"@mui/material/Chip";var s=[{status:"placed",color:"info"},{status:"ordered",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"received_on_stock",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],r=[{status:"placed",color:"warning"},{status:"ordered",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"received_on_stock",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],e=[{status:"placed",color:"info"},{status:"ordered",color:"warning"},{status:"logistics_operator_process",color:"info"},{status:"received_on_stock",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],l=function(l){var c,a,u,n=l.status,i=l.role;return o.createElement(t,{label:n,color:"enduser"===i?(null===(c=r.find((function(o){return o.status===n})))||void 0===c?void 0:c.color)||"default":"dispatcher"===i?(null===(a=e.find((function(o){return o.status===n})))||void 0===a?void 0:a.color)||"default":(null===(u=s.find((function(o){return o.status===n})))||void 0===u?void 0:u.color)||"default"})};export{l as IpoStatusIndicator};
7
+ import o from"react";import t from"@mui/material/Chip";var s=[{status:"placed",color:"info"},{status:"ordered",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"released_on_stock",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],r=[{status:"placed",color:"warning"},{status:"ordered",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"released_on_stock",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],l=[{status:"placed",color:"info"},{status:"ordered",color:"warning"},{status:"logistics_operator_process",color:"info"},{status:"released_on_stock",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],e=function(e){var c,a,u,n=e.status,i=e.role;return o.createElement(t,{label:n,color:"enduser"===i?(null===(c=r.find((function(o){return o.status===n})))||void 0===c?void 0:c.color)||"default":"dispatcher"===i?(null===(a=l.find((function(o){return o.status===n})))||void 0===a?void 0:a.color)||"default":(null===(u=s.find((function(o){return o.status===n})))||void 0===u?void 0:u.color)||"default"})};export{e as IpoStatusIndicator};
@@ -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"../report/ReportMakingComponent.js";import p from"../report/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,x=e(r(!1),2),j=x[0],D=x[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(!j)}},t.createElement(c,null)))),t.createElement(l,{in:j},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",minValue:-(w+k),maxValue:w,related:[{id:f.id,__type:"api::logistics.ipo-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Recieved"),t.createElement(m,{currentValue:h||0,totalValue:q+N+k,minNewValue:0,maxNewValue:_,color:"info",handleChange:function(e){g(e,f.id,"received_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"../report/ReportMakingComponent.js";import p from"../report/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.received_quantity,_=f.registered_quantity,h=f.released_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"received"===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,x=e(r(!1),2),j=x[0],D=x[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"},"received"),t.createElement(m,{currentValue:w,totalValue:q+N,minNewValue:0+_+-k,maxNewValue:q+N,color:"info",handleChange:function(e){g(e,f.id,"received_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(!j)}},t.createElement(c,null)))),t.createElement(l,{in:j},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",minValue:-(w+k),maxValue:w,related:[{id:f.id,__type:"api::logistics.ipo-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"released"),t.createElement(m,{currentValue:h||0,totalValue:q+N+k,minNewValue:0,maxNewValue:_,color:"info",handleChange:function(e){g(e,f.id,"released_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 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 _ from"@mui/material/Box";import x 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 O(E){var f,g,y,I,O,S,q,A=E.data,B=E.sx,U=E.revalidateCallback;E.handleClose;var P=E.role,T=e(n(i,F),2),M=T[0],H=T[1],R=e(r(A.items.data?A.items.data:[]),2),z=R[0],G=R[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)};return a.createElement(_,{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:A.id,__type:"api::logistics.ipo"}],revalidateCallback:U})),a.createElement(D,null))),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:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},A.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},A.custom_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},A.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Supplier"),a.createElement(h,{variant:"body2"},null===(g=null===(f=A.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:"250px"},"Order Status"),a.createElement(h,{variant:"body2",width:"250px"},A.status)),("placed"===A.status||"received_on_stock"===A.status)&&"enduser"===P&&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:A.id,currentStatus:A.status,revalidateCallback:U})))),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"===P&&a.createElement(a.Fragment,null,A.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=A.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(A.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:A.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:U}))),A.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(I=A.delivery_note)||void 0===I?void 0:I.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(A.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:A.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:U}))))))),(null===(S=null===(O=null==A?void 0:A.notes)||void 0===O?void 0:O.data)||void 0===S?void 0:S.length)>0&&a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:A.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"===A.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:H},a.createElement("input",{name:"id",type:"hidden",value:A.id}),(null===(q=null==A?void 0:A.items)||void 0===q?void 0:q.data)&&A.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(x,{sx:{p:2,mb:2},key:t},"placed"===A.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,revalidateCallback:U}))})),a.createElement(x,{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==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&a.createElement(v,{severity:"error"},null==M?void 0:M.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{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 E from"@mui/material/Alert";import v 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 _ from"@mui/material/Box";import x 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(v,{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 O(v){var f,g,y,I,O,S,q,A=v.data,B=v.sx,U=v.revalidateCallback;v.handleClose;var P=v.role,T=e(n(i,F),2),M=T[0],H=T[1],R=e(r(A.items.data?A.items.data:[]),2),z=R[0],G=R[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)};return a.createElement(_,{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:A.id,__type:"api::logistics.ipo"}],revalidateCallback:U})),a.createElement(D,null))),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:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},A.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},A.custom_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},A.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Supplier"),a.createElement(h,{variant:"body2"},null===(g=null===(f=A.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:"250px"},"Order Status"),a.createElement(h,{variant:"body2",width:"250px"},A.status)),("placed"===A.status||"released_on_stock"===A.status)&&"enduser"===P&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),a.createElement(E,{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:A.id,currentStatus:A.status,revalidateCallback:U})))),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"===P&&a.createElement(a.Fragment,null,A.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=A.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(A.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:A.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:U}))),A.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(I=A.delivery_note)||void 0===I?void 0:I.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(A.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:A.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:U}))))))),(null===(S=null===(O=null==A?void 0:A.notes)||void 0===O?void 0:O.data)||void 0===S?void 0:S.length)>0&&a.createElement(C,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:A.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"===A.status&&a.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:H},a.createElement("input",{name:"id",type:"hidden",value:A.id}),(null===(q=null==A?void 0:A.items)||void 0===q?void 0:q.data)&&A.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(x,{sx:{p:2,mb:2},key:t},"placed"===A.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,revalidateCallback:U}))})),a.createElement(x,{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==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&a.createElement(E,{severity:"error"},null==M?void 0:M.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity}}))}(z))}))))))}export{O as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as r,__generator as e}from"../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as t}from"./get-token.js";import o from"../../../node_modules/qs/lib/index.js";import{getStrapiURL as n}from"../../lib/utils.js";import{unstable_noStore as s}from"next/cache";var a=n(),i=o.stringify({populate:{dispatcher_profile:{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:{populate:{vat_validate_response:!0,eori_validate_response:!0}}}}}}),c=o.stringify({populate:"role"});function u(){return r(this,void 0,void 0,(function(){var r,o,n,c,u;return e(this,(function(e){switch(e.label){case 0:return s(),(r=new URL("/api/users/me",a)).search=i,[4,t()];case 1:if(!(o=e.sent()))return[2,{ok:!1,data:null,error:null}];e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(r.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(o)},cache:"no-cache"})];case 3:if(!(n=e.sent()).ok)throw new Error("HTTP error! status: ".concat(n.status));return[4,n.json()];case 4:return(c=e.sent()).error?[2,{ok:!1,data:null,error:c.error}]:[2,{ok:!0,data:c,error:null}];case 5:return u=e.sent(),console.error("getExtendedUserMeLoader Error:",u),[2,{ok:!1,data:null,error:u}];case 6:return[2]}}))}))}function l(t){return r(this,void 0,void 0,(function(){var r,o,n;return e(this,(function(e){switch(e.label){case 0:(r=new URL("/api/users/me",a)).search=i,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,fetch(r,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})];case 2:if(!(o=e.sent()).ok)throw new Error("HTTP error! status: ".concat(o.status));if(o.ok)return[2,o.json()];throw new Error("Failed to fetch user details");case 3:return n=e.sent(),console.error("getUserMeLoader Error:",n),[2,null];case 4:return[2]}}))}))}function d(){return r(this,void 0,void 0,(function(){var r,o,n,s,i;return e(this,(function(e){switch(e.label){case 0:return(r=new URL("/api/users/me",a)).search=c,[4,t()];case 1:if(!(o=e.sent()))return[2,{ok:!1,data:null,error:null}];e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(r.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(o)},cache:"no-cache"})];case 3:if(!(n=e.sent()).ok)throw new Error("HTTP error! status: ".concat(n.status));return[4,n.json()];case 4:return(s=e.sent()).error?[2,{ok:!1,data:null,error:s.error}]:[2,{ok:!0,data:s,error:null}];case 5:return i=e.sent(),console.error("getUserRole Error:",i),[2,{ok:!1,data:null,error:i}];case 6:return[2]}}))}))}export{u as getExtendedUserMeLoader,l as getUserMeLoader,d as getUserRole};
7
+ import{__awaiter as r,__generator as e}from"../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as t}from"./get-token.js";import o from"../../../node_modules/qs/lib/index.js";import{getStrapiURL as n}from"../../lib/utils.js";import{unstable_noStore as s}from"next/cache";var a=n(),i=o.stringify({populate:{customer_profile:{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:{populate:{vat_validate_response:!0,eori_validate_response:!0}}}}}}),c=o.stringify({populate:"role"});function u(){return r(this,void 0,void 0,(function(){var r,o,n,c,u;return e(this,(function(e){switch(e.label){case 0:return s(),(r=new URL("/api/users/me",a)).search=i,[4,t()];case 1:if(!(o=e.sent()))return[2,{ok:!1,data:null,error:null}];e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(r.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(o)},cache:"no-cache"})];case 3:if(!(n=e.sent()).ok)throw new Error("HTTP error! status: ".concat(n.status));return[4,n.json()];case 4:return(c=e.sent()).error?[2,{ok:!1,data:null,error:c.error}]:[2,{ok:!0,data:c,error:null}];case 5:return u=e.sent(),console.error("getExtendedUserMeLoader Error:",u),[2,{ok:!1,data:null,error:u}];case 6:return[2]}}))}))}function l(t){return r(this,void 0,void 0,(function(){var r,o,n;return e(this,(function(e){switch(e.label){case 0:(r=new URL("/api/users/me",a)).search=i,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,fetch(r,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}})];case 2:if(!(o=e.sent()).ok)throw new Error("HTTP error! status: ".concat(o.status));if(o.ok)return[2,o.json()];throw new Error("Failed to fetch user details");case 3:return n=e.sent(),console.error("getUserMeLoader Error:",n),[2,null];case 4:return[2]}}))}))}function d(){return r(this,void 0,void 0,(function(){var r,o,n,s,i;return e(this,(function(e){switch(e.label){case 0:return(r=new URL("/api/users/me",a)).search=c,[4,t()];case 1:if(!(o=e.sent()))return[2,{ok:!1,data:null,error:null}];e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(r.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(o)},cache:"no-cache"})];case 3:if(!(n=e.sent()).ok)throw new Error("HTTP error! status: ".concat(n.status));return[4,n.json()];case 4:return(s=e.sent()).error?[2,{ok:!1,data:null,error:s.error}]:[2,{ok:!0,data:s,error:null}];case 5:return i=e.sent(),console.error("getUserRole Error:",i),[2,{ok:!1,data:null,error:i}];case 6:return[2]}}))}))}export{u as getExtendedUserMeLoader,l as getUserMeLoader,d as getUserRole};