1import{r as n,u as p,K as g,j as e}from"./index-BDIM6IFg.js";import{D as y}from"./DynamicContentSection-8-ov5TK7.js";function S(){const[s,f]=n.useState({year:"",imgSrc:"",pdfSrc:""}),[h,x]=n.useState(!0),[u,o]=n.useState([]),l=p(),d=g().pathname.split("/").filter(Boolean),m=d[d.length-1];return n.useEffect(()=>{const c=async()=>{try{const a=await fetch("https://iiitn.ac.in/api/media/media/category/fee");if(!a.ok)throw new Error("Failed to fetch academic fee data");const t=(await a.json()).find(r=>r.m_sub_category==="first_hostel_fee");if(t){const r={year:t.title,imgSrc:t==null?void 0:t.media_img_id,pdfSrc:t==null?void 0:t.media_doc_id};f(r)}else console.warn("No academic fee data found.")}catch(a){console.error("Error fetching academic fee data:",a)}finally{x(!1)}};(async()=>{try{const i=await(await fetch("https://iiitn.ac.in/api/card/cards/content_grouped")).json(),t=Object.keys(i).find(r=>r.replace(/^content_/,"").toLowerCase()===m);t?o(i[t]):(o([]),console.warn("No dynamic sections found for:",m))}catch(a){console.error("Error fetching dynamic sections:",a),o([])}})(),c()},[]),h?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-t-2 border-b-2 border-primary"})}):e.jsxs("div",{className:"bg-gray-100 min-h-screen flex flex-col",children:[e.jsx("header",{className:"bg-primary text-white py-14 text-center",children:e.jsx("h1",{className:"text-3xl font-bold",children:"First Year Hostel Fees"})}),e.jsxs("main",{className:"max-w-4xl mx-auto p-6 bg-white shadow-lg rounded-lg mt-8",children:[e.jsx("div",{className:"mb-10",children:e.jsx("div",{className:"flex-1 max-h-[600px] overflow-y-auto px-4 scrollbar-thin scrollbar-thumb-primary scrollbar-track-gray-200 scrollbar-thumb-rounded-full scrollbar-track-rounded-full",children:u.map(c=>e.jsx(y,{cid:c.c_id},c.c_id))})}),e.jsx("h2",{className:"text-xl font-semibold text-gray-800 text-center mb-4",children:s.year}),e.jsx("div",{className:"flex justify-center",children:s.imgSrc?e.jsx("img",{src:s.imgSrc,alt:`Hostel Fee Structure for ${s.year}`,className:"max-w-full h-auto rounded-lg shadow-md"}):s.pdfSrc?e.jsxs("a",{href:s.pdfSrc,className:"inline-block px-6 py-3 text-white bg-blue-600 rounded-lg shadow-lg hover:bg-blue-700 transition duration-300",target:"_blank",rel:"noopener noreferrer",children:[e.jsx("i",{className:"fas fa-file-pdf mr-2"})," Download PDF"]}):e.jsx("p",{className:"text-red-500",children:"No image or PDF available"})}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mt-6 justify-center",children:[e.jsx("p",{onClick:()=>l("/pages/hostelfee"),className:"bg-blue-600 text-white px-5 py-2 rounded-md text-center hover:bg-blue-700 transition",children:"View All Years Hostel Fee Structure"}),e.jsx("p",{onClick:()=>l("/pages/hostelfeepayment"),className:"bg-green-600 text-white px-5 py-2 rounded-md text-center hover:bg-green-700 transition",children:"Hostel Fee Payment Details"})]})]})]})}export{S as default};
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.