umwd-components 0.1.742 → 0.1.744
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/cjs/src/components/auth/DenseRegisterForm.js +1 -1
- package/dist/cjs/src/components/auth/DenseSigninForm.js +1 -1
- package/dist/cjs/src/components/auth/ForgotPasswordForm.js +1 -1
- package/dist/cjs/src/components/auth/PasswordResetForm.js +1 -1
- package/dist/cjs/src/components/auth/RegisterForm.js +1 -1
- package/dist/cjs/src/components/common/media/DenseEditMediaForm.js +1 -1
- package/dist/cjs/src/components/common/media/UploadBase64MediaForm.js +1 -1
- package/dist/cjs/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/categories/AddCategoryForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/categories/EditCategoryForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/checkout/Step4.js +1 -1
- package/dist/cjs/src/components/e-commerce/customer/CustomerProfileEditForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/enduser/EnduserProfileEditForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/invoice/CreateInvoiceForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/CreateIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/ManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/RmaForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/AddProductForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditProductForm.js +1 -1
- package/dist/cjs/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/cjs/src/components/logistics/dispatcher/DispatcherProfileEditForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/AddIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/ManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/components/logistics/note/NoteTakingComponent.js +1 -1
- package/dist/cjs/src/components/logistics/report/ReportMakingComponent.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/AddVendorForm.js +1 -1
- package/dist/cjs/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/cjs/src/components/page-builder/PageBuilder.js +1 -1
- package/dist/cjs/src/components/public-information/PublicInformationForm.js +1 -1
- package/dist/cjs/src/data/loaders/e-commerce/getSingleProduct.js +1 -1
- package/dist/cjs/src/index.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/auth/DenseRegisterForm.js +2 -2
- package/dist/esm/src/components/auth/DenseSigninForm.js +2 -2
- package/dist/esm/src/components/auth/ForgotPasswordForm.js +2 -2
- package/dist/esm/src/components/auth/PasswordResetForm.js +2 -2
- package/dist/esm/src/components/auth/RegisterForm.js +2 -2
- package/dist/esm/src/components/common/media/DenseEditMediaForm.js +2 -2
- package/dist/esm/src/components/common/media/UploadBase64MediaForm.js +2 -3
- package/dist/esm/src/components/common/media/UploadMediaForm.js +4 -5
- package/dist/esm/src/components/e-commerce/categories/AddCategoryForm.js +2 -3
- package/dist/esm/src/components/e-commerce/categories/EditCategoryForm.js +2 -3
- package/dist/esm/src/components/e-commerce/checkout/Step4.js +2 -3
- package/dist/esm/src/components/e-commerce/customer/CustomerProfileEditForm.js +2 -3
- package/dist/esm/src/components/e-commerce/enduser/EnduserProfileEditForm.js +2 -3
- package/dist/esm/src/components/e-commerce/invoice/CreateInvoiceForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/CreateIROForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/ManageIROForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/RmaForm.js +2 -3
- package/dist/esm/src/components/e-commerce/iro/TextualManageIROForm.js +2 -3
- package/dist/esm/src/components/e-commerce/opo/CreateOpoForm.js +2 -3
- package/dist/esm/src/components/e-commerce/opo/ManageOpoForm.js +3 -4
- package/dist/esm/src/components/e-commerce/opo/TextualManageOpoForm.js +2 -3
- package/dist/esm/src/components/e-commerce/products/AddProductForm.js +2 -3
- package/dist/esm/src/components/e-commerce/products/EditProductForm.js +2 -3
- package/dist/esm/src/components/e-commerce/products/EditStockForm.js +3 -4
- package/dist/esm/src/components/logistics/dispatcher/DispatcherProfileEditForm.js +2 -3
- package/dist/esm/src/components/logistics/ipo/AddIPOForm.js +3 -4
- package/dist/esm/src/components/logistics/ipo/ManageIPOForm.js +2 -3
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +2 -3
- package/dist/esm/src/components/logistics/note/NoteTakingComponent.js +2 -3
- package/dist/esm/src/components/logistics/report/ReportMakingComponent.js +2 -3
- package/dist/esm/src/components/logistics/vendor/AddVendorForm.js +7 -8
- package/dist/esm/src/components/logistics/vendor/EditVendorForm.js +9 -10
- package/dist/esm/src/components/page-builder/PageBuilder.js +2 -2
- package/dist/esm/src/components/public-information/PublicInformationForm.js +8 -9
- package/dist/esm/src/data/loaders/e-commerce/getSingleProduct.js +20 -1
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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 r=require("react/jsx-runtime"),e=require("react
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),e=require("react"),a=require("../../data/actions/auth-actions.js"),s=require("@mui/material/TextField"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),o=require("../StrapiErrors.js"),l=require("../SubmitButton.js"),n=require("@mui/material/styles");const u={data:null,zodErrors:null,message:null};exports.default=function({data:d}){const{redirect_url:m="/"}=d,[p,c]=e.useActionState(a.registerUserAction,u);return n.useTheme(),r.jsxs("form",{action:c,children:[r.jsx("input",{type:"hidden",name:"redirect",value:m}),r.jsxs(t,{spacing:2,children:[r.jsx(s,{id:"username",name:"username",label:"username",variant:"outlined",error:null!=p?.zodErrors?.username,helperText:p?.zodErrors?.username}),r.jsx(s,{id:"email",name:"email",label:"email",variant:"outlined",error:null!=p?.zodErrors?.email,helperText:p?.zodErrors?.email}),r.jsx(s,{id:"password",name:"password",label:"password",type:"password",variant:"outlined",error:null!=p?.zodErrors?.password,helperText:p?.zodErrors?.password}),r.jsx(l.SubmitButton,{text:"Sign Up",loadingText:"Loading"}),r.jsx(o.StrapiErrors,{error:p?.strapiErrors}),null!=p?.message&&r.jsx(i,{sx:{pt:2},variant:"body2",color:"error",children:p.message})]})]})};
|
|
@@ -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 r=require("react/jsx-runtime"),e=require("react
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),e=require("react"),i=require("../../data/actions/auth-actions.js"),t=require("@mui/material/Stack"),s=require("@mui/material/TextField"),a=require("@mui/material/Typography"),o=require("../SubmitButton.js"),n=require("../StrapiErrors.js"),l=require("@mui/material/styles");const u={zodErrors:null,strapiErrors:null,data:null,message:null};exports.default=function({data:d}){const{redirect_url:p="/"}=d,[c,m]=e.useActionState(i.loginUserAction,u);return l.useTheme(),r.jsxs("form",{action:m,children:[r.jsx("input",{type:"hidden",name:"redirect",value:p}),r.jsxs(t,{spacing:2,children:[r.jsx(s,{id:"identifier",name:"identifier",label:"identifier",variant:"outlined",error:null!=c?.zodErrors?.identifier,helperText:c?.zodErrors?.identifier}),r.jsx(s,{id:"password",name:"password",label:"password",type:"password",variant:"outlined",error:null!=c?.zodErrors?.password,helperText:c?.zodErrors?.password}),r.jsx(o.SubmitButton,{text:"Sign In",loadingText:"Loading"}),r.jsx(n.StrapiErrors,{error:c?.strapiErrors}),null!=c?.message&&r.jsx(a,{sx:{pt:2},variant:"body2",color:"error",children:c.message})]})]})};
|
|
@@ -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 r=require("react/jsx-runtime"),e=require("react
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),e=require("react"),i=require("../../data/actions/auth-actions.js"),t=require("@mui/material/Card"),a=require("@mui/material/CardContent"),s=require("@mui/material/CardActions"),l=require("@mui/material/TextField"),n=require("@mui/material/Stack"),u=require("@mui/material/Container"),o=require("@mui/material/Typography"),m=require("../SubmitButton.js"),d=require("../StrapiErrors.js"),x=require("@mui/material/styles");const c={zodErrors:null,strapiErrors:null,data:null,message:null};exports.default=function({data:j}){const{title:h="Forgot Password",subtitle:p="Enter your email to reset your password",maxWidth:q="sm",sx:E={}}=j,[g,y]=e.useActionState(i.forgotPasswordAction,c);return x.useTheme(),r.jsx(u,{maxWidth:q||"sm",sx:{my:1,...E},children:r.jsxs("form",{action:y,children:[r.jsxs(t,{children:[r.jsxs(a,{children:[r.jsx(o,{variant:"h5",children:h}),r.jsx(o,{variant:"subtitle1",children:p}),r.jsx(n,{spacing:2,sx:{mt:2},children:r.jsx(l,{id:"email",name:"email",label:"Email",variant:"outlined",error:null!=g?.zodErrors?.email,helperText:g?.zodErrors?.email})})]}),r.jsxs(s,{children:[r.jsx(m.SubmitButton,{text:"Send Reset Email",loadingText:"Sending..."}),r.jsx(d.StrapiErrors,{error:g?.strapiErrors})]})]}),g.message&&r.jsx(o,{sx:{pt:2},variant:"body2",children:g.message})]})})};
|
|
@@ -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 r=require("react/jsx-runtime"),e=require("react
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),e=require("react"),s=require("../../data/actions/auth-actions.js"),a=require("@mui/material/Card"),t=require("@mui/material/CardContent"),i=require("@mui/material/CardActions"),o=require("@mui/material/TextField"),n=require("@mui/material/Stack"),d=require("@mui/material/Container"),u=require("@mui/material/Typography"),l=require("../SubmitButton.js"),m=require("../StrapiErrors.js"),x=require("next/navigation");const p={zodErrors:null,strapiErrors:null,data:null,message:null};exports.default=function({data:c}){const{title:j="Reset Password",subtitle:w="Enter your new password",maxWidth:h="sm",sx:q={}}=c,[C,E]=e.useActionState(s.resetPasswordAction,p),f=x.useSearchParams().get("code");return r.jsx(d,{maxWidth:h||"sm",sx:{my:1,...q},children:r.jsxs("form",{action:E,children:[r.jsxs(a,{children:[r.jsxs(t,{children:[null!==f&&r.jsx("input",{type:"hidden",name:"code",value:f}),r.jsx(u,{variant:"h5",children:j}),r.jsx(u,{variant:"subtitle1",children:w}),r.jsxs(n,{spacing:2,sx:{mt:2},children:[r.jsx(o,{id:"password",name:"password",label:"New Password",type:"password",variant:"outlined",error:null!=C?.zodErrors?.password,helperText:C?.zodErrors?.password}),r.jsx(o,{id:"passwordConfirmation",name:"passwordConfirmation",label:"Confirm New Password",type:"password",variant:"outlined",error:null!=C?.zodErrors?.passwordConfirmation,helperText:C?.zodErrors?.passwordConfirmation})]})]}),r.jsxs(i,{children:[r.jsx(l.SubmitButton,{text:"Reset Password",loadingText:"Resetting..."}),r.jsx(m.StrapiErrors,{error:C?.strapiErrors})]})]}),C.message&&r.jsx(u,{sx:{pt:2},variant:"body2",children:C.message})]})})};
|
|
@@ -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 r=require("react/jsx-runtime"),e=require("next/link"),a=require("react
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react/jsx-runtime"),e=require("next/link"),a=require("react"),i=require("../../data/actions/auth-actions.js"),t=require("@mui/material/CardHeader"),s=require("@mui/material/CardContent"),n=require("@mui/material/Card"),l=require("@mui/material/CardActions"),o=require("@mui/material/TextField"),u=require("@mui/material/Stack"),d=require("@mui/material/Container"),m=require("@mui/material/Typography"),c=require("../StrapiErrors.js"),x=require("../SubmitButton.js"),p=require("@mui/material/styles"),j=require("../../lib/utils.js");const h={data:null,zodErrors:null,message:null};exports.default=function({data:g}){const{title:b="Sign Up",subtitle:q="Enter your details to create a new account",maxWidth:y="lg",sx:E=[],glass:v=!1,signin_url:S="/signin",redirect_url:w="/"}=g,[z,C]=a.useActionState(i.registerUserAction,h),T=p.useTheme();return r.jsx(d,{maxWidth:y||"lg",sx:[{my:1},...Array.isArray(E)?E:[E]],children:r.jsxs("form",{action:C,children:[r.jsx("input",{type:"hidden",name:"redirect",value:w}),r.jsxs(n,{sx:{backdropFilter:"blur(3px)",backgroundColor:j.setOpacity(T.palette.background.paper,v?.1:1),border:v?"1px solid rgba(255, 255, 255, 0.15)":"none"},children:[r.jsx(t,{title:b,subheader:q}),r.jsx(s,{children:r.jsxs(u,{spacing:2,children:[r.jsx(o,{id:"username",name:"username",label:"username",variant:"outlined",error:null!=z?.zodErrors?.username,helperText:z?.zodErrors?.username}),r.jsx(o,{id:"email",name:"email",label:"email",variant:"outlined",error:null!=z?.zodErrors?.email,helperText:z?.zodErrors?.email}),r.jsx(o,{id:"password",name:"password",label:"password",type:"password",variant:"outlined",error:null!=z?.zodErrors?.password,helperText:z?.zodErrors?.password})]})}),r.jsxs(l,{children:[r.jsx(x.SubmitButton,{text:"Sign Up",loadingText:"Loading"}),r.jsx(c.StrapiErrors,{error:z?.strapiErrors}),null!=z?.message&&r.jsx(m,{sx:{pt:2},variant:"body2",color:"error",children:z.message})]})]}),r.jsx(m,{variant:"body2",sx:{pt:2},children:"Have an account?"}),r.jsx(e,{href:S,children:"Sing In"})]})})};
|
|
@@ -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("@mui/material/Box"),t=require("next/image"),r=require("@mui/material/Stack"),a=require("@mui/material/TextField"),n=require("@mui/material/Alert"),s=require("../../../data/actions/media/updateMediaAction.js"),l=require("react
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/Box"),t=require("next/image"),r=require("@mui/material/Stack"),a=require("@mui/material/TextField"),n=require("@mui/material/Alert"),s=require("../../../data/actions/media/updateMediaAction.js"),l=require("react"),u=require("../../SubmitButton.js"),d=require("../../StrapiErrors.js");const o={zodErrors:null,strapiErrors:null,data:null,message:null};exports.DenseEditMediaForm=({data:c})=>{const[m,x]=l.useActionState(s.updateMediaAction,o),{id:p,name:j,alternativeText:v,caption:h,url:g}=c;return e.jsxs("form",{action:x,children:[e.jsx("input",{id:"id",type:"hidden",name:"id",value:p}),e.jsxs(r,{spacing:2,sx:{width:"100%"},children:[e.jsx(i,{width:150,height:150,position:"relative",children:e.jsx(t,{src:`${process.env.NEXT_PUBLIC_STRAPI_URL}${g}`,fill:!0,sizes:"100vw",style:{objectFit:"contain"},alt:j})}),e.jsx(a,{id:"name",name:"name",label:"name",defaultValue:j,variant:"outlined"}),e.jsx(a,{id:"alternativeText",name:"alternativeText",label:"alternativeText",defaultValue:v,variant:"outlined"}),e.jsx(a,{id:"caption",name:"caption",label:"caption",defaultValue:h,variant:"outlined"}),e.jsxs(r,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{width:"100%",py:1},children:[e.jsx(u.SubmitButton,{text:"save changes",loadingText:"loading"}),e.jsx(d.StrapiErrors,{error:m?.strapiErrors}),m?.message&&e.jsx(n,{severity:"error",children:m?.message})]})]})]})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/Box"),
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Stack"),i=require("@mui/material/Typography"),n=require("@mui/material/Box"),s=require("../../../data/actions/media/uploadBase64MediaAction.js"),a=require("../../StrapiErrors.js"),l=require("../../ZodErrors.js"),o=require("@mui/material/Alert"),d=require("../../SubmitButton.js");const u={zodErrors:null,strapiErrors:null,data:null,message:null};exports.UploadBase64MediaForm=function({reference:c,refID:p,field:m,multiple:x=!0,accept:j="image/*",path:h="api/ipos",componentName:f="",componentReference:y,revalidateCallback:g}){const[b,q]=r.useState(null),[E,v]=r.useState(null),S=s.uploadBase64MediaAction.bind(null,h,p||"",f),[k,w]=r.useActionState(S,u),C=r.useRef(null);return r.useEffect(()=>{k.data&&g&&g()},[k.data]),e.jsx("form",{action:w,id:m,children:e.jsx(n,{sx:[b&&b.length>0&&{border:"2px solid red",p:1}],children:e.jsxs(t,{spacing:1,sx:{flex:1},children:[c&&e.jsx("input",{type:"text",name:"ref",value:c,style:{display:"none"},readOnly:!0}),p&&e.jsx("input",{type:"text",name:"refId",value:p,style:{display:"none"},readOnly:!0})," ",m&&e.jsx("input",{type:"text",name:"field",value:m,style:{display:"none"},readOnly:!0}),e.jsx("input",{id:"component_name",type:"hidden",name:`${f}.__component`,value:y}),null!==b?e.jsx(n,{onClick:()=>C.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"},children:void 0===j||"image/*"===j?e.jsx(t,{direction:"row",spacing:1,justifyContent:"flex-end",children:b.map((r,t)=>e.jsx("img",{src:r.url,alt:r.name,style:{width:"100px"}},t))}):e.jsx(t,{spacing:1,justifyContent:"flex-end",children:b.map((r,t)=>e.jsx(i,{children:r.name},t))})}):e.jsx(n,{onClick:()=>C.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px",cursor:"pointer"},children:e.jsxs(i,{children:["No file",""+(x?"s":"")," selected for upload"]})}),e.jsxs(t,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between",children:[e.jsx(a.StrapiErrors,{error:k.strapiErrors}),e.jsx(l.ZodErrors,{error:k.zodErrors?.image}),k?.message&&e.jsx(o,{severity:"error",children:k?.message}),e.jsxs(n,{children:[e.jsx("label",{htmlFor:"pictureInput",children:e.jsx("input",{id:"pictureInput",accept:j,multiple:x,type:"file",name:"files",ref:C,onChange:e=>{const r=e.target.files;if(null===r)return;const t=Object.keys(r).map((e,t)=>({url:URL.createObjectURL(r[t]),name:r[t].name}));v(r),q(t)},style:{display:"none"}})}),null!==E&&e.jsx(d.SubmitButton,{text:"upload",loadingText:"loading"})]})]})]})})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("../../../data/actions/media/uploadMediaAction.js"),t=require("../../StrapiErrors.js"),s=require("../../ZodErrors.js"),l=require("../../SubmitButton.js"),n=require("@mui/material/Stack"),a=require("@mui/material/Typography"),u=require("@mui/material/Box"),c=require("@mui/material/Grid"),d=require("@mui/material/Alert");const o={zodErrors:null,strapiErrors:null,data:null,message:null};exports.UploadMediaForm=function({reference:p,refID:m,field:x,multiple:j=!0,accept:h="image/*",revalidateCallback:y}){const[f,g]=r.useState(null),[q,b]=r.useState(null),[E,k]=r.useActionState(i.uploadMediaAction,o),S=r.useRef(null);return r.useEffect(()=>{E.data&&y?.()},[E.data]),e.jsx("form",{action:k,children:e.jsxs(n,{spacing:1,sx:{flex:1},children:[p&&e.jsx("input",{type:"text",name:"ref",value:p,style:{display:"none"},readOnly:!0}),m&&e.jsx("input",{type:"text",name:"refId",value:m,style:{display:"none"},readOnly:!0}),x&&e.jsx("input",{type:"text",name:"field",value:x,style:{display:"none"},readOnly:!0}),null!==f?e.jsx(u,{onClick:()=>S.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"},children:void 0===h||"image/*"===h?e.jsx(c,{container:!0,children:f.map((r,i)=>e.jsx(c,{size:{xs:12,sm:6,md:4,lg:2},children:e.jsx("img",{src:r.url,alt:r.name,style:{width:"100px"}},i)},i))}):e.jsx(c,{container:!0,children:f.map((r,i)=>e.jsx(c,{size:{xs:12,sm:6,md:4,lg:2},children:e.jsx(a,{children:r.name})},i))})}):e.jsx(u,{onClick:()=>S.current?.click(),sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px",cursor:"pointer"},children:e.jsxs(a,{children:["No file",""+(j?"s":"")," selected, click here to start uploading new files"]})}),e.jsxs(n,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between",children:[e.jsx(t.StrapiErrors,{error:E.strapiErrors}),e.jsx(s.ZodErrors,{error:E.zodErrors?.image}),E?.message&&e.jsx(d,{severity:"error",children:E?.message}),e.jsxs(u,{children:[e.jsx("label",{htmlFor:"pictureInput",children:e.jsx("input",{id:"pictureInput",accept:h,multiple:j,type:"file",name:"files",ref:S,onChange:e=>{const r=e.target.files;if(null===r)return;const i=Object.keys(r).map((e,i)=>({url:URL.createObjectURL(r[i]),name:r[i].name}));b(r),g(i)},style:{display:"none"}})}),null!==q&&e.jsx(l.SubmitButton,{text:"upload",loadingText:"loading"})]})]})]})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Box"),a=require("@mui/material/Stack"),i=require("@mui/material/TextField"),s=require("@mui/material/Typography"),n=require("@mui/material"),o=require("../../SubmitButton.js"),c=require("
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Box"),a=require("@mui/material/Stack"),i=require("@mui/material/TextField"),s=require("@mui/material/Typography"),n=require("@mui/material"),o=require("../../SubmitButton.js"),c=require("../../../data/actions/e-commerce/categories/createCategoryAction.js"),l=require("@mui/material/Grid"),u=require("../products/ProductSelector.js"),d=require("../../common/markdown/MarkdownEditor.js"),m=require("../../../context/common/SnackbarContext.js");const x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.AddCategoryForm=function({productNamesArray:g,revalidateCallback:j,sx:y,handleClose:h}){const[p,q]=r.useActionState(c.createCategoryAction,x),{handleAddMessage:v}=m.useSnackbar();return r.useEffect(()=>{p?.message&&(v({message:p.message||"Error creating category",severity:p.severity||"error"}),"success"===p.severity&&(j&&j(),h&&h()))},[p?.message]),r.useEffect(()=>{p?.strapiErrors&&v({message:p.strapiErrors.message||"Error creating category",severity:p.severity||"error"})},[p?.strapiErrors]),e.jsx(t,{sx:[...Array.isArray(y)?y:[y]],children:e.jsx("form",{action:q,children:e.jsxs(l,{container:!0,spacing:2,children:[e.jsx(l,{size:12,children:e.jsxs(a,{spacing:2,children:[e.jsx(s,{variant:"h3",component:"h1",children:"Add Category"}),e.jsx(s,{variant:"body2",children:"Create a new category for your products. You can add products to this category later."})]})}),e.jsx(l,{size:12,children:e.jsxs(a,{spacing:2,children:[e.jsx(i,{id:"title",name:"title",label:"Title"}),e.jsx(d.default,{name:"description",label:"Description"})]})}),e.jsxs(l,{size:12,children:[e.jsx(s,{variant:"h6",children:"Products"}),e.jsx(u.default,{productNames:g,currentValue:[]})]}),e.jsx(l,{size:12,children:e.jsxs(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[h&&e.jsx(n.Button,{onClick:h,variant:"outlined",children:"Cancel"}),e.jsx(o.SubmitButton,{text:"Create category",loadingText:"Loading...",variant:"contained"})]})})]})})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Box"),t=require("@mui/material/Stack"),a=require("@mui/material/TextField"),i=require("@mui/material/Typography"),s=require("../../SubmitButton.js"),n=require("react
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Box"),t=require("@mui/material/Stack"),a=require("@mui/material/TextField"),i=require("@mui/material/Typography"),s=require("../../SubmitButton.js"),n=require("react"),o=require("../../../data/actions/e-commerce/categories/updateCategoryAction.js"),c=require("@mui/material/Grid"),u=require("../products/ProductSelector.js"),d=require("../../common/markdown/MarkdownEditor.js"),l=require("../../../context/common/SnackbarContext.js"),m=require("@mui/material");const x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.EditCategoryForm=function({data:p,revalidateCallback:g,handleClose:j,productNamesArray:h,sx:y}){const{documentId:v,title:q,description:f,slug:E,is_archive:b,products:C}=p,k=C?.data||[],[A,S]=n.useActionState(o.updateCategoryAction.bind(null,v),x),{handleAddMessage:z}=l.useSnackbar();return n.useEffect(()=>{A?.message&&(z({message:A.message,severity:A.severity||"error"}),"success"===A.severity&&(g&&g(),j&&j()))},[A?.message]),n.useEffect(()=>{A?.strapiErrors&&z({message:A.strapiErrors.message||"Error updating category",severity:A.severity||"error"})},[A?.strapiErrors]),e.jsx(r,{sx:[...Array.isArray(y)?y:[y]],children:e.jsx("form",{action:S,children:e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{size:12,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{variant:"h3",component:"h1",children:"Edit Category"}),e.jsx(i,{variant:"body2",children:"Edit the category for your products. You can add products to this category later."})]})}),e.jsx(c,{size:12,children:e.jsxs(t,{spacing:2,children:[e.jsx(a,{id:"title",name:"title",label:"Title",defaultValue:q}),e.jsx(d.default,{name:"description",label:"Description",defaultValue:f})]})}),e.jsxs(c,{size:12,children:[e.jsx(i,{variant:"h6",children:"Products"}),e.jsx(u.default,{productNames:h,currentValue:[...k.map(e=>e.documentId)]})]}),e.jsxs(c,{size:12,children:[" ",e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[j&&e.jsx(m.Button,{onClick:j,variant:"outlined",children:"Cancel"}),e.jsx(s.SubmitButton,{text:"Update category",loadingText:"Loading...",variant:"contained"})]})]})]})})})};
|
|
@@ -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("@mui/material/Paper"),a=require("@mui/material/Stack"),i=require("@mui/material/Alert"),s=require("@mui/material/Button"),o=require("@mui/material/Typography"),n=require("../cart/hooks.js"),u=require("../cart/CartSummary.js"),c=require("
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("@mui/material/Paper"),a=require("@mui/material/Stack"),i=require("@mui/material/Alert"),s=require("@mui/material/Button"),o=require("@mui/material/Typography"),n=require("../cart/hooks.js"),u=require("../cart/CartSummary.js"),c=require("../../../data/actions/e-commerce/checkout-action.js"),l=require("../../StrapiErrors.js");exports.default=function({customer_reference:m}){const{state:d,isClient:p}=n.useClientSideCart(),[y,h]=r.useActionState(c.checkoutAction,{zodErrors:null,strapiErrors:null,data:null,message:null});return e.jsx(t,{sx:{p:2},children:e.jsxs(a,{spacing:2,children:[e.jsx(u.default,{}),e.jsx(l.StrapiErrors,{error:y?.strapiErrors}),y?.message&&e.jsx(i,{severity:"error",children:y?.message}),e.jsxs(o,{children:["Please double check all details prior to payment. ",m]}),e.jsx(o,{children:"Is this order compleet?"}),e.jsxs("form",{id:"paymentform",action:h,children:[d.items&&d.items.map((t,a)=>e.jsxs(r.Fragment,{children:[e.jsx("input",{type:"hidden",name:`opo_items[${a}].product`,value:t.documentId}),e.jsx("input",{type:"hidden",name:`opo_items[${a}].ordered_quantity`,value:t.quantity})]},a)),e.jsx("input",{type:"hidden",name:"customer_reference",value:m}),e.jsx(o,{children:"Please click 'Proceed to payment' to proceed to the secure payment page. After completing the payment, you will automatically return to our shop. For any updates on this order, you can always access the latest information in your personal details."}),e.jsx(s,{variant:"contained",form:"paymentform",type:"submit",children:"Proceed to payment"})]})]})})};
|
|
@@ -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"),s=require("@mui/material/Box"),r=require("@mui/material/Stack"),i=require("@mui/material/Grid"),
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("@mui/material/Box"),r=require("@mui/material/Stack"),i=require("@mui/material/Grid"),n=require("@mui/material/Divider"),a=require("@mui/material/TextField"),t=require("@mui/material/Typography"),d=require("@mui/material/Checkbox"),l=require("@mui/material/Button"),c=require("../../common/Address.js"),o=require("../../SubmitButton.js"),m=require("react"),u=require("../../../data/actions/profile-actions.js"),x=require("./BusinessCredentials.js"),j=require("../../../context/auth/SessionContext.js"),h=require("../../../context/common/SnackbarContext.js");const p={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.default=function({data:f,sx:g,revalidateCallback:v,handleClose:b}){const{documentId:y,uuid:_,customer_number:q,first_name:C,last_name:S,email:A,phone:E,company_address:k,delivery_address:z,billing_address:B,business_credentials:F}=f,N=u.updateCustomerProfileAction.bind(null,y),[P,w]=m.useActionState(N,p),[I,R]=m.useState(null!=z),[V,D]=m.useState(null!=B),{refreshSession:T}=j.useSession(),{handleAddMessage:U}=h.useSnackbar();return m.useEffect(()=>{P?.message&&(U({message:P.message,severity:P.severity||"error"}),"success"===P.severity&&(T(),v&&v(),b&&b()))},[P?.message]),m.useEffect(()=>{P?.strapiErrors&&U({message:P.strapiErrors.message||"Error updating profile",severity:P.severity||"error"})},[P?.strapiErrors]),e.jsx(s,{sx:[...Array.isArray(g)?g:[g]],children:e.jsx("form",{action:w,children:e.jsxs(i,{container:!0,spacing:2,children:[e.jsx(i,{size:12,children:e.jsxs(r,{spacing:2,children:[e.jsx(t,{variant:"h3",component:"h1",children:"Edit Profile"}),e.jsx(t,{variant:"body2",children:"Update your personal and business information"})]})}),e.jsxs(i,{size:12,children:[e.jsx(t,{variant:"h6",children:"Personal Details"}),e.jsx(n,{}),e.jsxs(r,{spacing:2,sx:{mt:2},children:[e.jsx(a,{id:"first_name",name:"first_name",label:"First Name",defaultValue:C}),e.jsx(a,{id:"last_name",name:"last_name",label:"Last Name",defaultValue:S}),e.jsx(a,{id:"email",name:"email",label:"Email",defaultValue:A,disabled:!0}),e.jsx(a,{id:"phone",name:"phone",label:"Phone",defaultValue:E})]})]}),e.jsxs(i,{size:12,children:[e.jsx(t,{variant:"h6",children:"Business Credentials"}),e.jsx(n,{}),e.jsx(s,{sx:{mt:2},children:e.jsx(x.BusinessCredentialsFields,{componentName:"business_credentials",componentReference:"business.credentials",data:F})})]}),e.jsxs(i,{size:12,children:[e.jsx(t,{variant:"h6",children:"Company Address"}),e.jsx(n,{}),e.jsx(s,{sx:{mt:2},children:e.jsx(c.AddressFields,{componentName:"company_address",componentReference:"common.address",data:k})})]}),e.jsxs(i,{size:12,children:[e.jsx(t,{variant:"h6",children:"Delivery Address"}),e.jsx(n,{}),e.jsxs(r,{spacing:2,sx:{mt:2},children:[e.jsxs(r,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(d,{value:I,checked:I,onChange:()=>R(!I)}),e.jsx(t,{children:"Use a different address for delivery"})]}),I&&e.jsx(c.AddressFields,{componentName:"delivery_address",componentReference:"common.address",data:z})]})]}),e.jsxs(i,{size:12,children:[e.jsx(t,{variant:"h6",children:"Billing Address"}),e.jsx(n,{}),e.jsxs(r,{spacing:2,sx:{mt:2},children:[e.jsxs(r,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(d,{value:V,checked:V,onChange:()=>D(!V)}),e.jsx(t,{children:"Use a different address for billing"})]}),V&&e.jsx(c.AddressFields,{componentName:"billing_address",componentReference:"common.address",data:B})]})]}),e.jsx(i,{size:12,children:e.jsxs(r,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[b&&e.jsx(l,{onClick:b,variant:"outlined",children:"Cancel"}),e.jsx(o.SubmitButton,{text:"Save changes",loadingText:"Saving...",variant:"contained"})]})})]})})})};
|
|
@@ -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("@mui/material/Box"),i=require("@mui/material/Stack"),s=require("@mui/material/Grid"),
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/Box"),i=require("@mui/material/Stack"),s=require("@mui/material/Grid"),n=require("@mui/material/TextField"),a=require("@mui/material/Typography"),t=require("@mui/material/Button"),l=require("../../SubmitButton.js"),o=require("react"),c=require("../../../data/actions/e-commerce/enduser/profile-actions.js"),u=require("../../../context/auth/SessionContext.js"),m=require("../../../context/common/SnackbarContext.js"),d=require("@mui/icons-material/Email"),x=require("@mui/icons-material/Phone"),h=require("@mui/icons-material/Person");const j={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.default=function({data:p,sx:g,revalidateCallback:f,handleClose:q}){const{documentId:v,first_name:y,last_name:E,email:b,phone:S}=p,C=c.updateEnduserProfileAction.bind(null,v),[P,I]=o.useActionState(C,j),{handleAddMessage:k}=m.useSnackbar(),{refreshSession:w}=u.useSession();return o.useEffect(()=>{P?.message&&(k({message:P.message,severity:P.severity||"error"}),"success"===P.severity&&(w(),f&&f(),q&&q()))},[P?.message]),o.useEffect(()=>{P?.strapiErrors&&k({message:P.strapiErrors.message||"Error performing action",severity:"error"})},[P?.strapiErrors]),e.jsx(r,{sx:[...Array.isArray(g)?g:[g]],children:e.jsx("form",{action:I,children:e.jsxs(s,{container:!0,spacing:2,children:[e.jsx(s,{size:12,children:e.jsxs(i,{spacing:2,children:[e.jsx(a,{variant:"h3",component:"h1",children:"Edit Profile"}),e.jsx(a,{variant:"body1",children:"Update your profile information"})]})}),e.jsx(s,{size:12,children:e.jsxs(i,{spacing:2,children:[e.jsx(a,{variant:"h6",children:"Personal Information"}),e.jsxs(i,{direction:"row",alignItems:"center",children:[e.jsx(h,{}),e.jsx(a,{children:`${y} ${E}`})]}),e.jsxs(i,{direction:"row",alignItems:"center",children:[e.jsx(d,{}),e.jsx(n,{id:"email",name:"email",label:"Email",type:"email",defaultValue:b})]}),e.jsxs(i,{direction:"row",alignItems:"center",children:[e.jsx(x,{}),e.jsx(n,{id:"phone",name:"phone",label:"Phone",type:"tel",defaultValue:S})]})]})}),e.jsx(s,{size:12,children:e.jsxs(i,{direction:"row",justifyContent:"space-between",spacing:2,alignItems:"center",sx:{mt:2},children:[q&&e.jsx(t,{onClick:q,variant:"outlined",children:"Cancel"}),e.jsx(l.SubmitButton,{text:"Save Changes",loadingText:"Saving...",variant:"contained"})]})})]})})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),s=require("@mui/material/Box"),a=require("@mui/material/Stack"),n=require("@mui/material/Button"),i=require("@mui/material/TextField"),t=require("@mui/material/Typography"),l=require("../../SubmitButton.js"),d=require("
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),s=require("@mui/material/Box"),a=require("@mui/material/Stack"),n=require("@mui/material/Button"),i=require("@mui/material/TextField"),t=require("@mui/material/Typography"),l=require("../../SubmitButton.js"),d=require("../../../data/actions/e-commerce/invoices/createInvoiceAction.js"),c=require("@mui/material/Grid"),o=require("../../common/Address.js"),u=require("@mui/material/Divider"),m=require("../customer/BusinessCredentials.js"),_=require("../customer/CustomerSelector.js"),v=require("../../../data/loaders/e-commerce/getSingleCustomer.js"),x=require("@mui/material/Checkbox"),h=require("./InvoiceItemFields.js"),b=require("./InvoicePDF.js"),j=require("../../../data/loaders/public-information/getPublicInformation.js"),g=require("../../common/markdown/MarkdownEditor.js"),p=require("../../../context/common/SnackbarContext.js");const y={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.CreateInvoiceForm=function({customerLabels:C,revalidateCallback:f,handleClose:q,sx:k}){const[I,A]=r.useActionState(d.createInvoiceAction,y),{handleAddMessage:F}=p.useSnackbar(),[S,w]=r.useState(!1),[E,N]=r.useState(!1),[B,z]=r.useState(null),[R,P]=r.useState(null);return r.useEffect(()=>{I?.message&&(F({message:I.message,severity:I.severity||"error"}),"success"===I.severity&&(f&&f(),q&&q()))},[I?.message]),r.useEffect(()=>{I?.strapiErrors&&F({message:I.strapiErrors.message||"Error creating invoice",severity:I.severity||"error"})},[I?.strapiErrors]),r.useEffect(()=>{!async function(){const e=await j.getPublicInformation();P(r=>({...r,seller_phone:e?.phone,seller_email:e?.email,seller_company_address:e?.address,seller_business_credentials:e?.business_credentials}))}()},[]),e.jsx(s,{sx:[...Array.isArray(k)?k:[k]],children:e.jsx("form",{action:A,children:e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{size:12,children:e.jsxs(a,{spacing:2,children:[e.jsx(t,{variant:"h3",component:"h1",children:"Create Invoice"}),e.jsx(t,{variant:"body2",children:"Create a new invoice by selecting a customer or filling in the details manually"})]})}),e.jsxs(c,{size:12,children:[e.jsx(t,{variant:"h6",children:"Choose a user"}),e.jsx(_.CustomerSelector,{customerLabels:C,onChangeCallback:async e=>{if(0===e.length)return void z(null);const r=await v.getSingleCustomer(e[0]);z(r)}}),e.jsx(t,{variant:"h6",children:"Set user details manually"}),e.jsxs(a,{spacing:2,direction:"row",children:[e.jsx(i,{name:"buyer_first_name",label:"First Name",value:B?.first_name||R?.buyer_first_name||"",onChange:e=>{P(r=>({...r,buyer_first_name:e.target.value}))},disabled:null!==B}),e.jsx(i,{name:"buyer_last_name",label:"Last Name",value:B?.last_name||R?.buyer_last_name||"",onChange:e=>{P(r=>({...r,buyer_last_name:e.target.value}))},disabled:null!==B})]}),e.jsx(t,{variant:"body2"}),e.jsx(t,{variant:"h6",children:"Company Address"}),e.jsx(u,{}),e.jsx(o.AddressFields,{data:B?.company_address,componentName:"buyer_company_address",componentReference:"common.address",onChangeCallback:e=>{P(r=>({...r,buyer_company_address:e}))},disabled:null!==B}),e.jsx(t,{variant:"h6",children:"Delivery Address"}),e.jsx(u,{}),null!==B?e.jsx(e.Fragment,{children:null===B.delivery_address?e.jsx(t,{variant:"body2",children:"No delivery address on file"}):e.jsx(o.AddressFields,{data:B?.delivery_address,componentName:"buyer_delivery_address",componentReference:"common.address",onChangeCallback:e=>{P(r=>({...r,buyer_delivery_address:e}))},disabled:null!==B})}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(x,{value:E,checked:E,onChange:()=>N(!E)}),e.jsx(t,{children:"Use a different address for delivery"})]}),E&&e.jsx(o.AddressFields,{componentName:"buyer_delivery_address",componentReference:"common.address",onChangeCallback:e=>{P(r=>({...r,buyer_delivery_address:e}))}})]}),e.jsx(t,{variant:"h6",children:"Billing Address"}),e.jsx(u,{}),null!==B?e.jsx(e.Fragment,{children:null===B.billing_address?e.jsx(t,{variant:"body2",children:"No billing address on file"}):e.jsx(o.AddressFields,{data:B?.billing_address,componentName:"buyer_billing_address",componentReference:"common.address",onChangeCallback:e=>{P(r=>({...r,buyer_billing_address:e}))},disabled:null!==B})}):e.jsxs(e.Fragment,{children:[e.jsxs(a,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(x,{value:S,checked:S,onChange:()=>w(!S)}),e.jsx(t,{children:"Use a different address for billing"})]}),S&&e.jsx(o.AddressFields,{componentName:"buyer_billing_address",componentReference:"common.address",onChangeCallback:e=>{P(r=>({...r,buyer_billing_address:e}))}})]}),e.jsx(t,{variant:"h6",children:"Bussiness Credentials"}),e.jsx(u,{}),e.jsx(m.BusinessCredentialsFields,{data:B?.business_credentials,componentName:"buyer_business_credentials",componentReference:"business.credentials",onChangeCallback:e=>{P(r=>({...r,buyer_business_credentials:e}))},disabled:null!==B})]}),e.jsxs(c,{size:12,children:[e.jsx(t,{variant:"h6",children:"Invoice Items"}),e.jsx(h.InvoiceItemFields,{onChangeCallback:e=>{P(r=>r?{...r,items:e.map(e=>({...e,product:"product"in e?e.product:void 0,item_description:"item_description"in e?e.item_description:void 0,price_excl_vat:"price_excl_vat"in e?e.price_excl_vat:0,vat_rate:"vat_rate"in e?e.vat_rate:0,vat:"vat"in e?e.vat:0,price_incl_vat:"price_incl_vat"in e?e.price_incl_vat:0})),VAT_total:e.reduce((e,r)=>e+r.price_excl_vat*(r.vat_rate/100),0),total_excl_vat:e.reduce((e,r)=>e+r.price_excl_vat,0),total_incl_vat:e.reduce((e,r)=>e+r.price_excl_vat+r.price_excl_vat*(r.vat_rate/100),0)}:null)}})]}),e.jsxs(c,{size:12,children:[e.jsx(t,{variant:"h6",children:"Add a Comment"}),e.jsx(g.default,{name:"comments",label:"Comments",onChangeCallback:e=>P(r=>r?{...r,comments:e}:null)})]}),e.jsxs(c,{size:12,children:[e.jsx(t,{variant:"h6",children:"Preview the Invoice"}),null!==R&&e.jsx(b.InvoicePDFViewer,{invoice:R})]})," ",e.jsx(c,{size:12,children:e.jsxs(a,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[q&&e.jsx(n,{onClick:q,variant:"outlined",children:"Cancel"}),e.jsx(l.SubmitButton,{text:"Create Invoice",loadingText:"Creating...",variant:"contained"})]})})]})})})};
|
|
@@ -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"),s=require("
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),s=require("../../../context/common/SnackbarContext.js"),t=require("../../../data/actions/e-commerce/iro/createIroAction.js"),i=require("../../SubmitButton.js"),n=require("../customer/CustomerSelector.js"),a=require("./IROItemFields.js"),o=require("@mui/material/Typography"),c=require("@mui/material/Grid"),u=require("@mui/material/Box"),l=require("@mui/material/TextField"),d=require("@mui/material/Checkbox"),m=require("@mui/material/Stack"),h=require("@mui/material/Button");const x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.default=function({sx:j,revalidateCallback:p,handleClose:g,customerLabels:f,productLabels:y}){const[v,C]=r.useState(!1),[b,q]=r.useActionState(t.createIroAction,x),{handleAddMessage:I}=s.useSnackbar();return r.useEffect(()=>{b?.message&&(I({message:b.message,severity:b.severity||"error"}),"success"===b.severity&&(p&&p(),g&&g()))},[b?.message]),r.useEffect(()=>{b?.strapiErrors&&I({message:b.strapiErrors.message||"Error creating return order",severity:b.severity||"error"})},[b?.strapiErrors]),e.jsx(u,{sx:[...Array.isArray(j)?j:[j]],children:e.jsx("form",{action:q,children:e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{size:12,children:e.jsx(m,{spacing:2,children:e.jsx(o,{variant:"h3",component:"h1",children:"Create new return order"})})}),e.jsx(c,{size:12,children:e.jsxs(m,{spacing:2,children:[e.jsx(o,{variant:"h6",children:"Choose a customer"}),e.jsx(o,{variant:"body2",children:"Select the customer for which you want to create a return order"}),e.jsx(n.CustomerSelector,{customerLabels:f})]})}),e.jsx(c,{size:12,children:e.jsxs(m,{spacing:2,children:[e.jsx(o,{variant:"h6",children:"Customer reference"}),e.jsx(o,{children:"If the customer utilizes a custom reference for inbound order management it should be left here"}),e.jsx(l,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}})]})}),e.jsxs(c,{size:12,children:[e.jsx(o,{variant:"h6",children:"Choose products that should be in this return order"}),e.jsx(a.IROItemFields,{productsArr:y})]}),e.jsxs(c,{size:12,children:[e.jsx(o,{variant:"h6",children:"Confirm Order"}),e.jsx(o,{children:"Are you sure you want to confirm this return? Confirming this order means you are sure the customer wants to return the products and you are ready to process the return."}),e.jsxs(m,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(d,{value:v,checked:v,onChange:()=>C(!v)}),v&&e.jsx(o,{color:"primary",children:"I am sure I want to confirm this return order"})]}),e.jsx("input",{name:"status",type:"hidden",value:v?"returning":"requested"})]})," ",e.jsx(c,{size:12,children:e.jsxs(m,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[g&&e.jsx(h,{onClick:g,variant:"outlined",children:"Cancel"}),e.jsx(i.SubmitButton,{text:"Confirm",loadingText:"Loading...",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"),i=require("
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("../../../data/actions/e-commerce/iro/updateIroAction.js"),t=require("../../logistics/note/NotesDisplay.js"),s=require("../../logistics/note/NoteTakingComponent.js"),a=require("../../StrapiErrors.js"),n=require("../../SubmitButton.js"),d=require("@mui/material/Alert");require("@mui/material/Dialog"),require("@mui/material/DialogActions"),require("@mui/material/DialogContent"),require("@mui/material/DialogTitle");var o=require("@mui/material/Typography");require("@mui/material/Button");var c=require("@mui/material/Grid"),l=require("@mui/material/Box"),u=require("@mui/material/Paper"),x=require("@mui/material/Stack"),h=require("@mui/material/Divider");require("next/headers");const j={zodErrors:null,strapiErrors:null,data:null,message:null};exports.default=function({data:m,sx:p,revalidateCallback:g,handleClose:v,role:y}){const[q,b]=r.useActionState((e,r)=>i.updateIroAction(m.documentId,e,r),j),[_,w]=r.useState(m.iro_items?m.iro_items:[]),[f,S]=r.useState(!1);return e.jsx(l,{sx:[...Array.isArray(p)?p:[p]],children:e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{size:12,children:e.jsxs(x,{spacing:2,children:[e.jsxs(x,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(x,{spacing:2,children:[e.jsx(o,{variant:"h3",component:"h1",children:"Management Inbound Purchase Order"}),e.jsx(o,{variant:"body1",children:"Manage arrival, registration and recieval of purchase order"})]}),e.jsx(s.default,{content:"",related:[{id:m.documentId,__type:"api::logistics.ipo"}],revalidateCallback:g})]}),e.jsx(h,{})]})}),e.jsx(c,{size:6,children:e.jsxs(x,{spacing:1,children:[e.jsx(o,{variant:"h5",children:"Details"}),e.jsxs(x,{direction:"row",spacing:2,children:[e.jsx(o,{variant:"body1",width:"250px",children:"Purchase Order Number"}),e.jsx(o,{variant:"body2",children:m.return_number})]}),e.jsx(x,{direction:"row",spacing:2,children:e.jsx(o,{variant:"body1",width:"250px",children:"Custom reference"})}),e.jsxs(x,{direction:"row",spacing:2,children:[e.jsx(o,{variant:"body1",width:"250px",children:"Order Date"}),e.jsx(o,{variant:"body2",children:m.return_date})]}),e.jsx(x,{direction:"row",spacing:2,children:e.jsx(o,{variant:"body1",width:"250px",children:"Supplier"})}),e.jsxs(x,{direction:"row",spacing:2,children:[e.jsx(o,{variant:"body1",width:"250px",children:"Order Status"}),e.jsx(o,{variant:"body2",width:"250px",children:m.internal_status})]})]})}),e.jsx(c,{size:12,children:e.jsxs(x,{spacing:2,children:[e.jsx(o,{variant:"h5",children:"Documents"}),e.jsx(u,{sx:{p:2},children:e.jsx(x,{spacing:1,children:"enduser"===y&&e.jsx(e.Fragment,{})})})]})}),m?.notes?.length>0&&e.jsx(c,{size:12,children:e.jsxs(x,{spacing:2,children:[e.jsx(o,{variant:"h5",children:"Notes"}),e.jsx(t.default,{notes:m.notes}),e.jsx(h,{})]})}),e.jsx(c,{size:12,children:e.jsxs(x,{spacing:1,children:[e.jsx(o,{variant:"h5",children:"Items"}),e.jsx(h,{}),e.jsxs("form",{action:b,children:[m?.iro_items&&m.iro_items.map((r,i)=>(console.log("item",r),e.jsx(u,{sx:{p:2,mb:2}},i))),e.jsx(u,{sx:{p:2},children:e.jsxs(x,{direction:"row",spacing:2,justifyContent:"end",children:[e.jsx(n.SubmitButton,{text:"Update items",loadingText:"Loading..."}),e.jsx(a.StrapiErrors,{error:q?.strapiErrors}),q?.message&&e.jsx(d,{severity:"error",children:q?.message})]})}),e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({id:e.documentId,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity})))(_))})]})]})})]})})};
|
|
@@ -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("
|
|
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");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,k]=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:k})}):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})]})]})})})};
|
|
@@ -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("react-dom"),i=require("../../../data/actions/e-commerce/iro/updateIroAction.js"),n=require("./TextualIROItemUpdater.js"),s=require("./IroItemDisplay.js"),a=require("../../logistics/note/NotesDisplay.js"),l=require("../../logistics/note/NoteTakingComponent.js"),o=require("../../SubmitButton.js"),c=require("@mui/material/Alert"),d=require("@mui/material/Dialog"),u=require("@mui/material/DialogActions"),m=require("@mui/material/DialogContent"),x=require("@mui/material/DialogTitle"),h=require("@mui/material/Typography"),p=require("@mui/material/Button"),j=require("@mui/material/Grid"),v=require("@mui/material/Box"),g=require("@mui/material/Paper"),_=require("@mui/material/Stack"),y=require("@mui/material/Divider"),f=require("../../../data/services/common/confirmation-service.js"),b=require("../../../data/services/common/cancellation-service.js"),C=require("@mui/material"),q=require("@mui/icons-material/Numbers"),w=require("@mui/icons-material/AssignmentReturn"),I=require("@mui/icons-material/CalendarToday"),S=require("@mui/icons-material/Business"),k=require("@mui/icons-material/Description"),T=require("@mui/icons-material/Update"),A=require("./IroStatusIndicator.js"),F=require("../../../data/loaders/e-commerce/queryAllProducts.js"),D=require("../../../../node_modules/qs/lib/index.js"),R=require("../../../context/common/SnackbarContext.js");const P={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function W({open:t,handleClose:i,overwrites:n,setOverwrites:s,iro:a}){const[l,o]=r.useState(!1);return r.useEffect(()=>{t&&a?.iro_items?.length>0&&(async()=>{o(!0);const e=D.default.stringify({filters:{product_number:{$in:a.iro_items.map(e=>e.product?.product_number?.replace(/^r-/,"")||"")}},populate:{price:!0}},{encodeValuesOnly:!0}),r=(await F.queryAllProducts(e)).data.map(e=>({id:e.documentId,product_number:e.product_number,price:e.price}));console.log("correspondingProducts",r),o(!1);let t=0,i=0;const n=a.iro_items.map((e,n)=>{const s=e.product,a=r.find(e=>e.product_number===s?.product_number?.replace(/^r-/,"")||"");let l=0,o=0,c=0;if(a&&a.price){l=a.price.price||0,o=a.price.price_incl_vat||0,c=a.price.vat_rate||0;const r=l*e.returned_quantity,n=o*e.returned_quantity;t+=r,i+=n}return{vat_rate:c,price_excl_vat:l,price_incl_vat:o,quantity:e.returned_quantity}});s({customer_internal_reference:a.customer_reference||"",total_excl_vat:parseFloat(t.toFixed(2)),total_incl_vat:parseFloat(i.toFixed(2)),lines:n})})()},[t,a]),e.jsxs(d,{open:t,onClose:i,fullWidth:!0,maxWidth:"lg",children:[e.jsx(x,{children:"Check or overwrite value for the return payment"}),e.jsx(m,{children:e.jsxs(_,{spacing:2,alignItems:"left",sx:{px:0},children:[e.jsx(C.DialogContentText,{children:"This is very important because these values will be used for automated invoice generation"}),e.jsx(C.DialogContentText,{variant:"h5",children:"Overwrites"}),l?e.jsx(C.CircularProgress,{}):e.jsxs(_,{spacing:2,children:[e.jsx(C.TextField,{label:"Customer internal reference",name:"customer_internal_reference",fullWidth:!0,variant:"outlined",value:n.customer_internal_reference,onChange:e=>s({...n,customer_internal_reference:e.target.value})}),e.jsx(C.TextField,{label:"Total excl. VAT",name:"total_excl_vat",type:"number",fullWidth:!0,variant:"outlined",value:n.total_excl_vat,onChange:e=>s({...n,total_excl_vat:parseFloat(e.target.value)})}),e.jsx(C.TextField,{label:"Total incl. VAT",name:"total_incl_vat",type:"number",fullWidth:!0,variant:"outlined",value:n.total_incl_vat,onChange:e=>s({...n,total_incl_vat:parseFloat(e.target.value)})})]}),a?.iro_items?.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(C.DialogContentText,{variant:"h5",children:"Items"}),a.iro_items.map((r,t)=>e.jsxs(_,{spacing:2,direction:"row",alignItems:"center",sx:{px:2},children:[e.jsx(h,{sx:{minWidth:100},children:r.line_item_number}),e.jsx(h,{sx:{minWidth:150},children:r.product?.product_number}),e.jsx(h,{sx:{minWidth:200},children:r.product?.title}),e.jsx(C.TextField,{size:"small",label:"VAT %",name:"vat_rate",type:"number",sx:{width:100},value:n?.lines?.[t]?.vat_rate??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],vat_rate:parseFloat(e.target.value)},s({...n,lines:r})}}),e.jsx(C.TextField,{size:"small",label:"Price excl.",name:"price_excl_vat",type:"number",sx:{width:120},value:n?.lines?.[t]?.price_excl_vat??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],price_excl_vat:parseFloat(e.target.value)},s({...n,lines:r})}}),e.jsx(C.TextField,{size:"small",label:"Price incl.",name:"price_incl_vat",type:"number",sx:{width:120},value:n?.lines?.[t]?.price_incl_vat??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],price_incl_vat:parseFloat(e.target.value)},s({...n,lines:r})}}),e.jsx(C.TextField,{size:"small",label:"Qty",name:"quantity",type:"number",sx:{width:80},value:n?.lines?.[t]?.quantity??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],quantity:parseFloat(e.target.value)},s({...n,lines:r})}})]},r.documentId))]})]})}),e.jsxs(u,{children:[e.jsx(p,{variant:"contained",onClick:e=>{f.confirmationService("iros",[a.documentId],n),i()},children:"Confirm"}),e.jsx(p,{variant:"contained",onClick:i,children:"Cancel"})]})]})}function z({open:r,handleClose:t,orderID:i,currentStatus:n,revalidateCallback:s,openOverwritesDialog:a}){const{handleAddMessage:l}=R.useSnackbar();return e.jsxs(d,{open:r,onClose:t,children:[e.jsx(x,{children:"Confirm Return"}),e.jsx(m,{children:e.jsxs(_,{spacing:2,children:[e.jsx(h,{children:"Are you sure you want to confirm this return?"}),e.jsxs(C.List,{children:["requested"===n&&e.jsx(C.ListItem,{children:"When confirming this return order a rma number will be generated"}),e.jsx(C.ListItem,{children:"requested"===n?"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"}),"finalising_process"===n&&e.jsx(C.ListItem,{children:"Confirming this order will automatically create an invoice"})]}),e.jsxs(h,{children:["Current status: ",n]})]})}),e.jsxs(u,{children:[e.jsx(p,{variant:"contained",onClick:async()=>{if("requested"===n||"finalising_process"===n){if("finalising_process"===n)return a?(a(),void t()):void l({message:"Please provide overwrites for the invoice",severity:"error"});try{await f.confirmationService("iros",[i]),l({message:"Return order confirmed successfully",severity:"success"}),s&&s(),t()}catch(e){l({message:"Failed to confirm return order",severity:"error"})}}else l({message:"Cannot confirm return order in current status",severity:"error"})},children:"Yes"}),e.jsx(p,{variant:"contained",onClick:t,children:"No"})]})]})}function E({open:t,handleClose:i,orderID:n,revalidateCallback:s}){const[a,l]=r.useState(""),[o,c]=r.useState(""),{handleAddMessage:j}=R.useSnackbar();return e.jsx("form",{children:e.jsxs(d,{open:t,onClose:i,children:[e.jsx(x,{children:"Cancel Return"}),e.jsx(m,{children:e.jsxs(_,{spacing:2,children:[e.jsx(h,{children:"Are you sure you want to cancel this return?"}),e.jsxs(C.List,{children:[e.jsx(C.ListItem,{children:"By cancelling this return order you will update it's status from requested to cancelled"}),e.jsx(C.ListItem,{children:"Please provide a reason for the cancellation"}),e.jsx(C.ListItem,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(C.TextField,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:a,onChange:e=>l(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!o,helperText:o})]})}),e.jsxs(u,{children:[e.jsx(p,{variant:"outlined",onClick:i,children:"Close"}),e.jsx(p,{variant:"contained",color:"error",onClick:async()=>{if(a.length<5)c("Please provide a reason for the cancellation (min 5 characters)");else{c("");try{await b.cancellationService("iros",n,a),j({message:"Return order cancelled successfully",severity:"success"}),s&&s(),i()}catch(e){j({message:"Failed to cancel return order",severity:"error"})}}},children:"Confirm Cancellation"})]})]})})}exports.default=function({data:d,sx:u,revalidateCallback:m,handleClose:x,role:f}){const[b,F]=t.useFormState((e,r)=>i.updateIroAction(d.documentId,e,r),P),[D,O]=r.useState(d.iro_items?d.iro_items:[]),[M,B]=r.useState(!1),[L,N]=r.useState(!1),[U,V]=r.useState(!1),[Q,Y]=r.useState({customer_internal_reference:"",total_excl_vat:0,total_incl_vat:0,lines:[]}),[G,J]=r.useState(["received","registered","released","reports"]),$=(e,r,t)=>{const i=[...D],n=i.findIndex(e=>e.documentId===r);i[n][t]=e,O(i)},H=(e,r)=>{const t=[...D],i=t.findIndex(e=>e.documentId===r),n=[...t[i]?.reports||[],e];null==t[i]?.reports&&(t[i]={...t[i],reports:[]}),t[i].reports=n,O(t)},K=(e,r)=>{const t=[...D],i=t.findIndex(r=>r.documentId===e),n=t[i]?.reports||[],s=n.filter(e=>"id"in e),a=n.filter(e=>!("id"in e));a.splice(r,1);const l=[...s,...a];t[i].reports=l,O(t)},{handleAddMessage:X}=R.useSnackbar();return r.useEffect(()=>{b?.message&&(X({message:b.message,severity:b.severity||"error"}),"success"===b.severity&&(m&&m(),x&&x()))},[b?.message]),r.useEffect(()=>{b?.strapiErrors&&X({message:b.strapiErrors.message||"Error updating IRO",severity:b.severity||"error"})},[b?.strapiErrors]),r.useEffect(()=>{console.log("data",d),d.iro_items&&O(d.iro_items?d.iro_items:[])},[d]),e.jsx(v,{sx:[...Array.isArray(u)?u:[u]],children:e.jsxs(j,{container:!0,spacing:2,children:[e.jsx(j,{size:12,children:e.jsxs(_,{spacing:2,children:[e.jsxs(_,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(_,{spacing:2,children:[e.jsx(h,{variant:"h3",component:"h1",children:"Management Inbound Return"}),e.jsx(h,{variant:"body1",children:"Manage arrival, registration and release of returns"})]}),e.jsx(l.default,{content:"",related:[{id:d.documentId,__type:"api::e-commerce.iro"}],revalidateCallback:m})]}),e.jsx(y,{})]})}),e.jsx(j,{size:12,children:e.jsx(h,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(j,{size:6,children:e.jsx(g,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(_,{spacing:2,children:[e.jsxs(_,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(q,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Return Number"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.return_number})]}),e.jsxs(_,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(w,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"RMA Number"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.rma_number})]}),e.jsxs(_,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(k,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Customer Reference"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.customer_reference})]}),e.jsxs(_,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(I,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Return Date"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.return_date})]}),e.jsxs(_,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(S,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Customer"}),e.jsx(h,{variant:"body1",fontWeight:"medium",children:d.customer?.business_credentials?.company_name})]}),e.jsxs(_,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(T,{color:"primary"}),e.jsx(h,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Return Status"}),e.jsx(A.IroStatusIndicator,{status:d.internal_status})]})]})})}),("requested"===d.internal_status||"finalising_process"===d.internal_status)&&"enduser"===f&&e.jsx(j,{size:6,children:e.jsx(g,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(_,{spacing:2,children:[e.jsx(p,{variant:"contained",color:"primary",onClick:()=>B(!0),children:"Confirm order"}),"requested"===d.internal_status&&e.jsx(c,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be assigned an RMA number and will become available to the dispatcher. Status: requested - returning"}),"finalising_process"===d.internal_status&&e.jsx(c,{severity:"warning",children:"Please finalise this return order. Make sure the customer receives a return payment if eligible and then confirm this step. Status: finalising_process - done"}),"finalising_process"===d.internal_status&&e.jsx(p,{variant:"contained",sx:{color:"yellow"},children:"// TODO RE-PAYMENT PROCESS"}),e.jsx(p,{variant:"contained",color:"error",onClick:()=>N(!0),children:"Cancel order"}),e.jsx(z,{open:M,handleClose:()=>B(!1),orderID:d.documentId,currentStatus:d.internal_status,revalidateCallback:m,openOverwritesDialog:()=>V(!0)}),e.jsx(W,{open:U,handleClose:()=>V(!1),overwrites:Q,setOverwrites:Y,iro:d}),e.jsx(E,{open:L,handleClose:()=>N(!1),orderID:d.documentId,revalidateCallback:m})]})})}),e.jsx(j,{size:12,children:e.jsxs(_,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Documents"}),e.jsx(g,{sx:{p:2},children:e.jsx(_,{spacing:1})})]})}),d?.notes?.length>0&&e.jsx(j,{size:12,children:e.jsxs(_,{spacing:2,children:[e.jsx(h,{variant:"h5",children:"Notes"}),e.jsx(a.default,{notes:d.notes}),e.jsx(y,{})]})}),e.jsx(j,{size:12,children:e.jsxs(_,{spacing:1,children:[e.jsx(h,{variant:"h5",children:"Items"}),e.jsxs(_,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:g,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"},children:[e.jsx(h,{variant:"body2",color:"text.secondary",children:"Show:"}),["received","registered","released","reports"].map(r=>e.jsx(C.FormControlLabel,{control:e.jsx(C.Checkbox,{size:"small",checked:G.includes(r),onChange:e=>{e.target.checked?J([...G,r]):J(G.filter(e=>e!==r))}}),label:e.jsx(h,{variant:"body2",color:"text.secondary",children:r.charAt(0).toUpperCase()+r.slice(1)}),sx:{mr:0}},r))]}),"requested"===d.internal_status&&e.jsx(c,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(y,{}),e.jsxs("form",{action:F,children:[e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,returned_quantity:e.returned_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:e.reports?.map(e=>({documentId:"documentId"in e?e.documentId:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(D))}),D&&D.map((r,t)=>e.jsx(g,{sx:{p:2,mb:2},children:"requested"===d.internal_status||"cancelled"===d.internal_status||"done"===d.internal_status?e.jsx(s.default,{item:r,index:t,image:r?.product?.image}):e.jsx(n.default,{item:r,index:t,handleUpdateQuantity:$,handleAddReport:H,image:r?.product?.image,handleRemoveReportAtIndex:K,revalidateCallback:m,showing:G})},t)),e.jsxs(_,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[x&&e.jsx(p,{onClick:x,variant:"outlined",children:"Cancel"}),e.jsx(o.SubmitButton,{text:"Save changes",loadingText:"Saving...",variant:"contained"})]})]})]})})]})})};
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../../data/actions/e-commerce/iro/updateIroAction.js"),i=require("./TextualIROItemUpdater.js"),n=require("./IroItemDisplay.js"),s=require("../../logistics/note/NotesDisplay.js"),a=require("../../logistics/note/NoteTakingComponent.js"),l=require("../../SubmitButton.js"),o=require("@mui/material/Alert"),c=require("@mui/material/Dialog"),d=require("@mui/material/DialogActions"),u=require("@mui/material/DialogContent"),m=require("@mui/material/DialogTitle"),x=require("@mui/material/Typography"),h=require("@mui/material/Button"),p=require("@mui/material/Grid"),j=require("@mui/material/Box"),v=require("@mui/material/Paper"),g=require("@mui/material/Stack"),_=require("@mui/material/Divider"),y=require("../../../data/services/common/confirmation-service.js"),f=require("../../../data/services/common/cancellation-service.js"),b=require("@mui/material"),C=require("@mui/icons-material/Numbers"),q=require("@mui/icons-material/AssignmentReturn"),w=require("@mui/icons-material/CalendarToday"),I=require("@mui/icons-material/Business"),S=require("@mui/icons-material/Description"),k=require("@mui/icons-material/Update"),T=require("./IroStatusIndicator.js"),A=require("../../../data/loaders/e-commerce/queryAllProducts.js"),F=require("../../../../node_modules/qs/lib/index.js"),D=require("../../../context/common/SnackbarContext.js");const R={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function P({open:t,handleClose:i,overwrites:n,setOverwrites:s,iro:a}){const[l,o]=r.useState(!1);return r.useEffect(()=>{t&&a?.iro_items?.length>0&&(async()=>{o(!0);const e=F.default.stringify({filters:{product_number:{$in:a.iro_items.map(e=>e.product?.product_number?.replace(/^r-/,"")||"")}},populate:{price:!0}},{encodeValuesOnly:!0}),r=(await A.queryAllProducts(e)).data.map(e=>({id:e.documentId,product_number:e.product_number,price:e.price}));console.log("correspondingProducts",r),o(!1);let t=0,i=0;const n=a.iro_items.map((e,n)=>{const s=e.product,a=r.find(e=>e.product_number===s?.product_number?.replace(/^r-/,"")||"");let l=0,o=0,c=0;if(a&&a.price){l=a.price.price||0,o=a.price.price_incl_vat||0,c=a.price.vat_rate||0;const r=l*e.returned_quantity,n=o*e.returned_quantity;t+=r,i+=n}return{vat_rate:c,price_excl_vat:l,price_incl_vat:o,quantity:e.returned_quantity}});s({customer_internal_reference:a.customer_reference||"",total_excl_vat:parseFloat(t.toFixed(2)),total_incl_vat:parseFloat(i.toFixed(2)),lines:n})})()},[t,a]),e.jsxs(c,{open:t,onClose:i,fullWidth:!0,maxWidth:"lg",children:[e.jsx(m,{children:"Check or overwrite value for the return payment"}),e.jsx(u,{children:e.jsxs(g,{spacing:2,alignItems:"left",sx:{px:0},children:[e.jsx(b.DialogContentText,{children:"This is very important because these values will be used for automated invoice generation"}),e.jsx(b.DialogContentText,{variant:"h5",children:"Overwrites"}),l?e.jsx(b.CircularProgress,{}):e.jsxs(g,{spacing:2,children:[e.jsx(b.TextField,{label:"Customer internal reference",name:"customer_internal_reference",fullWidth:!0,variant:"outlined",value:n.customer_internal_reference,onChange:e=>s({...n,customer_internal_reference:e.target.value})}),e.jsx(b.TextField,{label:"Total excl. VAT",name:"total_excl_vat",type:"number",fullWidth:!0,variant:"outlined",value:n.total_excl_vat,onChange:e=>s({...n,total_excl_vat:parseFloat(e.target.value)})}),e.jsx(b.TextField,{label:"Total incl. VAT",name:"total_incl_vat",type:"number",fullWidth:!0,variant:"outlined",value:n.total_incl_vat,onChange:e=>s({...n,total_incl_vat:parseFloat(e.target.value)})})]}),a?.iro_items?.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(b.DialogContentText,{variant:"h5",children:"Items"}),a.iro_items.map((r,t)=>e.jsxs(g,{spacing:2,direction:"row",alignItems:"center",sx:{px:2},children:[e.jsx(x,{sx:{minWidth:100},children:r.line_item_number}),e.jsx(x,{sx:{minWidth:150},children:r.product?.product_number}),e.jsx(x,{sx:{minWidth:200},children:r.product?.title}),e.jsx(b.TextField,{size:"small",label:"VAT %",name:"vat_rate",type:"number",sx:{width:100},value:n?.lines?.[t]?.vat_rate??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],vat_rate:parseFloat(e.target.value)},s({...n,lines:r})}}),e.jsx(b.TextField,{size:"small",label:"Price excl.",name:"price_excl_vat",type:"number",sx:{width:120},value:n?.lines?.[t]?.price_excl_vat??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],price_excl_vat:parseFloat(e.target.value)},s({...n,lines:r})}}),e.jsx(b.TextField,{size:"small",label:"Price incl.",name:"price_incl_vat",type:"number",sx:{width:120},value:n?.lines?.[t]?.price_incl_vat??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],price_incl_vat:parseFloat(e.target.value)},s({...n,lines:r})}}),e.jsx(b.TextField,{size:"small",label:"Qty",name:"quantity",type:"number",sx:{width:80},value:n?.lines?.[t]?.quantity??"",onChange:e=>{const r=[...n.lines||[]];r[t]={...r[t],quantity:parseFloat(e.target.value)},s({...n,lines:r})}})]},r.documentId))]})]})}),e.jsxs(d,{children:[e.jsx(h,{variant:"contained",onClick:e=>{y.confirmationService("iros",[a.documentId],n),i()},children:"Confirm"}),e.jsx(h,{variant:"contained",onClick:i,children:"Cancel"})]})]})}function W({open:r,handleClose:t,orderID:i,currentStatus:n,revalidateCallback:s,openOverwritesDialog:a}){const{handleAddMessage:l}=D.useSnackbar();return e.jsxs(c,{open:r,onClose:t,children:[e.jsx(m,{children:"Confirm Return"}),e.jsx(u,{children:e.jsxs(g,{spacing:2,children:[e.jsx(x,{children:"Are you sure you want to confirm this return?"}),e.jsxs(b.List,{children:["requested"===n&&e.jsx(b.ListItem,{children:"When confirming this return order a rma number will be generated"}),e.jsx(b.ListItem,{children:"requested"===n?"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"}),"finalising_process"===n&&e.jsx(b.ListItem,{children:"Confirming this order will automatically create an invoice"})]}),e.jsxs(x,{children:["Current status: ",n]})]})}),e.jsxs(d,{children:[e.jsx(h,{variant:"contained",onClick:async()=>{if("requested"===n||"finalising_process"===n){if("finalising_process"===n)return a?(a(),void t()):void l({message:"Please provide overwrites for the invoice",severity:"error"});try{await y.confirmationService("iros",[i]),l({message:"Return order confirmed successfully",severity:"success"}),s&&s(),t()}catch(e){l({message:"Failed to confirm return order",severity:"error"})}}else l({message:"Cannot confirm return order in current status",severity:"error"})},children:"Yes"}),e.jsx(h,{variant:"contained",onClick:t,children:"No"})]})]})}function z({open:t,handleClose:i,orderID:n,revalidateCallback:s}){const[a,l]=r.useState(""),[o,p]=r.useState(""),{handleAddMessage:j}=D.useSnackbar();return e.jsx("form",{children:e.jsxs(c,{open:t,onClose:i,children:[e.jsx(m,{children:"Cancel Return"}),e.jsx(u,{children:e.jsxs(g,{spacing:2,children:[e.jsx(x,{children:"Are you sure you want to cancel this return?"}),e.jsxs(b.List,{children:[e.jsx(b.ListItem,{children:"By cancelling this return order you will update it's status from requested to cancelled"}),e.jsx(b.ListItem,{children:"Please provide a reason for the cancellation"}),e.jsx(b.ListItem,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(b.TextField,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:a,onChange:e=>l(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!o,helperText:o})]})}),e.jsxs(d,{children:[e.jsx(h,{variant:"outlined",onClick:i,children:"Close"}),e.jsx(h,{variant:"contained",color:"error",onClick:async()=>{if(a.length<5)p("Please provide a reason for the cancellation (min 5 characters)");else{p("");try{await f.cancellationService("iros",n,a),j({message:"Return order cancelled successfully",severity:"success"}),s&&s(),i()}catch(e){j({message:"Failed to cancel return order",severity:"error"})}}},children:"Confirm Cancellation"})]})]})})}exports.default=function({data:c,sx:d,revalidateCallback:u,handleClose:m,role:y}){const[f,A]=r.useActionState((e,r)=>t.updateIroAction(c.documentId,e,r),R),[F,E]=r.useState(c.iro_items?c.iro_items:[]),[O,M]=r.useState(!1),[B,L]=r.useState(!1),[N,U]=r.useState(!1),[V,Q]=r.useState({customer_internal_reference:"",total_excl_vat:0,total_incl_vat:0,lines:[]}),[Y,G]=r.useState(["received","registered","released","reports"]),J=(e,r,t)=>{const i=[...F],n=i.findIndex(e=>e.documentId===r);i[n][t]=e,E(i)},$=(e,r)=>{const t=[...F],i=t.findIndex(e=>e.documentId===r),n=[...t[i]?.reports||[],e];null==t[i]?.reports&&(t[i]={...t[i],reports:[]}),t[i].reports=n,E(t)},H=(e,r)=>{const t=[...F],i=t.findIndex(r=>r.documentId===e),n=t[i]?.reports||[],s=n.filter(e=>"id"in e),a=n.filter(e=>!("id"in e));a.splice(r,1);const l=[...s,...a];t[i].reports=l,E(t)},{handleAddMessage:K}=D.useSnackbar();return r.useEffect(()=>{f?.message&&(K({message:f.message,severity:f.severity||"error"}),"success"===f.severity&&(u&&u(),m&&m()))},[f?.message]),r.useEffect(()=>{f?.strapiErrors&&K({message:f.strapiErrors.message||"Error updating IRO",severity:f.severity||"error"})},[f?.strapiErrors]),r.useEffect(()=>{console.log("data",c),c.iro_items&&E(c.iro_items?c.iro_items:[])},[c]),e.jsx(j,{sx:[...Array.isArray(d)?d:[d]],children:e.jsxs(p,{container:!0,spacing:2,children:[e.jsx(p,{size:12,children:e.jsxs(g,{spacing:2,children:[e.jsxs(g,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(g,{spacing:2,children:[e.jsx(x,{variant:"h3",component:"h1",children:"Management Inbound Return"}),e.jsx(x,{variant:"body1",children:"Manage arrival, registration and release of returns"})]}),e.jsx(a.default,{content:"",related:[{id:c.documentId,__type:"api::e-commerce.iro"}],revalidateCallback:u})]}),e.jsx(_,{})]})}),e.jsx(p,{size:12,children:e.jsx(x,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(p,{size:6,children:e.jsx(v,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(g,{spacing:2,children:[e.jsxs(g,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(C,{color:"primary"}),e.jsx(x,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Return Number"}),e.jsx(x,{variant:"body1",fontWeight:"medium",children:c.return_number})]}),e.jsxs(g,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(q,{color:"primary"}),e.jsx(x,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"RMA Number"}),e.jsx(x,{variant:"body1",fontWeight:"medium",children:c.rma_number})]}),e.jsxs(g,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(S,{color:"primary"}),e.jsx(x,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Customer Reference"}),e.jsx(x,{variant:"body1",fontWeight:"medium",children:c.customer_reference})]}),e.jsxs(g,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(w,{color:"primary"}),e.jsx(x,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Return Date"}),e.jsx(x,{variant:"body1",fontWeight:"medium",children:c.return_date})]}),e.jsxs(g,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(I,{color:"primary"}),e.jsx(x,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Customer"}),e.jsx(x,{variant:"body1",fontWeight:"medium",children:c.customer?.business_credentials?.company_name})]}),e.jsxs(g,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(k,{color:"primary"}),e.jsx(x,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Return Status"}),e.jsx(T.IroStatusIndicator,{status:c.internal_status})]})]})})}),("requested"===c.internal_status||"finalising_process"===c.internal_status)&&"enduser"===y&&e.jsx(p,{size:6,children:e.jsx(v,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(g,{spacing:2,children:[e.jsx(h,{variant:"contained",color:"primary",onClick:()=>M(!0),children:"Confirm order"}),"requested"===c.internal_status&&e.jsx(o,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be assigned an RMA number and will become available to the dispatcher. Status: requested - returning"}),"finalising_process"===c.internal_status&&e.jsx(o,{severity:"warning",children:"Please finalise this return order. Make sure the customer receives a return payment if eligible and then confirm this step. Status: finalising_process - done"}),"finalising_process"===c.internal_status&&e.jsx(h,{variant:"contained",sx:{color:"yellow"},children:"// TODO RE-PAYMENT PROCESS"}),e.jsx(h,{variant:"contained",color:"error",onClick:()=>L(!0),children:"Cancel order"}),e.jsx(W,{open:O,handleClose:()=>M(!1),orderID:c.documentId,currentStatus:c.internal_status,revalidateCallback:u,openOverwritesDialog:()=>U(!0)}),e.jsx(P,{open:N,handleClose:()=>U(!1),overwrites:V,setOverwrites:Q,iro:c}),e.jsx(z,{open:B,handleClose:()=>L(!1),orderID:c.documentId,revalidateCallback:u})]})})}),e.jsx(p,{size:12,children:e.jsxs(g,{spacing:2,children:[e.jsx(x,{variant:"h5",children:"Documents"}),e.jsx(v,{sx:{p:2},children:e.jsx(g,{spacing:1})})]})}),c?.notes?.length>0&&e.jsx(p,{size:12,children:e.jsxs(g,{spacing:2,children:[e.jsx(x,{variant:"h5",children:"Notes"}),e.jsx(s.default,{notes:c.notes}),e.jsx(_,{})]})}),e.jsx(p,{size:12,children:e.jsxs(g,{spacing:1,children:[e.jsx(x,{variant:"h5",children:"Items"}),e.jsxs(g,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:v,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"},children:[e.jsx(x,{variant:"body2",color:"text.secondary",children:"Show:"}),["received","registered","released","reports"].map(r=>e.jsx(b.FormControlLabel,{control:e.jsx(b.Checkbox,{size:"small",checked:Y.includes(r),onChange:e=>{e.target.checked?G([...Y,r]):G(Y.filter(e=>e!==r))}}),label:e.jsx(x,{variant:"body2",color:"text.secondary",children:r.charAt(0).toUpperCase()+r.slice(1)}),sx:{mr:0}},r))]}),"requested"===c.internal_status&&e.jsx(o,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(_,{}),e.jsxs("form",{action:A,children:[e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,returned_quantity:e.returned_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:e.reports?.map(e=>({documentId:"documentId"in e?e.documentId:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(F))}),F&&F.map((r,t)=>e.jsx(v,{sx:{p:2,mb:2},children:"requested"===c.internal_status||"cancelled"===c.internal_status||"done"===c.internal_status?e.jsx(n.default,{item:r,index:t,image:r?.product?.image}):e.jsx(i.default,{item:r,index:t,handleUpdateQuantity:J,handleAddReport:$,image:r?.product?.image,handleRemoveReportAtIndex:H,revalidateCallback:u,showing:Y})},t)),e.jsxs(g,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[m&&e.jsx(h,{onClick:m,variant:"outlined",children:"Cancel"}),e.jsx(l.SubmitButton,{text:"Save changes",loadingText:"Saving...",variant:"contained"})]})]})]})})]})})};
|
|
@@ -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"),s=require("
|
|
7
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),s=require("../../../data/actions/e-commerce/opo/createOpoAction.js"),i=require("../../SubmitButton.js"),t=require("../customer/CustomerSelector.js"),n=require("./OPOItemFields.js"),a=require("../../../context/common/SnackbarContext.js"),o=require("@mui/material/Typography"),c=require("@mui/material/Grid"),l=require("@mui/material/Box"),u=require("@mui/material/TextField"),d=require("@mui/material/Checkbox"),m=require("@mui/material/Stack"),h=require("@mui/material/Button");const x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.default=function({sx:j,revalidateCallback:p,handleClose:g,customerLabels:f,productLabels:v}){const[y,C]=r.useState(!1),[b,q]=r.useActionState(s.createOpoAction,x),{handleAddMessage:w}=a.useSnackbar();return console.log(f,v),r.useEffect(()=>{b?.message&&(w({message:b.message,severity:b.severity||"error"}),"success"===b.severity&&(p&&p(),g&&g()))},[b?.message]),r.useEffect(()=>{b?.strapiErrors&&w({message:b.strapiErrors.message||"Error creating order",severity:b.severity||"error"})},[b?.strapiErrors]),e.jsx(l,{sx:[...Array.isArray(j)?j:[j]],children:e.jsx("form",{action:q,children:e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{size:12,children:e.jsx(m,{spacing:2,children:e.jsx(o,{variant:"h3",component:"h1",children:"Create new order"})})}),e.jsx(c,{size:12,children:e.jsxs(m,{spacing:2,children:[e.jsx(o,{variant:"h6",children:"Choose a customer"}),e.jsx(t.CustomerSelector,{customerLabels:f})]})}),e.jsx(c,{size:12,children:e.jsxs(m,{spacing:2,children:[e.jsx(o,{variant:"h6",children:"Customer reference"}),e.jsx(o,{children:"If the customer utilizes a custom reference for inbound order management it should be left here"}),e.jsx(u,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}})]})}),e.jsxs(c,{size:12,children:[e.jsx(o,{variant:"h6",children:"Choose products for this order"}),e.jsx(n.OPOItemFields,{productsArr:v})]}),e.jsxs(c,{size:12,children:[e.jsx(o,{variant:"h6",children:"Confirm Order"}),e.jsx(o,{children:"Are you sure you want to confirm this order? Creating a order this way will not create a shipping label nor will it invoke a payment. It does however create an invoice which you can find under invoices"}),e.jsxs(m,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(d,{value:y,checked:y,onChange:()=>C(!y)}),y&&e.jsx(o,{color:"primary",children:"I am sure I want to confirm this order"})]}),e.jsx("input",{name:"internal_status",type:"hidden",value:y?"ordered":"placed"})]}),e.jsx(c,{size:12,children:e.jsxs(m,{direction:"row",justifyContent:"space-between",children:[g&&e.jsx(h,{onClick:g,variant:"outlined",children:"Cancel"}),e.jsx(i.SubmitButton,{text:"Confirm",loadingText:"Loading...",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"),i=require("react"),r=require("
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("../../../data/actions/e-commerce/opo/updateOpoAction.js"),n=require("../../common/media/UploadBase64MediaForm.js"),t=require("../../../data/loaders/common/media/downloadBase64File.js"),a=require("./OpoItemUpdater.js"),s=require("./OpoItemDisplay.js"),o=require("../../logistics/note/NotesDisplay.js"),d=require("../../logistics/note/NoteTakingComponent.js"),c=require("../../SubmitButton.js"),l=require("@mui/material/Alert"),u=require("@mui/material/Dialog"),m=require("@mui/material/DialogActions"),p=require("@mui/material/DialogContent"),h=require("@mui/material/DialogTitle"),x=require("@mui/material/Typography"),j=require("@mui/material/Button"),y=require("@mui/material/Grid"),v=require("@mui/material/Box"),g=require("@mui/material/Paper"),f=require("@mui/material/Stack"),b=require("@mui/material/Divider"),_=require("../../../data/services/common/confirmation-service.js"),q=require("../../../context/common/SnackbarContext.js");const C={zodErrors:null,strapiErrors:null,message:null};function w({open:i,handleClose:r,orderID:n,currentStatus:t,revalidateCallback:a}){return e.jsxs(u,{open:i,children:[e.jsx(h,{children:"Confirm Order"}),e.jsx(p,{children:e.jsxs(f,{spacing:2,children:[e.jsx(x,{children:"Are you sure you want to confirm this order?"}),e.jsxs(x,{children:["Current status: ",t]})]})}),e.jsxs(m,{children:[e.jsx(j,{variant:"contained",onClick:e=>{_.confirmationService("opos",[n]),a&&a()},children:"Confirm"}),e.jsx(j,{variant:"contained",onClick:r,children:"Cancel"})]})]})}exports.default=function({opo:u,sx:m,revalidateCallback:p,handleClose:h,role:_}){const[k,D]=i.useActionState((e,i)=>r.updateOpoAction(u.documentId,e,i),C),{handleAddMessage:I}=q.useSnackbar(),[O,S]=i.useState(u.opo_items?u.opo_items:[]),[A,E]=i.useState(!1),B=(e,i,r)=>{const n=[...O],t=n.findIndex(e=>e.documentId===i);n[t][r]=e,S(n)};return i.useEffect(()=>{u.opo_items&&S(u.opo_items)},[u]),i.useEffect(()=>{k?.message&&(I({message:k.message,severity:k.severity||"error"}),"success"===k.severity&&(p&&p(),h&&h()))},[k?.message]),i.useEffect(()=>{k?.strapiErrors&&I({message:k.strapiErrors.message||"Error updating OPO",severity:k.severity||"error"})},[k?.strapiErrors]),e.jsx(v,{sx:[...Array.isArray(m)?m:[m]],children:e.jsxs(y,{container:!0,spacing:2,children:[e.jsx(y,{size:12,children:e.jsxs(f,{spacing:2,children:[e.jsxs(f,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(f,{spacing:2,children:[e.jsx(x,{variant:"h3",component:"h1",children:"Manage Outbound Purchase Order"}),e.jsx(x,{variant:"body1",children:"Manage picking, packing and shipping of purchase order"})]}),e.jsx(d.default,{content:"",related:[{id:u.documentId,__type:"api::e-commerce.opo"}],revalidateCallback:p})]}),e.jsx(b,{})]})}),e.jsx(y,{size:6,children:e.jsxs(f,{spacing:1,children:[e.jsx(x,{variant:"h5",children:"Details"}),e.jsxs(f,{direction:"row",spacing:2,children:[e.jsx(x,{variant:"body1",width:"250px",children:"Purchase Order Number"}),e.jsx(x,{variant:"body2",children:u.opo_number})]}),e.jsxs(f,{direction:"row",spacing:2,children:[e.jsx(x,{variant:"body1",width:"250px",children:"Custom reference"}),e.jsx(x,{variant:"body2",children:u.customer_reference})]}),e.jsxs(f,{direction:"row",spacing:2,children:[e.jsx(x,{variant:"body1",width:"250px",children:"Order Date"}),e.jsx(x,{variant:"body2",children:u.order_date})]}),e.jsxs(f,{direction:"row",spacing:2,children:[e.jsx(x,{variant:"body1",width:"250px",children:"Customer"}),e.jsx(x,{variant:"body2",children:u.customer?.business_credentials?.company_name})]}),e.jsxs(f,{direction:"row",spacing:2,children:[e.jsx(x,{variant:"body1",width:"250px",children:"Order Status"}),e.jsx(x,{variant:"body2",width:"250px",children:u.internal_status})]}),("placed"===u.internal_status||"external_shipping_process"===u.internal_status)&&"enduser"===_&&e.jsxs(e.Fragment,{children:[e.jsx(j,{variant:"contained",color:"primary",onClick:()=>E(!0),children:"Confirm order"}),e.jsx(l,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"}),e.jsx(w,{open:A,handleClose:()=>E(!1),orderID:u.documentId,currentStatus:u.internal_status,revalidateCallback:p})]})]})}),e.jsx(y,{size:12,children:e.jsxs(f,{spacing:2,children:[e.jsx(x,{variant:"h5",children:"Documents"}),e.jsx(g,{sx:{p:2},children:e.jsx(f,{spacing:1,children:u.delivery_note?e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"h6",children:"Delivery Note"}),e.jsx(x,{children:u.delivery_note?.name}),e.jsx(j,{variant:"contained",onClick:()=>{t.default(`api/opos/${u.documentId}`,"delivery_note")},children:"Download"})]}):e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"h5",children:"Delivery Note"}),e.jsx(x,{variant:"body1",children:"Here you can upload the the delivery note for this order"}),e.jsx(b,{}),e.jsx(n.UploadBase64MediaForm,{reference:"api::e-commerce.opo",refID:u.documentId,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/opos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:p})]})})})]})}),u?.notes?.length>0&&e.jsx(y,{size:12,children:e.jsxs(f,{spacing:2,children:[e.jsx(x,{variant:"h5",children:"Notes"}),e.jsx(o.default,{notes:u.notes}),e.jsx(b,{})]})}),e.jsx(y,{size:12,children:e.jsxs(f,{spacing:1,children:[e.jsx(x,{variant:"h5",children:"Items"}),"placed"===u.internal_status&&e.jsx(l,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(b,{}),e.jsxs("form",{action:D,children:[e.jsx("input",{name:"id",type:"hidden",value:u.documentId}),O&&O.map((i,r)=>(console.log("item",i),e.jsx(g,{sx:{p:2,mb:2},children:"placed"===u.internal_status?e.jsx(s.default,{item:i,index:r,image:i?.product?.image}):e.jsx(a.default,{item:i,index:r,handleUpdateQuantity:B,image:i?.product?.image,revalidateCallback:p})},r))),e.jsx(g,{sx:{p:2},children:e.jsxs(f,{direction:"row",spacing:2,justifyContent:"space-between",children:[h&&e.jsx(j,{onClick:h,variant:"outlined",children:"Cancel"}),e.jsx(c.SubmitButton,{text:"Update items",loadingText:"Loading..."})]})}),e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity})))(O))})]})]})})]})})};
|