(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7262],{86573:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/packages",function(){return i(22629)}])},22629:function(e,n,i){"use strict";i.r(n);var c=i(85893),s=i(67294),r=i(9473),t=i(25604),a=i(41664),l=i.n(a),d=i(39332),h=i(86886),x=i(15861),o=i(66242),j=i(72882),Z=i(7906),u=i(53184),g=i(53816),k=i(98102),p=i(295),f=i(90629),_=i(69417),w=i(68269),v=i(69368),P=i(10633),m=i(87882);n.default=function(e){let n=(0,r.I0)(),{push:i}=(0,d.useRouter)(),a=(0,r.v9)(t.V_),C=(0,r.v9)(t.Vt);(0,r.v9)(t.MF);let b=(0,r.v9)(t.hU),[y,E]=(0,s.useState)(1),[N,A]=(0,s.useState)(!1),[D,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{n((0,t.ei)({page:y}))},[y]);let handleCheckboxChange=async(e,i)=>{let c=e.target.checked?1:0;n((0,m.KQ)({id:i,is_active:c})),window.location.reload()};return(0,c.jsxs)(h.ZP,{container:!0,spacing:6,children:[(0,c.jsx)(h.ZP,{item:!0,xs:12,children:(0,c.jsxs)(w.Z,{direction:"row",children:[(0,c.jsx)(x.Z,{variant:"h5",children:"All Packages"}),(0,c.jsx)(_.Z,{component:l(),href:"/packages/create",sx:{marginLeft:"auto"},children:"Create Packages"})]})}),(0,c.jsx)(h.ZP,{item:!0,xs:12,children:(0,c.jsx)(o.Z,{children:(0,c.jsxs)(f.Z,{sx:{width:"100%",overflow:"hidden"},children:[a?(0,c.jsx)(x.Z,{variant:"h5",sx:{my:3},textAlign:"center",children:"Loading..."}):(0,c.jsx)(j.Z,{sx:{maxHeight:440},children:(0,c.jsxs)(Z.Z,{stickyHeader:!0,"aria-label":"sticky table",children:[(0,c.jsx)(u.Z,{children:(0,c.jsxs)(g.Z,{children:[(0,c.jsx)(k.Z,{children:"ID"}),(0,c.jsx)(k.Z,{children:"Package Name"}),(0,c.jsx)(k.Z,{children:"Package Price"}),(0,c.jsx)(k.Z,{children:"Package Description"}),(0,c.jsx)(k.Z,{children:"Activate / DeActivat"})]})}),(0,c.jsx)(p.Z,{children:C.map(e=>(0,c.jsxs)(g.Z,{hover:!0,role:"checkbox",tabIndex:-1,children:[(0,c.jsx)(k.Z,{children:(0,c.jsx)("span",{children:e.id})}),(0,c.jsx)(k.Z,{children:(0,c.jsx)("span",{children:e.name})}),(0,c.jsx)(k.Z,{children:(0,c.jsx)("span",{children:e.price})}),(0,c.jsx)(k.Z,{children:(0,c.jsx)("span",{children:e.description})}),(0,c.jsx)(k.Z,{width:"200",align:"center",children:(0,c.jsx)(v.Z,{fullWidth:!0,label:"Package Description",checked:1===e.is_active,onChange:n=>handleCheckboxChange(n,e.id)})})]},e.id))})]})}),(0,c.jsx)(w.Z,{direction:"row",sx:{my:4,display:a?"none":""},justifyContent:"center",children:(0,c.jsx)(P.Z,{count:b,onChange:function(e,n){E(n)}})})]})})})]})}}},function(e){e.O(0,[2657,3795,7169,2244,9774,2888,179],function(){return e(e.s=86573)}),_N_E=e.O()}]);