PageSourceSearch

https://admin.pickyourplayground.com/assets/Category-3888e22b.js

js pickyourplayground.com collected 2026-10-02 01:41:37 UTC 5,066 bytes, 1 lines download raw bytes

1import{a as b,u as E,r as a,bB as I,j as e,aO as $,B as h,aU as z,S as O,ao as W,Y as H,b6 as U,t as V,aq as _,aY as q,aT as G,aA as J,aB as K,aC as Q,aD as X,z as m}from"./index-fb3c7097.js";import{c as Z}from"./changeStatus-7b27bace.js";const ee=n=>b.post(`/category/deleteCategory/${n}`),te=n=>b.get(`/category/getCategoryDeleteDetail/${n}`),ne=()=>{const n=E(),[o,w]=a.useState(""),[f,se]=a.useState(),[d,i]=a.useState(1),[u,N]=a.useState(10),D=t=>{i(t)},A=t=>{N(t),i(1)},{data:P,isLoading:k,isRefetching:R,refetch:c}=I({searchVal:o,joinedDate:f,page:d??1,rowsPerPage:u}),r=P||[],[j,g]=a.useState(!1),F=async t=>{await Z(t),m.success("Status updated successfully"),g(!1)},L=async t=>{g(!0);const s=await ee(t);s.status===200?m.success("Category deleted successfully"):m.error(s.message),g(!1),x()};a.useEffect(()=>{c()},[j]);const M=t=>{w(t),i(1)};a.useEffect(()=>{const t=setTimeout(()=>{c()},500);return()=>clearTimeout(t)},[o]),a.useEffect(()=>{i(1),c()},[f,u]),a.useEffect(()=>{c()},[d]);const[T,C]=a.useState(!1),[l,y]=a.useState(null),Y=async t=>{var v,S;const s=await te(t),p={subCategory:(v=s==null?void 0:s.data)==null?void 0:v.subCategoryCount,activity:(S=s==null?void 0:s.data)==null?void 0:S.activityCount,id:t};y(p),C(!0)},x=async()=>{C(!1),y(null)},B=t=>t!=="Land"&&t!=="Air"&&t!=="Water";return e.jsx(e.Fragment,{children:e.jsxs($,{title:"Category",children:[e.jsxs("div",{className:"row",children:[e.jsx("div",{className:"col-12 col-md-6",children:e.jsx("h3",{className:"semi-bold f-32 text-white ",children:"Category "})}),e.jsx("div",{className:"col-12 col-md-6 d-flex justify-content-end align-items-center",children:e.jsx(h,{type:"button",className:"rounded-full",variant:"primary",onClick:()=>n("/admin/categoryList/add-Category"),children:e.jsxs("span",{className:"d-flex align-items-center gap-2",children:[e.jsx("img",{src:z,className:"plus-icon",alt:""}),"   Add Category"]})})})]}),e.jsx("div",{className:"row my-4 search-bar align-items-end",children:e.jsx("div",{className:"col-12 col-md-5 d-flex align-items-center",children:e.jsxs("div",{className:"search-user-icon relative w-100",children:[e.jsx("input",{type:"text",className:"form-control text-white bg-black",style:{paddingRight:"0.75rem"},placeholder:"Search",value:o,onChange:t=>M(t.target.value)}),e.jsx("i",{className:"fa-solid fa-magnifying-glass"})]})})}),k||R?e.jsx("center",{className:"spiner",children:e.jsx(O,{})}):e.jsx("div",{className:"tablecard bg-black  rounded-full mt-3 p-3",children:e.jsx("div",{className:"row text-white mt-0",children:e.jsx(W,{rowsPerPage:u,currentPage:d,onPageChange:D,onRowsPerPageChange:A,totalRows:(r==null?void 0:r.count)??0,data:(r==null?void 0:r.data)??[],columns:[{title:"Image",field:"image",Cell({entry:t}){return e.jsx("div",{style:{display:"flex",alignItems:"center"},children:e.jsx("img",{src:t==null?void 0:t.image,alt:"",style:{width:"90px",objectFit:"cover",borderRadius:"8px"}})})}},{title:"Name",field:"name",Cell({entry:{name:t}}){return e.jsx("div",{style:{display:"flex",alignItems:"center"},children:t.charAt(0).toUpperCase()+t.slice(1)})}},{title:"Created date",field:"createdAt",Cell({entry:{createdAt:t}}){return e.jsx("span",{children:H(t).local().format("DD MMM YYYY,HH:mm")})}},{title:"Sub Category",field:"Sub Category",Cell({entry:{SubCategory:t}}){return e.jsx(e.Fragment,{children:e.jsx("div",{className:"d-flex activity-toggle al
1ign-items-center justify-content-start",children:t})})}},{title:"Status",field:"isActive",Cell({entry:{status:t,_id:s,name:p}}){return e.jsx(e.Fragment,{children:e.jsx("div",{className:"d-flex activity-toggle align-items-center justify-content-start",children:e.jsx(U,{color:"primary",defaultChecked:t==="active",onChange:()=>F(s)})})})}},{title:"Action",field:"_id",Cell({entry:{_id:t,name:s}}){return e.jsx(e.Fragment,{children:e.jsxs(V,{sx:{display:"flex",flexDirection:"row",gap:"10px"},children:[e.jsx(_,{fontSize:"medium",sx:{cursor:"pointer","&:hover":{}},onClick:()=>n(`view-Category/${t}`)}),e.jsx(q,{fontSize:"medium",getClubs:!0,sx:{cursor:"pointer","&:hover":{fill:"#1976D2"}},onClick:()=>n(`add-Category/${t}`)}),B(s)&&e.jsx(G,{fontSize:"medium",sx:{cursor:"pointer","&:hover":{fill:"#FF1744"}},onClick:()=>Y(t)})]})})}}]})})}),e.jsxs(J,{open:T,onClose:x,children:[e.jsx(K,{sx:{textAlign:"center"},children:"WARNING!!!!!"}),e.jsx(Q,{sx:{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center"},children:e.jsxs("div",{children:[e.jsxs("p",{children:["There are ",e.jsxs("strong",{style:{color:"green"},children:[l==null?void 0:l.subCategory," subcategories"]})," &"," ",e.jsxs("strong",{style:{color:"green"},children:[l==null?void 0:l.activity," activities"]}),"  in this category."]}),e.jsx("p",{children:"Are you sure you want to delete this category?"})]})}),e.jsxs(X,{sx:{justifyContent:"center"},children:[e.jsx(h,{onClick:x,variant:"outlined",sx:{marginRight:2},children:"Back"}),e.jsx(h,{onClick:()=>L(l==null?void 0:l.id),color:"error",variant:"contained",isLoading:j,children:"Yes, I Confirm"})]})]})]})})};export{ne as CategoryList};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.