(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2476],{963:function(e,s,t){Promise.resolve().then(t.bind(t,7186))},7186:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return u}});var r=t(7437),n=t(2265),a=t(9376);function u(){let[e,s]=(0,n.useState)(""),[t,u]=(0,n.useState)(""),[i,o]=(0,n.useState)(""),[l,d]=(0,n.useState)(!1),c=(0,a.useRouter)();async function m(s){s.preventDefault(),o(""),d(!0);try{let s=await fetch("/api/auth/sysadmin-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})}),r=await s.json();s.ok&&r.success?(c.push("/systemadmin"),c.refresh()):o(r.message||"Invalid credentials")}catch(e){o("An error occurred. Please try again.")}finally{d(!1)}}return(0,r.jsx)("div",{className:"min-h-[80vh] flex items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md",children:[(0,r.jsx)("h1",{className:"text-2xl font-bold text-center mb-8",children:"System Admin Login"}),(0,r.jsxs)("div",{className:"bg-white rounded-xl p-8 shadow-sm",children:[i&&(0,r.jsx)("div",{className:"bg-red-50 text-red-600 p-3 rounded-lg mb-4 text-sm",children:i}),(0,r.jsxs)("form",{onSubmit:m,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Username"}),(0,r.jsx)("input",{type:"text",value:e,onChange:e=>s(e.target.value),required:!0,className:"w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-gray-500 focus:border-transparent outline-none"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),(0,r.jsx)("input",{type:"password",value:t,onChange:e=>u(e.target.value),required:!0,className:"w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-gray-500 focus:border-transparent outline-none"})]}),(0,r.jsx)("button",{type:"submit",disabled:l,className:"w-full bg-gray-800 hover:bg-gray-900 disabled:bg-gray-400 text-white font-semibold px-6 py-3 rounded-lg transition-colors",children:l?"Logging in...":"Login"})]})]})]})})}},9376:function(e,s,t){"use strict";var r=t(5475);t.o(r,"useParams")&&t.d(s,{useParams:function(){return r.useParams}}),t.o(r,"usePathname")&&t.d(s,{usePathname:function(){return r.usePathname}}),t.o(r,"useRouter")&&t.d(s,{useRouter:function(){return r.useRouter}}),t.o(r,"useSearchParams")&&t.d(s,{useSearchParams:function(){return r.useSearchParams}})}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=963)}),_N_E=e.O()}]);