umwd-components 0.1.783 → 0.1.784

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/cjs/src/components/common/AmountUpdater.js +1 -1
  2. package/dist/cjs/src/components/common/NumberInput.js +1 -1
  3. package/dist/cjs/src/components/common/TextualAmountUpdater.js +1 -1
  4. package/dist/cjs/src/components/common/media/minio/UploadMinioMediaForm.js +1 -1
  5. package/dist/cjs/src/components/e-commerce/iro/IroItemUpdater.js +1 -1
  6. package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
  7. package/dist/cjs/src/components/e-commerce/iro/TextualIROItemUpdater.js +1 -1
  8. package/dist/cjs/src/components/e-commerce/opo/OpoItemUpdater.js +1 -1
  9. package/dist/cjs/src/components/e-commerce/opo/TextualOpoItemUpdater.js +1 -1
  10. package/dist/cjs/src/components/logistics/ipo/IPOItemUpdater.js +1 -1
  11. package/dist/cjs/src/components/logistics/ipo/TextualIPOItemUpdater.js +1 -1
  12. package/dist/cjs/src/data/actions/media/minio/uploadMinioMediaAction.js +1 -1
  13. package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
  14. package/dist/esm/src/components/common/AmountUpdater.js +10 -10
  15. package/dist/esm/src/components/common/NumberInput.js +13 -13
  16. package/dist/esm/src/components/common/TextualAmountUpdater.js +11 -11
  17. package/dist/esm/src/components/common/media/minio/UploadMinioMediaForm.js +97 -55
  18. package/dist/esm/src/components/e-commerce/iro/IroItemUpdater.js +3 -3
  19. package/dist/esm/src/components/e-commerce/iro/RmaForm.js +14 -5
  20. package/dist/esm/src/components/e-commerce/iro/TextualIROItemUpdater.js +3 -3
  21. package/dist/esm/src/components/e-commerce/opo/OpoItemUpdater.js +3 -3
  22. package/dist/esm/src/components/e-commerce/opo/TextualOpoItemUpdater.js +3 -3
  23. package/dist/esm/src/components/logistics/ipo/IPOItemUpdater.js +3 -3
  24. package/dist/esm/src/components/logistics/ipo/TextualIPOItemUpdater.js +3 -3
  25. package/dist/esm/src/components/logistics/report/SimpleReportFields.js +1 -1
  26. package/dist/esm/src/data/actions/media/minio/uploadMinioMediaAction.js +82 -56
  27. package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
  28. package/dist/esm/types/components/common/AmountUpdater.d.ts +1 -1
  29. package/dist/esm/types/components/common/NumberInput.d.ts +2 -2
  30. package/dist/esm/types/components/common/TextualAmountUpdater.d.ts +1 -1
  31. package/dist/esm/types/components/common/media/minio/UploadMinioMediaForm.d.ts +7 -1
  32. package/dist/esm/types/types/common/AmountUpdater.d.ts +4 -4
  33. package/package.json +1 -1
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),a=require("@mui/material/Box"),n=require("@mui/material/IconButton"),t=require("@mui/material/Typography"),r=require("@mui/material/Stack"),l=require("@mui/material/Badge"),d=require("@mui/icons-material/RemoveCircle"),o=require("@mui/icons-material/AddCircle"),s=require("@mui/material/styles");function c({currentValue:c,totalValue:x,minNewValue:m,maxNewValue:g,color:p,handleChange:u,offsetEnd:h}){const j=100/x*c,[b,$]=i.useState(c),C=100/x*b,k=h?100/x*h*-1:0,f=s.useTheme(),z=e=>{b+e<=g&&($(b+e),u(b+e))},y=e=>{b-e>=m&&($(b-e),u(b-e))};i.useEffect(()=>{$(c)},[c]);const v=s.styled(l)(({theme:e})=>({"& .MuiBadge-badge":{backgroundColor:"#fff",fontWeight:"bold",color:"black",mixBlendMode:"lighten",margin:"-1px 0px",padding:"0px 4px"}})),q=s.styled(n)(({theme:e})=>({"&:hover":{color:e.palette.primary.main,"& .MuiBadge-badge":{backgroundColor:e.palette.primary.main}}}));return e.jsxs(a,{sx:[{display:"flex",alignItems:"center",background:`\n linear-gradient(90deg, ${f.palette[p].main}55 ${j}%, ${f.palette[p].main}33 ${j}%),\n linear-gradient(90deg, ${f.palette[p].main}55 ${C}%, ${f.palette[p].main}33 ${C}%)\n `,width:"100%",borderRadius:"16px",padding:"2px",justifyContent:"space-between"},b-x===1&&{paddingRight:"4px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 4px, ${f.palette[p].main}66 4px)`},b-x===2&&{paddingRight:"8px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 8px, ${f.palette[p].main}66 8px)`},b-x===3&&{paddingRight:"12px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 12px, ${f.palette[p].main}66 12px)`},b-x===4&&{paddingRight:"16px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 16px, ${f.palette[p].main}66 16px)`},b-x>=5&&{paddingRight:"20px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 20px, ${f.palette[p].main}66 20px)`},null!=h&&h<0&&{background:`linear-gradient(-90deg, ${f.palette.error.main} ${k}%, ${f.palette[p].main}66 ${k}%)`}],children:[e.jsxs(a,{children:[b-100>=m&&e.jsx(q,{size:"small",onClick:e=>y(100),children:e.jsx(v,{badgeContent:100,max:100,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),b-25>=m&&e.jsx(q,{size:"small",onClick:e=>y(25),children:e.jsx(v,{badgeContent:25,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),b-10>=m&&e.jsx(q,{size:"small",onClick:e=>y(10),children:e.jsx(v,{badgeContent:10,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),b-5>=m&&e.jsx(q,{size:"small",onClick:e=>y(5),children:e.jsx(v,{badgeContent:5,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),e.jsx(q,{size:"small",onClick:()=>{b-1>=m&&($(b-1),u(b-1))},disabled:b-1<m,children:e.jsx(d,{})})]}),e.jsxs(r,{direction:"row",spacing:1,children:[c!==x?e.jsx(t,{variant:"body2",children:`${c} / ${x}`}):e.jsx(t,{variant:"body2",children:`${c}`}),b!==c&&e.jsx(t,{variant:"body2",children:`+ (${b-c}) = ${b}`})]}),e.jsxs(a,{children:[e.jsx(q,{size:"small",onClick:()=>{b+1<=g&&($(b+1),u(b+1))},disabled:b+1>g,children:e.jsx(o,{})}),b+5<=g&&e.jsx(q,{size:"small",onClick:e=>z(5),children:e.jsx(v,{badgeContent:5,children:e.jsx(o,{})})}),b+10<=g&&e.jsx(q,{size:"small",onClick:e=>z(10),children:e.jsx(v,{badgeContent:10,children:e.jsx(o,{})})}),b+25<=g&&e.jsx(q,{size:"small",onClick:e=>z(25),children:e.jsx(v,{badgeContent:25,children:e.jsx(o,{})})}),b+100<=g&&e.jsx(q,{size:"small",onClick:e=>z(100),children:e.jsx(v,{badgeContent:100,max:100,children:e.jsx(o,{})})})]})]})}exports.AmountUpdater=c,exports.default=c;
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),a=require("@mui/material/Box"),n=require("@mui/material/IconButton"),t=require("@mui/material/Typography"),r=require("@mui/material/Stack"),l=require("@mui/material/Badge"),d=require("@mui/icons-material/RemoveCircle"),o=require("@mui/icons-material/AddCircle"),s=require("@mui/material/styles");function c({currentValue:c,totalValue:x,minnewvalue:m,maxnewvalue:g,color:p,handleChange:u,offsetEnd:h}){const j=100/x*c,[b,$]=i.useState(c),C=100/x*b,k=h?100/x*h*-1:0,f=s.useTheme(),z=e=>{b+e<=g&&($(b+e),u(b+e))},v=e=>{b-e>=m&&($(b-e),u(b-e))};i.useEffect(()=>{$(c)},[c]);const y=s.styled(l)(({theme:e})=>({"& .MuiBadge-badge":{backgroundColor:"#fff",fontWeight:"bold",color:"black",mixBlendMode:"lighten",margin:"-1px 0px",padding:"0px 4px"}})),q=s.styled(n)(({theme:e})=>({"&:hover":{color:e.palette.primary.main,"& .MuiBadge-badge":{backgroundColor:e.palette.primary.main}}}));return e.jsxs(a,{sx:[{display:"flex",alignItems:"center",background:`\n linear-gradient(90deg, ${f.palette[p].main}55 ${j}%, ${f.palette[p].main}33 ${j}%),\n linear-gradient(90deg, ${f.palette[p].main}55 ${C}%, ${f.palette[p].main}33 ${C}%)\n `,width:"100%",borderRadius:"16px",padding:"2px",justifyContent:"space-between"},b-x===1&&{paddingRight:"4px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 4px, ${f.palette[p].main}66 4px)`},b-x===2&&{paddingRight:"8px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 8px, ${f.palette[p].main}66 8px)`},b-x===3&&{paddingRight:"12px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 12px, ${f.palette[p].main}66 12px)`},b-x===4&&{paddingRight:"16px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 16px, ${f.palette[p].main}66 16px)`},b-x>=5&&{paddingRight:"20px",background:`linear-gradient(-90deg, ${f.palette[p].main}33 20px, ${f.palette[p].main}66 20px)`},null!=h&&h<0&&{background:`linear-gradient(-90deg, ${f.palette.error.main} ${k}%, ${f.palette[p].main}66 ${k}%)`}],children:[e.jsxs(a,{children:[b-100>=m&&e.jsx(q,{size:"small",onClick:e=>v(100),children:e.jsx(y,{badgeContent:100,max:100,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),b-25>=m&&e.jsx(q,{size:"small",onClick:e=>v(25),children:e.jsx(y,{badgeContent:25,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),b-10>=m&&e.jsx(q,{size:"small",onClick:e=>v(10),children:e.jsx(y,{badgeContent:10,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),b-5>=m&&e.jsx(q,{size:"small",onClick:e=>v(5),children:e.jsx(y,{badgeContent:5,anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(d,{})})}),e.jsx(q,{size:"small",onClick:()=>{b-1>=m&&($(b-1),u(b-1))},disabled:b-1<m,children:e.jsx(d,{})})]}),e.jsxs(r,{direction:"row",spacing:1,children:[c!==x?e.jsx(t,{variant:"body2",children:`${c} / ${x}`}):e.jsx(t,{variant:"body2",children:`${c}`}),b!==c&&e.jsx(t,{variant:"body2",children:`+ (${b-c}) = ${b}`})]}),e.jsxs(a,{children:[e.jsx(q,{size:"small",onClick:()=>{b+1<=g&&($(b+1),u(b+1))},disabled:b+1>g,children:e.jsx(o,{})}),b+5<=g&&e.jsx(q,{size:"small",onClick:e=>z(5),children:e.jsx(y,{badgeContent:5,children:e.jsx(o,{})})}),b+10<=g&&e.jsx(q,{size:"small",onClick:e=>z(10),children:e.jsx(y,{badgeContent:10,children:e.jsx(o,{})})}),b+25<=g&&e.jsx(q,{size:"small",onClick:e=>z(25),children:e.jsx(y,{badgeContent:25,children:e.jsx(o,{})})}),b+100<=g&&e.jsx(q,{size:"small",onClick:e=>z(100),children:e.jsx(y,{badgeContent:100,max:100,children:e.jsx(o,{})})})]})]})}exports.AmountUpdater=c,exports.default=c;
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("@mui/material/TextField");exports.default=t=>{const{label:i,minNewValue:l,maxNewValue:s}=t,[u,o]=r.useState(0);return r.useEffect(()=>{t.setValueCallback&&t.setValueCallback(u)},[u]),e.jsx(a,{...t,type:"number",label:i,size:"small",value:u,onChange:e=>{const r=Number(e.target.value);o(void 0!==l&&void 0!==s?Math.max(l,Math.min(r,s)):void 0!==l?Math.max(r,l):void 0!==s?Math.min(r,s):r)},inputProps:{step:1,min:l??void 0,max:s??void 0},onWheel:e=>{e.target.blur()},helperText:`min: ${l}, max: ${s}`,error:void 0!==l&&u<l||void 0!==s&&u>s||t.error,sx:[{width:"9rem"},...Array.isArray(t?.sx)?t.sx:[t.sx]]})};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),a=require("@mui/material/TextField");exports.default=t=>{const{label:i,minnewvalue:l,maxnewvalue:s,setValueCallback:u}=t,[o,m]=r.useState(0);return r.useEffect(()=>{u&&u(o)},[o]),e.jsx(a,{type:"number",label:i,size:"small",value:o,onChange:e=>{const r=Number(e.target.value);m(void 0!==l&&void 0!==s?Math.max(l,Math.min(r,s)):void 0!==l?Math.max(r,l):void 0!==s?Math.min(r,s):r)},inputProps:{step:1,min:l??void 0,max:s??void 0},onWheel:e=>{e.target.blur()},helperText:`min: ${l}, max: ${s}`,error:void 0!==l&&o<l||void 0!==s&&o>s||t.error,sx:[{width:"9rem"},...Array.isArray(t?.sx)?t.sx:[t.sx]]})};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Typography"),a=require("@mui/material/Stack"),i=require("@mui/material/TextField"),n=require("@mui/material/Button");function l({label:l,currentValue:u,totalValue:o,minNewValue:m,maxNewValue:s,handleChange:d}){const[c,x]=r.useState(u),[h,p]=r.useState(!1);return e.jsxs(a,{direction:"row",spacing:1,justifyContent:"space-between",alignItems:"center",children:[u!==o?e.jsx(t,{variant:"body2",children:`${u} / ${o}`}):e.jsx(t,{variant:"body2",children:`${u}`}),e.jsx(i,{type:"number",label:l,size:"small",value:c,onChange:e=>{const r=Number(e.target.value);x(void 0!==m&&void 0!==s?Math.max(m,Math.min(r,s)):void 0!==m?Math.max(r,m):void 0!==s?Math.min(r,s):r)},inputProps:{step:1,min:m??void 0,max:s??void 0},onWheel:e=>{e.target.blur()},helperText:`min: ${m}, max: ${s}`,error:h,sx:{width:"9rem"}}),e.jsx(n,{variant:"contained",color:"primary",onClick:()=>{c<m||c>s?p(!0):(d(c),p(!1))},size:"small",children:"Confirm"})]})}exports.TextualAmountUpdater=l,exports.default=l;
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Typography"),a=require("@mui/material/Stack"),i=require("@mui/material/TextField"),n=require("@mui/material/Button");function l({label:l,currentValue:u,totalValue:o,minnewvalue:m,maxnewvalue:s,handleChange:d}){const[c,x]=r.useState(u),[h,p]=r.useState(!1);return e.jsxs(a,{direction:"row",spacing:1,justifyContent:"space-between",alignItems:"center",children:[u!==o?e.jsx(t,{variant:"body2",children:`${u} / ${o}`}):e.jsx(t,{variant:"body2",children:`${u}`}),e.jsx(i,{type:"number",label:l,size:"small",value:c,onChange:e=>{const r=Number(e.target.value);x(void 0!==m&&void 0!==s?Math.max(m,Math.min(r,s)):void 0!==m?Math.max(r,m):void 0!==s?Math.min(r,s):r)},inputProps:{step:1,min:m??void 0,max:s??void 0},onWheel:e=>{e.target.blur()},helperText:`min: ${m}, max: ${s}`,error:h,sx:{width:"9rem"}}),e.jsx(n,{variant:"contained",color:"primary",onClick:()=>{c<m||c>s?p(!0):(d(c),p(!1))},size:"small",children:"Confirm"})]})}exports.TextualAmountUpdater=l,exports.default=l;
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- "use strict";var e=require("react/jsx-runtime"),i=require("react"),n=require("../../../../data/actions/media/minio/uploadMinioMediaAction.js"),t=require("../../../StrapiErrors.js"),r=require("../../../ZodErrors.js"),a=require("../../../SubmitButton.js"),s=require("@mui/material/Stack"),l=require("@mui/material/Typography"),o=require("@mui/material/Box"),p=require("@mui/material/Grid"),c=require("@mui/material/Alert");const d={zodErrors:null,strapiErrors:null,data:null,message:null};exports.UploadMinioMediaForm=function({bucketName:m=process.env.MINIO_BUCKET_NAME||"umwd",multiple:u=!1,accept:x=process.env.MINIO_ACCEPTED_FILE_TYPES||["image/jpeg","image/jpg","image/png","image/webp","image/gif","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/pdf","text/plain","text/markdown","text/csv","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation"],reference:g,refID:j,field:f,revalidateCallback:h}){console.log("UploadMinioMediaForm render",g,j,f),console.log("accept:",x);const[y,v]=i.useState(null),[E,w]=i.useState(null),[b,k]=i.useState(null),[q,M]=i.useActionState(n.uploadMinioMediaAction,d),I=i.useRef(null);return i.useEffect(()=>{q.message&&"success"===q.message.type&&h?.()},[q.message]),e.jsx("form",{action:M,children:e.jsxs(s,{spacing:1,sx:{flex:1},children:[g&&j&&f&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",name:"reference",value:g,style:{display:"none"},readOnly:!0}),e.jsx("input",{type:"text",name:"refID",value:j,style:{display:"none"},readOnly:!0}),e.jsx("input",{type:"text",name:"field",value:f,style:{display:"none"},readOnly:!0})]}),m&&e.jsx("input",{type:"text",name:"bucketName",value:m,style:{display:"none"},readOnly:!0}),b&&e.jsx("input",{type:"text",name:"fileName",value:b,style:{display:"none"},readOnly:!0}),null!==y?e.jsx(o,{onClick:()=>I.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"},children:void 0===x||"image/*"===x?e.jsx(p,{container:!0,children:y.map((i,n)=>e.jsx(p,{size:{xs:12,sm:6,md:4,lg:2},children:e.jsx("img",{src:i.url,alt:i.name,style:{width:"100px"}},n)},n))}):e.jsx(p,{container:!0,children:y.map((i,n)=>e.jsx(p,{size:{xs:12,sm:6,md:4,lg:2},children:e.jsx(l,{children:i.name})},n))})}):e.jsx(o,{onClick:()=>I.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px",cursor:"pointer"},children:e.jsxs(l,{children:["No file",""+(u?"s":"")," selected, click here to start uploading new files"]})}),e.jsxs(s,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between",children:[e.jsx(t.StrapiErrors,{error:q.strapiErrors}),e.jsx(r.ZodErrors,{error:q.zodErrors?.image}),q?.message&&e.jsx(c,{severity:"error",children:q?.message}),e.jsxs(o,{children:[e.jsx("label",{htmlFor:"minioInput",children:e.jsx("input",{id:"minioInput",accept:"string"==typeof x?x:x.join(","),multiple:u,type:"file",name:"files",ref:I,onChange:e=>{const i=e.target.files;if(null===i)return;i.length>0&&k(i[0].name);const n=Object.keys(i).map((e,n)=>({url:URL.createObjectURL(i[n]),name:i[n].name}));w(i),v(n)},style:{display:"none"}})}),null!==E&&e.jsx(a.SubmitButton,{text:"upload",loadingText:"loading"})]})]})]})})};
7
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("react-dom"),n=require("../../../../data/actions/media/minio/uploadMinioMediaAction.js"),s=require("../../../../context/common/SnackbarContext.js"),t=require("../../../StrapiErrors.js"),a=require("../../../ZodErrors.js"),o=require("../../../SubmitButton.js"),l=require("@mui/material/Stack"),c=require("@mui/material/Typography"),p=require("@mui/material/Box"),d=require("@mui/material/Grid"),m=require("@mui/material/Button");const u={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.UploadMinioMediaForm=function({bucketName:x=process.env.MINIO_BUCKET_NAME||"umwd",multiple:h=!1,accept:g=process.env.MINIO_ACCEPTED_FILE_TYPES||["image/jpeg","image/jpg","image/png","image/webp","image/gif","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/pdf","text/plain","text/markdown","text/csv","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation"],reference:j,refID:f,field:y,revalidateCallback:v,sx:E,handleClose:b}){const[w,k]=r.useState(null),[q,C]=r.useState(null),[S,A]=i.useFormState(n.uploadMinioMediaAction,u),M=r.useRef(null),{handleAddMessage:z}=s.useSnackbar();return r.useEffect(()=>{S?.message&&(z({message:S.message,severity:S.severity||"error"}),"success"===S.severity&&(v&&v(),b&&b(),C(null),k(null),M.current&&(M.current.value="")))},[S?.message,z,v,b]),r.useEffect(()=>{S?.strapiErrors&&z({message:S.strapiErrors.message||"Error uploading files",severity:"error"})},[S?.strapiErrors,z]),e.jsx(p,{sx:[...Array.isArray(E)?E:[E]],children:e.jsx("form",{action:A,children:e.jsxs(d,{container:!0,spacing:2,children:[e.jsx(d,{size:{xs:12},children:e.jsxs(l,{spacing:2,children:[e.jsx(c,{variant:"h3",component:"h1",children:"Upload Files"}),e.jsxs(c,{variant:"body2",children:["Select ",h?"one or more files":"a file"," to upload"]})]})}),e.jsxs(d,{size:{xs:12},children:[j&&f&&y&&e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"text",name:"reference",value:j,style:{display:"none"},readOnly:!0}),e.jsx("input",{type:"text",name:"refID",value:f,style:{display:"none"},readOnly:!0}),e.jsx("input",{type:"text",name:"field",value:y,style:{display:"none"},readOnly:!0})]}),x&&e.jsx("input",{type:"text",name:"bucketName",value:x,style:{display:"none"},readOnly:!0}),null!==w?e.jsx(p,{onClick:()=>M.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px",cursor:"pointer"},children:"image/*"===g||Array.isArray(g)&&g.some(e=>e.startsWith("image/"))&&w?.every(e=>(e=>[".jpg",".jpeg",".png",".gif",".webp",".svg",".bmp"].some(r=>e.name.toLowerCase().endsWith(r)))(e))||!1?e.jsx(d,{container:!0,spacing:1,children:w.map((r,i)=>e.jsxs(d,{size:{xs:12,sm:6,md:4,lg:2},children:[e.jsx("img",{src:r.url,alt:r.name,style:{width:"100px",height:"100px",objectFit:"cover"}}),e.jsx(c,{variant:"caption",sx:{display:"block",mt:1},children:r.name})]},i))}):e.jsx(d,{container:!0,spacing:1,children:w.map((r,i)=>e.jsx(d,{size:{xs:12,sm:6,md:4,lg:2},children:e.jsx(c,{children:r.name})},i))})}):e.jsx(p,{onClick:()=>M.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px",cursor:"pointer"},children:e.jsxs(c,{children:["No file",""+(h?"s":"")," selected, click here to start uploading new files"]})}),e.jsx("input",{id:"minioInput",accept:"string"==typeof g?g:g.join(","),multiple:h,type:"file",name:"files",ref:M,onChange:e=>{const r=e.target.files;if(null===r||0===r.length)return;const i=Array.from(r).map(e=>({url:URL.createObjectURL(e),name:e.name}));C(r),k(i)},style:{display:"none"}})]}),e.jsxs(d,{size:{xs:12},children:[e.jsx(t.StrapiErrors,{error:S.strapiErrors}),e.jsx(a.ZodErrors,{error:S.zodErrors?.files})]}),e.jsx(d,{size:{xs:12},children:e.jsxs(l,{direction:"row",justifyContent:"space-between",children:[b&&e.jsx(m,{onClick:b,variant:"outlined",children:"Cancel"}),null!==q&&e.jsx(o.SubmitButton,{text:`Upload ${q.length} file${q.length>1?"s":""}`,loadingText:"Uploading...",variant:"contained"})]})})]})})})};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),a=require("@mui/material/IconButton"),n=require("@mui/material/Divider"),o=require("@mui/material/Collapse"),l=require("../../common/AmountUpdater.js"),d=require("@mui/icons-material/ArrowDropDown"),u=require("../../common/ImagePreviewTooltip.js"),s=require("../../logistics/report/ReportMakingComponent.js"),c=require("../../logistics/report/ReportsDisplay.js");exports.default=function({item:m,index:p,handleUpdateQuantity:x,image:j,revalidateCallback:h}){const{line_item_number:y,product:g,received_quantity:q,registered_quantity:v,released_quantity:b,returned_quantity:f,reports:_,reason:V,other_reason:w}=m,C=void 0!==_&&_.length>0?_.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0):0,I=void 0!==_&&_.length>0?_.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0,[N,k]=r.useState(!1);return e.jsx(t,{spacing:1,children:m&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",children:[e.jsxs(t,{spacing:1,children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",y]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",g&&g.product_number]})]}),j&&e.jsx(e.Fragment,{children:e.jsx(u.default,{image:j,label:g&&g.title})})]}),e.jsx(i,{variant:"body1",children:"Reason"}),e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(l.AmountUpdater,{currentValue:q,totalValue:f+C,minNewValue:0+v+-I,maxNewValue:f+C,color:"info",handleChange:e=>{x(e,m.documentId,"received_quantity")}}),e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(l.AmountUpdater,{currentValue:v,totalValue:f+C,minNewValue:0+b,maxNewValue:q+I,color:"info",handleChange:e=>{x(e,m.documentId,"registered_quantity")},offsetEnd:I}),e.jsx(n,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(a,{onClick:()=>k(!N),children:e.jsx(d,{})})]})}),e.jsx(o,{in:N,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:_}),e.jsx(s.default,{content:"content",quantity:0,type:"registered",minValue:-(q+I),maxValue:q,related:[{documentId:m.documentId,__type:"api::e-commerce.iro-item"}],revalidateCallback:h})]})}),e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(l.AmountUpdater,{currentValue:b||0,totalValue:f+C+I,minNewValue:0,maxNewValue:v,color:"info",handleChange:e=>{x(e,m.documentId,"released_quantity")}})]})},p)};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),o=require("@mui/material/Collapse"),l=require("../../common/AmountUpdater.js"),d=require("@mui/icons-material/ArrowDropDown"),u=require("../../common/ImagePreviewTooltip.js"),s=require("../../logistics/report/ReportMakingComponent.js"),c=require("../../logistics/report/ReportsDisplay.js");exports.default=function({item:m,index:p,handleUpdateQuantity:x,image:j,revalidateCallback:h}){const{line_item_number:y,product:g,received_quantity:v,registered_quantity:q,released_quantity:b,returned_quantity:f,reports:_,reason:w,other_reason:C}=m,I=void 0!==_&&_.length>0?_.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0):0,V=void 0!==_&&_.length>0?_.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0,[k,R]=r.useState(!1);return e.jsx(t,{spacing:1,children:m&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",children:[e.jsxs(t,{spacing:1,children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",y]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",g&&g.product_number]})]}),j&&e.jsx(e.Fragment,{children:e.jsx(u.default,{image:j,label:g&&g.title})})]}),e.jsx(i,{variant:"body1",children:"Reason"}),e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(l.AmountUpdater,{currentValue:v,totalValue:f+I,minnewvalue:0+q+-V,maxnewvalue:f+I,color:"info",handleChange:e=>{x(e,m.documentId,"received_quantity")}}),e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(l.AmountUpdater,{currentValue:q,totalValue:f+I,minnewvalue:0+b,maxnewvalue:v+V,color:"info",handleChange:e=>{x(e,m.documentId,"registered_quantity")},offsetEnd:V}),e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>R(!k),children:e.jsx(d,{})})]})}),e.jsx(o,{in:k,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:_}),e.jsx(s.default,{content:"content",quantity:0,type:"registered",minValue:-(v+V),maxValue:v,related:[{documentId:m.documentId,__type:"api::e-commerce.iro-item"}],revalidateCallback:h})]})}),e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(l.AmountUpdater,{currentValue:b||0,totalValue:f+I+V,minnewvalue:0,maxnewvalue:q,color:"info",handleChange:e=>{x(e,m.documentId,"released_quantity")}})]})},p)};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../../context/common/SnackbarContext.js"),i=require("../../../data/actions/e-commerce/iro/requestRmaAction.js"),s=require("../../StrapiErrors.js"),a=require("../../SubmitButton.js"),n=require("@mui/material/Typography"),o=require("@mui/material/Grid"),u=require("@mui/material/Box"),l=require("@mui/material/TextField"),d=require("@mui/material/Checkbox"),c=require("@mui/material/Button"),m=require("@mui/material/Alert"),h=require("@mui/material/Stack"),x=require("@mui/material"),g=require("@mui/material/Dialog"),j=require("@mui/material/DialogActions"),p=require("@mui/material/DialogContent"),y=require("@mui/material/DialogContentText"),b=require("@mui/material/DialogTitle"),v=require("../../common/NumberInput.js");require("next/headers");const f={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null},q=({items:t,itemsToReturn:i,setItemsToReturn:s,selectedItems:a,setSelectedItems:o})=>{const[u,c]=r.useState(!1),m=(e,r,t)=>{s(i.map((i,s)=>s===e?{...i,[r]:t}:i))};r.useEffect(()=>{t&&s(t.map(e=>({line_item_number:e.line_item_number||"",product:e.product?.documentId||"",ordered_quantity:e.ordered_quantity,returned_quantity:0,reason:"damaged",other_reason:""})))},[t]);const[g,j]=r.useState([]);return r.useEffect(()=>{i&&j((e=>e.map((e,r)=>({line_item_number:`${r+1}.0.0`,product:e.product,returned_quantity:e.returned_quantity,reason:e.reason,other_reason:e.other_reason||""})))(i))},[i]),e.jsx(r.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsxs(h,{spacing:2,children:[e.jsx(n,{variant:"h6",children:"Items"}),e.jsx(n,{variant:"body1",children:"from the items in the original order please select the items you'd like to return"}),e.jsx("input",{type:"hidden",name:"iro_items",value:JSON.stringify(g)}),e.jsx(h,{spacing:1,children:t.map((r,t)=>e.jsxs(e.Fragment,{children:[e.jsxs(h,{spacing:1,direction:"row",alignItems:"center",children:[e.jsx(d,{checked:a.includes(t),onChange:e=>{e.target.checked?o([...a,t]):o(a.filter(e=>e!==t))}}),e.jsxs(n,{variant:"body1",children:["Line Item Number: ",r.line_item_number]}),e.jsxs(n,{variant:"body1",children:["Part Number: ",r.product?.product_number]}),e.jsxs(n,{variant:"body1",children:["Quantity Ordered: ",r.ordered_quantity]})]}),a.includes(t)&&e.jsxs(e.Fragment,{children:[e.jsxs(h,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(v.default,{label:"Quantity to return",minNewValue:0,maxNewValue:r.ordered_quantity,setValueCallback:e=>{m(t,"returned_quantity",e)},sx:{width:"12rem"}}),e.jsx(x.Divider,{orientation:"vertical",flexItem:!0}),e.jsx(n,{variant:"body1",sx:{width:"12rem"},children:"Reason for return:"}),e.jsxs(l,{value:i[t]?.reason,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:e=>{const r=e.target.value;c("other"===r),m(t,"reason",r)},children:[e.jsx("option",{value:"damaged",children:"Damaged on arrival"}),e.jsx("option",{value:"not_as_described",children:"Not as described"}),e.jsx("option",{value:"wrong_item",children:"Wrong item"}),e.jsx("option",{value:"other",children:"Other"})]})]}),u&&e.jsx(l,{value:i[t].other_reason,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:e=>{const r=e.target.value;m(t,"other_reason",r)}})]}),e.jsx(x.Divider,{})]}))})]})})},_=({open:t,onClose:i,items:o,formState:u,submitCallback:l})=>{const[h,v]=r.useState(!0);return e.jsxs(g,{open:t,onClose:i,children:[e.jsx(b,{children:"Confirm RMA"}),e.jsxs(p,{children:[e.jsx(y,{children:"Summary of items to be returned:"}),e.jsx(x.List,{children:o.map((r,t)=>e.jsx(x.ListItem,{children:`Product with ID ${r.product} - Quantity: ${r.returned_quantity}`},t))}),e.jsx(y,{children:"Are you sure you want to request a return merchandise authorization for these items?"}),e.jsx(d,{onChange:e=>v(!e.target.checked)}),e.jsx(n,{variant:"body1",children:"I confirm that the information I have provided is accurate and truthful. I understand that providing false or misleading information about the reason for returning goods may result in additional costs being charged to me. By checking this box, I acknowledge my legal responsibility for the accuracy of my declaration."})]}),e.jsxs(j,{children:[l?e.jsx(a.SubmitButton,{text:"Yes",loadingText:"Loading...",disabled:h,onClick:l}):e.jsx(a.SubmitButton,{text:"Yes",loadingText:"Loading...",disabled:h}),e.jsx(c,{onClick:i,children:"No"}),null!==u?.strapiErrors&&e.jsx(s.StrapiErrors,{error:u?.strapiErrors}),u?.message&&e.jsx(m,{severity:"error",children:u?.message})]})]})};exports.default=function({opo:a,sx:l,revalidateCallback:d,handleClose:x}){const[g,j]=r.useActionState(i.requestRmaAction,f),{handleAddMessage:p}=t.useSnackbar(),[y,b]=r.useState(!1),[v,S]=r.useState([]),[C,I]=r.useState([]);return r.useEffect(()=>{g?.message&&(p({message:g.message,severity:g.severity||"error"}),"success"===g.severity&&(d&&d(),x&&x()))},[g?.message]),r.useEffect(()=>{g?.strapiErrors&&p({message:g.strapiErrors.message||"Error requesting RMA",severity:g.severity||"error"})},[g?.strapiErrors]),e.jsx(u,{sx:[...Array.isArray(l)?l:[l]],children:e.jsx("form",{action:j,children:e.jsxs(o,{container:!0,spacing:2,children:[e.jsx(o,{size:12,children:e.jsx(n,{variant:"h6",children:"RMA Form"})}),e.jsx("input",{type:"hidden",name:"opos",value:a.documentId}),e.jsx(o,{size:12,children:e.jsxs(h,{spacing:2,children:[e.jsx(n,{variant:"body1",children:"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."}),e.jsx(m,{severity:"warning",children:"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."})]})}),e.jsx(o,{size:12,children:a.opo_items?e.jsx(h,{spacing:1,children:a.opo_items&&e.jsx(q,{items:a.opo_items,itemsToReturn:v,setItemsToReturn:S,selectedItems:C,setSelectedItems:I},a.documentId)}):e.jsx(n,{variant:"body1",children:"No items"})}),e.jsx(_,{formState:g,open:y,items:v.filter(e=>e.returned_quantity>0),onClose:()=>b(!y),submitCallback:()=>{console.log("submit callback");const e=document.querySelector("form");j(e?new FormData(e):new FormData),b(!y)}}),e.jsxs(o,{size:12,children:[e.jsx(c,{onClick:()=>{console.log(g),b(!y)},disabled:0===C.length||0===C.reduce((e,r)=>e+v[r].returned_quantity,0),children:"Request RMA"}),null!==g?.strapiErrors&&e.jsx(s.StrapiErrors,{error:g?.strapiErrors}),g?.message&&e.jsx(m,{severity:"error",children:g?.message})]})]})})})};
7
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../../context/common/SnackbarContext.js"),i=require("../../../data/actions/e-commerce/iro/requestRmaAction.js"),s=require("../../StrapiErrors.js"),n=require("../../SubmitButton.js"),a=require("@mui/material/Typography"),o=require("@mui/material/Grid"),u=require("@mui/material/Box"),l=require("@mui/material/TextField"),d=require("@mui/material/Checkbox"),c=require("@mui/material/Button"),m=require("@mui/material/Alert"),h=require("@mui/material/Stack"),x=require("@mui/material"),g=require("@mui/material/Dialog"),j=require("@mui/material/DialogActions"),p=require("@mui/material/DialogContent"),y=require("@mui/material/DialogContentText"),v=require("@mui/material/DialogTitle"),b=require("../../common/NumberInput.js");require("react-dom"),require("next/headers");const f={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null},q=({items:t,itemsToReturn:i,setItemsToReturn:s,selectedItems:n,setSelectedItems:o})=>{const[u,c]=r.useState(!1),m=(e,r,t)=>{s(i.map((i,s)=>s===e?{...i,[r]:t}:i))};r.useEffect(()=>{t&&s(t.map(e=>({line_item_number:e.line_item_number||"",product:e.product?.documentId||"",ordered_quantity:e.ordered_quantity,returned_quantity:0,reason:"damaged",other_reason:""})))},[t]);const[g,j]=r.useState([]);return r.useEffect(()=>{i&&j((e=>e.map((e,r)=>({line_item_number:`${r+1}.0.0`,product:e.product,returned_quantity:e.returned_quantity,reason:e.reason,other_reason:e.other_reason||""})))(i))},[i]),e.jsx(r.Suspense,{fallback:e.jsx("div",{children:"Loading..."}),children:e.jsxs(h,{spacing:2,children:[e.jsx(a,{variant:"h6",children:"Items"}),e.jsx(a,{variant:"body1",children:"from the items in the original order please select the items you'd like to return"}),e.jsx("input",{type:"hidden",name:"iro_items",value:JSON.stringify(g)}),e.jsx(h,{spacing:1,children:t.map((t,s)=>e.jsxs(r.Fragment,{children:[e.jsxs(h,{spacing:1,direction:"row",alignItems:"center",children:[e.jsx(d,{checked:n.includes(s),onChange:e=>{e.target.checked?o([...n,s]):o(n.filter(e=>e!==s))}}),e.jsxs(a,{variant:"body1",children:["Line Item Number: ",t.line_item_number]}),e.jsxs(a,{variant:"body1",children:["Part Number: ",t.product?.product_number]}),e.jsxs(a,{variant:"body1",children:["Quantity Ordered: ",t.ordered_quantity]})]}),n.includes(s)&&e.jsxs(e.Fragment,{children:[e.jsxs(h,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(b.default,{label:"Quantity to return",minnewvalue:0,maxnewvalue:t.ordered_quantity,setValueCallback:e=>{m(s,"returned_quantity",e)},sx:{width:"12rem"}}),e.jsx(x.Divider,{orientation:"vertical",flexItem:!0}),e.jsx(a,{variant:"body1",sx:{width:"12rem"},children:"Reason for return:"}),e.jsxs(l,{value:i[s]?.reason,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:e=>{const r=e.target.value;c("other"===r),m(s,"reason",r)},children:[e.jsx("option",{value:"damaged",children:"Damaged on arrival"}),e.jsx("option",{value:"not_as_described",children:"Not as described"}),e.jsx("option",{value:"wrong_item",children:"Wrong item"}),e.jsx("option",{value:"other",children:"Other"})]})]}),u&&e.jsx(l,{value:i[s].other_reason,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:e=>{const r=e.target.value;m(s,"other_reason",r)}})]}),e.jsx(x.Divider,{})]},s))})]})})},_=({open:t,onClose:i,items:o,formState:u,submitCallback:l})=>{const[h,b]=r.useState(!0),[f,q]=r.useTransition();return e.jsxs(g,{open:t,onClose:i,children:[e.jsx(v,{children:"Confirm RMA"}),e.jsxs(p,{children:[e.jsx(y,{children:"Summary of items to be returned:"}),e.jsx(x.List,{children:o.map((r,t)=>e.jsx(x.ListItem,{children:`Product with ID ${r.product} - Quantity: ${r.returned_quantity}`},t))}),e.jsx(y,{children:"Are you sure you want to request a return merchandise authorization for these items?"}),e.jsx(d,{onChange:e=>b(!e.target.checked)}),e.jsx(a,{variant:"body1",children:"I confirm that the information I have provided is accurate and truthful. I understand that providing false or misleading information about the reason for returning goods may result in additional costs being charged to me. By checking this box, I acknowledge my legal responsibility for the accuracy of my declaration."})]}),e.jsxs(j,{children:[e.jsx(n.SubmitButton,{text:"Yes",loadingText:"Loading...",disabled:h,onClick:()=>{l&&q(()=>{l()})},loading:f}),e.jsx(c,{onClick:i,children:"No"}),null!==u?.strapiErrors&&e.jsx(s.StrapiErrors,{error:u?.strapiErrors}),u?.message&&e.jsx(m,{severity:"error",children:u?.message})]})]})};exports.default=function({opo:n,sx:l,revalidateCallback:d,handleClose:x}){const[g,j]=r.useActionState(i.requestRmaAction,f),{handleAddMessage:p}=t.useSnackbar(),[y,v]=r.useState(!1),[b,S]=r.useState([]),[C,I]=r.useState([]);return r.useEffect(()=>{g?.message&&(p({message:g.message,severity:g.severity||"error"}),"success"===g.severity&&(d&&d(),x&&x()))},[g?.message]),r.useEffect(()=>{g?.strapiErrors&&p({message:g.strapiErrors.message||"Error requesting RMA",severity:g.severity||"error"})},[g?.strapiErrors]),e.jsx(u,{sx:[...Array.isArray(l)?l:[l]],children:e.jsx("form",{action:j,children:e.jsxs(o,{container:!0,spacing:2,children:[e.jsx(o,{size:12,children:e.jsx(a,{variant:"h6",children:"RMA Form"})}),e.jsx("input",{type:"hidden",name:"opos",value:n.documentId}),e.jsx(o,{size:12,children:e.jsxs(h,{spacing:2,children:[e.jsx(a,{variant:"body1",children:"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."}),e.jsx(m,{severity:"warning",children:"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."})]})}),e.jsx(o,{size:12,children:n.opo_items?e.jsx(h,{spacing:1,children:n.opo_items&&e.jsx(q,{items:n.opo_items,itemsToReturn:b,setItemsToReturn:S,selectedItems:C,setSelectedItems:I},n.documentId)}):e.jsx(a,{variant:"body1",children:"No items"})}),e.jsx(_,{formState:g,open:y,items:b.filter(e=>e.returned_quantity>0),onClose:()=>v(!y),submitCallback:()=>{console.log("submit callback");const e=document.querySelector("form");j(e?new FormData(e):new FormData),v(!y)}}),e.jsxs(o,{size:12,children:[e.jsx(c,{onClick:()=>{console.log(g),v(!y)},disabled:0===C.length||0===C.reduce((e,r)=>e+b[r].returned_quantity,0),children:"Request RMA"}),null!==g?.strapiErrors&&e.jsx(s.StrapiErrors,{error:g?.strapiErrors}),g?.message&&e.jsx(m,{severity:"error",children:g?.message})]})]})})})};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),l=require("../../common/TextualAmountUpdater.js"),o=require("@mui/icons-material/ArrowDropDown"),d=require("../../common/ImagePreviewTooltip.js"),u=require("../../logistics/report/ReportsDisplay.js"),c=require("../../logistics/report/PreReportsDisplay.js"),m=require("../../logistics/report/SimpleReportFields.js"),x=require("@mui/material/Box");exports.default=function({item:p,index:j,handleAddReport:h,handleUpdateQuantity:g,image:y,handleRemoveReportAtIndex:b,showing:q}){console.log("TextualIROItemUpdater",p);const{line_item_number:f,product:v,returned_quantity:w,received_quantity:I,registered_quantity:R,released_quantity:V,reports:_,reason:C,other_reason:A}=p,[D,N]=r.useState(!1);null!=_&&_.length>0&&_.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0);const T=null!=_&&_.length>0?_.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0;null!=_&&_.length>0&&_.filter(e=>"released"===e.type).reduce((e,r)=>e+r.quantity,0);const U=p.reports?.filter(e=>"id"in e)||[],F=p.reports?.filter(e=>!1===Boolean("id"in e))||[];return e.jsx(t,{spacing:1,children:p&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",f]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",v?.product_number]}),y&&e.jsx(e.Fragment,{children:e.jsx(d.default,{image:y,label:p.product?.title})})]}),e.jsxs(i,{variant:"body1",children:["Reason: ",C,"other"===C&&void 0!==A&&`, ${A}`]}),e.jsx(a,{sx:{mb:1}}),q&&q.includes("received")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(l.TextualAmountUpdater,{label:"Received",currentValue:I,totalValue:w,minNewValue:0+R,maxNewValue:w,color:"info",handleChange:e=>{g(e,p.documentId,"received_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("registered")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(l.TextualAmountUpdater,{label:"Registered",currentValue:R,totalValue:w+T,minNewValue:0+V,maxNewValue:I+T,color:"info",handleChange:e=>{g(e,p.documentId,"registered_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("reports")&&e.jsxs(x,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>N(!D),children:e.jsx(o,{})})]})}),e.jsx(s,{in:D,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(u.default,{reports:U}),e.jsx(c.default,{itemID:p.documentId,reports:F,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:p.documentId,content:"",type:"registered",minValue:-(I-R+T),handleAddReport:h})]})})]}),q&&q.includes("released")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(l.TextualAmountUpdater,{label:"Released",currentValue:V,totalValue:w+T,minNewValue:0,maxNewValue:R,color:"info",handleChange:e=>{g(e,p.documentId,"released_quantity")}})]})]})},j)};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),l=require("../../common/TextualAmountUpdater.js"),o=require("@mui/icons-material/ArrowDropDown"),d=require("../../common/ImagePreviewTooltip.js"),u=require("../../logistics/report/ReportsDisplay.js"),c=require("../../logistics/report/PreReportsDisplay.js"),m=require("../../logistics/report/SimpleReportFields.js"),x=require("@mui/material/Box");exports.default=function({item:p,index:j,handleAddReport:h,handleUpdateQuantity:g,image:y,handleRemoveReportAtIndex:b,showing:v}){console.log("TextualIROItemUpdater",p);const{line_item_number:q,product:f,returned_quantity:w,received_quantity:I,registered_quantity:R,released_quantity:_,reports:C,reason:A,other_reason:D}=p,[T,V]=r.useState(!1);null!=C&&C.length>0&&C.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0);const U=null!=C&&C.length>0?C.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0;null!=C&&C.length>0&&C.filter(e=>"released"===e.type).reduce((e,r)=>e+r.quantity,0);const F=p.reports?.filter(e=>"id"in e)||[],P=p.reports?.filter(e=>!1===Boolean("id"in e))||[];return e.jsx(t,{spacing:1,children:p&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",q]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",f?.product_number]}),y&&e.jsx(e.Fragment,{children:e.jsx(d.default,{image:y,label:p.product?.title})})]}),e.jsxs(i,{variant:"body1",children:["Reason: ",A,"other"===A&&void 0!==D&&`, ${D}`]}),e.jsx(a,{sx:{mb:1}}),v&&v.includes("received")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(l.TextualAmountUpdater,{label:"Received",currentValue:I,totalValue:w,minnewvalue:0+R,maxnewvalue:w,color:"info",handleChange:e=>{g(e,p.documentId,"received_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),v&&v.includes("registered")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(l.TextualAmountUpdater,{label:"Registered",currentValue:R,totalValue:w+U,minnewvalue:0+_,maxnewvalue:I+U,color:"info",handleChange:e=>{g(e,p.documentId,"registered_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),v&&v.includes("reports")&&e.jsxs(x,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>V(!T),children:e.jsx(o,{})})]})}),e.jsx(s,{in:T,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(u.default,{reports:F}),e.jsx(c.default,{itemID:p.documentId,reports:P,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:p.documentId,content:"",type:"registered",minValue:-(I-R+U),handleAddReport:h})]})})]}),v&&v.includes("released")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(l.TextualAmountUpdater,{label:"Released",currentValue:_,totalValue:w+U,minnewvalue:0,maxnewvalue:R,color:"info",handleChange:e=>{g(e,p.documentId,"released_quantity")}})]})]})},j)};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material/Stack"),i=require("@mui/material/Typography"),a=require("@mui/material/IconButton"),n=require("@mui/material/Divider"),o=require("@mui/material/Collapse"),d=require("../../common/AmountUpdater.js"),u=require("@mui/icons-material/ArrowDropDown"),l=require("../../common/ImagePreviewTooltip.js"),c=require("../../logistics/report/ReportMakingComponent.js"),s=require("../../logistics/report/ReportsDisplay.js");exports.default=function({item:m,index:p,handleUpdateQuantity:h,image:x,revalidateCallback:j}){const{line_item_number:y,product:g,ordered_quantity:q,picked_quantity:f,packed_quantity:b,shipped_quantity:v,reports:k}=m,[V,_]=t.useState(!1);t.useMemo(()=>void 0!==k&&k.length>0?k.filter(e=>"picked"===e.type).reduce((e,t)=>e+t.quantity,0):0,[k]);const w=t.useMemo(()=>void 0!==k&&k.length>0?k.filter(e=>"packed"===e.type).reduce((e,t)=>e+t.quantity,0):0,[k]);return t.useMemo(()=>void 0!==k&&k.length>0?k.filter(e=>"shipped"===e.type).reduce((e,t)=>e+t.quantity,0):0,[k]),e.jsx(r,{spacing:1,children:m&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{direction:"row",justifyContent:"space-between",children:[e.jsxs(r,{spacing:1,children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",y]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",g?.product_number]})]}),x&&e.jsx(e.Fragment,{children:e.jsx(l.default,{image:x,label:g?.title})})]}),e.jsx(i,{variant:"body2",children:"Picked"}),e.jsx(d.AmountUpdater,{currentValue:f,totalValue:q+-w,minNewValue:0+b+-w,maxNewValue:q+-w,color:"info",handleChange:e=>{h(e,m.documentId,"picked_quantity")}}),e.jsx(i,{variant:"body2",children:"Packed"}),e.jsx(d.AmountUpdater,{currentValue:b,totalValue:q,minNewValue:0+v,maxNewValue:f+w,color:"info",handleChange:e=>{h(e,m.documentId,"packed_quantity")},offsetEnd:w}),e.jsx(n,{sx:{p:0},children:e.jsxs(r,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(a,{onClick:()=>_(!V),children:e.jsx(u,{})})]})}),e.jsx(o,{in:V,children:e.jsxs(r,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(s.default,{reports:k.filter(e=>"documentId"in e&&"string"==typeof e.documentId)}),e.jsx(c.default,{content:"content",quantity:0,type:"packed",minValue:-(f+w),maxValue:0,related:[{documentId:m.documentId,__type:"api::e-commerce.opo-item"}],revalidateCallback:j})]})}),e.jsx(i,{variant:"body2",children:"Shipped"}),e.jsx(d.AmountUpdater,{currentValue:v,totalValue:q,minNewValue:0,maxNewValue:b,color:"info",handleChange:e=>{h(e,m.documentId,"shipped_quantity")}})]})},p)};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),o=require("@mui/material/Collapse"),d=require("../../common/AmountUpdater.js"),u=require("@mui/icons-material/ArrowDropDown"),l=require("../../common/ImagePreviewTooltip.js"),c=require("../../logistics/report/ReportMakingComponent.js"),s=require("../../logistics/report/ReportsDisplay.js");exports.default=function({item:m,index:p,handleUpdateQuantity:h,image:x,revalidateCallback:j}){const{line_item_number:y,product:g,ordered_quantity:q,picked_quantity:v,packed_quantity:f,shipped_quantity:b,reports:k}=m,[_,w]=t.useState(!1);t.useMemo(()=>void 0!==k&&k.length>0?k.filter(e=>"picked"===e.type).reduce((e,t)=>e+t.quantity,0):0,[k]);const I=t.useMemo(()=>void 0!==k&&k.length>0?k.filter(e=>"packed"===e.type).reduce((e,t)=>e+t.quantity,0):0,[k]);return t.useMemo(()=>void 0!==k&&k.length>0?k.filter(e=>"shipped"===e.type).reduce((e,t)=>e+t.quantity,0):0,[k]),e.jsx(r,{spacing:1,children:m&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{direction:"row",justifyContent:"space-between",children:[e.jsxs(r,{spacing:1,children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",y]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",g?.product_number]})]}),x&&e.jsx(e.Fragment,{children:e.jsx(l.default,{image:x,label:g?.title})})]}),e.jsx(i,{variant:"body2",children:"Picked"}),e.jsx(d.AmountUpdater,{currentValue:v,totalValue:q+-I,minnewvalue:0+f+-I,maxnewvalue:q+-I,color:"info",handleChange:e=>{h(e,m.documentId,"picked_quantity")}}),e.jsx(i,{variant:"body2",children:"Packed"}),e.jsx(d.AmountUpdater,{currentValue:f,totalValue:q,minnewvalue:0+b,maxnewvalue:v+I,color:"info",handleChange:e=>{h(e,m.documentId,"packed_quantity")},offsetEnd:I}),e.jsx(a,{sx:{p:0},children:e.jsxs(r,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>w(!_),children:e.jsx(u,{})})]})}),e.jsx(o,{in:_,children:e.jsxs(r,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(s.default,{reports:k.filter(e=>"documentId"in e&&"string"==typeof e.documentId)}),e.jsx(c.default,{content:"content",quantity:0,type:"packed",minValue:-(v+I),maxValue:0,related:[{documentId:m.documentId,__type:"api::e-commerce.opo-item"}],revalidateCallback:j})]})}),e.jsx(i,{variant:"body2",children:"Shipped"}),e.jsx(d.AmountUpdater,{currentValue:b,totalValue:q,minnewvalue:0,maxnewvalue:f,color:"info",handleChange:e=>{h(e,m.documentId,"shipped_quantity")}})]})},p)};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),l=require("../../common/TextualAmountUpdater.js"),d=require("@mui/icons-material/ArrowDropDown"),o=require("../../common/ImagePreviewTooltip.js"),c=require("../../logistics/report/ReportsDisplay.js"),u=require("../../logistics/report/PreReportsDisplay.js"),m=require("../../logistics/report/SimpleReportFields.js"),p=require("@mui/material/Box");exports.default=function({item:x,index:h,handleAddReport:j,handleUpdateQuantity:y,image:g,handleRemoveReportAtIndex:b,showing:q}){const{line_item_number:f,product:w,ordered_quantity:I,picked_quantity:k,packed_quantity:A,shipped_quantity:v,reports:V}=x,[_,C]=r.useState(!1);Array.isArray(V)&&V.length>0&&V.filter(e=>"picked"===e.type).reduce((e,r)=>e+r.quantity,0);const R=Array.isArray(V)&&V.length>0?V.filter(e=>"packed"===e.type).reduce((e,r)=>e+r.quantity,0):0;Array.isArray(V)&&V.length>0&&V.filter(e=>"shipped"===e.type).reduce((e,r)=>e+r.quantity,0);const D=x.reports?.filter(e=>"id"in e)||[],N=x.reports?.filter(e=>!1===Boolean("id"in e))||[];return e.jsx(t,{spacing:1,children:x&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",f]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",w?.product_number]}),g&&e.jsx(e.Fragment,{children:e.jsx(o.default,{image:g,label:w?.title})})]}),e.jsx(a,{sx:{mb:1}}),q&&q.includes("picked")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Picked"}),e.jsx(l.TextualAmountUpdater,{label:"Picked",currentValue:k,totalValue:I,minNewValue:0+A,maxNewValue:I,color:"info",handleChange:e=>{y(e,x.documentId,"picked_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("packed")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Packed"}),e.jsx(l.TextualAmountUpdater,{label:"Packed",currentValue:A,totalValue:I+R,minNewValue:0+v,maxNewValue:k+R,color:"info",handleChange:e=>{y(e,x.documentId,"packed_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("reports")&&e.jsxs(p,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>C(!_),children:e.jsx(d,{})})]})}),e.jsx(s,{in:_,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:D}),e.jsx(u.default,{itemID:x.documentId,reports:N,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:x.documentId,content:"",type:"packed",minValue:-(k-A+R),handleAddReport:j})]})})]}),q&&q.includes("shipped")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Shipped"}),e.jsx(l.TextualAmountUpdater,{label:"Shipped",currentValue:v,totalValue:I+R,minNewValue:0,maxNewValue:A,color:"info",handleChange:e=>{y(e,x.documentId,"shipped_quantity")}})]})]})},h)};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),l=require("../../common/TextualAmountUpdater.js"),d=require("@mui/icons-material/ArrowDropDown"),o=require("../../common/ImagePreviewTooltip.js"),c=require("../../logistics/report/ReportsDisplay.js"),u=require("../../logistics/report/PreReportsDisplay.js"),m=require("../../logistics/report/SimpleReportFields.js"),p=require("@mui/material/Box");exports.default=function({item:x,index:h,handleAddReport:j,handleUpdateQuantity:y,image:g,handleRemoveReportAtIndex:b,showing:q}){const{line_item_number:f,product:w,ordered_quantity:v,picked_quantity:I,packed_quantity:k,shipped_quantity:A,reports:_}=x,[C,R]=r.useState(!1);Array.isArray(_)&&_.length>0&&_.filter(e=>"picked"===e.type).reduce((e,r)=>e+r.quantity,0);const D=Array.isArray(_)&&_.length>0?_.filter(e=>"packed"===e.type).reduce((e,r)=>e+r.quantity,0):0;Array.isArray(_)&&_.length>0&&_.filter(e=>"shipped"===e.type).reduce((e,r)=>e+r.quantity,0);const P=x.reports?.filter(e=>"id"in e)||[],V=x.reports?.filter(e=>!1===Boolean("id"in e))||[];return e.jsx(t,{spacing:1,children:x&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",f]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",w?.product_number]}),g&&e.jsx(e.Fragment,{children:e.jsx(o.default,{image:g,label:w?.title})})]}),e.jsx(a,{sx:{mb:1}}),q&&q.includes("picked")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Picked"}),e.jsx(l.TextualAmountUpdater,{label:"Picked",currentValue:I,totalValue:v,minnewvalue:0+k,maxnewvalue:v,color:"info",handleChange:e=>{y(e,x.documentId,"picked_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("packed")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Packed"}),e.jsx(l.TextualAmountUpdater,{label:"Packed",currentValue:k,totalValue:v+D,minnewvalue:0+A,maxnewvalue:I+D,color:"info",handleChange:e=>{y(e,x.documentId,"packed_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("reports")&&e.jsxs(p,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>R(!C),children:e.jsx(d,{})})]})}),e.jsx(s,{in:C,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:P}),e.jsx(u.default,{itemID:x.documentId,reports:V,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:x.documentId,content:"",type:"packed",minValue:-(I-k+D),handleAddReport:j})]})})]}),q&&q.includes("shipped")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Shipped"}),e.jsx(l.TextualAmountUpdater,{label:"Shipped",currentValue:A,totalValue:v+D,minnewvalue:0,maxnewvalue:k,color:"info",handleChange:e=>{y(e,x.documentId,"shipped_quantity")}})]})]})},h)};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),a=require("@mui/material/IconButton"),n=require("@mui/material/Divider"),o=require("@mui/material/Collapse"),d=require("../../common/AmountUpdater.js"),l=require("@mui/icons-material/ArrowDropDown"),u=require("../../common/ImagePreviewTooltip.js"),s=require("../report/ReportMakingComponent.js"),c=require("../report/ReportsDisplay.js");exports.default=function({item:m,index:p,handleUpdateQuantity:x,image:j,revalidateCallback:h}){const{line_item_number:y,product:g,received_quantity:q,registered_quantity:v,released_quantity:b,ordered_quantity:f,reports:V}=m,_=void 0!==V&&V.length>0?V.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0):0,w=void 0!==V&&V.length>0?V.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0,[C,I]=r.useState(!1);return e.jsx(t,{spacing:1,children:m&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",children:[e.jsxs(t,{spacing:1,children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",y]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",g.product_number]})]}),j&&e.jsx(e.Fragment,{children:e.jsx(u.default,{image:j,label:m.product.title})})]}),e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(d.AmountUpdater,{currentValue:q,totalValue:f+_,minNewValue:0+v+-w,maxNewValue:f+_,color:"info",handleChange:e=>{x(e,m.documentId,"received_quantity")}}),e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(d.AmountUpdater,{currentValue:v,totalValue:f+_,minNewValue:0+b,maxNewValue:q+w,color:"info",handleChange:e=>{x(e,m.documentId,"registered_quantity")},offsetEnd:w}),e.jsx(n,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(a,{onClick:()=>I(!C),children:e.jsx(l,{})})]})}),e.jsx(o,{in:C,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:V}),e.jsx(s.default,{content:"content",quantity:0,type:"registered",minValue:-(q+w),maxValue:q,related:[{documentId:m.documentId,__type:"api::logistics.ipo-item"}],revalidateCallback:h})]})}),e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(d.AmountUpdater,{currentValue:b||0,totalValue:f+_+w,minNewValue:0,maxNewValue:v,color:"info",handleChange:e=>{x(e,m.documentId,"released_quantity")}})]})},p)};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),a=require("@mui/material/IconButton"),n=require("@mui/material/Divider"),o=require("@mui/material/Collapse"),d=require("../../common/AmountUpdater.js"),l=require("@mui/icons-material/ArrowDropDown"),u=require("../../common/ImagePreviewTooltip.js"),s=require("../report/ReportMakingComponent.js"),c=require("../report/ReportsDisplay.js");exports.default=function({item:m,index:p,handleUpdateQuantity:x,image:j,revalidateCallback:h}){const{line_item_number:y,product:g,received_quantity:v,registered_quantity:q,released_quantity:b,ordered_quantity:f,reports:_}=m,w=void 0!==_&&_.length>0?_.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0):0,C=void 0!==_&&_.length>0?_.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0,[I,V]=r.useState(!1);return e.jsx(t,{spacing:1,children:m&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",children:[e.jsxs(t,{spacing:1,children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",y]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",g.product_number]})]}),j&&e.jsx(e.Fragment,{children:e.jsx(u.default,{image:j,label:m.product.title})})]}),e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(d.AmountUpdater,{currentValue:v,totalValue:f+w,minnewvalue:0+q+-C,maxnewvalue:f+w,color:"info",handleChange:e=>{x(e,m.documentId,"received_quantity")}}),e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(d.AmountUpdater,{currentValue:q,totalValue:f+w,minnewvalue:0+b,maxnewvalue:v+C,color:"info",handleChange:e=>{x(e,m.documentId,"registered_quantity")},offsetEnd:C}),e.jsx(n,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(a,{onClick:()=>V(!I),children:e.jsx(l,{})})]})}),e.jsx(o,{in:I,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:_}),e.jsx(s.default,{content:"content",quantity:0,type:"registered",minValue:-(v+C),maxValue:v,related:[{documentId:m.documentId,__type:"api::logistics.ipo-item"}],revalidateCallback:h})]})}),e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(d.AmountUpdater,{currentValue:b||0,totalValue:f+w+C,minnewvalue:0,maxnewvalue:q,color:"info",handleChange:e=>{x(e,m.documentId,"released_quantity")}})]})},p)};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),d=require("../../common/TextualAmountUpdater.js"),l=require("@mui/icons-material/ArrowDropDown"),o=require("../../common/ImagePreviewTooltip.js"),u=require("../report/ReportsDisplay.js"),c=require("../report/PreReportsDisplay.js"),m=require("../report/SimpleReportFields.js"),x=require("@mui/material/Box");exports.default=function({item:p,index:j,handleAddReport:h,handleUpdateQuantity:g,image:y,handleRemoveReportAtIndex:b,showing:q}){const{line_item_number:f,product:w,ordered_quantity:I,received_quantity:v,registered_quantity:R,released_quantity:V,reports:_}=p,[C,A]=r.useState(!1);_&&_.length>0&&_.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0);const D=_&&_.length>0?_.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0;_&&_.length>0&&_.filter(e=>"released"===e.type).reduce((e,r)=>e+r.quantity,0);const N=p.reports?.filter(e=>"documentId"in e)||[],T=p.reports?.filter(e=>!("documentId"in e))||[];return e.jsx(t,{spacing:1,children:p&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(i,{variant:"body1",children:["Line Item Number: ",f]}),e.jsxs(i,{variant:"body1",children:["Part Number: ",w?.product_number]}),y&&e.jsx(e.Fragment,{children:e.jsx(o.default,{image:y,label:p.product?.title})})]}),e.jsx(a,{sx:{mb:1}}),q&&q.includes("received")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Received"}),e.jsx(d.TextualAmountUpdater,{label:"Received",currentValue:v,totalValue:I,minNewValue:0+R,maxNewValue:I,color:"info",handleChange:e=>{g(e,p.documentId,"received_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("registered")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Registered"}),e.jsx(d.TextualAmountUpdater,{label:"Registered",currentValue:R,totalValue:I+D,minNewValue:0+V,maxNewValue:v+D,color:"info",handleChange:e=>{g(e,p.documentId,"registered_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),q&&q.includes("reports")&&e.jsxs(x,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(i,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(n,{onClick:()=>A(!C),children:e.jsx(l,{})})]})}),e.jsx(s,{in:C,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(u.default,{reports:N}),e.jsx(c.default,{itemID:p.documentId,reports:T,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:p.documentId,content:"",type:"registered",minValue:-(v-R+D),handleAddReport:h})]})})]}),q&&q.includes("released")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(i,{variant:"body2",children:"Released"}),e.jsx(d.TextualAmountUpdater,{label:"Released",currentValue:V,totalValue:I+D,minNewValue:0,maxNewValue:R,color:"info",handleChange:e=>{g(e,p.documentId,"released_quantity")}})]})]})},j)};
6
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),n=require("@mui/material/Typography"),i=require("@mui/material/IconButton"),a=require("@mui/material/Divider"),s=require("@mui/material/Collapse"),d=require("../../common/TextualAmountUpdater.js"),l=require("@mui/icons-material/ArrowDropDown"),o=require("../../common/ImagePreviewTooltip.js"),u=require("../report/ReportsDisplay.js"),c=require("../report/PreReportsDisplay.js"),m=require("../report/SimpleReportFields.js"),x=require("@mui/material/Box");exports.default=function({item:p,index:j,handleAddReport:h,handleUpdateQuantity:g,image:y,handleRemoveReportAtIndex:b,showing:v}){const{line_item_number:q,product:f,ordered_quantity:w,received_quantity:I,registered_quantity:R,released_quantity:_,reports:C}=p,[A,D]=r.useState(!1);C&&C.length>0&&C.filter(e=>"received"===e.type).reduce((e,r)=>e+r.quantity,0);const V=C&&C.length>0?C.filter(e=>"registered"===e.type).reduce((e,r)=>e+r.quantity,0):0;C&&C.length>0&&C.filter(e=>"released"===e.type).reduce((e,r)=>e+r.quantity,0);const T=p.reports?.filter(e=>"documentId"in e)||[],F=p.reports?.filter(e=>!("documentId"in e))||[];return e.jsx(t,{spacing:1,children:p&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsxs(n,{variant:"body1",children:["Line Item Number: ",q]}),e.jsxs(n,{variant:"body1",children:["Part Number: ",f?.product_number]}),y&&e.jsx(e.Fragment,{children:e.jsx(o.default,{image:y,label:p.product?.title})})]}),e.jsx(a,{sx:{mb:1}}),v&&v.includes("received")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(n,{variant:"body2",children:"Received"}),e.jsx(d.TextualAmountUpdater,{label:"Received",currentValue:I,totalValue:w,minnewvalue:0+R,maxnewvalue:w,color:"info",handleChange:e=>{g(e,p.documentId,"received_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),v&&v.includes("registered")&&e.jsxs(e.Fragment,{children:[e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(n,{variant:"body2",children:"Registered"}),e.jsx(d.TextualAmountUpdater,{label:"Registered",currentValue:R,totalValue:w+V,minnewvalue:0+_,maxnewvalue:I+V,color:"info",handleChange:e=>{g(e,p.documentId,"registered_quantity")}})]}),e.jsx(a,{sx:{mb:2}})]}),v&&v.includes("reports")&&e.jsxs(x,{sx:{mb:2},children:[e.jsx(a,{sx:{p:0},children:e.jsxs(t,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(n,{variant:"body2",children:"Irregularities / Corrections"}),e.jsx(i,{onClick:()=>D(!A),children:e.jsx(l,{})})]})}),e.jsx(s,{in:A,children:e.jsxs(t,{spacing:2,children:[e.jsx(n,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(u.default,{reports:T}),e.jsx(c.default,{itemID:p.documentId,reports:F,handleRemoveReportAtIndex:b}),e.jsx(m.default,{itemID:p.documentId,content:"",type:"registered",minValue:-(I-R+V),handleAddReport:h})]})})]}),v&&v.includes("released")&&e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1},children:[e.jsx(n,{variant:"body2",children:"Released"}),e.jsx(d.TextualAmountUpdater,{label:"Released",currentValue:_,totalValue:w+V,minnewvalue:0,maxnewvalue:R,color:"info",handleChange:e=>{g(e,p.documentId,"released_quantity")}})]})]})},j)};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- "use strict";var e=require("../../../services/common/media/minio/minioUploadService.js"),o=require("../../../../lib/utils.js");exports.uploadMinioMediaAction=async function(r,l){try{const s=Object.fromEntries(l),i=s.bucketName,n=s.fileName,t=s.files,a=s.reference,c=s.refID,f=s.field;if(console.log("files:",t),console.log("files type:",typeof t),console.log("files instanceof File:",t instanceof File),console.log("fileName:",n),console.log("bucketName:",i),console.log("reference:",a),console.log("refID:",c),console.log("field:",f),!(t instanceof File))return{...r,strapiErrors:null,zodErrors:null,message:"No valid file provided"};const u=await t.arrayBuffer();console.log("arrayBuffer:",u);const d=Buffer.from(u).toString("base64");console.log("fileContent length:",d.length);({success:!0}).success,console.log("Uploading file:",n,"Size:",Math.round(d.length/1024/1024),"MB");const g=a&&c&&f?await e.minioUploadService(i,n,d,a,c,f):await e.minioUploadService(i,n,d);if(!g)return{...r,strapiErrors:null,zodErrors:null,message:"Ops! Something went wrong. Please try again."};if(g.error)return{...r,strapiErrors:g.error,zodErrors:null,message:"Failed to Upload File."};const m=o.flattenAttributes(g);return{...r,data:m,zodErrors:null,strapiErrors:null,message:"Image Uploaded"}}catch(e){return console.error("Upload action error:",e),{...r,strapiErrors:null,zodErrors:null,message:"Failed to process file upload"}}};
6
+ "use strict";var e=require("../../../services/common/media/minio/minioUploadService.js"),r=require("../../../../lib/utils.js");exports.uploadMinioMediaAction=async function(o,s){try{const l=Object.fromEntries(s),i=l.bucketName,n=s.getAll("files"),a=l.reference,t=l.refID,u=l.field,c=n.filter(e=>e instanceof File&&e.size>0&&void 0!==e.name);if(0===c.length)return{...o,strapiErrors:null,zodErrors:null,message:"No valid files provided",severity:"error"};({success:!0}).success,console.log(`Uploading ${c.length} file(s):`);const d=[],f=[];for(const o of c)try{const s=await o.arrayBuffer(),l=Buffer.from(s).toString("base64");console.log("Uploading file:",o.name,"Size:",Math.round(l.length/1024/1024),"MB");const n=a&&t&&u?await e.minioUploadService(i,o.name,l,a,t,u):await e.minioUploadService(i,o.name,l);if(!n){f.push(`Failed to upload ${o.name}`);continue}if(n.error){f.push(`Failed to upload ${o.name}: ${n.error.message||"Unknown error"}`);continue}const c=r.flattenAttributes(n);d.push({fileName:o.name,data:c})}catch(e){console.error(`Error uploading ${o.name}:`,e),f.push(`Failed to process ${o.name}`)}return 0===d.length?{...o,strapiErrors:f.length>0?{message:f.join(", ")}:null,zodErrors:null,message:"Failed to upload any files",severity:"error"}:f.length>0&&d.length>0?{...o,data:d,zodErrors:null,strapiErrors:null,message:`Uploaded ${d.length} file(s) successfully. ${f.length} file(s) failed: ${f.join(", ")}`,severity:"warning"}:{...o,data:d,zodErrors:null,strapiErrors:null,message:`Successfully uploaded ${d.length} file(s)`,severity:"success"}}catch(e){return console.error("Upload action error:",e),{...o,strapiErrors:null,zodErrors:null,message:"Failed to process file upload",severity:"error"}}};