(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7159],{31541:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/users/create",function(){return t(34801)}])},34801:function(e,s,t){"use strict";t.r(s);var n=t(85893),l=t(67294),r=t(9473),a=t(92118),i=t(39332),u=t(86886),c=t(21737),d=t(92401),x=t(68269),h=t(15861),o=t(69417),j=t(44267),Z=t(50135),m=t(5616),f=t(66242);s.default=function(e){let s=(0,r.I0)(),{push:t}=(0,i.useRouter)(),v=(0,r.v9)(a.V_),p=(0,r.v9)(a.R0),g=(0,r.v9)(a.Vp),[_,b]=(0,l.useState)(null),[P,w]=(0,l.useState)(""),[S,E]=(0,l.useState)(""),[y,C]=(0,l.useState)(""),[N,k]=(0,l.useState)(""),[W,T]=(0,l.useState)("");return(0,l.useEffect)(()=>{s((0,a.xM)(!1))},[g]),(0,l.useEffect)(()=>{!v&&g&&(b("User added successfully!"),setTimeout(()=>{t("/users")},500))},[g,v]),(0,n.jsxs)(u.ZP,{container:!0,spacing:6,children:[(0,n.jsx)(u.ZP,{item:!0,xs:12,children:(0,n.jsx)(h.Z,{variant:"h5",children:"Create User"})}),(0,n.jsx)(u.ZP,{item:!0,xs:12,children:(0,n.jsx)(f.Z,{children:(0,n.jsxs)(j.Z,{children:[_?(0,n.jsxs)(c.Z,{severity:"success",sx:{mb:4},children:[(0,n.jsx)(d.Z,{children:"Success"}),(0,n.jsx)(m.Z,{component:"strong",sx:{display:"block"},children:_})]}):null,p&&p.length>0?(0,n.jsxs)(c.Z,{severity:"error",sx:{mb:4},children:[(0,n.jsx)(d.Z,{children:"Errors"}),p.map((e,s)=>(0,n.jsx)(m.Z,{component:"strong",sx:{display:"block"},children:e},s))]}):null,(0,n.jsx)("form",{onSubmit:e=>{e.preventDefault(),v||s((0,a.cn)({first_name:P,last_name:S,email:y,phone:N,password:W}))},children:(0,n.jsxs)(u.ZP,{row:!0,children:[(0,n.jsx)(u.ZP,{item:!0,xs:12,children:(0,n.jsxs)(x.Z,{direction:"row",gap:5,children:[(0,n.jsx)(Z.Z,{fullWidth:!0,label:"First Name",value:P,onChange:e=>w(e.target.value)}),(0,n.jsx)(Z.Z,{fullWidth:!0,label:"Last Name",value:S,onChange:e=>E(e.target.value)})]})}),(0,n.jsx)(u.ZP,{item:!0,xs:12,sx:{mt:5},children:(0,n.jsxs)(x.Z,{direction:"row",gap:5,children:[(0,n.jsx)(Z.Z,{fullWidth:!0,label:"Email",type:"email",value:y,onChange:e=>C(e.target.value)}),(0,n.jsx)(Z.Z,{fullWidth:!0,label:"Phone",value:N,onChange:e=>k(e.target.value)})]})}),(0,n.jsx)(u.ZP,{item:!0,xs:6,sx:{mt:5},children:(0,n.jsx)(Z.Z,{fullWidth:!0,label:"Password",type:"password",value:W,onChange:e=>T(e.target.value)})}),(0,n.jsx)(u.ZP,{item:!0,xs:12,sx:{mt:5},children:(0,n.jsx)(o.Z,{type:"submit",variant:"contained",disabled:v,children:v?"Saving":"Save"})})]})})]})})})]})}}},function(e){e.O(0,[2657,315,341,3274,9774,2888,179],function(){return e(e.s=31541)}),_N_E=e.O()}]);