(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2288],{12917:function(e,r,t){Promise.resolve().then(t.bind(t,53853))},58064:function(e,r,t){"use strict";Object.defineProperty(r,"$",{enumerable:!0,get:function(){return n}});let s=t(74590);function n(e){let{createServerReference:r}=t(6671);return r(e,s.callServer)}},53853:function(e,r,t){"use strict";t.d(r,{default:function(){return o}});var s=t(57437),n=t(2265),i=t(16463);t(74590);var l=t(58064),c=(0,l.$)("2da71732094c165c6cf923febb508bd2328939c6"),a=(0,l.$)("c6c42058dcc71677248d5560748caa4ab4ac09c7"),d=t(95956);function o(){let[e,r]=(0,n.useState)(null),[t,l]=(0,n.useState)(!1),o=(0,i.useRouter)();(0,n.useEffect)(()=>{a().then(e=>{r(e.isInitialized)})},[]);let u=async()=>{l(!0);try{let e=await c();e.success?(d.Am.success("Academic structure initialized successfully!"),r(!0),o.refresh()):e.alreadyInitialized?(d.Am.info("System is already initialized."),r(!0)):d.Am.error(e.error||"Initialization failed")}catch(e){d.Am.error("An unexpected error occurred")}finally{l(!1)}};return null===e?(0,s.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,s.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-green-600"})}):(0,s.jsx)("div",{className:"max-w-2xl mx-auto",children:e?(0,s.jsxs)("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 border border-green-200 rounded-2xl p-8 text-center",children:[(0,s.jsx)("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,s.jsx)("svg",{className:"w-8 h-8 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),(0,s.jsx)("h2",{className:"text-2xl font-bold text-green-800 mb-2",children:"System Already Initialized"}),(0,s.jsx)("p",{className:"text-green-600 mb-6",children:"The academic structure has been set up. All Section Groups, Grades, Classes, and Subjects are configured."}),(0,s.jsxs)("div",{className:"flex gap-4 justify-center",children:[(0,s.jsx)("a",{href:"/admin/academic-operations/setup",className:"px-6 py-2 bg-white text-green-700 rounded-lg border border-green-300 hover:bg-green-50 transition-colors font-medium",children:"View Classes"}),(0,s.jsx)("a",{href:"/admin/list/students",className:"px-6 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors font-medium",children:"Add Students"})]})]}):(0,s.jsxs)("div",{className:"bg-gradient-to-br from-amber-50 to-yellow-50 border border-amber-200 rounded-2xl p-8 text-center",children:[(0,s.jsx)("div",{className:"w-16 h-16 bg-amber-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,s.jsx)("svg",{className:"w-8 h-8 text-amber-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),(0,s.jsx)("h2",{className:"text-2xl font-bold text-amber-800 mb-2",children:"Academic Structure Not Initialized"}),(0,s.jsx)("p",{className:"text-amber-600 mb-4",children:"Click below to set up the complete academic structure:"}),(0,s.jsxs)("div",{className:"bg-white/60 rounded-lg p-4 mb-6 text-left text-sm text-gray-700",children:[(0,s.jsx)("p",{className:"font-semibold mb-2",children:"This will create:"}),(0,s.jsxs)("ul",{className:"list-disc list-inside space-y-1",children:[(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Section Groups:"})," College Section, Senior Section"]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Grades:"})," 9th, 10th, 11th, 12th"]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Subjects:"})," All required subjects (9 total)"]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Classes:"})," 17 classes with correct programs"]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"Subject Mappings:"})," Per class as per specification"]})]})]}),(0,s.jsx)("button",{onClick:u,disabled:t,className:"px-8 py-3 bg-gradient-to-r from-green-600 to-emerald-600 text-white rounded-lg hover:from-green-700 hover:to-emerald-700 transition-all font-bold text-lg shadow-lg hover:shadow-xl disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 mx-auto",children:t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"animate-spin rounded-full h-5 w-5 border-b-2 border-white"}),"Initializing..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),"Initialize Full Academic Structure"]})})]})})}}},function(e){e.O(0,[5945,2971,7023,1744],function(){return e(e.s=12917)}),_N_E=e.O()}]);