umwd-components 0.1.685 → 0.1.687

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{__exports as r}from"../../_virtual/index7.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
6
+ import{__exports as r}from"../../_virtual/index8.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
@@ -3,5 +3,5 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as a}from"../../_virtual/index8.js";
6
+ import{__exports as a}from"../../_virtual/index7.js";
7
7
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var t;function o(){return t||(t=1,a.read=function(a,t,o,r,h){var M,e,i=8*h-r-1,p=(1<<i)-1,f=p>>1,n=-7,w=o?h-1:0,s=o?-1:1,u=a[t+w];for(w+=s,M=u&(1<<-n)-1,u>>=-n,n+=i;n>0;M=256*M+a[t+w],w+=s,n-=8);for(e=M&(1<<-n)-1,M>>=-n,n+=r;n>0;e=256*e+a[t+w],w+=s,n-=8);if(0===M)M=1-f;else{if(M===p)return e?NaN:1/0*(u?-1:1);e+=Math.pow(2,r),M-=f}return(u?-1:1)*e*Math.pow(2,M-r)},a.write=function(a,t,o,r,h,M){var e,i,p,f=8*M-h-1,n=(1<<f)-1,w=n>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:M-1,N=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,e=n):(e=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-e))<1&&(e--,p*=2),(t+=e+w>=1?s/p:s*Math.pow(2,1-w))*p>=2&&(e++,p/=2),e+w>=n?(i=0,e=n):e+w>=1?(i=(t*p-1)*Math.pow(2,h),e+=w):(i=t*Math.pow(2,w-1)*Math.pow(2,h),e=0));h>=8;a[o+u]=255&i,u+=N,i/=256,h-=8);for(e=e<<h|i,f+=h;f>0;a[o+u]=255&e,u+=N,e/=256,f-=8);a[o+u-N]|=128*_}),a}export{o as __require};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import t from"react";import a from"@mui/material/Box";import e from"@mui/material/Typography";import{useTheme as r}from"@mui/material/styles";function o(o){var n=o.value,c=o.maxValue,i=o.color,m=void 0===i?"primary":i,l=100/c*n,p=r();return t.createElement(a,{sx:{display:"flex",alignItems:"center",background:"linear-gradient(90deg, ".concat(p.palette[m].main,"FF ").concat(l,"%, ").concat(p.palette[m].main,"66 ").concat(l,"%)"),width:"100%",borderRadius:"16px",padding:"2px",justifyContent:"center"}},n!==c?t.createElement(e,{variant:"body2",color:p.palette[m].contrastText},"".concat(n," / ").concat(c)):t.createElement(e,{variant:"body2"},"".concat(n)))}export{o as AmountIndicator,o as default};
7
+ import t from"react";import a from"@mui/material/Box";import e from"@mui/material/Typography";import{useTheme as r}from"@mui/material/styles";function o(o){var n=o.value,c=o.maxValue,i=o.color,m=void 0===i?"primary":i,l=100/c*n,p=r();return t.createElement(a,{sx:{display:"flex",alignItems:"center",background:"linear-gradient(90deg, ".concat(p.palette[m].main,"FF ").concat(l,"%, ").concat(p.palette[m].main,"66 ").concat(l,"%)"),width:"100%",borderRadius:"16px",padding:"2px",justifyContent:"center"}},n!==c?t.createElement(e,{variant:"body2",color:p.palette[m].contrastText},"".concat(n," / ").concat(c)):t.createElement(e,{variant:"body2",color:p.palette[m].contrastText},"".concat(n)))}export{o as AmountIndicator,o 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,{useEffect as n}from"react";import l from"@mui/material/Paper";import a from"@mui/material/Box";import m from"@mui/material/Stack";import i from"@mui/material/Typography";import{SubmitButton as o}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{updateProductAction as c}from"../../../data/actions/e-commerce/product/updateProductAction.js";import d from"@mui/material/Grid";import s from"../../logistics/report/ReportsDisplay.js";import E from"../../logistics/report/ReportMakingComponent.js";import{useSnackbar as p}from"../../../context/common/SnackbarContext.js";import y from"@mui/material/Table";import f from"@mui/material/TableBody";import g from"@mui/material/TableCell";import _ from"@mui/material/TableContainer";import v from"@mui/material/TableFooter";import k from"@mui/material/TableHead";import q from"@mui/material/TableRow";import b from"@mui/material/Tooltip";import x from"@mui/material/Button";import{AmountIndicator as h}from"../../common/AmountIndicator.js";var T={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function C(C){var S=C.data,j=C.revalidateCallback,Q=C.handleClose,V=C.sx,O=S.id,R=S.title;S.product_number,S.stock;var A=S.ipos,I=S.opos,N=S.reports,w=p().handleAddMessage,z=e(u(c,T),2),B=z[0],D=z[1];return n((function(){(null==B?void 0:B.message)&&(w({message:B.message,severity:B.severity||"error"}),"success"===B.severity&&(j&&j(),Q&&Q()))}),[null==B?void 0:B.message,w,j,Q]),n((function(){(null==B?void 0:B.strapiErrors)&&w({message:B.strapiErrors.message||"Error updating stock",severity:"error"})}),[null==B?void 0:B.strapiErrors,w]),r.createElement(a,{sx:t([],e(Array.isArray(V)?V:[V]),!1)},r.createElement(d,{container:!0,spacing:2},r.createElement(d,{item:!0,xs:12},r.createElement(i,{variant:"h6"},R)),r.createElement(d,{item:!0,xs:12},r.createElement(_,{component:l},r.createElement(y,{size:"small"},r.createElement(i,{variant:"h6"},"Incoming orders"),r.createElement(k,null,r.createElement(q,null,r.createElement(g,null,"Number"),r.createElement(g,null,"Order Date"),r.createElement(g,null,"Line Item Number"),r.createElement(g,null,"Ordered Quantity"),r.createElement(g,null,"Received Quantity"),r.createElement(g,null,"Registered Quantity"),r.createElement(g,null,"Released Quantity"))),r.createElement(f,null,A.map((function(e){return r.createElement(r.Fragment,null,e.items.map((function(t){return r.createElement(q,{key:e.id},r.createElement(g,null,e.ipo_number),r.createElement(g,null,e.order_date),r.createElement(g,null,t.line_item_number),r.createElement(g,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.received_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.registered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.released_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(v,null,r.createElement(q,null,r.createElement(g,{colSpan:6,align:"right"},"Total added to stock:"),r.createElement(g,null,A.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))))),r.createElement(y,{size:"small"},r.createElement(i,{variant:"h6"},"Outgoing orders"),r.createElement(k,null,r.createElement(q,null,r.createElement(g,null,"Number"),r.createElement(g,null,"Order Date"),r.createElement(g,null,"Line Item Number"),r.createElement(g,null,"Ordered Quantity"),r.createElement(g,null,"Picked Quantity"),r.createElement(g,null,"Packed Quantity"),r.createElement(g,null,"Shipped Quantity"))),r.createElement(f,null,I.map((function(e){return r.createElement(r.Fragment,null,e.opo_items.map((function(t){return r.createElement(q,{key:e.id},r.createElement(g,null,e.opo_number),r.createElement(g,null,e.order_date),r.createElement(g,null,t.line_item_number),r.createElement(g,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.picked_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.packed_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.shipped_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(v,null,r.createElement(q,null,r.createElement(g,{colSpan:3,align:"right"},"Total reduced from stock:"),r.createElement(g,null,I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))))),r.createElement(y,{size:"small"},r.createElement(q,null,r.createElement(g,{align:"right"},"Total added to stock:"),r.createElement(g,null,A.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))),r.createElement(q,null,r.createElement(g,{align:"right"},"Total reduced from stock:"),r.createElement(g,null,I.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))),r.createElement(q,null,r.createElement(g,{align:"right"},"Corrections:"),r.createElement(g,null,r.createElement(b,{title:"Total stock corrections"},r.createElement(i,null,N?N.reduce((function(e,t){return e+t.quantity}),0):0))),r.createElement(g,null,r.createElement(b,{title:"Total stock corrections after updating"},r.createElement("b",null,N?N.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(q,null,r.createElement(g,{align:"right"},"Stock:"),r.createElement(g,null,r.createElement(b,{title:"Total stock"},r.createElement(i,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(g,null,r.createElement(b,{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},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(N)}),r.createElement(d,{container:!0,spacing:2},r.createElement(d,{item:!0,xs:12,sx:{mt:2}},r.createElement(m,{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(s,{reports:N}),r.createElement(E,{content:"content",quantity:0,type:"stock",related:[{id:O,__type:"api::e-commerce.product"}],revalidateCallback:j}))),r.createElement(d,{item:!0,xs:12},r.createElement(m,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{py:1}},Q&&r.createElement(x,{onClick:Q,variant:"outlined"},"Close"),r.createElement(o,{text:"Update Stock",loadingText:"Updating...",variant:"contained"}))))))}export{C as EditStockForm};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useEffect as n}from"react";import l from"@mui/material/Paper";import a from"@mui/material/Box";import m from"@mui/material/Stack";import i from"@mui/material/Typography";import{SubmitButton as o}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{updateProductAction as c}from"../../../data/actions/e-commerce/product/updateProductAction.js";import d from"@mui/material/Grid";import s from"../../logistics/report/ReportsDisplay.js";import E from"../../logistics/report/ReportMakingComponent.js";import{useSnackbar as p}from"../../../context/common/SnackbarContext.js";import y from"@mui/material/Table";import f from"@mui/material/TableBody";import g from"@mui/material/TableCell";import _ from"@mui/material/TableContainer";import v from"@mui/material/TableFooter";import k from"@mui/material/TableHead";import q from"@mui/material/TableRow";import b from"@mui/material/Tooltip";import x from"@mui/material/Button";import{AmountIndicator as h}from"../../common/AmountIndicator.js";var T={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function C(C){var S=C.data,j=C.revalidateCallback,Q=C.handleClose,V=C.sx,O=S.id,R=S.title;S.product_number,S.stock;var w=S.ipos,A=S.opos,I=S.reports,N=p().handleAddMessage,z=e(u(c,T),2),B=z[0],D=z[1];return n((function(){(null==B?void 0:B.message)&&(N({message:B.message,severity:B.severity||"error"}),"success"===B.severity&&(j&&j(),Q&&Q()))}),[null==B?void 0:B.message,N,j,Q]),n((function(){(null==B?void 0:B.strapiErrors)&&N({message:B.strapiErrors.message||"Error updating stock",severity:"error"})}),[null==B?void 0:B.strapiErrors,N]),r.createElement(a,{sx:t([],e(Array.isArray(V)?V:[V]),!1)},r.createElement(d,{container:!0,spacing:2},r.createElement(d,{item:!0,xs:12},r.createElement(i,{variant:"h6"},R)),r.createElement(d,{item:!0,xs:12},r.createElement(_,{component:l},r.createElement(i,{variant:"h6",sx:{pl:2}},"Incoming orders"),r.createElement(y,{size:"small"},r.createElement(k,null,r.createElement(q,null,r.createElement(g,null,"Number"),r.createElement(g,null,"Order Date"),r.createElement(g,null,"Line Item Number"),r.createElement(g,null,"Ordered Quantity"),r.createElement(g,null,"Received Quantity"),r.createElement(g,null,"Registered Quantity"),r.createElement(g,null,"Released Quantity"))),r.createElement(f,null,w.map((function(e){return r.createElement(r.Fragment,null,e.items.map((function(t){return r.createElement(q,{key:e.id},r.createElement(g,null,e.ipo_number),r.createElement(g,null,e.order_date),r.createElement(g,null,t.line_item_number),r.createElement(g,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.received_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.registered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.released_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(v,null,r.createElement(q,null,r.createElement(g,{colSpan:6,align:"right"},"Total added to stock:"),r.createElement(g,null,w.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))))),r.createElement(i,{variant:"h6",sx:{pl:2}},"Outgoing orders"),r.createElement(y,{size:"small"},r.createElement(k,null,r.createElement(q,null,r.createElement(g,null,"Number"),r.createElement(g,null,"Order Date"),r.createElement(g,null,"Line Item Number"),r.createElement(g,null,"Ordered Quantity"),r.createElement(g,null,"Picked Quantity"),r.createElement(g,null,"Packed Quantity"),r.createElement(g,null,"Shipped Quantity"))),r.createElement(f,null,A.map((function(e){return r.createElement(r.Fragment,null,e.opo_items.map((function(t){return r.createElement(q,{key:e.id},r.createElement(g,null,e.opo_number),r.createElement(g,null,e.order_date),r.createElement(g,null,t.line_item_number),r.createElement(g,null,r.createElement(h,{value:t.ordered_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.picked_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.packed_quantity,maxValue:t.ordered_quantity,color:"primary"})),r.createElement(g,null,r.createElement(h,{value:t.shipped_quantity,maxValue:t.ordered_quantity,color:"primary"})))})))}))),r.createElement(v,null,r.createElement(q,null,r.createElement(g,{colSpan:3,align:"right"},"Total reduced from stock:"),r.createElement(g,null,A.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))))),r.createElement(y,{size:"small"},r.createElement(q,null,r.createElement(g,{align:"right"},"Total added to stock:"),r.createElement(g,null,w.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0))),r.createElement(q,null,r.createElement(g,{align:"right"},"Total reduced from stock:"),r.createElement(g,null,A.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0))),r.createElement(q,null,r.createElement(g,{align:"right"},"Corrections:"),r.createElement(g,null,r.createElement(b,{title:"Total stock corrections"},r.createElement(i,null,I?I.reduce((function(e,t){return e+t.quantity}),0):0))),r.createElement(g,null,r.createElement(b,{title:"Total stock corrections after updating"},r.createElement("b",null,I?I.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(q,null,r.createElement(g,{align:"right"},"Stock:"),r.createElement(g,null,r.createElement(b,{title:"Total stock"},r.createElement(i,null,w.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0)-A.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(I?I.reduce((function(e,t){return e+t.quantity}),0):0)))),r.createElement(g,null,r.createElement(b,{title:"Total stock after updating"},r.createElement("b",null,w.reduce((function(e,t){return e+t.items.reduce((function(e,t){return e+t.released_quantity}),0)}),0)-A.reduce((function(e,t){return e+t.opo_items.reduce((function(e,t){return e+t.ordered_quantity}),0)}),0)+(I?I.reduce((function(e,t){return e+t.quantity}),0):0))))))))),r.createElement("form",{action:D},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(I)}),r.createElement(d,{container:!0,spacing:2},r.createElement(d,{item:!0,xs:12,sx:{mt:2}},r.createElement(m,{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(s,{reports:I}),r.createElement(m,{direction:"row",justifyContent:"flex-end"},r.createElement(E,{content:"content",quantity:0,type:"stock",related:[{id:O,__type:"api::e-commerce.product"}],revalidateCallback:j})))),r.createElement(d,{item:!0,xs:12},r.createElement(m,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{py:1}},Q&&r.createElement(x,{onClick:Q,variant:"outlined"},"Close"),r.createElement(o,{text:"Update Stock",loadingText:"Updating...",variant:"contained"}))))))}export{C 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,useEffect as a}from"react";import o from"@mui/material/Alert";import m from"@mui/material/IconButton";import n from"@mui/material/Dialog";import i from"@mui/material/DialogContent";import l from"@mui/material/DialogActions";import u from"@mui/material/Button";import c from"@mui/material/Typography";import p from"@mui/material/Stack";import d from"@mui/material/TextField";import s from"../../../../node_modules/dayjs/dayjs.min.js";import{SubmitButton as f}from"../../SubmitButton.js";import{StrapiErrors as E}from"../../StrapiErrors.js";import{useFormState as g}from"react-dom";import{createReportAction as v}from"../../../data/actions/logistics/report/createReportAction.js";import b from"../../common/markdown/MarkdownEditor.js";import y from"@mui/icons-material/Announcement";import{Tooltip as x}from"@mui/material";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function h(h){var k=h.content,A=h.related,C=h.type,D=h.minValue,S=h.maxValue,T=h.revalidateCallback,w=e(r(!1),2),V=w[0],Y=w[1],z=v.bind(null,A),B=e(g(z,j),2),M=B[0],q=B[1];return a((function(){(null==M?void 0:M.data)&&T&&T()}),[M.data]),t.createElement(t.Fragment,null,t.createElement(x,{title:"Create a report"},t.createElement(m,{onClick:function(){return Y(!0)}},t.createElement(y,{fontSize:"large"}))),t.createElement(n,{open:V,fullWidth:!0,maxWidth:"lg"},t.createElement("form",{action:q},t.createElement(i,{sx:{p:1}},t.createElement(p,{spacing:2},t.createElement("input",{type:"hidden",name:"type",value:C}),t.createElement(c,{variant:"body1",textAlign:"right"},s(Date.now()).format("DD-MM-YYYY")),t.createElement(d,{id:"quantity",name:"quantity",type:"number",label:"Amount",size:"small",InputProps:{inputProps:{min:"".concat(void 0!==D&&void 0!==S&&D<S?D:S),max:"".concat(void 0!==D&&void 0!==S&&S>D?S:D),step:"1"}},defaultValue:0,helperText:D&&S&&"Enter a number between ".concat(D," and ").concat(S)}),t.createElement(b,{name:"content",label:"The report",defaultValue:k}))),t.createElement(l,null,t.createElement(u,{onClick:function(){return Y(!1)}},"Cancel"),t.createElement(f,{text:"Submit",loadingText:"Loading..."}),t.createElement(E,{error:null==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&t.createElement(o,{severity:"error"},null==M?void 0:M.message)))))}export{h as default};
6
+ import{__read as e,__awaiter as t,__generator as r}from"../../../../node_modules/tslib/tslib.es6.js";import o,{useState as a,useEffect as n}from"react";import i from"@mui/material/Alert";import m from"@mui/material/IconButton";import l from"@mui/material/Dialog";import s from"@mui/material/DialogContent";import u from"@mui/material/DialogActions";import c from"@mui/material/Button";import d from"@mui/material/Typography";import p from"@mui/material/Stack";import f from"@mui/material/TextField";import g from"../../../../node_modules/dayjs/dayjs.min.js";import{SubmitButton as E}from"../../SubmitButton.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{useFormState as b}from"react-dom";import{createReportAction as y}from"../../../data/actions/logistics/report/createReportAction.js";import x from"../../common/markdown/MarkdownEditor.js";import h from"@mui/icons-material/Announcement";import{Box as j,Tooltip as k}from"@mui/material";import{getUserMeLoader as A}from"../../../data/loaders/user/getUserMeLoader.js";import{useSnackbar as C}from"../../../context/common/SnackbarContext.js";var D={zodErrors:null,strapiErrors:null,data:null,message:null};function S(S){var w=S.content,M=S.related,T=S.type,V=S.minValue,Y=S.maxValue,z=S.revalidateCallback,B=e(a(!1),2),F=B[0],q=B[1],I=e(a(null),2),L=I[0],P=I[1],U=y.bind(null,M,T),W=e(b(U,D),2),_=W[0],R=W[1],G=C().handleAddMessage;return n((function(){(null==_?void 0:_.message)&&(G({message:_.message,severity:_.severity||"error"}),"success"===_.severity&&(z&&z(),q(!1)))}),[null==_?void 0:_.message]),n((function(){!function(){t(this,void 0,void 0,(function(){var e,t,o,a;return r(this,(function(r){switch(r.label){case 0:return[4,A()];case 1:return e=r.sent(),t=e.ok,o=e.data,a=e.error,t&&o?(console.log("Current User:",o),P(o)):(P(null),console.error("Error fetching current user:",a)),[2]}}))}))}()}),[]),o.createElement(o.Fragment,null,o.createElement(j,{sx:{display:"block",position:"relative"}},o.createElement(k,{title:"Create a report"},o.createElement(m,{onClick:function(){return q(!0)}},o.createElement(h,{fontSize:"large"})))),o.createElement(l,{open:F,fullWidth:!0,maxWidth:"lg"},o.createElement("form",{action:R},o.createElement(s,{sx:{p:1}}," ",o.createElement(p,{spacing:2},o.createElement(d,{variant:"body1",textAlign:"right"},g(Date.now()).format("DD-MM-YYYY")),o.createElement(f,{id:"quantity",name:"quantity",type:"number",label:"Amount",size:"small",InputProps:{inputProps:{min:"".concat(void 0!==V&&void 0!==Y&&V<Y?V:Y),max:"".concat(void 0!==V&&void 0!==Y&&Y>V?Y:V),step:"1"}},defaultValue:0,helperText:V&&Y&&"Enter a number between ".concat(V," and ").concat(Y)}),o.createElement(x,{name:"content",label:"The report",defaultValue:w}),null!==L&&o.createElement(o.Fragment,null,o.createElement(d,{variant:"body1",textAlign:"right"},L.username),o.createElement(d,{variant:"body2",textAlign:"right"},L.email)))),o.createElement(u,null,o.createElement(c,{onClick:function(){return q(!1)}},"Cancel"),o.createElement(E,{text:"Submit",loadingText:"Loading..."}),o.createElement(v,{error:null==_?void 0:_.strapiErrors}),(null==_?void 0:_.message)&&o.createElement(i,{severity:"error"},null==_?void 0:_.message)))))}export{S 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 i from"../../common/markdown/MarkdownDisplay.js";import{Divider as n}from"@mui/material";var o=function(o){var l=o.reports;return e.createElement(r,{spacing:1,sx:{mb:1}},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:1},e.createElement(a,{label:"".concat(r.quantity>0?"+":""," ").concat(r.quantity),color:r.quantity>0?"success":"error",size:"small"})),e.createElement(m,{item:!0,xs:7},e.createElement(i,null,r.content)),e.createElement(m,{item:!0,xs:2},e.createElement(t,{variant:"body2"}," ",r.date)),e.createElement(m,{item:!0,xs:2},e.createElement(t,{variant:"body2",align:"right"},null===(l=r.author)||void 0===l?void 0:l.username)),e.createElement(m,{item:!0,xs:12},e.createElement(n,{sx:{mb:1}})))})))};export{o as default};
6
+ import e from"react";import t from"@mui/material/Typography";import a from"@mui/material/Stack";import r from"@mui/material/Chip";import n from"@mui/material/Grid";import m from"../../common/markdown/MarkdownDisplay.js";import{Divider as i}from"@mui/material";var l=function(l){var s=l.reports;return e.createElement(a,{spacing:1,sx:{mb:1}},s&&s.length>0&&s.map((function(l,s){return e.createElement(n,{container:!0,key:s},e.createElement(n,{item:!0,xs:1,sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"}},e.createElement(r,{label:"".concat(l.quantity>0?"+":""," ").concat(l.quantity),color:l.quantity>0?"success":"error",size:"small"})),e.createElement(n,{item:!0,xs:7,sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"}},e.createElement(m,null,l.content)),e.createElement(n,{item:!0,xs:2,sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"}},e.createElement(t,{variant:"body2"}," ",l.date)),e.createElement(n,{item:!0,xs:2,sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"}},e.createElement(a,{direction:"column",alignItems:"flex-end"},l.signature_username&&e.createElement(t,{variant:"body1"},l.signature_username),l.signature_username&&e.createElement(t,{variant:"body2"},l.signature_email))),e.createElement(n,{item:!0,xs:12},e.createElement(i,{sx:{my:1}})))})))};export{l 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,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function i(i,n,l){return r(this,void 0,void 0,(function(){var r,p,m,u;return e(this,(function(e){switch(e.label){case 0:return r=a(l),p={data:t(t({},r.data),{related:i})},console.log("reportData",p),[4,s("POST","/api/reports",p)];case 1:return m=e.sent(),console.log("responseData",m),m?m.error?[2,t(t({},n),{strapiErrors:m.error,message:"Failed to Create Report."})]:(u=o(m),[2,t(t({},n),{message:"New Report Created",data:u,strapiErrors:null})]):[2,t(t({},n),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createReportAction};
7
+ import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function i(i,n,l,p){return r(this,void 0,void 0,(function(){var r,m,u,c;return e(this,(function(e){switch(e.label){case 0:return r=a(p),m={data:t(t({},r.data),{related:i,type:n})},console.log("reportData",m),[4,s("POST","/api/reports",m)];case 1:return u=e.sent(),console.log("responseData",u),u?u.error?[2,t(t({},l),{strapiErrors:u.error,message:"Failed to Create Report."})]:(c=o(u),[2,t(t({},l),{message:"New Report Created",severity:"success",data:c,strapiErrors:null})]):[2,t(t({},l),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createReportAction};
@@ -0,0 +1,7 @@
1
+ "use server";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__awaiter as r,__generator as e}from"../../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as t}from"../../services/get-token.js";import o from"../../../../node_modules/qs/lib/index.js";import{getStrapiURL as s,flattenAttributes as n}from"../../../lib/utils.js";import{unstable_noStore as a}from"next/cache";var i=s(),c=o.stringify({fields:["id","username","email","createdAt","updatedAt"]});function u(){return r(this,arguments,void 0,(function(r){var o,s,u,l,d;return void 0===r&&(r=c),e(this,(function(e){switch(e.label){case 0:return a(),(o=new URL("/api/users/me",i)).search=r,[4,t()];case 1:if(!(s=e.sent()))return[2,{ok:!1,data:null,error:null}];e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(o.href,{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(s)},cache:"no-cache"})];case 3:if(!(u=e.sent()).ok)throw new Error("HTTP error! status: ".concat(u.status));return[4,u.json()];case 4:return(l=e.sent()).error?[2,{ok:!1,data:null,error:l.error}]:[2,{ok:!0,data:n(l),error:null}];case 5:return d=e.sent(),console.error("getUserMeLoader Error:",d),[2,{ok:!1,data:null,error:d}];case 6:return[2]}}))}))}export{u as getUserMeLoader};