umwd-components 0.1.627 → 0.1.628

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as r}from"../../_virtual/index7.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
6
+ import{__exports as r}from"../../_virtual/index8.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
@@ -3,5 +3,5 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as a}from"../../_virtual/index8.js";
6
+ import{__exports as a}from"../../_virtual/index7.js";
7
7
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var t;function o(){return t||(t=1,a.read=function(a,t,o,r,h){var M,e,i=8*h-r-1,p=(1<<i)-1,f=p>>1,n=-7,w=o?h-1:0,s=o?-1:1,u=a[t+w];for(w+=s,M=u&(1<<-n)-1,u>>=-n,n+=i;n>0;M=256*M+a[t+w],w+=s,n-=8);for(e=M&(1<<-n)-1,M>>=-n,n+=r;n>0;e=256*e+a[t+w],w+=s,n-=8);if(0===M)M=1-f;else{if(M===p)return e?NaN:1/0*(u?-1:1);e+=Math.pow(2,r),M-=f}return(u?-1:1)*e*Math.pow(2,M-r)},a.write=function(a,t,o,r,h,M){var e,i,p,f=8*M-h-1,n=(1<<f)-1,w=n>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:M-1,N=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,e=n):(e=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-e))<1&&(e--,p*=2),(t+=e+w>=1?s/p:s*Math.pow(2,1-w))*p>=2&&(e++,p/=2),e+w>=n?(i=0,e=n):e+w>=1?(i=(t*p-1)*Math.pow(2,h),e+=w):(i=t*Math.pow(2,w-1)*Math.pow(2,h),e=0));h>=8;a[o+u]=255&i,u+=N,i/=256,h-=8);for(e=e<<h|i,f+=h;f>0;a[o+u]=255&e,u+=N,e/=256,f-=8);a[o+u-N]|=128*_}),a}export{o as __require};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__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};
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 n}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{StrapiErrors as i}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as s}from"../customer/CustomerSelector.js";import{IROItemFields as c}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],S=e(m(n,g),2),_=S[0],k=S[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:k},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(u,{variant:"body2"},"Select the customer for which you want to create a return order"),t.createElement(s,{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_internal_reference",name:"customer_internal_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products that should be in this return order"),t.createElement(c,{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 return? Confirming this order means you are sure the customer wants to return the products and you are ready to process the return."),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 return order")),t.createElement("input",{name:"status",type:"hidden",value:j?"returning":"requested"})),t.createElement(d,{item:!0,xs:12},t.createElement(l,{text:"Confirm",loadingText:"Loading..."}),null!==(null==_?void 0:_.strapiErrors)&&t.createElement(i,{error:null==_?void 0:_.strapiErrors}),(null==_?void 0:_.message)&&t.createElement(h,{severity:"error"},null==_?void 0:_.message)))))}export{x as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as 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};
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 a from"@mui/material/Table";import i from"@mui/material/TableHead";import o from"@mui/material/TableBody";import l 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 b from"@mui/icons-material/Delete";import{useTheme as h}from"@mui/material/styles";function y(y){var g=y.productsArr,x=e(n([]),2),_=x[0],w=x[1],v=e(n(null),2),j=v[0],T=v[1],C=e(n(0),2),k=C[0],A=C[1],I=e(n("damaged"),2),N=I[0],q=I[1],P=e(n(""),2),S=P[0],B=P[1],D=e(n([]),2),F=D[0],H=D[1];h();var J=e(n([]),2),L=J[0],O=J[1];return m((function(){O(function(e){return e.map((function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:e.product?"number"==typeof e.product?e.product:e.product.id:0,returned_quantity:e.returned_quantity,reason:N,other_reason:S}}))}(_))}),[_]),r.createElement(s,{spacing:2},r.createElement(a,null,r.createElement(i,null,r.createElement(u,null,r.createElement(l,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),r.createElement(l,{sx:[{width:"70%"}]},"Product Number"),r.createElement(l,{sx:[{width:"15%"}]},"Amount"),r.createElement(l,{sx:[]}))),r.createElement(o,null,_.map((function(e,t){return r.createElement(u,{key:t},r.createElement(l,{sx:[{width:"15%"}]},t+1,".0.0"),r.createElement(l,{sx:[{width:"70%"}]},"object"==typeof e.product?e.product.product_number:e.product," ","| ","object"==typeof e.product?e.product.title:""),r.createElement(l,{sx:{width:"15%"}},e.returned_quantity),r.createElement(l,{align:"right",sx:{width:"5%"}},r.createElement(c,{onClick:function(){return function(e){var t=_.filter((function(t,r){return r!==e}));w(t)}(t)}},r.createElement(b,null))))})))),r.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(L)}),r.createElement(s,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(p,{variant:"body1",sx:{width:"15%"}},_.length+1,".0.0"),g&&r.createElement(E,{productNames:g,currentValue:F,sx:{width:"70%"},multiple:!1,onChangeCallback:function(e){var t=g.find((function(t){return t.id===e[0]}));T(t||null),H(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!==j&&null!==k){var r={product:j.id,returned_quantity:k,reason:N,other_reason:S};w(t(t([],e(_),!1),[r],!1)),T(null),A(0),q("damaged"),B(""),H([])}else console.log("nextProductName or nextAmount is null")}},r.createElement(d,null))))}export{y as IROItemFields};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a,useEffect as o}from"react";import{useFormState as n}from"react-dom";import{requestRmaAction as i}from"../../../data/actions/e-commerce/iro/requestRmaAction.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),R=A[0],q=A[1],C=e(a([]),2),N=C[0],T=C[1],w=function(r){T(t(t([],e(N),!1),[r],!1))};return o((function(){(null==R?void 0:R.data)&&_&&_()}),[R.data]),console.log(g),r.createElement(d,{sx:t([],e(Array.isArray(x)?x:[x]),!1)},r.createElement("form",{action:q},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:R}),r.createElement(c,{item:!0,xs:12},r.createElement(m,{text:"Request RMA",loadingText:"Loading..."}),null!==(null==R?void 0:R.strapiErrors)&&r.createElement(l,{error:null==R?void 0:R.strapiErrors}),(null==R?void 0:R.message)&&r.createElement(v,{severity:"error"},null==R?void 0:R.message)))))}export{x as default};
7
+ import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useEffect as n,useState as o,Suspense as i}from"react";import{useFormState as l}from"react-dom";import{requestRmaAction as m}from"../../../data/actions/e-commerce/iro/requestRmaAction.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as c}from"../../SubmitButton.js";import d from"@mui/material/Typography";import s from"@mui/material/Grid";import p from"@mui/material/Box";import v from"@mui/material/TextField";import E from"@mui/material/Button";import f from"@mui/material/Alert";import g from"@mui/material/Stack";import{Divider as h}from"@mui/material";import{TextualAmountUpdater as y}from"../../common/TextualAmountUpdater.js";var _={zodErrors:null,strapiErrors:null,data:null,message:null},b=function(t){var l=t.items,m=e(o([]),2),u=m[0],c=m[1],s=e(o([]),2);s[0],s[1];var p=e(o(!1),2),E=p[0],f=p[1],_=function(e,t,a){c(u.map((function(n,o){var i;return o===e?r(r({},n),((i={})[t]=a,i)):n})))};n((function(){l&&c(l.map((function(e){return{line_item_number:e.line_item_number,product:e.product,ordered_quantity:e.ordered_quantity,returned_quantity:0,reason:"damaged",other_reason:""}})))}),[l]);var b=e(o([]),2),x=b[0],q=b[1];return n((function(){u&&q(u.map((function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:"object"==typeof e.product&&"id"in e.product?e.product.id:0,returned_quantity:e.returned_quantity,reason:e.reason,other_reason:e.other_reason||""}})))}),[u]),a.createElement(i,{fallback:a.createElement("div",null,"Loading...")},a.createElement(g,{spacing:2},a.createElement(d,{variant:"h6"},"Items"),a.createElement(d,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),a.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(x)}),a.createElement(g,{spacing:1},l.map((function(e,t){var r,n;return a.createElement(g,{spacing:1},a.createElement(d,{variant:"body1"},"Line Item Number: ",e.line_item_number),a.createElement(d,{variant:"body1"},"Part Number: ",null===(r=e.product)||void 0===r?void 0:r.product_number),a.createElement(d,{variant:"body1"},"Quantity Ordered: ",e.ordered_quantity),a.createElement(y,{label:"Quantity to return",currentValue:e.ordered_quantity,totalValue:e.ordered_quantity,minNewValue:0,maxNewValue:e.ordered_quantity,handleChange:function(e){console.log(e),_(t,"returned_quantity",e)},color:"info"}),a.createElement(d,{variant:"body1"},"Reason for return:"),a.createElement(v,{value:null===(n=u[t])||void 0===n?void 0:n.reason,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:function(e){var r=e.target.value;f("other"===r),_(t,"reason",r)}},a.createElement("option",{value:"damaged"},"Damaged"),a.createElement("option",{value:"not_as_described"},"Not as described"),a.createElement("option",{value:"wrong_item"},"Wrong item"),a.createElement("option",{value:"other"},"Other")),E&&a.createElement(v,{value:u[t].other_reason,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var r=e.target.value;_(t,"other_reason",r)}}),a.createElement(h,null))})))))},x=function(e){return e.data,a.createElement(g,{spacing:2},a.createElement(d,{variant:"h6"},"Confirm RMA"),a.createElement(d,{variant:"body1"},"Are you sure you want to request a return merchandise authorization for the selected items?"),a.createElement(g,{direction:"row",spacing:2},a.createElement(c,{text:"Yes",loadingText:"Loading..."}),a.createElement(E,null,"No")))};function q(r){var o,i,v,E=r.opo,h=r.sx,y=r.revalidateCallback;r.handleClose;var q=e(l(m,_),2),A=q[0],N=q[1];return n((function(){(null==A?void 0:A.data)&&y&&y()}),[A.data]),console.log("opo",E),n((function(){console.log("formState",A)}),[A]),a.createElement(p,{sx:t([],e(Array.isArray(h)?h:[h]),!1)},a.createElement("form",{action:N},a.createElement(s,{container:!0,spacing:2},a.createElement(s,{item:!0,xs:12},a.createElement(d,{variant:"h6"},"RMA Form")),a.createElement("input",{type:"hidden",name:"opos",value:JSON.stringify([E.id])}),a.createElement(s,{item:!0,xs:12},a.createElement(g,{spacing:2},a.createElement(d,{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."))),a.createElement(s,{item:!0,xs:12},(null===(o=E.opo_items)||void 0===o?void 0:o.data)?a.createElement(g,{spacing:2},a.createElement(d,{variant:"h6"},"Items"),a.createElement(d,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),a.createElement(g,{spacing:1},(null===(i=E.opo_items)||void 0===i?void 0:i.data)&&a.createElement(b,{items:null===(v=E.opo_items)||void 0===v?void 0:v.data}))):a.createElement(d,{variant:"body1"},"No items")),a.createElement(x,{data:A}),a.createElement(s,{item:!0,xs:12},a.createElement(c,{text:"Request RMA",loadingText:"Loading..."}),null!==(null==A?void 0:A.strapiErrors)&&a.createElement(u,{error:null==A?void 0:A.strapiErrors}),(null==A?void 0:A.message)&&a.createElement(f,{severity:"error"},null==A?void 0:A.message)))))}export{q as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
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{createOpoAction as i}from"../../../data/actions/e-commerce/opo/createOpoAction.js";import{StrapiErrors as n}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{OPOItemFields as s}from"./OPOItemFields.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,j=e(a(!1),2),A=j[0],I=j[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:A,checked:A,onChange:function(){return I(!A)}}),A&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this order")),t.createElement("input",{name:"status",type:"hidden",value:A?"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};
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{createOpoAction as i}from"../../../data/actions/e-commerce/opo/createOpoAction.js";import{StrapiErrors as n}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{OPOItemFields as s}from"./OPOItemFields.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,j=e(a(!1),2),A=j[0],I=j[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_internal_reference",name:"customer_internal_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:A,checked:A,onChange:function(){return I(!A)}}),A&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this order")),t.createElement("input",{name:"status",type:"hidden",value:A?"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};
@@ -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/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};
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_internal_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 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};
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_internal_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};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as r,__generator as e,__assign as 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};
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,l,m;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),r=i(n),console.log(r),[4,t("POST","/api/iros/createAdmin",r)];case 1:return(l=e.sent())?l.error?[2,s(s({},a),{strapiErrors:l.error,message:"Failed to Create Iro."})]:(m=o(l),[2,s(s({},a),{message:"Iro Created Successfully",data:m,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as createIroAction};
@@ -1,7 +1,7 @@
1
- "use server";
1
+ "use client";
2
2
  /*
3
3
  * UMWD-Components
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
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,l,m;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),r=i(n),[4,t("POST","/api/iros",r)];case 1:return(l=e.sent())?l.error?[2,s(s({},a),{strapiErrors:l.error,message:"Failed to Create Iro."})]:(m=o(l),[2,s(s({},a),{message:"Iro Created Successfully",data:m,strapiErrors:null})]):[2,s(s({},a),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{a as requestRmaAction};
7
+ import{__awaiter as r,__generator as s,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as e}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,m){return r(this,void 0,void 0,(function(){var r,n,l;return s(this,(function(s){switch(s.label){case 0:return Object.fromEntries(m),(r=o(m)).data.iro_items&&(r.data.iro_items=JSON.parse(r.data.iro_items)),r.data.opos&&(r.data.opos=JSON.parse(r.data.opos)),console.log("parsedFormData",r),[4,e("POST","/api/iros",r)];case 1:return(n=s.sent())?n.error?[2,t(t({},i),{strapiErrors:n.error,message:"Failed to Create Iro."})]:(l=a(n),[2,t(t({},i),{message:"Iro Created Successfully",data:l,strapiErrors:null})]):[2,t(t({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as requestRmaAction};