umwd-components 0.1.622 → 0.1.624

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.
Files changed (74) hide show
  1. package/dist/node_modules/base64-js/index.js +1 -1
  2. package/dist/node_modules/ieee754/index.js +1 -1
  3. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  4. package/dist/node_modules/safe-buffer/index.js +1 -1
  5. package/dist/src/components/e-commerce/iro/CreateIROForm.js +7 -0
  6. package/dist/src/components/e-commerce/iro/IROItemFields.js +6 -0
  7. package/dist/src/components/e-commerce/iro/IROItemUpdater.js +6 -0
  8. package/dist/src/components/e-commerce/iro/IroItemDisplay.js +6 -0
  9. package/dist/src/components/e-commerce/iro/IroStatusIndicator.js +7 -0
  10. package/dist/src/components/e-commerce/iro/ManageIROForm.js +6 -0
  11. package/dist/src/components/e-commerce/iro/RmaForm.js +7 -0
  12. package/dist/src/components/e-commerce/iro/TextualIROItemUpdater.js +6 -0
  13. package/dist/src/components/e-commerce/iro/TextualManageIROForm.js +6 -0
  14. package/dist/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
  15. package/dist/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
  16. package/dist/src/components/logistics/ipo/ManageIPOForm.js +1 -1
  17. package/dist/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
  18. package/dist/src/data/actions/e-commerce/iro/createIroAction.js +7 -0
  19. package/dist/src/data/actions/e-commerce/iro/updateIroAction.js +7 -0
  20. package/dist/src/data/loaders/e-commerce/getAllOpos.js +7 -0
  21. package/dist/src/data/loaders/e-commerce/iros/getAllIros.js +7 -0
  22. package/dist/src/data/loaders/e-commerce/iros/getIroModel.js +7 -0
  23. package/dist/src/data/loaders/e-commerce/iros/getSingleIro.js +7 -0
  24. package/dist/src/data/loaders/e-commerce/iros/queryAllIros.js +7 -0
  25. package/dist/src/data/loaders/e-commerce-loaders.js +1 -1
  26. package/dist/src/data/services/common/confirmation-service.js +7 -0
  27. package/dist/src/index.js +1 -1
  28. package/dist/tsconfig.build.tsbuildinfo +1 -1
  29. package/dist/types/components/e-commerce/iro/CreateIROForm.d.ts +3 -0
  30. package/dist/types/components/e-commerce/iro/IROItemFields.d.ts +5 -0
  31. package/dist/types/components/e-commerce/iro/IROItemUpdater.d.ts +4 -0
  32. package/dist/types/components/e-commerce/iro/IroItemDisplay.d.ts +4 -0
  33. package/dist/types/components/e-commerce/iro/IroStatusIndicator.d.ts +10 -0
  34. package/dist/types/components/e-commerce/iro/ManageIROForm.d.ts +3 -0
  35. package/dist/types/components/e-commerce/iro/RmaForm.d.ts +3 -0
  36. package/dist/types/components/e-commerce/iro/TextualIROItemUpdater.d.ts +4 -0
  37. package/dist/types/components/e-commerce/iro/TextualManageIROForm.d.ts +3 -0
  38. package/dist/types/data/actions/e-commerce/iro/createIroAction.d.ts +5 -0
  39. package/dist/types/data/actions/e-commerce/iro/updateIroAction.d.ts +1 -0
  40. package/dist/types/data/loaders/e-commerce/getAllOpos.d.ts +2 -1
  41. package/dist/types/data/loaders/e-commerce/iros/getAllIros.d.ts +2 -0
  42. package/dist/types/data/loaders/e-commerce/iros/getIroModel.d.ts +2 -0
  43. package/dist/types/data/loaders/e-commerce/iros/getSingleIro.d.ts +2 -0
  44. package/dist/types/data/loaders/e-commerce/iros/queryAllIros.d.ts +2 -0
  45. package/dist/types/data/loaders/e-commerce-loaders.d.ts +1 -2
  46. package/dist/types/index.d.ts +18 -2
  47. package/dist/types/types/e-commerce/iro/types.d.ts +89 -0
  48. package/package.json +1 -1
  49. package/src/components/e-commerce/iro/CreateIROForm.tsx +134 -0
  50. package/src/components/e-commerce/iro/IROItemFields.tsx +171 -0
  51. package/src/components/e-commerce/iro/IROItemUpdater.tsx +140 -0
  52. package/src/components/e-commerce/iro/IroItemDisplay.tsx +41 -0
  53. package/src/components/e-commerce/iro/IroStatusIndicator.tsx +81 -0
  54. package/src/components/e-commerce/iro/ManageIROForm.tsx +450 -0
  55. package/src/components/e-commerce/iro/RmaForm.tsx +225 -0
  56. package/src/components/e-commerce/iro/TextualIROItemUpdater.tsx +217 -0
  57. package/src/components/e-commerce/iro/TextualManageIROForm.tsx +456 -0
  58. package/src/components/e-commerce/opo/ManageOpoForm.tsx +1 -1
  59. package/src/components/e-commerce/opo/TextualManageOpoForm.tsx +1 -1
  60. package/src/components/logistics/ipo/ManageIPOForm.tsx +1 -1
  61. package/src/components/logistics/ipo/TextualManageIPOForm.tsx +1 -3
  62. package/src/data/actions/e-commerce/iro/createIroAction.ts +46 -0
  63. package/src/data/actions/e-commerce/iro/updateIroAction.ts +43 -0
  64. package/src/data/loaders/e-commerce/getAllOpos.ts +3 -1
  65. package/src/data/loaders/e-commerce/iros/getAllIros.ts +64 -0
  66. package/src/data/loaders/e-commerce/iros/getIroModel.ts +18 -0
  67. package/src/data/loaders/e-commerce/iros/getSingleIro.ts +47 -0
  68. package/src/data/loaders/e-commerce/iros/queryAllIros.ts +26 -0
  69. package/src/data/loaders/e-commerce-loaders.ts +2 -1
  70. package/src/data/services/{logistics/ipo → common}/confirmation-service.ts +2 -2
  71. package/src/index.ts +21 -2
  72. package/src/types/e-commerce/iro/types.ts +109 -0
  73. package/dist/src/data/services/logistics/ipo/confirmation-service.js +0 -7
  74. /package/dist/types/data/services/{logistics/ipo → common}/confirmation-service.d.ts +0 -0
