PageSourceSearch

https://www.thestudyias.com/_next/static/chunks/3648.20f0f64946861e2b.js

js thestudyias.com collected 2026-09-24 11:38:13 UTC 10,498 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3648],{93648:function(e,s,t){t.r(s),t.d(s,{default:function(){return o}});var a=t(57437),c=t(2265),l=t(28784),i=t(14573),n=t(37996),r=t(56462),d=t(50363);function o(){(0,l.s0)();let[e,s]=(0,c.useState)([]),[t,o]=(0,c.useState)([]),[m,h]=(0,c.useState)(!0),[u,x]=(0,c.useState)(0),[j,g]=(0,c.useState)(1),[p,b]=(0,c.useState)(""),[y,f]=(0,c.useState)(""),[v,N]=(0,c.useState)("all"),[C,S]=(0,c.useState)("all"),[k,w]=(0,c.useState)(""),[_,A]=(0,c.useState)(""),[M,W]=(0,c.useState)(null),[z,U]=(0,c.useState)(""),$=async()=>{try{let e=await (0,d.UQ)("flat");e&&e.responseObject&&o(e.responseObject||[])}catch(e){console.error("Categories fetch error:",e)}},T=async()=>{h(!0),A("");try{let e=await (0,d.nl)({search:p,category_id:y||void 0,status:v,lang:C,page:j,limit:15});e&&e.responseObject&&(s(e.responseObject.rows||[]),x(e.responseObject.total||0))}catch(e){A(e.message||"Failed to load courses")}finally{h(!1)}};(0,c.useEffect)(()=>{$()},[]),(0,c.useEffect)(()=>{T()},[j,y,v,C]);let E=async e=>{let s="published"===e.status?"draft":"published";try{await (0,d.PI)(e.id,{status:s}),w(`Updated "${e.title}" status to ${s}`),T(),setTimeout(()=>w(""),3e3)}catch(e){alert(e.message||"Failed to update status")}},P=async()=>{if(M&&z)try{await (0,d.V4)(M.id,z),w(`Moved "${M.title}" successfully!`),W(null),T(),setTimeout(()=>w(""),3e3)}catch(e){alert(e.message||"Failed to move category")}},B=async e=>{if(window.confirm(`Are you sure you want to delete course "${e.title}"? This cannot be undone.`))try{await (0,d.g)(e.id),w(`Deleted "${e.title}"`),T(),setTimeout(()=>w(""),3e3)}catch(e){alert(e.message||"Failed to delete course")}},H=Math.ceil(u/15),I=e.filter(e=>"published"===e.status||!e.status).length,L=e.filter(e=>"draft"===e.status).length;return(0,a.jsx)(r.Z,{title:"Course Management",children:(0,a.jsxs)("div",{className:"cm-container",children:[(0,a.jsxs)("div",{className:"cm-header",children:[(0,a.jsxs)("div",{className:"cm-title-area",children:[(0,a.jsxs)("h1",{children:[(0,a.jsx)(n.hbr,{style:{color:"#2563eb"}})," Course Catalog Management"]}),(0,a.jsx)("p",{children:"Manage live courses, update batch fees, reassign categories, and edit rich curriculum with zero coding."})]}),(0,a.jsxs)("div",{className:"cm-actions-group",children:[(0,a.jsxs)(i.rU,{to:"/admin/create-course",className:"cm-btn cm-btn-primary",children:[(0,a.jsx)(n.OvN,{})," Create New Course"]}),(0,a.jsxs)(i.rU,{to:"/admin/course-categories",className:"cm-btn cm-btn-secondary",children:[(0,a.jsx)(n.QoU,{})," Category Hierarchy"]})]})]}),(0,a.jsxs)("div",{className:"cm-kpi-grid",children:[(0,a.jsxs)("div",{className:"cm-kpi-card",children:[(0,a.jsx)("div",{className:"cm-kpi-icon blue",children:(0,a.jsx)(n.yG,{})}),(0,a.jsxs)("div",{className:"cm-kpi-info",children:[(0,a.jsx)("h4",{children:"Total Courses"}),(0,a.jsx)("p",{className:"cm-kpi-num",children:u})]})]}),(0,a.jsxs)("div",{className:"cm-kpi-card",children:[(0,a.jsx)("div",{className:"cm-kpi-icon green",children:(0,a.jsx)(n._rq,{})}),(0,a.jsxs)("div",{className:"cm-kpi-info",children:[(0,a.jsx)("h4",{children:"Published Live"}),(0,a.jsx)("p",{className:"cm-kpi-num",children:I})]})]}),(0,a.jsxs)("div",{className:"cm-kpi-card",children:[(0,a.jsx)("div",{className:"cm-kpi-icon amber",children:(0,a.jsx)(n.bcx,{})}),(0,a.jsxs)("div",{className:"cm-kpi-info",children:[(0,a.jsx)("h4",{children:"Draft / Hidden"}),(0,a.jsx)("p",{className:"cm-kpi-num",children:L})]})]}),(0,a.jsxs)("div",{className:"cm-kpi-card",children:[(0,a.jsx)("div",{className:"cm-kpi-icon purple",children:(0,a.jsx)(n.QoU,{})}),(0,a.jsxs)("div",{className:"cm-kpi-info",children:[(0,a.jsx)("h4",{children:"Total Categories"}),(0,a.jsx)("p",{className:"cm-kpi-num",children:t.length})]})]})]}),k&&(0,a.jsxs)("div",{style:{padding:"0.9rem 1.25rem",background:"#dcfce7",color:"#15803d",borderRadius:12,marginBottom:"1.25rem",fontWeight:600,display:"flex",alignItems:"center",gap:8},children:[(0,a.jsx)(n.UgA,{})," ",k]}),_&&(0,a.jsx)("div",{style:{padding:"0.9rem 1.25rem",background:"#fee2e2",color:"#b91c1c",borderRadius:12,marginBottom:"1.25rem",fontWeight:600},children:_}),(0,a.jsxs)("div",{className:"cm-filter-bar",children:[(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),g(1),T()},style:{display:"flex",flex:1,gap:"0.75rem",minWidth:280},children:[(0,a.jsxs)("div",{className:"cm-search-input",children:[(0,a.jsx)(n.jRj,{className:"cm-search-icon"}),(0,a.jsx)("input",{type:"text",placeholder:"Search course title, keyword, slug...",value:p,onChange:e=>b(e.target.value)})]}),(0,a.jsx)("button",{type:"submit",className:"cm-btn cm-btn-secondary",children:"Search"})]}),(0,a.jsxs)("select",{className:"cm-select-filter",value:y,onChange:e=>{f(e.target.value),g(1)},children:[(0,a.jsx)("option",{value:"",children:"All Categories"}),t.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.category," (",e.medium,")"]},e.id))]}),(0,a.jsxs)("select",{className:"cm-select-filter",value:C,onChange:e=>{S(e.target.value),g(1)},children:[(0,a.jsx)("option",{value:"all",children:"All Languages"}),(0,a.jsx)("option",{value:"English",children:"English"}),(0,a.jsx)("option",{value:"Hindi",children:"Hindi"})]}),(0,a.jsxs)("select",{className:"cm-select-filter",value:v,onCh
1ange:e=>{N(e.target.value),g(1)},children:[(0,a.jsx)("option",{value:"all",children:"All Status"}),(0,a.jsx)("option",{value:"published",children:"Published"}),(0,a.jsx)("option",{value:"draft",children:"Draft"})]})]}),(0,a.jsxs)("div",{className:"cm-card",children:[(0,a.jsx)("div",{className:"cm-table-wrapper",children:(0,a.jsxs)("table",{className:"cm-table",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{children:"Course Info"}),(0,a.jsx)("th",{children:"Category Placement"}),(0,a.jsx)("th",{children:"Language"}),(0,a.jsx)("th",{children:"Pricing & Batches"}),(0,a.jsx)("th",{children:"Start Date"}),(0,a.jsx)("th",{children:"Status"}),(0,a.jsx)("th",{style:{textAlign:"right"},children:"Actions"})]})}),(0,a.jsx)("tbody",{children:m?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:7,style:{textAlign:"center",padding:"3.5rem",color:"#64748b"},children:"Loading courses from database..."})}):0===e.length?(0,a.jsx)("tr",{children:(0,a.jsx)("td",{colSpan:7,style:{textAlign:"center",padding:"3.5rem",color:"#64748b"},children:"No courses found matching your search."})}):e.map(e=>(0,a.jsxs)("tr",{children:[(0,a.jsxs)("td",{style:{maxWidth:320},children:[(0,a.jsx)("div",{style:{fontWeight:700,color:"#0f172a",fontSize:"0.95rem",marginBottom:3},children:e.title}),e.tagline&&(0,a.jsx)("div",{style:{fontSize:"0.78rem",color:"#2563eb",fontWeight:500,marginBottom:2},children:e.tagline}),(0,a.jsxs)("div",{style:{fontSize:"0.75rem",color:"#94a3b8"},children:["Slug: /courses/",e.slug||`course-${e.id}`]})]}),(0,a.jsx)("td",{children:(0,a.jsxs)("span",{className:"cm-cat-badge",children:[e.parent_category_name?`${e.parent_category_name} > `:"",e.category_name||e.category||"Unassigned"]})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{style:{fontWeight:600,color:"#475569"},children:e.lang})}),(0,a.jsx)("td",{children:(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{style:{fontWeight:800,color:"#16a34a",fontSize:"0.95rem"},children:e.min_price?`₹${Number(e.min_price).toLocaleString("en-IN")}`:"Free / Enquiry"}),(0,a.jsxs)("span",{style:{fontSize:"0.76rem",color:"#64748b"},children:[e.batches_count||0," Batch mode(s)"]})]})}),(0,a.jsx)("td",{children:(0,a.jsx)("span",{style:{fontSize:"0.85rem",color:"#475569",fontWeight:500},children:e.start_date||"-"})}),(0,a.jsx)("td",{children:(0,a.jsx)("button",{onClick:()=>E(e),className:`cm-status-badge cm-status-${e.status||"published"}`,style:{cursor:"pointer",border:"none"},title:"Click to toggle publish status",children:e.status||"published"})}),(0,a.jsx)("td",{style:{textAlign:"right"},children:(0,a.jsxs)("div",{className:"cm-actions-group",style:{justifyContent:"flex-end"},children:[(0,a.jsxs)("button",{onClick:()=>{W(e),U(e.category_id?String(e.category_id):"")},className:"cm-btn cm-btn-secondary cm-btn-sm",title:"Move Course to another Category",children:[(0,a.jsx)(n.uWH,{})," Move"]}),(0,a.jsxs)(i.rU,{to:`/admin/edit-course/${e.id}`,className:"cm-btn cm-btn-secondary cm-btn-sm",children:[(0,a.jsx)(n.IYd,{})," Edit"]}),(0,a.jsx)("button",{onClick:()=>B(e),className:"cm-btn cm-btn-danger cm-btn-sm",children:(0,a.jsx)(n.Ybf,{})})]})})]},e.id))})]})}),H>1&&(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"1rem 1.5rem",borderTop:"1px solid #e2e8f0",background:"#f8fafc"},children:[(0,a.jsxs)("span",{style:{fontSize:"0.85rem",color:"#64748b",fontWeight:500},children:["Showing Page ",j," of ",H," (",u," total courses)"]}),(0,a.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,a.jsx)("button",{disabled:j<=1,onClick:()=>g(e=>Math.max(1,e-1)),className:"cm-btn cm-btn-secondary cm-btn-sm",children:"Previous"}),(0,a.jsx)("button",{disabled:j>=H,onClick:()=>g(e=>Math.min(H,e+1)),className:"cm-btn cm-btn-secondary cm-btn-sm",children:"Next"})]})]})]}),M&&(0,a.jsx)("div",{className:"cm-modal-overlay",onClick:()=>W(null),children:(0,a.jsxs)("div",{className:"cm-modal-content",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"cm-modal-header",children:[(0,a.jsx)("h3",{children:"Move Course"}),(0,a.jsx)("button",{className:"cm-modal-close",onClick:()=>W(null),children:(0,a.jsx)(n.q5L,{})})]}),(0,a.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,a.jsxs)("p",{style:{color:"#475569",fontSize:"0.92rem",lineHeight:1.5},children:["Select the Category or Subcategory where you want to place:",(0,a.jsx)("br",{}),(0,a.jsxs)("strong",{style:{color:"#0f172a",fontSize:"1rem"},children:['"',M.title,'"']})]}),(0,a.jsxs)("div",{className:"cm-form-group",style:{marginTop:"1.25rem"},children:[(0,a.jsx)("label",{children:"Select Target Category / Subcategory"}),(0,a.jsxs)("select",{value:z,onChange:e=>U(e.target.value),children:[(0,a.jsx)("option",{value:"",children:"-- Choose Category --"}),t.map(e=>(0,a.jsxs)("option",{value:e.id,children:[e.category," (",e.medium,")"]},e.id))]})]})]}),(0,a.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:12},children:[(0,a.jsx)("button",{type:"button",className:"cm-btn cm-btn-secondary",onClick:()=>W(null),children:"Cancel"}),(0,a.jsxs)("button",{type:"button",className:"cm-btn cm-btn-primary",onClick:P,disabled:!z,children:[(0,a.jsx)(n.UgA,{})," Move Course"]})]})]})})]})})}}}]);

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.