(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1848],{29863:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/packages/create",function(){return n(74992)}])},74992:function(e,s,n){"use strict";n.r(s);var t=n(85893),i=n(67294),r=n(9473),a=n(25604),c=n(39332),l=n(86886),u=n(21737),d=n(92401),o=n(68269),x=n(15861),h=n(69417),g=n(44267),j=n(50135),Z=n(5616),p=n(66242);s.default=function(e){let s=(0,r.I0)(),{push:n}=(0,c.useRouter)(),f=(0,r.v9)(a.V_),m=(0,r.v9)(a.R0),v=(0,r.v9)(a.Vp),[P,b]=(0,i.useState)(null),[k,_]=(0,i.useState)(""),[w,E]=(0,i.useState)(),[S,N]=(0,i.useState)("");return(0,i.useEffect)(()=>{s((0,a.xM)(!1))},[v]),(0,i.useEffect)(()=>{!f&&v&&(b("Package added successfully!"),setTimeout(()=>{n("/packages")},500))},[v,f]),(0,t.jsxs)(l.ZP,{container:!0,spacing:6,children:[(0,t.jsx)(l.ZP,{item:!0,xs:12,children:(0,t.jsx)(x.Z,{variant:"h5",children:"Create Package"})}),(0,t.jsx)(l.ZP,{item:!0,xs:12,children:(0,t.jsx)(p.Z,{children:(0,t.jsxs)(g.Z,{children:[P?(0,t.jsxs)(u.Z,{severity:"success",sx:{mb:4},children:[(0,t.jsx)(d.Z,{children:"Success"}),(0,t.jsx)(Z.Z,{component:"strong",sx:{display:"block"},children:P})]}):null,m&&m.length>0?(0,t.jsxs)(u.Z,{severity:"error",sx:{mb:4},children:[(0,t.jsx)(d.Z,{children:"Errors"}),m.map((e,s)=>(0,t.jsx)(Z.Z,{component:"strong",sx:{display:"block"},children:e},s))]}):null,(0,t.jsx)("form",{onSubmit:e=>{e.preventDefault(),f||s((0,a.u3)({name:k,price:Number(w),description:S}))},children:(0,t.jsxs)(l.ZP,{row:!0,children:[(0,t.jsxs)(l.ZP,{item:!0,xs:12,children:[(0,t.jsxs)(o.Z,{direction:"row",margin:10,gap:5,children:[(0,t.jsx)(j.Z,{fullWidth:!0,label:"Package Name",value:k,onChange:e=>_(e.target.value)}),(0,t.jsx)(j.Z,{fullWidth:!0,label:"Package Prcie",value:w,onChange:e=>E(e.target.value)})]}),(0,t.jsx)(o.Z,{direction:"row",margin:10,gap:5,children:(0,t.jsx)(j.Z,{fullWidth:!0,label:"Package Description",value:S,onChange:e=>N(e.target.value)})})]}),(0,t.jsx)(l.ZP,{item:!0,xs:12,sx:{mt:5},children:(0,t.jsx)(h.Z,{type:"submit",variant:"contained",disabled:f,children:f?"Saving":"Save"})})]})})]})})})]})}}},function(e){e.O(0,[2657,315,341,6056,9774,2888,179],function(){return e(e.s=29863)}),_N_E=e.O()}]);