umwd-components 0.1.637 → 0.1.638
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.
- package/dist/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/ieee754/index.js +1 -1
- package/dist/src/components/common/ImagePreviewTooltip.js +1 -1
- package/dist/src/components/e-commerce/iro/IroItemDisplay.js +1 -1
- package/dist/src/components/e-commerce/iro/IroItemUpdater.js +1 -1
- package/dist/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/src/components/e-commerce/iro/TextualIROItemUpdater.js +1 -1
- package/dist/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/e-commerce/iro/IroItemUpdater.d.ts +2 -2
- package/dist/types/components/e-commerce/iro/TextualIROItemUpdater.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/common/ImagePreviewTooltip.tsx +31 -22
- package/src/components/e-commerce/iro/IroItemDisplay.tsx +8 -1
- package/src/components/e-commerce/iro/IroItemUpdater.tsx +17 -9
- package/src/components/e-commerce/iro/RmaForm.tsx +38 -7
- package/src/components/e-commerce/iro/TextualIROItemUpdater.tsx +10 -2
- package/src/components/e-commerce/iro/TextualManageIROForm.tsx +76 -6
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__exports as r}from"../../_virtual/
|
|
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/
|
|
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 t from"react";import e from"@mui/material/Tooltip";import a from"@mui/material/Box";import i from"@mui/material/Typography";import{StrapiImage as r}from"../StrapiImage.js";function
|
|
6
|
+
import t from"react";import e from"@mui/material/Tooltip";import a from"@mui/material/Box";import i from"@mui/material/Typography";import{StrapiImage as r}from"../StrapiImage.js";function l(l){var m=l.label,o=l.image;return t.createElement(e,{title:t.createElement(t.Fragment,null,void 0!==(null==o?void 0:o.formats)?t.createElement(r,{id:o.id,url:"".concat(o.formats.thumbnail.url),alternativeText:"",width:o.formats.thumbnail.width,height:o.formats.thumbnail.height,style:{maxWidth:"100%",height:"auto"}}):t.createElement(i,{variant:"body2"},"No image available"),t.createElement(i,{variant:"body2"},m||o.alt))},t.createElement(a,{sx:{display:"block",position:"relative",width:36,height:36,borderRadius:"50%",overflow:"hidden"}},void 0!==(null==o?void 0:o.formats)?t.createElement(r,{id:o.id,url:"".concat(o.formats.thumbnail.url),alternativeText:"",width:o.formats.thumbnail.width,height:o.formats.thumbnail.height,style:{maxWidth:"100%",height:"auto"}}):t.createElement(i,{variant:"body2"},"No image available")))}export{l as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import e from"react";import t from"@mui/material/Stack";import r from"@mui/material/Typography";import a from"../../common/ImagePreviewTooltip.js";function n(n){var m
|
|
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 i,m=n.item,o=n.index,l=n.image,c=m.line_item_number,u=m.product,d=m.returned_quantity,p=m.reason,b=m.other_reason;return e.createElement(t,{spacing:1,key:o},m&&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)),e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Reason: ",p),void 0!==b&&e.createElement(r,{variant:"body1"},b)),l&&e.createElement(e.Fragment,null,e.createElement(a,{image:l,label:null===(i=m.product)||void 0===i?void 0:i.title}))))}export{n as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import a from"@mui/material/Stack";import n from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../../logistics/report/ReportMakingComponent.js";import
|
|
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 s from"../../logistics/report/ReportsDisplay.js";function p(p){var f=p.item,y=p.index,g=p.handleUpdateQuantity,E=p.image,v=p.revalidateCallback,b=f.line_item_number,V=f.product,_=f.received_quantity,w=f.registered_quantity,h=f.released_quantity,q=f.returned_quantity,C=f.reports;f.reason,f.other_reason;var 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],R=x[1];return t.createElement(a,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between"},t.createElement(a,{spacing:1},t.createElement(n,{variant:"body1"},"Line Item Number: ",b),t.createElement(n,{variant:"body1"},"Part Number: ",V&&V.product_number)),E&&t.createElement(t.Fragment,null,t.createElement(u,{image:E,label:V&&V.title}))),t.createElement(n,{variant:"body1"},"Reason"),t.createElement(n,{variant:"body2"},"Received"),t.createElement(m,{currentValue:_,totalValue:q+N,minNewValue:0+w+-k,maxNewValue:q+N,color:"info",handleChange:function(e){g(e,f.id,"received_quantity")}}),t.createElement(n,{variant:"body2"},"Registered"),t.createElement(m,{currentValue:w,totalValue:q+N,minNewValue:0+h,maxNewValue:_+k,color:"info",handleChange:function(e){g(e,f.id,"registered_quantity")},offsetEnd:k}),t.createElement(o,{sx:{p:0}},t.createElement(a,{direction:"row",spacing:1,alignItems:"center"},t.createElement(n,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return R(!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(s,{reports:C.data}),t.createElement(d,{content:"content",quantity:0,type:"registered",minValue:-(_+k),maxValue:_,related:[{id:f.id,__type:"api::e-commerce.iro-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Released"),t.createElement(m,{currentValue:h||0,totalValue:q+N+k,minNewValue:0,maxNewValue:w,color:"info",handleChange:function(e){g(e,f.id,"released_quantity")}})))}export{p as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect 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
|
|
7
|
+
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect 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 s from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import v from"@mui/material/Checkbox";import E from"@mui/material/Button";import g from"@mui/material/Alert";import y from"@mui/material/Stack";import{Divider as h,List as b,ListItem as _}from"@mui/material";import C from"@mui/material/Dialog";import x from"@mui/material/DialogActions";import k from"@mui/material/DialogContent";import q from"@mui/material/DialogContentText";import I from"@mui/material/DialogTitle";import w from"../../common/NumberInput.js";var S={zodErrors:null,strapiErrors:null,data:null,message:null},T=function(l){var m=l.items,u=l.itemsToReturn,c=l.setItemsToReturn,d=l.selectedItems,p=l.setSelectedItems,E=e(a(!1),2),g=E[0],b=E[1],_=function(e,t,n){c(u.map((function(a,o){var i;return o===e?r(r({},a),((i={})[t]=n,i)):a})))};o((function(){m&&c(m.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:""}})))}),[m]);var C=e(a([]),2),x=C[0],k=C[1];return o((function(){u&&k(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]),n.createElement(i,{fallback:n.createElement("div",null,"Loading...")},n.createElement(y,{spacing:2},n.createElement(s,{variant:"h6"},"Items"),n.createElement(s,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),n.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(x)}),n.createElement(y,{spacing:1},m.map((function(r,a){var o,i;return n.createElement(n.Fragment,null,n.createElement(y,{spacing:1,direction:"row",alignItems:"center"},n.createElement(v,{checked:d.includes(a),onChange:function(r){r.target.checked?p(t(t([],e(d),!1),[a],!1)):p(d.filter((function(e){return e!==a})))}}),n.createElement(s,{variant:"body1"},"Line Item Number: ",r.line_item_number),n.createElement(s,{variant:"body1"},"Part Number: ",null===(o=r.product)||void 0===o?void 0:o.product_number),n.createElement(s,{variant:"body1"},"Quantity Ordered: ",r.ordered_quantity)),d.includes(a)&&n.createElement(n.Fragment,null,n.createElement(y,{direction:"row",spacing:1,alignItems:"center"},n.createElement(w,{label:"Quantity to return",minNewValue:0,maxNewValue:r.ordered_quantity,setValueCallback:function(e){_(a,"returned_quantity",e)},sx:{width:"12rem"}}),n.createElement(h,{orientation:"vertical",flexItem:!0}),n.createElement(s,{variant:"body1",sx:{width:"12rem"}},"Reason for return:"),n.createElement(f,{value:null===(i=u[a])||void 0===i?void 0:i.reason,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;b("other"===t),_(a,"reason",t)}},n.createElement("option",{value:"damaged"},"Damaged on arrival"),n.createElement("option",{value:"not_as_described"},"Not as described"),n.createElement("option",{value:"wrong_item"},"Wrong item"),n.createElement("option",{value:"other"},"Other"))),g&&n.createElement(f,{value:u[a].other_reason,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;_(a,"other_reason",t)}})),n.createElement(h,null))})))))},D=function(t){var r=t.open,o=t.onClose,i=t.items,l=t.formState,m=t.submitCallback,d=e(a(!0),2),p=d[0],f=d[1];return n.createElement(C,{open:r,onClose:o},n.createElement(I,null,"Confirm RMA"),n.createElement(k,null,n.createElement(q,null,"Summary of items to be returned:"),n.createElement(b,null,i.map((function(e,t){var r,a;return n.createElement(_,{key:t},"object"==typeof e.product?"".concat(null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.product_number," ").concat(null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.title):"Product with ID ".concat(e.product)," ","- Quantity: ",e.returned_quantity)}))),n.createElement(q,null,"Are you sure you want to request a return merchandise authorization for these items?"),n.createElement(v,{onChange:function(e){return f(!e.target.checked)}}),n.createElement(s,{variant:"body1"},"I understand that all returned items must be unused and unopened")),n.createElement(x,null,m?n.createElement(c,{text:"Yes",loadingText:"Loading...",disabled:p,onClick:m}):n.createElement(c,{text:"Yes",loadingText:"Loading...",disabled:p}),n.createElement(E,{onClick:o},"No"),null!==(null==l?void 0:l.strapiErrors)&&n.createElement(u,{error:null==l?void 0:l.strapiErrors}),(null==l?void 0:l.message)&&n.createElement(g,{severity:"error"},null==l?void 0:l.message)))};function N(r){var i,c,f,v=r.opo,h=r.sx,b=r.revalidateCallback;r.handleClose;var _=e(l(m,S),2),C=_[0],x=_[1],k=e(a(!1),2),q=k[0],I=k[1],w=e(a([]),2),N=w[0],R=w[1],A=e(a([]),2),j=A[0],F=A[1];return o((function(){(null==C?void 0:C.data)&&b&&b()}),[C.data]),n.createElement(p,{sx:t([],e(Array.isArray(h)?h:[h]),!1)},n.createElement("form",{action:x},n.createElement(d,{container:!0,spacing:2},n.createElement(d,{item:!0,xs:12},n.createElement(s,{variant:"h6"},"RMA Form")),n.createElement("input",{type:"hidden",name:"opos",value:JSON.stringify([v.id])}),n.createElement(d,{item:!0,xs:12},n.createElement(y,{spacing:2},n.createElement(s,{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."),n.createElement(g,{severity:"warning"},"We urge you to carefully photograph the items you are returning. These pictures can be requested at a later time by our team to verify the condition of the items."))),n.createElement(d,{item:!0,xs:12},(null===(i=v.opo_items)||void 0===i?void 0:i.data)?n.createElement(y,{spacing:1},(null===(c=v.opo_items)||void 0===c?void 0:c.data)&&n.createElement(T,{items:null===(f=v.opo_items)||void 0===f?void 0:f.data,itemsToReturn:N,setItemsToReturn:R,selectedItems:j,setSelectedItems:F})):n.createElement(s,{variant:"body1"},"No items")),n.createElement(D,{formState:C,open:q,items:N.filter((function(e){return e.returned_quantity>0})),onClose:function(){return I(!q)},submitCallback:function(){console.log("submit callback");var e=document.querySelector("form");x(e?new FormData(e):new FormData),I(!q)}}),n.createElement(d,{item:!0,xs:12},n.createElement(E,{onClick:function(){console.log(C),I(!q)},disabled:0===j.length||0===j.reduce((function(e,t){return e+N[t].returned_quantity}),0)},"Request RMA"),null!==(null==C?void 0:C.strapiErrors)&&n.createElement(u,{error:null==C?void 0:C.strapiErrors}),(null==C?void 0:C.message)&&n.createElement(g,{severity:"error"},null==C?void 0:C.message)))))}export{N as default};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import 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
|
|
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 v(v){var g,E,y,b,w,h=v.item,x=v.index,R=v.handleAddReport,I=v.handleUpdateQuantity,V=v.image,_=v.handleRemoveReportAtIndex,j=v.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=h.reason,P=h.other_reason,T=e(r(!1),2),S=T[0],U=T[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 H=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 L=(null===(E=null===(g=h.reports)||void 0===g?void 0:g.data)||void 0===E?void 0:E.filter((function(e){return"id"in e})))||[],Q=(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(a,{variant:"body1"},"Reason: ",B,"other"===B&&void 0!==P&&", ".concat(P)),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+H,minNewValue:0+F,maxNewValue:N+H,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 U(!S)}},t.createElement(c,null)))),t.createElement(l,{in:S},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:L}),t.createElement(s,{itemID:h.id,reports:Q,handleRemoveReportAtIndex:_}),t.createElement(p,{itemID:h.id,content:"",type:"registered",minValue:-(N-A+H),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+H,minNewValue:0,maxNewValue:A,color:"info",handleChange:function(e){I(e,h.id,"released_quantity")}}))))}export{v 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{updateIroAction as l}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import m from"./TextualIROItemUpdater.js";import c from"./IroItemDisplay.js";import
|
|
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{updateIroAction as l}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import m from"./TextualIROItemUpdater.js";import c from"./IroItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import d 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 E from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import C from"@mui/material/Grid";import w from"@mui/material/Box";import x from"@mui/material/Paper";import _ from"@mui/material/Stack";import k from"@mui/material/Divider";import{confirmationService as q}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as I,Checkbox as D,List as j,ListItem as A}from"@mui/material";var R={zodErrors:null,strapiErrors:null,data:null,message:null};function S(e){var t=e.open,r=e.handleClose,a=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return n.createElement(E,{open:t},n.createElement(y,null,"Confirm Return"),n.createElement(g,null,n.createElement(_,{spacing:2},n.createElement(h,null,"Are you sure you want to confirm this return?"),n.createElement(j,null,"requested"===i&&n.createElement(A,null,"When confirming this return order a rma number will be generated"),n.createElement(A,null,"requested"===i?"By confirming the return you will update it's status from requested to returning":"By confirming the return you will update it's status from finalising_process to done")),n.createElement(h,null,"Current status: ",i))),n.createElement(f,null,n.createElement(b,{variant:"contained",onClick:function(e){q("iros",[a]),o&&o(),r()}},"Yes"),n.createElement(b,{variant:"contained",onClick:r},"No")))}function N(e){var t=e.open,r=e.handleClose;return e.orderID,e.revalidateCallback,n.createElement(E,{open:t},n.createElement(y,null,"Cancel Return"),n.createElement(g,null,n.createElement(_,{spacing:2},n.createElement(h,null,"Are you sure you want to cancel this return?"),n.createElement(j,null))),n.createElement(f,null,n.createElement(b,{variant:"contained",onClick:function(e){r()}},"Yes"),n.createElement(b,{variant:"contained",onClick:r},"No")))}function B(E){var f,g,y,q,j=E.data,A=E.sx,B=E.revalidateCallback;E.handleClose;var M=E.role,T=e(o(l,R),2),U=T[0],P=T[1],O=e(a(j.iro_items.data?j.iro_items.data:[]),2),Y=O[0],z=O[1],F=e(a(!1),2),G=F[0],J=F[1],L=e(a(!1),2),Q=L[0],W=L[1],H=e(a(["received","registered","released","reports"]),2),K=H[0],V=H[1],X=function(r,n,a){var i=t([],e(Y),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,z(i)},Z=function(n,a){var i,o,l,m=t([],e(Y),!1),c=m.findIndex((function(e){return e.id===a})),s=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],d=t(t([],e(s),!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=d,z(m)},$=function(r,n){var a,i,o=t([],e(Y),!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})),s=m.filter((function(e){return!("id"in e)}));s.splice(n,1);var d=t(t([],e(c),!1),e(s),!1);o[l].reports.data=d,z(o)};return i((function(){"Iro Updated"===(null==U?void 0:U.message)&&B&&B()}),[U]),i((function(){var e;console.log(j),(null===(e=j.iro_items)||void 0===e?void 0:e.data)&&z(j.iro_items.data?j.iro_items.data:[])}),[j]),n.createElement(w,{sx:t([],e(Array.isArray(A)?A:[A]),!1)},n.createElement(C,{container:!0,spacing:2},n.createElement(C,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(_,{direction:"row",spacing:2,justifyContent:"space-between"},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h3",component:"h1"},"Management Inbound Return"),n.createElement(h,{variant:"body1"},"Manage arrival, registration and release of returns")),n.createElement(d,{content:"",related:[{id:j.id,__type:"api::e-commerce.iro"}],revalidateCallback:B})),n.createElement(k,null))),n.createElement(C,{item:!0,xs:6},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Details"),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Number"),n.createElement(h,{variant:"body2"},j.return_number)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"RMA Number"),n.createElement(h,{variant:"body2"},j.rma_number)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Customer internal reference number"),n.createElement(h,{variant:"body2"},j.customer_reference)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Date"),n.createElement(h,{variant:"body2"},j.return_date)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Customer"),n.createElement(h,{variant:"body2"},null===(g=null===(f=j.customer)||void 0===f?void 0:f.business_credentials)||void 0===g?void 0:g.company_name)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Status"),n.createElement(h,{variant:"body2",width:"250px"},j.status)),("requested"===j.status||"finalising_process"===j.status)&&"enduser"===M&&n.createElement(n.Fragment,null,n.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),"requested"===j.status?n.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be assigned an RMA number and will become available to the dispatcher. Status: requested - returning"):n.createElement(v,{severity:"warning"},"Please finalise this return order. Make sure the customer recieves a return payment if eligible and than confirm this step. Status: finalising_process - done"),n.createElement(b,{variant:"contained",color:"error",onClick:function(){return W(!0)}},"Cancel order"),n.createElement(S,{open:G,handleClose:function(){return J(!1)},orderID:j.id,currentStatus:j.status,revalidateCallback:B}),n.createElement(N,{open:Q,handleClose:function(){return W(!1)},orderID:j.id,revalidateCallback:B})))),n.createElement(C,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Documents"),n.createElement(x,{sx:{p:2}},n.createElement(_,{spacing:1})))),(null===(q=null===(y=null==j?void 0:j.notes)||void 0===y?void 0:y.data)||void 0===q?void 0:q.length)>0&&n.createElement(C,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Notes"),n.createElement(s,{notes:j.notes.data}),n.createElement(k,null))),n.createElement(C,{item:!0,xs:12},n.createElement(_,{spacing:1},n.createElement(h,{variant:"h5"},"Items"),n.createElement(_,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:x,p:1},n.createElement(h,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(I,{key:r,control:n.createElement(D,{checked:K.includes(r),onChange:function(n){n.target.checked?V(t(t([],e(K),!1),[r],!1)):V(K.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"requested"===j.status&&n.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(k,null),n.createElement("form",{action:P},n.createElement("input",{name:"id",type:"hidden",value:j.id}),Y&&Y.map((function(e,t){var r,a;return n.createElement(x,{sx:{p:2,mb:2},key:t},"requested"===j.status?n.createElement(c,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):n.createElement(m,{item:e,index:t,handleUpdateQuantity:X,handleAddReport:Z,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:$,revalidateCallback:B,showing:K}))})),n.createElement(x,{sx:{p:2}},n.createElement(_,{direction:"row",spacing:2,justifyContent:"end"},n.createElement(p,{text:"Update items",loadingText:"Loading..."}),n.createElement(u,{error:null==U?void 0:U.strapiErrors}),(null==U?void 0:U.message)&&n.createElement(v,{severity:"error"},null==U?void 0:U.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,returned_quantity:e.returned_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}})))||[]}}))}(Y))}))))))}export{B as default};
|