PageSourceSearch

https://www.thestudyias.com/_next/static/chunks/1547.ac9bf5e84f3d3e57.js

js thestudyias.com collected 2026-10-01 14:59:27 UTC 5,363 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1547],{31547:function(e,s,t){t.r(s);var l=t(57437),a=t(2265),i=t(28784),n=t(14573),r=t(37996),c=t(56462),o=t(68289);s.default=()=>{let[e,s]=(0,a.useState)([]),[t,d]=(0,a.useState)([]),[h,u]=(0,a.useState)(!0),[b,g]=(0,a.useState)(""),[m,j]=(0,a.useState)(""),[x,p]=(0,a.useState)(0),[N]=(0,a.useState)(10),[f,y]=(0,a.useState)(0),[v,S]=(0,a.useState)(1),[C,w]=(0,a.useState)(null),[k,D]=(0,a.useState)(""),E=(0,i.s0)();(0,a.useEffect)(()=>{_()},[]),(0,a.useEffect)(()=>{$()},[x,N,C]);let _=async()=>{try{let e=await (0,o.TC)();e.responseObject&&d(e.responseObject)}catch(e){console.error("Error fetching categories:",e)}},$=async()=>{try{u(!0);let e=await (0,o.De)(x*N,N,"creation_date","DESC",C,k);if(e.responseObject){let{recordList:t,totalCount:l,pageCount:a}=e.responseObject;s(t||[]),y(l||0),S(a||1)}g("")}catch(e){console.error("Error loading blogs:",e),g("Failed to load blogs"),j("error")}finally{u(!1)}},A=e=>{let s=t.find(s=>String(s.id)===String(e));return s?s.category_name:"Unknown"},F=e=>{E(`/admin/edit-blog/${e}`)},B=async e=>{if(window.confirm("Are you sure you want to delete this blog?"))try{u(!0);let s=await (0,o.XD)(e),t=s?.errorMessage||"Deleted successfully";g(t),j("success"),await $()}catch(e){console.error("Error deleting blog:",e),g(e.message||"Failed to delete blog"),j("error")}finally{u(!1),setTimeout(()=>g(""),3e3)}},M=e=>{e>=0&&e<v&&p(e)},O=e=>{w(e),p(0)};return h&&0===e.length?(0,l.jsx)(c.Z,{title:"All Blogs",children:(0,l.jsxs)("div",{className:"loading-state",children:[(0,l.jsx)(r.dAq,{className:"spinner"})," Loading blogs..."]})}):(0,l.jsx)(c.Z,{title:"All Blogs",children:(0,l.jsxs)("div",{className:"all-blogs-container",children:[b&&(0,l.jsx)("div",{className:`message-alert ${m}`,children:b}),(0,l.jsxs)("div",{className:"blogs-header",children:[(0,l.jsxs)("h2",{children:["Blog Posts (",f,")"]}),(0,l.jsxs)("form",{onSubmit:e=>{e&&e.preventDefault(),p(0),$()},style:{display:"flex",gap:8,alignItems:"center"},children:[(0,l.jsx)("input",{placeholder:"Search blogs...",value:k,onChange:e=>{D(e.target.value)}}),(0,l.jsx)("button",{type:"submit",className:"submit-btn",children:"Search"})]}),(0,l.jsx)(n.rU,{to:"/admin/create-blog",className:"btn-create",style:{marginLeft:12},children:"+ Create New Blog"})]}),(0,l.jsx)("div",{className:"blogs-filters",children:(0,l.jsxs)("div",{className:"filter-group",children:[(0,l.jsx)("label",{children:"Filter by Status:"}),(0,l.jsxs)("div",{className:"filter-buttons",children:[(0,l.jsx)("button",{className:`filter-btn ${null===C?"active":""}`,onClick:()=>O(null),children:"All"}),(0,l.jsx)("button",{className:`filter-btn ${"published"===C?"active":""}`,onClick:()=>O("published"),children:"Published"}),(0,l.jsx)("button",{className:`filter-btn ${"draft"===C?"active":""}`,onClick:()=>O("draft"),children:"Draft"})]})]})}),0===e.length?(0,l.jsxs)("div",{className:"empty-state",children:[(0,l.jsx)("p",{children:"No blogs found"}),(0,l.jsx)(n.rU,{to:"/admin/create-blog",className:"btn-create-empty",children:"Create Your First Blog"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:"blogs-table-wrapper",children:(0,l.jsxs)("table",{className:"blogs-table",children:[(0,l.jsx)("thead",{children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{children:"Title"}),(0,l.jsx)("th",{children:"Category"}),(0,l.jsx)("th",{children:"Status"}),(0,l.jsx)("th",{children:"Created Date"}),(0,l.jsx)("th",{children:"Actions"})]})}),(0,l.jsx)("tbody",{children:e.map(e=>(0,l.jsxs)("tr",{children:[(0,l.jsx)("td",{className:"blog-title",children:(0,l.jsx)("span",{className:"title-text",children:e.title})}),(0,l.jsx)("td",{className:"blog-category",children:A(e.category_id)}),(0,l.jsx)("td",{className:"blog-status",children:(0,l.jsx)("span",{className:`status-badge ${e.status}`,children:"published"===e.status?"Published":"Draft"})}),(0,l.jsx)("td",{className:"blog-date",children:e.creation_date?new Date(e.creation_date).toLocaleDateString():"-"}),(0,l.jsxs)("td",{className:"blog-actions",children:[(0,l.jsxs)("button",{onClick:()=>F(e.id),className:"action-btn edit",title:"Edit blog",children:[(0,l.jsx)(r.IYd,{})," Edit"]}),(0,l.jsxs)("button",{onClick:()=>B(e.id),className:"action-btn delete",title:"Delete blog",children:[(0,l.jsx)(r.Ybf,{})," Delete"]})]})]},e.id))})]})}),(0,l.jsxs)("div",{className:"pagination-section",children:[(0,l.jsxs)("div",{className:"pagination-info",children:["Showing ",x*N+1," to"," ",Math.min((x+1)*N,f)," of ",f," blogs"]}),(0,l.jsxs)("div",{className:"pagination-controls",children:[(0,l.jsxs)("button",{onClick:()=>M(x-1),disabled:0===x||h,className:"pagination-btn",children:[(0,l.jsx)(r.YFh,{})," Previous"]}),(0,l.jsx)("div",{className:"pagination-numbers",children:(()=>{let e=x+1;if(v<=7)return Array.from({length:v},(e,s)=>s+1);let s=[1],t=Math.max(2,e-1),l=Math.min(v-1,e+1);t>2&&s.push("...");for(let e=t;e<=l;e+=1)s.push(e);return l<v-1&&s.push("..."),s.push(v),s})().map((e,s)=>"..."===e?(0,l.jsx)("span",{className:"pagination-gap",children:"..."},`dots-${s}`):(0,l.jsx)("button",{onClick:()=>p(Number(e)-1),className:`pagination-number ${x+1===Number(e)?"active":""}`,disabled:h,children:e},e))}),(0,l.jsxs)("button",{onClick:()=>M(x+1),disabled:x>=v-1||h,className:"pagination-btn",children:["Next ",(0,l.jsx)(r.Tfp,{})]})]})]})]})]})})}}}]);

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.