umwd-components 0.1.651 → 0.1.652

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.
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as o,useEffect as a}from"react";import{useFormState as m}from"react-dom";import{useSnackbar as n}from"../../../context/common/SnackbarContext.js";import{createIroAction as i}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{StrapiErrors as s}from"../../StrapiErrors.js";import{SubmitButton as l}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{IROItemFields as u}from"./IROItemFields.js";import d from"@mui/material/Typography";import p from"@mui/material/Grid";import E from"@mui/material/Box";import f from"@mui/material/TextField";import h from"@mui/material/Checkbox";import v from"@mui/material/Alert";import g from"@mui/material/Stack";import y from"@mui/material/Button";var x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function C(C){var b=C.sx,j=C.revalidateCallback,w=C.handleClose,A=C.customerLabels,I=C.productLabels,k=e(o(!1),2),S=k[0],L=k[1],B=e(m(i,x),2),T=B[0],_=B[1],z=n().handleAddMessage;return a((function(){(null==T?void 0:T.message)&&(z({message:T.message,severity:T.severity||"error"}),"success"===T.severity&&(j&&j(),w&&w()))}),[null==T?void 0:T.message]),a((function(){(null==T?void 0:T.strapiErrors)&&z({message:T.strapiErrors.message||"Error creating return order",severity:T.severity||"error"})}),[null==T?void 0:T.strapiErrors]),t.createElement(E,{sx:r([{p:2}],e(Array.isArray(b)?b:[b]),!1)},t.createElement("form",{action:_},t.createElement(p,{container:!0,spacing:2},t.createElement(p,{item:!0,xs:12},t.createElement(g,{spacing:2},t.createElement(d,{variant:"h6"},"Choose a customer"),t.createElement(d,{variant:"body2"},"Select the customer for which you want to create a return order"),t.createElement(c,{customerLabels:A}))),t.createElement(p,{item:!0,xs:12},t.createElement(g,{spacing:2},t.createElement(d,{variant:"h6"},"Customer reference"),t.createElement(d,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(f,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(p,{item:!0,xs:12},t.createElement(d,{variant:"h6"},"Choose products that should be in this return order"),t.createElement(u,{productsArr:I})),t.createElement(p,{item:!0,xs:12},t.createElement(d,{variant:"h6"},"Confirm Order"),t.createElement(d,null,"Are you sure you want to confirm this return? Confirming this order means you are sure the customer wants to return the products and you are ready to process the return."),t.createElement(g,{direction:"row",spacing:1,alignItems:"center"},t.createElement(h,{value:S,checked:S,onChange:function(){return L(!S)}}),S&&t.createElement(d,{color:"primary"},"I am sure I want to confirm this return order")),t.createElement("input",{name:"status",type:"hidden",value:S?"returning":"requested"})),t.createElement(p,{item:!0,xs:12},t.createElement(l,{text:"Confirm",loadingText:"Loading..."}),t.createElement(y,{onClick:w,variant:"outlined"},"Cancel")),t.createElement(p,{item:!0,xs:12},null!==(null==T?void 0:T.strapiErrors)&&t.createElement(s,{error:null==T?void 0:T.strapiErrors}),(null==T?void 0:T.message)&&t.createElement(v,{severity:"error"},null==T?void 0:T.message)))))}export{C as default};
7
+ import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as o}from"react";import{useFormState as n}from"react-dom";import{useSnackbar as m}from"../../../context/common/SnackbarContext.js";import{createIroAction as i}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{SubmitButton as s}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{IROItemFields as l}from"./IROItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import E from"@mui/material/TextField";import f from"@mui/material/Checkbox";import h from"@mui/material/Stack";import v from"@mui/material/Button";var g={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function y(y){var x=y.sx,C=y.revalidateCallback,b=y.handleClose,w=y.customerLabels,j=y.productLabels,I=e(a(!1),2),k=I[0],A=I[1],S=e(n(i,g),2),L=S[0],B=S[1],T=m().handleAddMessage;return o((function(){(null==L?void 0:L.message)&&(T({message:L.message,severity:L.severity||"error"}),"success"===L.severity&&(C&&C(),b&&b()))}),[null==L?void 0:L.message]),o((function(){(null==L?void 0:L.strapiErrors)&&T({message:L.strapiErrors.message||"Error creating return order",severity:L.severity||"error"})}),[null==L?void 0:L.strapiErrors]),t.createElement(p,{sx:r([{p:2}],e(Array.isArray(x)?x:[x]),!1)},t.createElement("form",{action:B},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h3",component:"h1"},"Create new return order"))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(u,{variant:"body2"},"Select the customer for which you want to create a return order"),t.createElement(c,{customerLabels:w}))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(E,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products that should be in this return order"),t.createElement(l,{productsArr:j})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this return? Confirming this order means you are sure the customer wants to return the products and you are ready to process the return."),t.createElement(h,{direction:"row",spacing:1,alignItems:"center"},t.createElement(f,{value:k,checked:k,onChange:function(){return A(!k)}}),k&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this return order")),t.createElement("input",{name:"status",type:"hidden",value:k?"returning":"requested"})),t.createElement(d,{item:!0,xs:12},t.createElement(h,{direction:"row",justifyContent:"space-between"},t.createElement(v,{onClick:b,variant:"outlined"},"Cancel"),t.createElement(s,{text:"Confirm",loadingText:"Loading...",variant:"contained"}))))))}export{y as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,l,m;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),(r=o(n)).data.iro_items&&(r.data.iro_items=JSON.parse(r.data.iro_items)),console.log(r),0===r.data.iro_items.length?[2,t(t({},i),{strapiErrors:null,message:"Please add at least one item to the Iro."})]:[4,s("POST","/api/iros/createAdmin",r)];case 1:return(l=e.sent())?l.error?[2,t(t({},i),{strapiErrors:l.error,message:"Failed to Create Iro."})]:(m=a(l),[2,t(t({},i),{message:"Iro Created Successfully",data:m,strapiErrors:null})]):[2,t(t({},i),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createIroAction};
7
+ import{__awaiter as r,__generator as e,__assign as s}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as t}from"../../../services/mutate-data.js";import{flattenAttributes as o}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function i(i,n){return r(this,void 0,void 0,(function(){var r,l,m;return e(this,(function(e){switch(e.label){case 0:return Object.fromEntries(n),(r=a(n)).data.iro_items&&(r.data.iro_items=JSON.parse(r.data.iro_items)),console.log(r),0===r.data.iro_items.length?[2,s(s({},i),{strapiErrors:null,message:"Please add at least one item to the Iro."})]:[4,t("POST","/api/iros/createAdmin",r)];case 1:return(l=e.sent())?l.error?[2,s(s({},i),{strapiErrors:l.error,severity:"error",message:"Failed to Create Iro."})]:(m=o(l),[2,s(s({},i),{message:"Iro Created Successfully",severity:"success",data:m,strapiErrors:null})]):[2,s(s({},i),{strapiErrors:null,severity:"error",message:"Ops! Something went wrong. Please try again."})]}}))}))}export{i as createIroAction};