@@ -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};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__module as r}from"../../../../_virtual/index5.js";import{__require as e}from"./cjs/react-is.production.min.js";import{__require as o}from"./cjs/react-is.development.js";var s;function t(){return s||(s=1,"production"===process.env.NODE_ENV?r.exports=e():r.exports=o()),r.exports}export{t as __require};
6
+ import{__module as r}from"../../../../_virtual/index4.js";import{__require as e}from"./cjs/react-is.production.min.js";import{__require as o}from"./cjs/react-is.development.js";var s;function t(){return s||(s=1,"production"===process.env.NODE_ENV?r.exports=e():r.exports=o()),r.exports}export{t as __require};
@@ -3,5 +3,5 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__module as r}from"../../_virtual/index4.js";import{__require as e}from"../buffer/index.js";
6
+ import{__module as r}from"../../_virtual/index5.js";import{__require as e}from"../buffer/index.js";
7
7
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var o;function n(){return o||(o=1,function(r,o){var n=e(),t=n.Buffer;function u(r,e){for(var o in r)e[o]=r[o]}function f(r,e,o){return t(r,e,o)}t.from&&t.alloc&&t.allocUnsafe&&t.allocUnsafeSlow?r.exports=n:(u(n,o),o.Buffer=f),f.prototype=Object.create(t.prototype),u(t,f),f.from=function(r,e,o){if("number"==typeof r)throw new TypeError("Argument must not be a number");return t(r,e,o)},f.alloc=function(r,e,o){if("number"!=typeof r)throw new TypeError("Argument must be a number");var n=t(r);return void 0!==e?"string"==typeof o?n.fill(e,o):n.fill(e):n.fill(0),n},f.allocUnsafe=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return t(r)},f.allocUnsafeSlow=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return n.SlowBuffer(r)}}(r,r.exports)),r.exports}export{n as __require};
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as o}from"react";import{useFormState as m}from"react-dom";import{createIroAction as i}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{StrapiErrors as n}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{IROItemFields as s}from"./IROItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import E from"@mui/material/Checkbox";import h from"@mui/material/Alert";import v from"@mui/material/Stack";var g={zodErrors:null,strapiErrors:null,data:null,message:null};function x(x){var y=x.sx,b=x.revalidateCallback;x.handleClose;var C=x.customerLabels,w=x.productLabels,I=e(a(!1),2),j=I[0],A=I[1],k=e(m(i,g),2),_=k[0],L=k[1];return o((function(){(null==_?void 0:_.data)&&b&&b()}),[_.data]),t.createElement(p,{sx:r([],e(Array.isArray(y)?y:[y]),!1)},t.createElement("form",{action:L},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(v,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(c,{customerLabels:C}))),t.createElement(d,{item:!0,xs:12},t.createElement(v,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(f,{id:"customer_inhouse_reference",name:"customer_inhouse_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products for this order"),t.createElement(s,{productsArr:w})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this order? Creating a order this way will not create a shipping label nor will it invoke a payment. It does however create an invoice which you can find under invoices"),t.createElement(v,{direction:"row",spacing:1,alignItems:"center"},t.createElement(E,{value:j,checked:j,onChange:function(){return A(!j)}}),j&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this order")),t.createElement("input",{name:"status",type:"hidden",value:j?"ordered":"placed"})),t.createElement(d,{item:!0,xs:12},t.createElement(l,{text:"Confirm",loadingText:"Loading..."}),null!==(null==_?void 0:_.strapiErrors)&&t.createElement(n,{error:null==_?void 0:_.strapiErrors}),(null==_?void 0:_.message)&&t.createElement(h,{severity:"error"},null==_?void 0:_.message)))))}export{x as default};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as m}from"react";import i from"@mui/material/Table";import a from"@mui/material/TableHead";import l from"@mui/material/TableBody";import o from"@mui/material/TableCell";import u from"@mui/material/TableRow";import c from"@mui/material/IconButton";import d from"@mui/icons-material/Add";import p from"@mui/material/Typography";import s from"@mui/material/Stack";import f from"@mui/material/TextField";import E from"../products/ProductSelector.js";import"../../../../node_modules/dayjs/dayjs.min.js";import h from"@mui/icons-material/Delete";import{useTheme as b}from"@mui/material/styles";function x(x){var g=x.productsArr,w=e(n([]),2),y=w[0],v=w[1],_=e(n(null),2),T=_[0],C=_[1],j=e(n(0),2),k=j[0],A=j[1],I=e(n([]),2),N=I[0],P=I[1];b();var S=e(n([]),2),B=S[0],q=S[1];return m((function(){q(function(e){return e.map((function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:e.product.id,ordered_quantity:e.amount}}))}(y))}),[y]),r.createElement(s,{spacing:2},r.createElement(i,null,r.createElement(a,null,r.createElement(u,null,r.createElement(o,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),r.createElement(o,{sx:[{width:"70%"}]},"Product Number"),r.createElement(o,{sx:[{width:"15%"}]},"Amount"),r.createElement(o,{sx:[]}))),r.createElement(l,null,y.map((function(e,t){return r.createElement(u,{key:t},r.createElement(o,{sx:[{width:"15%"}]},t+1,".0.0"),r.createElement(o,{sx:[{width:"70%"}]},e.product.product_number," | ",e.product.title),r.createElement(o,{sx:{width:"15%"}},e.amount),r.createElement(o,{align:"right",sx:{width:"5%"}},r.createElement(c,{onClick:function(){return function(e){var t=y.filter((function(t,r){return r!==e}));v(t)}(t)}},r.createElement(h,null))))})))),r.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(B)}),r.createElement(s,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(p,{variant:"body1",sx:{width:"15%"}},y.length+1,".0.0"),g&&r.createElement(E,{productNames:g,currentValue:N,sx:{width:"70%"},multiple:!1,onChangeCallback:function(e){var t=g.find((function(t){return t.id===e[0]}));C(t||null),P(e)}}),r.createElement(f,{id:"amount",name:"amount",type:"number",label:"Amount",value:k,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?A(0):A(parseInt(e.target.value)):A(0)},sx:{width:"15%"}}),r.createElement(c,{onClick:function(){if(null!==T&&null!==k){var r={product:T,amount:k};v(t(t([],e(y),!1),[r],!1)),C(null),A(0),P([])}else console.log("nextProductName or nextAmount is null")}},r.createElement(d,null))))}export{x as IROItemFields};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
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"../../logistics/report/ReportMakingComponent.js";import p from"../../logistics/report/ReportsDisplay.js";function s(s){var f=s.item,g=s.index,y=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:g},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){y(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){y(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){y(e,f.id,"released_quantity")}})))}export{s as default};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+ import e from"react";import t from"@mui/material/Stack";import r from"@mui/material/Typography";import a from"../../common/ImagePreviewTooltip.js";function n(n){var m,i=n.item,o=n.index,l=n.image,c=i.line_item_number,u=i.product,d=i.returned_quantity;return e.createElement(t,{spacing:1,key:o},i&&e.createElement(t,{direction:"row",justifyContent:"space-between",alignItems:"center"},e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Line Item Number: ",c),e.createElement(r,{variant:"body1"},"Part Number: ",null==u?void 0:u.product_number),e.createElement(r,{variant:"body1"},"Quantity Ordered: ",d)),l&&e.createElement(e.Fragment,null,e.createElement(a,{image:l,label:null===(m=i.product)||void 0===m?void 0:m.title}))))}export{n as default};
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
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"}],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 IroStatusIndicator};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import{useFormState as i}from"react-dom";import{updateIpoAction as n}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import m from"../../logistics/note/NotesDisplay.js";import o from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as l}from"../../StrapiErrors.js";import{SubmitButton as c}from"../../SubmitButton.js";import s from"@mui/material/Alert";import"@mui/material/Dialog";import"@mui/material/DialogActions";import"@mui/material/DialogContent";import"@mui/material/DialogTitle";import d from"@mui/material/Typography";import"@mui/material/Button";import p from"@mui/material/Grid";import u from"@mui/material/Box";import E from"@mui/material/Paper";import g from"@mui/material/Stack";import v from"@mui/material/Divider";import"next/headers";var y={zodErrors:null,strapiErrors:null,data:null,message:null};function f(f){var h,x,b,w=f.data,_=f.sx,D=f.revalidateCallback;f.handleClose;var j=f.role,C=e(i(n,y),2),q=C[0],S=C[1],k=e(a(w.items.data?w.items.data:[]),2),A=k[0];k[1];var N=e(a(!1),2);N[0],N[1];return r.createElement(u,{sx:t([],e(Array.isArray(_)?_:[_]),!1)},r.createElement(p,{container:!0,spacing:2},r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:2},r.createElement(g,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(g,{spacing:2},r.createElement(d,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),r.createElement(d,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),r.createElement(o,{content:"",related:[{id:w.id,__type:"api::logistics.ipo"}],revalidateCallback:D})),r.createElement(v,null))),r.createElement(p,{item:!0,xs:6},r.createElement(g,{spacing:1},r.createElement(d,{variant:"h5"},"Details"),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(d,{variant:"body2"},w.iro_number)),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Custom reference")),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Order Date"),r.createElement(d,{variant:"body2"},w.return_date)),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Supplier")),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Order Status"),r.createElement(d,{variant:"body2",width:"250px"},w.status)))),r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:2},r.createElement(d,{variant:"h5"},"Documents"),r.createElement(E,{sx:{p:2}},r.createElement(g,{spacing:1},"enduser"===j&&r.createElement(r.Fragment,null))))),(null===(x=null===(h=null==w?void 0:w.notes)||void 0===h?void 0:h.data)||void 0===x?void 0:x.length)>0&&r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:2},r.createElement(d,{variant:"h5"},"Notes"),r.createElement(m,{notes:w.notes.data}),r.createElement(v,null))),r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:1},r.createElement(d,{variant:"h5"},"Items"),r.createElement(v,null),r.createElement("form",{action:S},r.createElement("input",{name:"id",type:"hidden",value:w.id}),(null===(b=null==w?void 0:w.items)||void 0===b?void 0:b.data)&&w.items.data.map((function(e,t){return console.log("item",e),r.createElement(E,{sx:{p:2,mb:2},key:t})})),r.createElement(E,{sx:{p:2}},r.createElement(g,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(c,{text:"Update items",loadingText:"Loading..."}),r.createElement(l,{error:null==q?void 0:q.strapiErrors}),(null==q?void 0:q.message)&&r.createElement(s,{severity:"error"},null==q?void 0:q.message))),r.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}}))}(A))}))))))}export{f as default};
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as o}from"react";import{useFormState as n}from"react-dom";import{createIroAction as i}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{StrapiErrors as l}from"../../StrapiErrors.js";import{SubmitButton as m}from"../../SubmitButton.js";import u from"@mui/material/Typography";import c from"@mui/material/Grid";import d from"@mui/material/Box";import s from"@mui/material/TextField";import p from"@mui/material/Button";import v from"@mui/material/Alert";import E from"@mui/material/Stack";import{Divider as f}from"@mui/material";import{TextualAmountUpdater as g}from"../../common/TextualAmountUpdater.js";var h={zodErrors:null,strapiErrors:null,data:null,message:null},y=function(t){var o,n=t.item;t.addToRma;var i=e(a(!1),2),l=i[0],m=i[1],c=e(a(0),2);c[0];var d=c[1],p=e(a(),2);p[0];var v=p[1],h=e(a(),2);h[0];var y=h[1];return r.createElement(E,{spacing:1},r.createElement(u,{variant:"body1"},"Line Item Number: ",n.line_item_number),r.createElement(u,{variant:"body1"},"Part Number: ",null===(o=n.product)||void 0===o?void 0:o.product_number),r.createElement(u,{variant:"body1"},"Quantity Ordered: ",n.ordered_quantity),r.createElement(g,{label:"Quantity to return",currentValue:0,totalValue:n.ordered_quantity,minNewValue:0,maxNewValue:n.ordered_quantity,handleChange:function(e){console.log(e),d(e)},color:"info"}),r.createElement(u,{variant:"body1"},"Reason for return:"),r.createElement(s,{select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;m("other"===t),v(t)}},r.createElement("option",{value:"damaged"},"Damaged"),r.createElement("option",{value:"not_as_described"},"Not as described"),r.createElement("option",{value:"wrong_item"},"Wrong item"),r.createElement("option",{value:"other"},"Other")),l&&r.createElement(s,{label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;console.log(t),y(t)}}),r.createElement(f,null))},b=function(e){return e.data,r.createElement(E,{spacing:2},r.createElement(u,{variant:"h6"},"Confirm RMA"),r.createElement(u,{variant:"body1"},"Are you sure you want to request a return merchandise authorization for the selected items?"),r.createElement(E,{direction:"row",spacing:2},r.createElement(m,{text:"Yes",loadingText:"Loading..."}),r.createElement(p,null,"No")))};function x(s){var p,f,g=s.opo,x=s.sx,_=s.revalidateCallback;s.handleClose;var A=e(n(i,h),2),C=A[0],N=A[1],R=e(a([]),2),T=R[0],q=R[1],w=function(r){q(t(t([],e(T),!1),[r],!1))};return o((function(){(null==C?void 0:C.data)&&_&&_()}),[C.data]),console.log(g),r.createElement(d,{sx:t([],e(Array.isArray(x)?x:[x]),!1)},r.createElement("form",{action:N},r.createElement(c,{container:!0,spacing:2},r.createElement(c,{item:!0,xs:12},r.createElement(u,{variant:"h6"},"RMA Form")),r.createElement(c,{item:!0,xs:12},r.createElement(E,{spacing:2},r.createElement(u,{variant:"body1"},"Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned."))),r.createElement(c,{item:!0,xs:12},(null===(p=g.opo_items)||void 0===p?void 0:p.data)?r.createElement(E,{spacing:2},r.createElement(u,{variant:"h6"},"Items"),r.createElement(u,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),r.createElement(E,{spacing:1},null===(f=g.opo_items)||void 0===f?void 0:f.data.map((function(e,t){return r.createElement(y,{key:t,item:e,addToRma:w})})))):r.createElement(u,{variant:"body1"},"No items")),r.createElement(b,{data:C}),r.createElement(c,{item:!0,xs:12},r.createElement(m,{text:"Request RMA",loadingText:"Loading..."}),null!==(null==C?void 0:C.strapiErrors)&&r.createElement(l,{error:null==C?void 0:C.strapiErrors}),(null==C?void 0:C.message)&&r.createElement(v,{severity:"error"},null==C?void 0:C.message)))))}export{x as default};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{TextualAmountUpdater as m}from"../../common/TextualAmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import d from"../../common/ImagePreviewTooltip.js";import u from"../../logistics/report/ReportsDisplay.js";import s from"../../logistics/report/PreReportsDisplay.js";import p from"../../logistics/report/SimpleReportFields.js";import f from"@mui/material/Box";function g(g){var v,E,y,b,w,h=g.item,x=g.index,R=g.handleAddReport,I=g.handleUpdateQuantity,V=g.image,_=g.handleRemoveReportAtIndex,j=g.showing,q=h.line_item_number,C=h.product,D=h.returned_quantity,N=h.received_quantity,A=h.registered_quantity,F=h.released_quantity,k=h.reports,B=e(r(!1),2),P=B[0],T=B[1];void 0!==(null==k?void 0:k.data)&&k.data.length>0&&k.data.filter((function(e){return"received"===e.type})).reduce((function(e,t){return e+t.quantity}),0);var S=void 0!==(null==k?void 0:k.data)&&k.data.length>0?k.data.filter((function(e){return"registered"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0;void 0!==(null==k?void 0:k.data)&&k.data.length>0&&k.data.filter((function(e){return"released"===e.type})).reduce((function(e,t){return e+t.quantity}),0);var U=(null===(E=null===(v=h.reports)||void 0===v?void 0:v.data)||void 0===E?void 0:E.filter((function(e){return"id"in e})))||[],H=(null===(b=null===(y=h.reports)||void 0===y?void 0:y.data)||void 0===b?void 0:b.filter((function(e){return!1===Boolean("id"in e)})))||[];return t.createElement(n,{spacing:1,key:x},h&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body1"},"Line Item Number: ",q),t.createElement(a,{variant:"body1"},"Part Number: ",null==C?void 0:C.product_number),V&&t.createElement(t.Fragment,null,t.createElement(d,{image:V,label:null===(w=h.product)||void 0===w?void 0:w.title}))),t.createElement(o,{sx:{mb:1}}),j&&j.includes("received")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Received"),t.createElement(m,{label:"Received",currentValue:N,totalValue:D,minNewValue:0+A,maxNewValue:D,color:"info",handleChange:function(e){I(e,h.id,"received_quantity")}})),t.createElement(o,{sx:{mb:2}})),j&&j.includes("registered")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center"},t.createElement(a,{variant:"body2"},"Registered"),t.createElement(m,{label:"Registered",currentValue:A,totalValue:D+S,minNewValue:0+F,maxNewValue:N+S,color:"info",handleChange:function(e){I(e,h.id,"registered_quantity")}})),t.createElement(o,{sx:{mb:2}})),j&&j.includes("reports")&&t.createElement(f,{sx:{mb:2}},t.createElement(o,{sx:{p:0}},t.createElement(n,{direction:"row",spacing:1,alignItems:"center"},t.createElement(a,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return T(!P)}},t.createElement(c,null)))),t.createElement(l,{in:P},t.createElement(n,{spacing:2},t.createElement(a,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(u,{reports:U}),t.createElement(s,{itemID:h.id,reports:H,handleRemoveReportAtIndex:_}),t.createElement(p,{itemID:h.id,content:"",type:"registered",minValue:-(N-A+S),handleAddReport:R})))),j&&j.includes("released")&&t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Released"),t.createElement(m,{label:"Released",currentValue:F,totalValue:D+S,minNewValue:0,maxNewValue:A,color:"info",handleChange:function(e){I(e,h.id,"released_quantity")}}))))}export{g as default};
@@ -0,0 +1,6 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+ import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as i,useEffect as n}from"react";import{useFormState as o}from"react-dom";import{updateIroAction as m}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import l from"./TextualIROItemUpdater.js";import d from"./IroItemDisplay.js";import c from"../../logistics/note/NotesDisplay.js";import s from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as p}from"../../SubmitButton.js";import v from"@mui/material/Alert";import"@mui/material/Dialog";import"@mui/material/DialogActions";import"@mui/material/DialogContent";import"@mui/material/DialogTitle";import E from"@mui/material/Typography";import"@mui/material/Button";import f from"@mui/material/Grid";import g from"@mui/material/Box";import y from"@mui/material/Paper";import h from"@mui/material/Stack";import x from"@mui/material/Divider";import"next/headers";import{FormControlLabel as b,Checkbox as w}from"@mui/material";var I={zodErrors:null,strapiErrors:null,data:null,message:null};function C(C){var j,D,k=C.data,A=C.sx,S=C.revalidateCallback;C.handleClose,C.role;var _=e(o(m,I),2),q=_[0],O=_[1],N=e(i(k.items.data?k.items.data:[]),2),T=N[0],U=N[1],B=e(i(!1),2);B[0],B[1];var R=e(i(["received","registered","released","reports"]),2),P=R[0],M=R[1],z=function(r,a,i){var n=t([],e(T),!1),o=n.findIndex((function(e){return e.id===a}));n[o][i]=r,U(n)},G=function(a,i){var n,o,m,l=t([],e(T),!1),d=l.findIndex((function(e){return e.id===i})),c=(null===(o=null===(n=l[d])||void 0===n?void 0:n.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(c),!1),[a],!1);null==(null===(m=l[d])||void 0===m?void 0:m.reports)&&(l[d]=r(r({},l[d]),{reports:{data:[]}})),l[d].reports.data=s,U(l)},J=function(r,a){var i,n,o=t([],e(T),!1),m=o.findIndex((function(e){return e.id===r})),l=(null===(n=null===(i=o[m])||void 0===i?void 0:i.reports)||void 0===n?void 0:n.data)||[],d=l.filter((function(e){return"id"in e})),c=l.filter((function(e){return!("id"in e)}));c.splice(a,1);var s=t(t([],e(d),!1),e(c),!1);o[m].reports.data=s,U(o)};return n((function(){"Iro Updated"===(null==q?void 0:q.message)&&S&&S()}),[q]),n((function(){var e;(null===(e=k.items)||void 0===e?void 0:e.data)&&U(k.items.data?k.items.data:[])}),[k]),a.createElement(g,{sx:t([],e(Array.isArray(A)?A:[A]),!1)},a.createElement(f,{container:!0,spacing:2},a.createElement(f,{item:!0,xs:12},a.createElement(h,{spacing:2},a.createElement(h,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(h,{spacing:2},a.createElement(E,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),a.createElement(E,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),a.createElement(s,{content:"",related:[{id:k.id,__type:"api::e-commerce.iro"}],revalidateCallback:S})),a.createElement(x,null))),a.createElement(f,{item:!0,xs:6},a.createElement(h,{spacing:1},a.createElement(E,{variant:"h5"},"Details"),a.createElement(h,{direction:"row",spacing:2},a.createElement(E,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(E,{variant:"body2"},k.iro_number)),a.createElement(h,{direction:"row",spacing:2},a.createElement(E,{variant:"body1",width:"250px"},"Custom reference")),a.createElement(h,{direction:"row",spacing:2},a.createElement(E,{variant:"body1",width:"250px"},"Order Date"),a.createElement(E,{variant:"body2"},k.return_date)),a.createElement(h,{direction:"row",spacing:2},a.createElement(E,{variant:"body1",width:"250px"},"Supplier")),a.createElement(h,{direction:"row",spacing:2},a.createElement(E,{variant:"body1",width:"250px"},"Order Status"),a.createElement(E,{variant:"body2",width:"250px"},k.status)))),a.createElement(f,{item:!0,xs:12},a.createElement(h,{spacing:2},a.createElement(E,{variant:"h5"},"Documents"),a.createElement(y,{sx:{p:2}},a.createElement(h,{spacing:1})))),(null===(D=null===(j=null==k?void 0:k.notes)||void 0===j?void 0:j.data)||void 0===D?void 0:D.length)>0&&a.createElement(f,{item:!0,xs:12},a.createElement(h,{spacing:2},a.createElement(E,{variant:"h5"},"Notes"),a.createElement(c,{notes:k.notes.data}),a.createElement(x,null))),a.createElement(f,{item:!0,xs:12},a.createElement(h,{spacing:1},a.createElement(E,{variant:"h5"},"Items"),a.createElement(h,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:y,p:1},a.createElement(E,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return a.createElement(b,{key:r,control:a.createElement(w,{checked:P.includes(r),onChange:function(a){a.target.checked?M(t(t([],e(P),!1),[r],!1)):M(P.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"requested"===k.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(x,null),a.createElement("form",{action:O},a.createElement("input",{name:"id",type:"hidden",value:k.id}),T&&T.map((function(e,t){var r,i;return a.createElement(y,{sx:{p:2,mb:2},key:t},"requested"===k.status?a.createElement(d,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(l,{item:e,index:t,handleUpdateQuantity:z,handleAddReport:G,image:null===(i=null==e?void 0:e.product)||void 0===i?void 0:i.image,handleRemoveReportAtIndex:J,revalidateCallback:S,showing:P}))})),a.createElement(y,{sx:{p:2}},a.createElement(h,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(p,{text:"Update items",loadingText:"Loading..."}),a.createElement(u,{error:null==q?void 0:q.strapiErrors}),(null==q?void 0:q.message)&&a.createElement(v,{severity:"error"},null==q?void 0:q.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,returned_quantity:e.returned_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(T))}))))))}export{C 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,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./OpoItemUpdater.js";import d from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import p from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import v from"@mui/material/Alert";import f from"@mui/material/Dialog";import y from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import h from"@mui/material/DialogTitle";import b from"@mui/material/Typography";import _ from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import k from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/logistics/ipo/confirmation-service.js";var O={zodErrors:null,strapiErrors:null,data:null,message:null};function q(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(f,{open:t},a.createElement(h,null,"Confirm Order"),a.createElement(g,null,a.createElement(k,{spacing:2},a.createElement(b,null,"Are you sure you want to confirm this order?"),a.createElement(b,null,"Current status: ",i))),a.createElement(y,null,a.createElement(_,{variant:"contained",onClick:function(e){j("opos",[n]),o&&o()}},"Confirm"),a.createElement(_,{variant:"contained",onClick:r},"Cancel")))}function N(f){var y,g,h,j,N,I=f.opo,S=f.sx,A=f.revalidateCallback;f.handleClose;var B=f.role,F=e(i(o,O),2),P=F[0],T=F[1],U=e(r(I.opo_items.data?I.opo_items.data:[]),2),M=U[0],z=U[1],G=e(r(!1),2),H=G[0],J=G[1],L=function(a,r,n){var i=t([],e(M),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,z(i)};return n((function(){var e;(null===(e=I.opo_items)||void 0===e?void 0:e.data)&&z(I.opo_items.data)}),[I]),a.createElement(C,{sx:t([],e(Array.isArray(S)?S:[S]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(k,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),a.createElement(b,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),a.createElement(p,{content:"",related:[{id:I.id,__type:"api::e-commerce.opo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Details"),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(b,{variant:"body2"},I.opo_number)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(b,{variant:"body2"},I.customer_inhouse_reference)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Date"),a.createElement(b,{variant:"body2"},I.order_date)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Customer"),a.createElement(b,{variant:"body2"},null===(g=null===(y=I.customer)||void 0===y?void 0:y.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Status"),a.createElement(b,{variant:"body2",width:"250px"},I.status)),("placed"===I.status||"external_shipping_process"===I.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(_,{variant:"contained",color:"primary",onClick:function(){return J(!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(q,{open:H,handleClose:function(){return J(!1)},orderID:I.id,currentStatus:I.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Documents"),a.createElement(w,{sx:{p:2}},a.createElement(k,{spacing:1},I.delivery_note?a.createElement(a.Fragment,null,a.createElement(b,{variant:"h6"},"Delivery Note"),a.createElement(b,null,null===(h=I.delivery_note)||void 0===h?void 0:h.name),a.createElement(_,{variant:"contained",onClick:function(){m("api/opos/".concat(I.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(b,{variant:"h5"},"Delivery Note"),a.createElement(b,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(l,{reference:"api::e-commerce.opo",refID:I.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/opos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:A})))))),(null===(N=null===(j=null==I?void 0:I.notes)||void 0===j?void 0:j.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Notes"),a.createElement(s,{notes:I.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Items"),"placed"===I.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:I.id}),M&&M.map((function(e,t){var r,n;return console.log("item",e),a.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===I.status?a.createElement(d,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(c,{item:e,index:t,handleUpdateQuantity:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(w,{sx:{p:2}},a.createElement(k,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(E,{text:"Update items",loadingText:"Loading..."}),a.createElement(u,{error:null==P?void 0:P.strapiErrors}),(null==P?void 0:P.message)&&a.createElement(v,{severity:"error"},null==P?void 0:P.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity}}))}(M))}))))))}export{N as default};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./OpoItemUpdater.js";import d from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import p from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import v from"@mui/material/Alert";import f from"@mui/material/Dialog";import y from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import h from"@mui/material/DialogTitle";import b from"@mui/material/Typography";import _ from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import k from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/common/confirmation-service.js";var O={zodErrors:null,strapiErrors:null,data:null,message:null};function q(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(f,{open:t},a.createElement(h,null,"Confirm Order"),a.createElement(g,null,a.createElement(k,{spacing:2},a.createElement(b,null,"Are you sure you want to confirm this order?"),a.createElement(b,null,"Current status: ",i))),a.createElement(y,null,a.createElement(_,{variant:"contained",onClick:function(e){j("opos",[n]),o&&o()}},"Confirm"),a.createElement(_,{variant:"contained",onClick:r},"Cancel")))}function N(f){var y,g,h,j,N,I=f.opo,S=f.sx,A=f.revalidateCallback;f.handleClose;var B=f.role,F=e(i(o,O),2),P=F[0],T=F[1],U=e(r(I.opo_items.data?I.opo_items.data:[]),2),M=U[0],z=U[1],G=e(r(!1),2),H=G[0],J=G[1],L=function(a,r,n){var i=t([],e(M),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,z(i)};return n((function(){var e;(null===(e=I.opo_items)||void 0===e?void 0:e.data)&&z(I.opo_items.data)}),[I]),a.createElement(C,{sx:t([],e(Array.isArray(S)?S:[S]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(k,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),a.createElement(b,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),a.createElement(p,{content:"",related:[{id:I.id,__type:"api::e-commerce.opo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{item:!0,xs:6},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Details"),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(b,{variant:"body2"},I.opo_number)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(b,{variant:"body2"},I.customer_inhouse_reference)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Date"),a.createElement(b,{variant:"body2"},I.order_date)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Customer"),a.createElement(b,{variant:"body2"},null===(g=null===(y=I.customer)||void 0===y?void 0:y.business_credentials)||void 0===g?void 0:g.company_name)),a.createElement(k,{direction:"row",spacing:2},a.createElement(b,{variant:"body1",width:"250px"},"Order Status"),a.createElement(b,{variant:"body2",width:"250px"},I.status)),("placed"===I.status||"external_shipping_process"===I.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(_,{variant:"contained",color:"primary",onClick:function(){return J(!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(q,{open:H,handleClose:function(){return J(!1)},orderID:I.id,currentStatus:I.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Documents"),a.createElement(w,{sx:{p:2}},a.createElement(k,{spacing:1},I.delivery_note?a.createElement(a.Fragment,null,a.createElement(b,{variant:"h6"},"Delivery Note"),a.createElement(b,null,null===(h=I.delivery_note)||void 0===h?void 0:h.name),a.createElement(_,{variant:"contained",onClick:function(){m("api/opos/".concat(I.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(b,{variant:"h5"},"Delivery Note"),a.createElement(b,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(D,null),a.createElement(l,{reference:"api::e-commerce.opo",refID:I.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/opos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:A})))))),(null===(N=null===(j=null==I?void 0:I.notes)||void 0===j?void 0:j.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:2},a.createElement(b,{variant:"h5"},"Notes"),a.createElement(s,{notes:I.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(k,{spacing:1},a.createElement(b,{variant:"h5"},"Items"),"placed"===I.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:I.id}),M&&M.map((function(e,t){var r,n;return console.log("item",e),a.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===I.status?a.createElement(d,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(c,{item:e,index:t,handleUpdateQuantity:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(w,{sx:{p:2}},a.createElement(k,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(E,{text:"Update items",loadingText:"Loading..."}),a.createElement(u,{error:null==P?void 0:P.strapiErrors}),(null==P?void 0:P.message)&&a.createElement(v,{severity:"error"},null==P?void 0:P.message))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity}}))}(M))}))))))}export{N 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,__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateOpoAction as l}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualOpoItemUpdater.js";import s from"./OpoItemDisplay.js";import p from"../../logistics/note/NotesDisplay.js";import u from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import f from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import _ from"@mui/material/Button";import C from"@mui/material/Grid";import k from"@mui/material/Box";import w from"@mui/material/Paper";import D from"@mui/material/Stack";import j from"@mui/material/Divider";import{confirmationService as I}from"../../../data/services/logistics/ipo/confirmation-service.js";import{FormControlLabel as q,Checkbox as O}from"@mui/material";var A={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,n=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return r.createElement(y,{open:t},r.createElement(b,null,"Confirm Order"),r.createElement(h,null,r.createElement(D,{spacing:2},r.createElement(x,null,"Are you sure you want to confirm this order?"),r.createElement(x,null,"Current status: ",i))),r.createElement(g,null,r.createElement(_,{variant:"contained",onClick:function(e){I("opos",[a]),o&&o()}},"Confirm"),r.createElement(_,{variant:"contained",onClick:n},"Cancel")))}function S(y){var g,h,b,I,S,B=y.opo,U=y.sx,F=y.revalidateCallback;y.handleClose;var T=y.role,P=e(o(l,A),2),R=P[0],M=P[1],z=e(a(B.opo_items.data?B.opo_items.data:[]),2),G=z[0],H=z[1],J=e(a(!1),2),L=J[0],Q=J[1],K=e(a(["picked","packed","shipped","reports"]),2),V=K[0],W=K[1],X=function(n,r,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===r}));i[o][a]=n,H(i)},Y=function(r,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[r],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=n(n({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,H(m)},Z=function(n,r){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===n})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(r,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,H(o)};return i((function(){"Ipo Updated"===(null==R?void 0:R.message)&&F&&F()}),[R]),i((function(){var e;(null===(e=B.opo_items)||void 0===e?void 0:e.data)&&H(B.opo_items.data?B.opo_items.data:[])}),[B]),r.createElement(k,{sx:t([],e(Array.isArray(U)?U:[U]),!1)},r.createElement(C,{container:!0,spacing:2},r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(x,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(u,{content:"",related:[{id:B.id,__type:"api::e-commerce.opo"}],revalidateCallback:F})),r.createElement(j,null))),r.createElement(C,{item:!0,xs:6},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Details"),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(x,{variant:"body2"},B.opo_number)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),r.createElement(x,{variant:"body2"},B.customer_inhouse_reference)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Date"),r.createElement(x,{variant:"body2"},B.order_date)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Customer"),r.createElement(x,{variant:"body2"},null===(h=null===(g=B.customer)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Status"),r.createElement(x,{variant:"body2",width:"250px"},B.status)),("placed"===B.status||"external_shipping_process"===B.status)&&"enduser"===T&&r.createElement(r.Fragment,null,r.createElement(_,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),r.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(N,{open:L,handleClose:function(){return Q(!1)},orderID:B.id,currentStatus:B.status,revalidateCallback:F})))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Documents"),r.createElement(w,{sx:{p:2}},r.createElement(D,{spacing:1},B.delivery_note?r.createElement(r.Fragment,null,r.createElement(x,{variant:"h6"},"Delivery Note"),r.createElement(x,null,null===(b=B.delivery_note)||void 0===b?void 0:b.name),r.createElement(_,{variant:"contained",onClick:function(){c("api/ipos/".concat(B.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(x,{variant:"h5"},"Delivery Note"),r.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(j,null),r.createElement(m,{reference:"api::e-commerce.opo",refID:B.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:F})))))),(null===(S=null===(I=null==B?void 0:B.notes)||void 0===I?void 0:I.data)||void 0===S?void 0:S.length)>0&&r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Notes"),r.createElement(p,{notes:B.notes.data}),r.createElement(j,null))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Items"),r.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:w,p:1},r.createElement(x,{variant:"body1"},"Show:"),["picked","packed","shipped","reports"].map((function(n){return r.createElement(q,{key:n,control:r.createElement(O,{checked:V.includes(n),onChange:function(r){r.target.checked?W(t(t([],e(V),!1),[n],!1)):W(V.filter((function(e){return e!==n})))}}),label:n.charAt(0).toUpperCase()+n.slice(1)})}))),"placed"===B.status&&r.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(j,null),r.createElement("form",{action:M},r.createElement("input",{name:"id",type:"hidden",value:B.id}),G&&G.map((function(e,t){var n,a;return r.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===B.status?r.createElement(s,{item:e,index:t,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image}):r.createElement(d,{item:e,index:t,handleUpdateQuantity:X,handleAddReport:Y,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:Z,revalidateCallback:F,showing:V}))})),r.createElement(w,{sx:{p:2}},r.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(E,{text:"Update items",loadingText:"Loading..."}),r.createElement(v,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&r.createElement(f,{severity:"error"},null==R?void 0:R.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,n;return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,reports:(null===(n=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===n?void 0:n.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}export{S as default};
6
+ import{__read as e,__spreadArray as t,__assign as n}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateOpoAction as l}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualOpoItemUpdater.js";import p from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import u from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as E}from"../../SubmitButton.js";import f from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import _ from"@mui/material/Button";import C from"@mui/material/Grid";import k from"@mui/material/Box";import w from"@mui/material/Paper";import D from"@mui/material/Stack";import j from"@mui/material/Divider";import{confirmationService as I}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as q,Checkbox as O}from"@mui/material";var A={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,n=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return r.createElement(y,{open:t},r.createElement(b,null,"Confirm Order"),r.createElement(h,null,r.createElement(D,{spacing:2},r.createElement(x,null,"Are you sure you want to confirm this order?"),r.createElement(x,null,"Current status: ",i))),r.createElement(g,null,r.createElement(_,{variant:"contained",onClick:function(e){I("opos",[a]),o&&o()}},"Confirm"),r.createElement(_,{variant:"contained",onClick:n},"Cancel")))}function S(y){var g,h,b,I,S,B=y.opo,U=y.sx,F=y.revalidateCallback;y.handleClose;var T=y.role,P=e(o(l,A),2),R=P[0],M=P[1],z=e(a(B.opo_items.data?B.opo_items.data:[]),2),G=z[0],H=z[1],J=e(a(!1),2),L=J[0],Q=J[1],K=e(a(["picked","packed","shipped","reports"]),2),V=K[0],W=K[1],X=function(n,r,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===r}));i[o][a]=n,H(i)},Y=function(r,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],p=t(t([],e(d),!1),[r],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=n(n({},m[c]),{reports:{data:[]}})),m[c].reports.data=p,H(m)},Z=function(n,r){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===n})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(r,1);var p=t(t([],e(c),!1),e(d),!1);o[l].reports.data=p,H(o)};return i((function(){"Ipo Updated"===(null==R?void 0:R.message)&&F&&F()}),[R]),i((function(){var e;(null===(e=B.opo_items)||void 0===e?void 0:e.data)&&H(B.opo_items.data?B.opo_items.data:[])}),[B]),r.createElement(k,{sx:t([],e(Array.isArray(U)?U:[U]),!1)},r.createElement(C,{container:!0,spacing:2},r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h3",component:"h1"},"Management Outbound Purchase Order"),r.createElement(x,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),r.createElement(u,{content:"",related:[{id:B.id,__type:"api::e-commerce.opo"}],revalidateCallback:F})),r.createElement(j,null))),r.createElement(C,{item:!0,xs:6},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Details"),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(x,{variant:"body2"},B.opo_number)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),r.createElement(x,{variant:"body2"},B.customer_inhouse_reference)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Date"),r.createElement(x,{variant:"body2"},B.order_date)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Customer"),r.createElement(x,{variant:"body2"},null===(h=null===(g=B.customer)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),r.createElement(D,{direction:"row",spacing:2},r.createElement(x,{variant:"body1",width:"250px"},"Order Status"),r.createElement(x,{variant:"body2",width:"250px"},B.status)),("placed"===B.status||"external_shipping_process"===B.status)&&"enduser"===T&&r.createElement(r.Fragment,null,r.createElement(_,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),r.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),r.createElement(N,{open:L,handleClose:function(){return Q(!1)},orderID:B.id,currentStatus:B.status,revalidateCallback:F})))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Documents"),r.createElement(w,{sx:{p:2}},r.createElement(D,{spacing:1},B.delivery_note?r.createElement(r.Fragment,null,r.createElement(x,{variant:"h6"},"Delivery Note"),r.createElement(x,null,null===(b=B.delivery_note)||void 0===b?void 0:b.name),r.createElement(_,{variant:"contained",onClick:function(){c("api/ipos/".concat(B.id),"delivery_note")}},"Download")):r.createElement(r.Fragment,null,r.createElement(x,{variant:"h5"},"Delivery Note"),r.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),r.createElement(j,null),r.createElement(m,{reference:"api::e-commerce.opo",refID:B.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:F})))))),(null===(S=null===(I=null==B?void 0:B.notes)||void 0===I?void 0:I.data)||void 0===S?void 0:S.length)>0&&r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:2},r.createElement(x,{variant:"h5"},"Notes"),r.createElement(s,{notes:B.notes.data}),r.createElement(j,null))),r.createElement(C,{item:!0,xs:12},r.createElement(D,{spacing:1},r.createElement(x,{variant:"h5"},"Items"),r.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:w,p:1},r.createElement(x,{variant:"body1"},"Show:"),["picked","packed","shipped","reports"].map((function(n){return r.createElement(q,{key:n,control:r.createElement(O,{checked:V.includes(n),onChange:function(r){r.target.checked?W(t(t([],e(V),!1),[n],!1)):W(V.filter((function(e){return e!==n})))}}),label:n.charAt(0).toUpperCase()+n.slice(1)})}))),"placed"===B.status&&r.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),r.createElement(j,null),r.createElement("form",{action:M},r.createElement("input",{name:"id",type:"hidden",value:B.id}),G&&G.map((function(e,t){var n,a;return r.createElement(w,{sx:{p:2,mb:2},key:t},"placed"===B.status?r.createElement(p,{item:e,index:t,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image}):r.createElement(d,{item:e,index:t,handleUpdateQuantity:X,handleAddReport:Y,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:Z,revalidateCallback:F,showing:V}))})),r.createElement(w,{sx:{p:2}},r.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(E,{text:"Update items",loadingText:"Loading..."}),r.createElement(v,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&r.createElement(f,{severity:"error"},null==R?void 0:R.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,n;return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity,reports:(null===(n=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===n?void 0:n.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}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"./IPOItemUpdater.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 x from"@mui/material/Grid";import C from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/logistics/ipo/confirmation-service.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function I(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){k("ipos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function F(v){var f,g,y,k,F,N,O,S=v.data,q=v.sx,A=v.revalidateCallback;v.handleClose;var B=v.role,P=e(n(i,j),2),U=P[0],T=P[1],M=e(r(S.items.data?S.items.data:[]),2),H=M[0],R=M[1],z=e(r(!1),2),G=z[0],J=z[1],L=function(a,r,n){var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,R(i)};return a.createElement(C,{sx:t([],e(Array.isArray(q)?q:[q]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{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:S.id,__type:"api::logistics.ipo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{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"},S.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},S.custom_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},S.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=S.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"},S.status)),("placed"===S.status||"released_on_stock"===S.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!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(I,{open:G,handleClose:function(){return J(!1)},orderID:S.id,currentStatus:S.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(_,{sx:{p:2}},a.createElement(w,{spacing:1},"enduser"===B&&a.createElement(a.Fragment,null,S.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=S.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.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:S.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:A}))),S.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(k=S.delivery_note)||void 0===k?void 0:k.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.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:S.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:A})))))),(null===(N=null===(F=null==S?void 0:S.notes)||void 0===F?void 0:F.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:S.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===S.status&&a.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:S.id}),(null===(O=null==S?void 0:S.items)||void 0===O?void 0:O.data)&&S.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===S.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:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(_,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(u,{text:"Update items",loadingText:"Loading..."}),a.createElement(p,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&a.createElement(E,{severity:"error"},null==U?void 0:U.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}}))}(H))}))))))}export{F 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"./IPOItemUpdater.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 x from"@mui/material/Grid";import C from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import D from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";var j={zodErrors:null,strapiErrors:null,data:null,message:null};function I(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){k("ipos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function F(v){var f,g,y,k,F,N,O,S=v.data,q=v.sx,A=v.revalidateCallback;v.handleClose;var B=v.role,P=e(n(i,j),2),U=P[0],T=P[1],M=e(r(S.items.data?S.items.data:[]),2),H=M[0],R=M[1],z=e(r(!1),2),G=z[0],J=z[1],L=function(a,r,n){var i=t([],e(H),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,R(i)};return a.createElement(C,{sx:t([],e(Array.isArray(q)?q:[q]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{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:S.id,__type:"api::logistics.ipo"}],revalidateCallback:A})),a.createElement(D,null))),a.createElement(x,{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"},S.ipo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},S.custom_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},S.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=S.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"},S.status)),("placed"===S.status||"released_on_stock"===S.status)&&"enduser"===B&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!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(I,{open:G,handleClose:function(){return J(!1)},orderID:S.id,currentStatus:S.status,revalidateCallback:A})))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(_,{sx:{p:2}},a.createElement(w,{spacing:1},"enduser"===B&&a.createElement(a.Fragment,null,S.order_confirmation?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Order Confirmation"),a.createElement(h,null,null===(y=S.order_confirmation)||void 0===y?void 0:y.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.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:S.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:A}))),S.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(k=S.delivery_note)||void 0===k?void 0:k.name),a.createElement(b,{variant:"contained",onClick:function(){l("api/ipos/".concat(S.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:S.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:A})))))),(null===(N=null===(F=null==S?void 0:S.notes)||void 0===F?void 0:F.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:S.notes.data}),a.createElement(D,null))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===S.status&&a.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(D,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:S.id}),(null===(O=null==S?void 0:S.items)||void 0===O?void 0:O.data)&&S.items.data.map((function(e,t){var r,n;return console.log("item",e),a.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===S.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:L,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:A}))})),a.createElement(_,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"end"},a.createElement(u,{text:"Update items",loadingText:"Loading..."}),a.createElement(p,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&a.createElement(E,{severity:"error"},null==U?void 0:U.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}}))}(H))}))))))}export{F 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,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as f}from"../../SubmitButton.js";import E from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import C from"@mui/material/Button";import _ from"@mui/material/Grid";import w from"@mui/material/Box";import k from"@mui/material/Paper";import D from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/logistics/ipo/confirmation-service.js";import{FormControlLabel as q,Checkbox as A}from"@mui/material";var F={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(y,{open:t},n.createElement(b,null,"Confirm Order"),n.createElement(h,null,n.createElement(D,{spacing:2},n.createElement(x,null,"Are you sure you want to confirm this order?"),n.createElement(x,null,"Current status: ",i))),n.createElement(g,null,n.createElement(C,{variant:"contained",onClick:function(e){j("ipos",[a]),o&&o()}},"Confirm"),n.createElement(C,{variant:"contained",onClick:r},"Cancel")))}function O(y){var g,h,b,j,O,S,U=y.data,B=y.sx,P=y.revalidateCallback;y.handleClose;var R=y.role,T=e(o(l,F),2),M=T[0],H=T[1],z=e(a(U.items.data?U.items.data:[]),2),G=z[0],J=z[1],L=e(a(!1),2),Q=L[0],K=L[1],V=e(a(["received","registered","released","reports"]),2),W=V[0],X=V[1],Y=function(r,n,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,J(i)},Z=function(n,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,J(m)},$=function(r,n){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,J(o)};return i((function(){"Ipo Updated"===(null==M?void 0:M.message)&&P&&P()}),[M]),i((function(){var e;(null===(e=U.items)||void 0===e?void 0:e.data)&&J(U.items.data?U.items.data:[])}),[U]),n.createElement(w,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},n.createElement(_,{container:!0,spacing:2},n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(x,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:U.id,__type:"api::logistics.ipo"}],revalidateCallback:P})),n.createElement(I,null))),n.createElement(_,{item:!0,xs:6},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Details"),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(x,{variant:"body2"},U.ipo_number)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(x,{variant:"body2"},U.custom_reference)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Date"),n.createElement(x,{variant:"body2"},U.order_date)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Supplier"),n.createElement(x,{variant:"body2"},null===(h=null===(g=U.vendor_profile)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Status"),n.createElement(x,{variant:"body2",width:"250px"},U.status)),("placed"===U.status||"released_on_stock"===U.status)&&"enduser"===R&&n.createElement(n.Fragment,null,n.createElement(C,{variant:"contained",color:"primary",onClick:function(){return K(!0)}},"Confirm order"),n.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(N,{open:Q,handleClose:function(){return K(!1)},orderID:U.id,currentStatus:U.status,revalidateCallback:P})))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Documents"),n.createElement(k,{sx:{p:2}},n.createElement(D,{spacing:1},"enduser"===R&&n.createElement(n.Fragment,null,U.order_confirmation?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Order Confirmation"),n.createElement(x,null,null===(b=U.order_confirmation)||void 0===b?void 0:b.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"order_confirmation")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Order Confirmation"),n.createElement(x,{variant:"body1"},"Here you can upload the the order confirmation for this order"),n.createElement(x,{variant:"body1"},"FileUpload"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.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:P}))),U.delivery_note?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Delivery Note"),n.createElement(x,null,null===(j=U.delivery_note)||void 0===j?void 0:j.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"delivery_note")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Delivery Note"),n.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.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:P})))))),(null===(S=null===(O=null==U?void 0:U.notes)||void 0===O?void 0:O.data)||void 0===S?void 0:S.length)>0&&n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Notes"),n.createElement(u,{notes:U.notes.data}),n.createElement(I,null))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Items"),n.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:k,p:1},n.createElement(x,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(q,{key:r,control:n.createElement(A,{checked:W.includes(r),onChange:function(n){n.target.checked?X(t(t([],e(W),!1),[r],!1)):X(W.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"placed"===U.status&&n.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:H},n.createElement("input",{name:"id",type:"hidden",value:U.id}),G&&G.map((function(e,t){var r,a;return n.createElement(k,{sx:{p:2,mb:2},key:t},"placed"===U.status?n.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(d,{item:e,index:t,handleUpdateQuantity:Y,handleAddReport:Z,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:$,revalidateCallback:P,showing:W}))})),n.createElement(k,{sx:{p:2}},n.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(f,{text:"Update items",loadingText:"Loading..."}),n.createElement(v,{error:null==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&n.createElement(E,{severity:"error"},null==M?void 0:M.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}export{O as default};
6
+ import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as i}from"react";import{useFormState as o}from"react-dom";import{updateIpoAction as l}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import{UploadBase64MediaForm as m}from"../../common/media/UploadBase64MediaForm.js";import c from"../../../data/loaders/common/media/downloadBase64File.js";import d from"./TextualIPOItemUpdater.js";import s from"./ItemDisplay.js";import u from"../note/NotesDisplay.js";import p from"../note/NoteTakingComponent.js";import{StrapiErrors as v}from"../../StrapiErrors.js";import{SubmitButton as f}from"../../SubmitButton.js";import E from"@mui/material/Alert";import y from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import b from"@mui/material/DialogTitle";import x from"@mui/material/Typography";import C from"@mui/material/Button";import _ from"@mui/material/Grid";import w from"@mui/material/Box";import k from"@mui/material/Paper";import D from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as j}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as q,Checkbox as A}from"@mui/material";var F={zodErrors:null,strapiErrors:null,data:null,message:null};function N(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(y,{open:t},n.createElement(b,null,"Confirm Order"),n.createElement(h,null,n.createElement(D,{spacing:2},n.createElement(x,null,"Are you sure you want to confirm this order?"),n.createElement(x,null,"Current status: ",i))),n.createElement(g,null,n.createElement(C,{variant:"contained",onClick:function(e){j("ipos",[a]),o&&o()}},"Confirm"),n.createElement(C,{variant:"contained",onClick:r},"Cancel")))}function O(y){var g,h,b,j,O,S,U=y.data,B=y.sx,P=y.revalidateCallback;y.handleClose;var R=y.role,T=e(o(l,F),2),M=T[0],H=T[1],z=e(a(U.items.data?U.items.data:[]),2),G=z[0],J=z[1],L=e(a(!1),2),Q=L[0],K=L[1],V=e(a(["received","registered","released","reports"]),2),W=V[0],X=V[1],Y=function(r,n,a){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,J(i)},Z=function(n,a){var i,o,l,m=t([],e(G),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,J(m)},$=function(r,n){var a,i,o=t([],e(G),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,J(o)};return i((function(){"Ipo Updated"===(null==M?void 0:M.message)&&P&&P()}),[M]),i((function(){var e;(null===(e=U.items)||void 0===e?void 0:e.data)&&J(U.items.data?U.items.data:[])}),[U]),n.createElement(w,{sx:t([],e(Array.isArray(B)?B:[B]),!1)},n.createElement(_,{container:!0,spacing:2},n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(D,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),n.createElement(x,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),n.createElement(p,{content:"",related:[{id:U.id,__type:"api::logistics.ipo"}],revalidateCallback:P})),n.createElement(I,null))),n.createElement(_,{item:!0,xs:6},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Details"),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Purchase Order Number"),n.createElement(x,{variant:"body2"},U.ipo_number)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Custom reference"),n.createElement(x,{variant:"body2"},U.custom_reference)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Date"),n.createElement(x,{variant:"body2"},U.order_date)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Supplier"),n.createElement(x,{variant:"body2"},null===(h=null===(g=U.vendor_profile)||void 0===g?void 0:g.business_credentials)||void 0===h?void 0:h.company_name)),n.createElement(D,{direction:"row",spacing:2},n.createElement(x,{variant:"body1",width:"250px"},"Order Status"),n.createElement(x,{variant:"body2",width:"250px"},U.status)),("placed"===U.status||"released_on_stock"===U.status)&&"enduser"===R&&n.createElement(n.Fragment,null,n.createElement(C,{variant:"contained",color:"primary",onClick:function(){return K(!0)}},"Confirm order"),n.createElement(E,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(N,{open:Q,handleClose:function(){return K(!1)},orderID:U.id,currentStatus:U.status,revalidateCallback:P})))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Documents"),n.createElement(k,{sx:{p:2}},n.createElement(D,{spacing:1},"enduser"===R&&n.createElement(n.Fragment,null,U.order_confirmation?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Order Confirmation"),n.createElement(x,null,null===(b=U.order_confirmation)||void 0===b?void 0:b.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"order_confirmation")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Order Confirmation"),n.createElement(x,{variant:"body1"},"Here you can upload the the order confirmation for this order"),n.createElement(x,{variant:"body1"},"FileUpload"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.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:P}))),U.delivery_note?n.createElement(n.Fragment,null,n.createElement(x,{variant:"h6"},"Delivery Note"),n.createElement(x,null,null===(j=U.delivery_note)||void 0===j?void 0:j.name),n.createElement(C,{variant:"contained",onClick:function(){c("api/ipos/".concat(U.id),"delivery_note")}},"Download")):n.createElement(n.Fragment,null,n.createElement(x,{variant:"h5"},"Delivery Note"),n.createElement(x,{variant:"body1"},"Here you can upload the the delivery note for this order"),n.createElement(I,null),n.createElement(m,{reference:"api::logistics.ipo",refID:U.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:P})))))),(null===(S=null===(O=null==U?void 0:U.notes)||void 0===O?void 0:O.data)||void 0===S?void 0:S.length)>0&&n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:2},n.createElement(x,{variant:"h5"},"Notes"),n.createElement(u,{notes:U.notes.data}),n.createElement(I,null))),n.createElement(_,{item:!0,xs:12},n.createElement(D,{spacing:1},n.createElement(x,{variant:"h5"},"Items"),n.createElement(D,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:k,p:1},n.createElement(x,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(q,{key:r,control:n.createElement(A,{checked:W.includes(r),onChange:function(n){n.target.checked?X(t(t([],e(W),!1),[r],!1)):X(W.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"placed"===U.status&&n.createElement(E,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:H},n.createElement("input",{name:"id",type:"hidden",value:U.id}),G&&G.map((function(e,t){var r,a;return n.createElement(k,{sx:{p:2,mb:2},key:t},"placed"===U.status?n.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(d,{item:e,index:t,handleUpdateQuantity:Y,handleAddReport:Z,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:$,revalidateCallback:P,showing:W}))})),n.createElement(k,{sx:{p:2}},n.createElement(D,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(f,{text:"Update items",loadingText:"Loading..."}),n.createElement(v,{error:null==M?void 0:M.strapiErrors}),(null==M?void 0:M.message)&&n.createElement(E,{severity:"error"},null==M?void 0:M.message))),n.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(G))}))))))}export{O as default};
@@ -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,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as i}from"../../../../lib/parseFormData.js";function a(a,n){return r(this,void 0,void 0,(function(){var r,m,l;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),r=i(n),[4,t("POST","/api/iros/createAdmin",r)];case 1:return(m=e.sent())?m.error?[2,s(s({},a),{strapiErrors:m.error,message:"Failed to Create Iro."})]:(l=o(m),[2,s(s({},a),{message:"Iro Created Successfully",data:l,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as createIroAction};
@@ -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 t,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}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){return r(this,void 0,void 0,(function(){var r,m,l,p;return t(this,(function(t){switch(t.label){case 0:return r=Object.fromEntries(n),m=a(n),console.log("parsedFormData",m),[4,e("PUT","/api/iros/".concat(r.id),m)];case 1:return(l=t.sent())?l.error?[2,s(s({},i),{strapiErrors:l.error,message:"Failed to Update Iro."})]:(p=o(l),[2,s(s({},i),{message:"Iro Updated",data:p,strapiErrors:null})]):[2,s(s({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as updateIroAction};
@@ -0,0 +1,7 @@
1
+ "use server";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__awaiter as e,__generator as s}from"../../../../node_modules/tslib/tslib.es6.js";import r from"../../../../node_modules/qs/lib/index.js";import{fetchData as i}from"../loaders.js";import{getStrapiURL as o}from"../../../lib/utils.js";import{unstable_noStore as t}from"next/cache";import{getUserRole as n}from"../../services/get-user-me-loader.js";var a=o();function d(o,d,l,p,u){return e(this,void 0,void 0,(function(){var e,c,m,_,b,v;return s(this,(function(s){switch(s.label){case 0:return t(),[4,n()];case 1:return e=s.sent(),c=null===(v=null===(b=null==e?void 0:e.data)||void 0===b?void 0:b.role)||void 0===v?void 0:v.type,m="enduser"===c,(_=new URL("/api/opos",a)).search=r.stringify({filters:{is_archive:{$in:u}},sort:"".concat(p||"id",":").concat(l||"desc"),populate:{opo_items:{populate:{product:{populate:{price:!0}},reports:!0}},customer:!!m&&{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:!0}},payments:!0,invoice:{populate:{seller_business_credentials:!0,seller_company_address:!0,buyer_company_address:!0,buyer_delivery_address:!0,buyer_billing_address:!0,buyer_business_credentials:!0,items:!0,admin_items:!0}}},pagination:{pageSize:d||10,page:o?o+1:1}}),[4,i(_.href)];case 2:return[2,s.sent()]}}))}))}export{d as getAllOpos};
@@ -0,0 +1,7 @@
1
+ "use server";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__awaiter as e,__generator as r}from"../../../../../node_modules/tslib/tslib.es6.js";import i from"../../../../../node_modules/qs/lib/index.js";import{fetchData as s}from"../../loaders.js";import{getStrapiURL as o}from"../../../../lib/utils.js";import{unstable_noStore as t}from"next/cache";import{getUserRole as n}from"../../../services/get-user-me-loader.js";var a=o();function d(o,d,l,p,u){return e(this,void 0,void 0,(function(){var e,c,m,f,v,_;return r(this,(function(r){switch(r.label){case 0:return t(),[4,n()];case 1:return e=r.sent(),c=null===(_=null===(v=null==e?void 0:e.data)||void 0===v?void 0:v.role)||void 0===_?void 0:_.type,m="enduser"===c,(f=new URL("/api/iros",a)).search=i.stringify({filters:{is_archive:{$in:u}},sort:"".concat(p||"id",":").concat(l||"desc"),populate:{iro_items:{populate:{product:{populate:{price:!0}},reports:!0}},customer:!!m&&{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:!0}}},pagination:{pageSize:d||10,page:o?o+1:1}}),[4,s(f.href)];case 2:return[2,r.sent()]}}))}))}export{d as getAllIros};
@@ -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 t}from"../../../../../node_modules/tslib/tslib.es6.js";import{fetchData as i}from"../../loaders.js";import{getStrapiURL as o}from"../../../../lib/utils.js";import{unstable_noStore as e}from"next/cache";var s=o();function n(){return r(this,void 0,void 0,(function(){var r;return t(this,(function(t){switch(t.label){case 0:return e(),r=new URL("/api/iros/findModel",s),[4,i(r.href)];case 1:return[2,t.sent()]}}))}))}export{n as getIroModel};
@@ -0,0 +1,7 @@
1
+ "use server";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__awaiter as t,__generator as o}from"../../../../../node_modules/tslib/tslib.es6.js";import e from"../../../../../node_modules/qs/lib/index.js";import{fetchData as r}from"../../loaders.js";import{getStrapiURL as s}from"../../../../lib/utils.js";var i=s();function p(s){return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return(t=new URL("/api/iros/".concat(s),i)).search=e.stringify({populate:{iro_items:{populate:{product:{populate:{image:!0}},reports:{populate:{author:!0}}}},customer:{populate:["business_credentials"]},notes:{populate:{author:{populate:!0}}}}}),[4,r(t.href)];case 1:return[2,o.sent()]}}))}))}export{p as getSingleIro};
@@ -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 o}from"../../../../../node_modules/tslib/tslib.es6.js";import{fetchData as e}from"../../loaders.js";import{getStrapiURL as t}from"../../../../lib/utils.js";import{unstable_noStore as i}from"next/cache";var s=t();function n(t){return r(this,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return i(),r=new URL("/api/iros",s),console.log("query",t),r.search=t,[4,e(r.href)];case 1:return[2,o.sent()]}}))}))}export{n as queryAllIros};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as e,__generator as r}from"../../../node_modules/tslib/tslib.es6.js";import s from"../../../node_modules/qs/lib/index.js";import{fetchData as i}from"./loaders.js";import{getStrapiURL as t}from"../../lib/utils.js";import{unstable_noStore as n}from"next/cache";import{getUserRole as o}from"../services/get-user-me-loader.js";var a=t();function u(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return n(),(e=new URL("/api/users/me",a)).search=s.stringify({populate:{customer_profile:!0}}),[4,i(e.href)];case 1:return[2,r.sent()]}}))}))}function d(s){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return console.log("getSingleOrderByUuid",s),n(),e=new URL("/api/opos/uuid/".concat(s),a),[4,i(e.href)];case 1:return[2,r.sent()]}}))}))}function l(t,u,d,l,c){return e(this,void 0,void 0,(function(){var e,p,m,f,_,v;return r(this,(function(r){switch(r.label){case 0:return n(),[4,o()];case 1:return e=r.sent(),p=null===(v=null===(_=null==e?void 0:e.data)||void 0===_?void 0:_.role)||void 0===v?void 0:v.type,m="enduser"===p,(f=new URL("/api/opos",a)).search=s.stringify({filters:{is_archive:{$in:c}},sort:"".concat(l||"id",":").concat(d||"desc"),populate:{opo_items:{populate:{product:{populate:{price:!0}},reports:!0}},customer:!!m&&{populate:{company_address:!0,delivery_address:!0,billing_address:!0,business_credentials:!0}},payments:!0,invoice:{populate:{seller_business_credentials:!0,seller_company_address:!0,buyer_company_address:!0,buyer_delivery_address:!0,buyer_billing_address:!0,buyer_business_credentials:!0,items:!0,admin_items:!0}}},pagination:{pageSize:u||10,page:t?t+1:1}}),[4,i(f.href)];case 2:return[2,r.sent()]}}))}))}export{l as getAllOrders,u as getCustomerProfile,d as getSingleOrderByUuid};
7
+ import{__awaiter as e,__generator as r}from"../../../node_modules/tslib/tslib.es6.js";import t from"../../../node_modules/qs/lib/index.js";import{fetchData as i}from"./loaders.js";import{getStrapiURL as o}from"../../lib/utils.js";import{unstable_noStore as s}from"next/cache";import"../services/get-user-me-loader.js";var n=o();function u(){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return s(),(e=new URL("/api/users/me",n)).search=t.stringify({populate:{customer_profile:!0}}),[4,i(e.href)];case 1:return[2,r.sent()]}}))}))}function c(t){return e(this,void 0,void 0,(function(){var e;return r(this,(function(r){switch(r.label){case 0:return console.log("getSingleOrderByUuid",t),s(),e=new URL("/api/opos/uuid/".concat(t),n),[4,i(e.href)];case 1:return[2,r.sent()]}}))}))}export{u as getCustomerProfile,c as getSingleOrderByUuid};
@@ -0,0 +1,7 @@
1
+ "use server";
2
+ /*
3
+ * UMWD-Components
4
+ * @copyright Jelle Paulus
5
+ * @license MIT
6
+ */
7
+ import{__awaiter as o,__generator as e,__spreadArray as t,__read as r}from"../../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as n}from"../get-token.js";import{getStrapiURL as s}from"../../../lib/utils.js";function i(i,a){return o(this,void 0,void 0,(function(){var o,c,l,u,d,f;return e(this,(function(e){switch(e.label){case 0:return[4,n()];case 1:if(o=e.sent(),c=s(),l=new URL("api/".concat(i,"/confirm"),c),!o)throw new Error("No auth token found");u=JSON.stringify({data:{selectedIds:t([],r(a),!1)}}),console.log("payload",u),console.log("url",l),e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(l,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(o)},body:u})];case 3:return d=e.sent(),console.log(d),[4,d.json()];case 4:return[2,e.sent()];case 5:throw f=e.sent(),console.log("error",f),f;case 6:return[2]}}))}))}export{i as confirmationService};