umwd-components 0.1.631 → 0.1.633
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/NumberInput.js +6 -0
- package/dist/src/components/e-commerce/iro/RmaForm.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/common/NumberInput.d.ts +11 -0
- package/package.json +1 -1
- package/src/components/common/NumberInput.tsx +70 -0
- package/src/components/e-commerce/iro/RmaForm.tsx +102 -67
- package/src/components/e-commerce/iro/TextualManageIROForm.tsx +22 -9
- package/src/data/loaders/e-commerce/iros/getSingleIro.ts +1 -0
- package/src/data/loaders/e-commerce-loaders.ts +3 -0
|
@@ -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};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
import{extends as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{__read as a,__spreadArray as t}from"../../../node_modules/tslib/tslib.es6.js";import l,{useEffect as r}from"react";import i from"@mui/material/TextField";var o=function(o){var n=o.label,m=o.minNewValue,u=o.maxNewValue,s=a(l.useState(0),2),d=s[0],v=s[1];return r((function(){o.setValueCallback&&o.setValueCallback(d)}),[d]),l.createElement(i,e({},o,{type:"number",label:n,size:"small",value:d,onChange:function(e){var a=Number(e.target.value);v(void 0!==m&&void 0!==u?Math.max(m,Math.min(a,u)):void 0!==m?Math.max(a,m):void 0!==u?Math.min(a,u):a)},inputProps:{step:1,min:null!=m?m:void 0,max:null!=u?u:void 0},onWheel:function(e){e.target.blur()},helperText:"min: ".concat(m,", max: ").concat(u),error:void 0!==m&&d<m||void 0!==u&&d>u||o.error,sx:t([{width:"9rem"}],a(Array.isArray(null==o?void 0:o.sx)?o.sx:[o.sx]),!1)}))};export{o as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.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 m}from"react-dom";import{requestRmaAction as l}from"../../../data/actions/e-commerce/iro/requestRmaAction.js";import{SubmitButton as u}from"../../SubmitButton.js";import c from"@mui/material/Typography";import d from"@mui/material/Grid";import s from"@mui/material/Box";import p from"@mui/material/TextField";import f from"@mui/material/Checkbox";import E from"@mui/material/Button";import v from"@mui/material/Stack";import{Divider as g}from"@mui/material";import h from"@mui/material/Dialog";import b from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import _ from"@mui/material/DialogContentText";import x from"@mui/material/DialogTitle";import C from"../../common/NumberInput.js";var k={zodErrors:null,strapiErrors:null,data:null,message:null},q=function(m){var l=m.items,u=e(a([]),2),d=u[0],s=u[1],E=e(a([]),2),h=E[0],b=E[1],y=e(a(!1),2),_=y[0],x=y[1],k=function(e,t,n){s(d.map((function(a,o){var i;return o===e?r(r({},a),((i={})[t]=n,i)):a})))};o((function(){l&&s(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 q=e(a([]),2),N=q[0],w=q[1];return o((function(){d&&w(d.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||""}})))}),[d]),n.createElement(i,{fallback:n.createElement("div",null,"Loading...")},n.createElement(v,{spacing:2},n.createElement(c,{variant:"h6"},"Items"),n.createElement(c,{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(N)}),n.createElement(v,{spacing:1},l.map((function(r,a){var o,i;return n.createElement(n.Fragment,null,n.createElement(v,{spacing:1,direction:"row",alignItems:"center"},n.createElement(f,{checked:h.includes(a),onChange:function(r){r.target.checked?b(t(t([],e(h),!1),[a],!1)):b(h.filter((function(e){return e!==a})))}}),n.createElement(c,{variant:"body1"},"Line Item Number: ",r.line_item_number),n.createElement(c,{variant:"body1"},"Part Number: ",null===(o=r.product)||void 0===o?void 0:o.product_number),n.createElement(c,{variant:"body1"},"Quantity Ordered: ",r.ordered_quantity)),h.includes(a)&&n.createElement(n.Fragment,null,n.createElement(v,{direction:"row",spacing:1,alignItems:"center"},n.createElement(C,{label:"Quantity to return",minNewValue:0,maxNewValue:r.ordered_quantity,setValueCallback:function(e){k(a,"returned_quantity",e)},sx:{width:"12rem"}}),n.createElement(g,{orientation:"vertical",flexItem:!0}),n.createElement(c,{variant:"body1",sx:{width:"12rem"}},"Reason for return:"),n.createElement(p,{value:null===(i=d[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;x("other"===t),k(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"))),_&&n.createElement(p,{value:d[a].other_reason,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;k(a,"other_reason",t)}})),n.createElement(g,null))})))))},N=function(t){var r=t.open,o=t.onClose;t.data;var i=e(a(!0),2),m=i[0],l=i[1];return n.createElement(h,{open:r,onClose:o},n.createElement(x,null,"Confirm RMA"),n.createElement(y,null,n.createElement(_,null,"Are you sure you want to request a return merchandise authorization for the selected items?"),n.createElement(f,{onChange:function(e){return l(!e.target.checked)}}),n.createElement(c,{variant:"body1"},"I understand that all returned items must be unused and unopened")),n.createElement(b,null,n.createElement(u,{text:"Yes",loadingText:"Loading...",disabled:m}),n.createElement(E,{onClick:o},"No")))};function w(r){var i,u,p,f=r.opo,g=r.sx,h=r.revalidateCallback;r.handleClose;var b=e(m(l,k),2),y=b[0],_=b[1],x=e(a(!1),2),C=x[0],w=x[1];return o((function(){(null==y?void 0:y.data)&&h&&h()}),[y.data]),n.createElement(s,{sx:t([],e(Array.isArray(g)?g:[g]),!1)},n.createElement("form",{action:_},n.createElement(d,{container:!0,spacing:2},n.createElement(d,{item:!0,xs:12},n.createElement(c,{variant:"h6"},"RMA Form")),n.createElement("input",{type:"hidden",name:"opos",value:JSON.stringify([f.id])}),n.createElement(d,{item:!0,xs:12},n.createElement(v,{spacing:2},n.createElement(c,{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(d,{item:!0,xs:12},(null===(i=f.opo_items)||void 0===i?void 0:i.data)?n.createElement(v,{spacing:1},(null===(u=f.opo_items)||void 0===u?void 0:u.data)&&n.createElement(q,{items:null===(p=f.opo_items)||void 0===p?void 0:p.data})):n.createElement(c,{variant:"body1"},"No items")),n.createElement(N,{data:y,open:C,onClose:function(){return w(!C)}}),n.createElement(d,{item:!0,xs:12},n.createElement(E,{onClick:function(){return w(!C)}},"Request RMA")))))}export{w 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
|
|
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 d from"../../logistics/note/NotesDisplay.js";import s from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as u}from"../../StrapiErrors.js";import{SubmitButton as p}from"../../SubmitButton.js";import v from"@mui/material/Alert";import f from"@mui/material/Dialog";import E from"@mui/material/DialogActions";import g from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import _ from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";import{FormControlLabel as j,Checkbox as D,List as q,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(f,{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(q,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(E,null,n.createElement(b,{variant:"contained",onClick:function(e){k("iros",[a]),o&&o()}},"Confirm"),n.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function B(f){var E,g,y,k,q=f.data,A=f.sx,B=f.revalidateCallback;f.handleClose;var N=f.role,T=e(o(l,R),2),U=T[0],M=T[1],O=e(a(q.iro_items.data?q.iro_items.data:[]),2),P=O[0],z=O[1],F=e(a(!1),2),G=F[0],J=F[1],L=e(a(["received","registered","released","reports"]),2),Q=L[0],W=L[1],H=function(r,n,a){var i=t([],e(P),!1),o=i.findIndex((function(e){return e.id===n}));i[o][a]=r,z(i)},K=function(n,a){var i,o,l,m=t([],e(P),!1),c=m.findIndex((function(e){return e.id===a})),d=(null===(o=null===(i=m[c])||void 0===i?void 0:i.reports)||void 0===o?void 0:o.data)||[],s=t(t([],e(d),!1),[n],!1);null==(null===(l=m[c])||void 0===l?void 0:l.reports)&&(m[c]=r(r({},m[c]),{reports:{data:[]}})),m[c].reports.data=s,z(m)},V=function(r,n){var a,i,o=t([],e(P),!1),l=o.findIndex((function(e){return e.id===r})),m=(null===(i=null===(a=o[l])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],c=m.filter((function(e){return"id"in e})),d=m.filter((function(e){return!("id"in e)}));d.splice(n,1);var s=t(t([],e(c),!1),e(d),!1);o[l].reports.data=s,z(o)};return i((function(){"Iro Updated"===(null==U?void 0:U.message)&&B&&B()}),[U]),i((function(){var e;console.log(q),(null===(e=q.iro_items)||void 0===e?void 0:e.data)&&z(q.iro_items.data?q.iro_items.data:[])}),[q]),n.createElement(C,{sx:t([],e(Array.isArray(A)?A:[A]),!1)},n.createElement(x,{container:!0,spacing:2},n.createElement(x,{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(s,{content:"",related:[{id:q.id,__type:"api::e-commerce.iro"}],revalidateCallback:B})),n.createElement(I,null))),n.createElement(x,{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"},q.return_number)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Return Date"),n.createElement(h,{variant:"body2"},q.return_date)),n.createElement(_,{direction:"row",spacing:2},n.createElement(h,{variant:"body1",width:"250px"},"Customer"),n.createElement(h,{variant:"body2"},null===(g=null===(E=q.customer)||void 0===E?void 0:E.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"},q.status)),("requested"===q.status||"finalising_process"===q.status)&&"enduser"===N&&n.createElement(n.Fragment,null,n.createElement(b,{variant:"contained",color:"primary",onClick:function(){return J(!0)}},"Confirm order"),n.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),n.createElement(S,{open:G,handleClose:function(){return J(!1)},orderID:q.id,currentStatus:q.status,revalidateCallback:B})))),n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Documents"),n.createElement(w,{sx:{p:2}},n.createElement(_,{spacing:1})))),(null===(k=null===(y=null==q?void 0:q.notes)||void 0===y?void 0:y.data)||void 0===k?void 0:k.length)>0&&n.createElement(x,{item:!0,xs:12},n.createElement(_,{spacing:2},n.createElement(h,{variant:"h5"},"Notes"),n.createElement(d,{notes:q.notes.data}),n.createElement(I,null))),n.createElement(x,{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:w,p:1},n.createElement(h,{variant:"body1"},"Show:"),["received","registered","released","reports"].map((function(r){return n.createElement(j,{key:r,control:n.createElement(D,{checked:Q.includes(r),onChange:function(n){n.target.checked?W(t(t([],e(Q),!1),[r],!1)):W(Q.filter((function(e){return e!==r})))}}),label:r.charAt(0).toUpperCase()+r.slice(1)})}))),"requested"===q.status&&n.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),n.createElement(I,null),n.createElement("form",{action:M},n.createElement("input",{name:"id",type:"hidden",value:q.id}),P&&P.map((function(e,t){var r,a;return n.createElement(w,{sx:{p:2,mb:2},key:t},"requested"===q.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:H,handleAddReport:K,image:null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.image,handleRemoveReportAtIndex:V,revalidateCallback:B,showing:Q}))})),n.createElement(w,{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,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}})))||[]}}))}(P))}))))))}export{B as default};
|