umwd-components 0.1.670 → 0.1.671

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 t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as m}from"react";import a from"@mui/material/Box";import o from"@mui/material/Stack";import i from"@mui/material/Button";import s from"@mui/material/TextField";import c from"@mui/material/Typography";import{SubmitButton as l}from"../../SubmitButton.js";import{useFormState as d}from"react-dom";import{useSnackbar as u}from"../../../context/common/SnackbarContext.js";import{createVendorAction as p}from"../../../data/actions/logistics/vendor/createVendorAction.js";import E from"@mui/material/Grid";import{BusinessCredentialsFields as f}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as x}from"../../common/Address.js";import g from"../../e-commerce/products/ProductSelector.js";import{ContactsFields as v}from"../../common/Contacts.js";import b from"@mui/icons-material/Add";import{ContactType as y}from"../../../types/common/Contact.js";import{ExplanatoryFoldOut as h}from"../../ExplanatoryFoldOut.js";var C={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function j(j){var A=j.productNamesArr,_=j.revalidateCallback,k=j.handleClose,N=j.sx,V=e(d(p,C),2),w=V[0],B=V[1],R=u().handleAddMessage,S=e(n([]),2),P=S[0],T=S[1];return m((function(){(null==w?void 0:w.message)&&(R({message:w.message,severity:w.severity||"error"}),"success"===w.severity&&(_&&_(),k&&k()))}),[null==w?void 0:w.message]),m((function(){(null==w?void 0:w.strapiErrors)&&R({message:w.strapiErrors.message||"Error creating vendor",severity:"error"})}),[null==w?void 0:w.strapiErrors]),r.createElement(a,{sx:t([],e(Array.isArray(N)?N:[N]),!1)},r.createElement("form",{action:B},r.createElement(E,{container:!0,spacing:2},r.createElement(E,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(c,{variant:"h3",component:"h1"},"Add Vendor"),r.createElement(c,{variant:"body1"},"Create a new vendor for your business"))),r.createElement(E,{item:!0,xs:12},r.createElement(h,{title:"Vendor",description:"Vendors are businesses that you purchase products from."})),r.createElement(E,{item:!0,xs:12,md:6},r.createElement(f,{componentName:"business_credentials",componentReference:"common.business-credentials"})),r.createElement(E,{item:!0,xs:12,md:6},r.createElement(o,{spacing:1,sx:{pt:1}},r.createElement(s,{id:"website_url",name:"website_url",label:"Website Url"}),r.createElement(s,{id:"phone_number",name:"phone_number",label:"Phone Number"}),r.createElement(s,{id:"email",name:"email",label:"Email"}))),r.createElement(E,{item:!0,xs:12,md:6},r.createElement(c,{variant:"h6"},"Address"),r.createElement(x,{componentName:"address",componentReference:"common.address"})),r.createElement(E,{item:!0,xs:12,sx:{mt:1}},r.createElement(c,{variant:"h6"},"Products"),r.createElement(g,{productNames:A,currentValue:[]})),r.createElement(E,{item:!0,xs:12,sx:{mt:1}},r.createElement(c,{variant:"h6"},"Contacts"),r.createElement(E,{container:!0,spacing:2},P.map((function(e,t){return r.createElement(E,{item:!0,xs:12,sm:6,md:4,lg:3,key:t},r.createElement(v,{key:t,data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact",deleteCallback:function(){!function(e){var t=P.filter((function(t,r){return r!==e}));T(t)}(t)}}))})),r.createElement(E,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"}},r.createElement(i,{variant:"contained",startIcon:r.createElement(b,null),onClick:function(){T(t(t([],e(P),!1),[{componentName:"contacts[".concat(P.length,"]"),componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:y.Other}}],!1))},size:"large"},"Add contact"))))," ",r.createElement(E,{item:!0,xs:12},r.createElement(o,{direction:"row",spacing:2,justifyContent:"flex-end",sx:{mt:2}},k&&r.createElement(i,{onClick:k,variant:"outlined"},"Cancel"),r.createElement(l,{text:"Create Vendor",loadingText:"Creating...",variant:"contained"}))))))}export{j as AddVendorForm};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as a}from"react";import m from"@mui/material/Box";import o from"@mui/material/Stack";import i from"@mui/material/Button";import s from"@mui/material/TextField";import c from"@mui/material/Typography";import{SubmitButton as l}from"../../SubmitButton.js";import{useFormState as d}from"react-dom";import{useSnackbar as u}from"../../../context/common/SnackbarContext.js";import{createVendorAction as p}from"../../../data/actions/logistics/vendor/createVendorAction.js";import f from"@mui/material/Grid";import{BusinessCredentialsFields as E}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as g}from"../../common/Address.js";import x from"../../e-commerce/products/ProductSelector.js";import{ContactsFields as y}from"../../common/Contacts.js";import v from"@mui/icons-material/Add";import{ContactType as b}from"../../../types/common/Contact.js";import{ExplanatoryFoldOut as h}from"../../ExplanatoryFoldOut.js";import{Paper as C}from"@mui/material";var j={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function A(A){var _=A.productNamesArr,k=A.revalidateCallback,N=A.handleClose,w=A.sx,I=e(d(p,j),2),V=I[0],B=I[1],R=u().handleAddMessage,S=e(n([]),2),P=S[0],T=S[1];return a((function(){(null==V?void 0:V.message)&&(R({message:V.message,severity:V.severity||"error"}),"success"===V.severity&&(k&&k(),N&&N()))}),[null==V?void 0:V.message]),a((function(){(null==V?void 0:V.strapiErrors)&&R({message:V.strapiErrors.message||"Error creating vendor",severity:"error"})}),[null==V?void 0:V.strapiErrors]),r.createElement(m,{sx:t([],e(Array.isArray(w)?w:[w]),!1)},r.createElement("form",{action:B},r.createElement(f,{container:!0,spacing:2},r.createElement(f,{item:!0,xs:12},r.createElement(o,{spacing:2},r.createElement(c,{variant:"h3",component:"h1"},"Add Vendor"),r.createElement(c,{variant:"body1"},"Create a new vendor for your business"))),r.createElement(f,{item:!0,xs:12},r.createElement(h,{title:"Vendor",description:"Vendors are businesses that you purchase products from."})),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(E,{componentName:"business_credentials",componentReference:"common.business-credentials"})),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(o,{spacing:1,sx:{pt:1}},r.createElement(s,{id:"website_url",name:"website_url",label:"Website Url"}),r.createElement(s,{id:"phone_number",name:"phone_number",label:"Phone Number"}),r.createElement(s,{id:"email",name:"email",label:"Email"}))),r.createElement(f,{item:!0,xs:12,md:6},r.createElement(c,{variant:"h6"},"Address"),r.createElement(g,{componentName:"address",componentReference:"common.address"})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Products")),r.createElement(f,{item:!0,xs:12},r.createElement(x,{productNames:_,currentValue:[]})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Contacts")),P.map((function(e,t){return r.createElement(f,{item:!0,xs:12,sm:6,md:4,lg:3,key:t,sx:{justifyContent:"center",display:"flex",alignItems:"center"}},r.createElement(C,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},r.createElement(y,{key:t,data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact",deleteCallback:function(){!function(e){var t=P.filter((function(t,r){return r!==e}));T(t)}(t)}})))})),r.createElement(f,{item:!0,xs:12,sm:6,md:4,lg:3,sx:{justifyContent:"center",display:"flex",alignItems:"center"}},r.createElement(C,{sx:{p:2,width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},r.createElement(i,{variant:"contained",startIcon:r.createElement(v,null),onClick:function(){T(t(t([],e(P),!1),[{componentName:"contacts[".concat(P.length,"]"),componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:b.Other}}],!1))},size:"large"},"Add contact"))),r.createElement(f,{item:!0,xs:12},r.createElement(o,{direction:"row",spacing:2,justifyContent:"space-between",alignItems:"center"},N&&r.createElement(i,{onClick:N,variant:"outlined"},"Cancel"),r.createElement(l,{text:"Create Vendor",loadingText:"Creating...",variant:"contained"}))))))}export{A as AddVendorForm};