umwd-components 0.1.602 → 0.1.603

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 o from"react";import s from"@mui/material/Chip";var t=[{status:"placed",color:"info"},{status:"ordered",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"external_shipping_process",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:"external_shipping_process",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:"external_shipping_process",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(s,{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=t.find((function(o){return o.status===n})))||void 0===u?void 0:u.color)||"default"})};export{e as OpoStatusIndicator};
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:"external_shipping_process",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:"external_shipping_process",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:"external_shipping_process",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],l=function(l){var c,a,n,u=l.status,i=l.role,d=u?u.split("_").map((function(o){return o.charAt(0).toUpperCase()+o.slice(1)})).join(" "):"Unknown";return o.createElement(t,{label:d,color:"enduser"===i?(null===(c=r.find((function(o){return o.status===u})))||void 0===c?void 0:c.color)||"default":"dispatcher"===i?(null===(a=e.find((function(o){return o.status===u})))||void 0===a?void 0:a.color)||"default":(null===(n=s.find((function(o){return o.status===u})))||void 0===n?void 0:n.color)||"default"})};export{l as OpoStatusIndicator};
@@ -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 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};
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,R=e(i(d,h),2),z=R[0],C=R[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:C},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==z?void 0:z.strapiErrors)&&r.createElement(o,{error:null==z?void 0:z.strapiErrors}),(null==z?void 0:z.message)&&r.createElement(c,{severity:"error"},null==z?void 0:z.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:"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};
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"}],e=[{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"}],l=function(l){var c,a,n,u=l.status,i=l.role,d=u?u.split("_").map((function(o){return o.charAt(0).toUpperCase()+o.slice(1)})).join(" "):"Unknown";return o.createElement(t,{label:d,color:"enduser"===i?(null===(c=r.find((function(o){return o.status===u})))||void 0===c?void 0:c.color)||"default":"dispatcher"===i?(null===(a=e.find((function(o){return o.status===u})))||void 0===a?void 0:a.color)||"default":(null===(n=s.find((function(o){return o.status===u})))||void 0===n?void 0:n.color)||"default"})};export{l 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.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};
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};