(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,19140,(e,t,s)=>{t.exports=e.r(72586)},31459,e=>{"use strict";var t=e.i(36703),s=e.i(2286),a=e.i(19140);function l(){let[e,l]=(0,s.useState)(""),[r,i]=(0,s.useState)(""),[n,o]=(0,s.useState)(""),c=(0,a.useRouter)(),d=async t=>{t.preventDefault(),o("");try{let t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})});if(t.ok){let e=await t.json();"HR"===e.user.role?c.push("/dashboard/hr"):c.push("/dashboard/personnel")}else{let e=await t.json();o(e.error||"Kullanıcı adı ya da şifre hatalı")}}catch(e){console.error(e),o("Bir hata oluştu")}};return(0,t.jsx)("div",{className:"flex items-center justify-center min-h-screen bg-gray-100",children:(0,t.jsxs)("div",{className:"px-8 py-6 mt-4 text-left bg-white shadow-lg rounded-xl md:w-1/3 w-full max-w-md",children:[(0,t.jsx)("div",{className:"flex justify-center mb-4",children:(0,t.jsx)("img",{src:"/giris-ekrani-logo.png",alt:"Koruyucu OSGB Logo",className:"h-24 w-auto object-contain"})}),(0,t.jsx)("h3",{className:"text-2xl font-bold text-center text-gray-800",children:"İzin Yönetim Sistemi"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-center text-gray-400",children:"Hesabınıza giriş yapın"}),(0,t.jsx)("form",{onSubmit:d,children:(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("div",{className:"block","aria-label":"E-posta Adresi",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"E-posta"}),(0,t.jsx)("input",{type:"email",placeholder:"E-posta",className:"w-full px-4 py-2 mt-2 border rounded-md focus:outline-none focus:ring-1 focus:ring-blue-600 border-gray-300",value:e,onChange:e=>l(e.target.value),required:!0})]}),(0,t.jsxs)("div",{className:"mt-4 block","aria-label":"Şifre",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-slate-700 mb-1",children:"Şifre"}),(0,t.jsx)("input",{type:"password",placeholder:"Şifre",className:"w-full px-4 py-2 mt-2 border rounded-md focus:outline-none focus:ring-1 focus:ring-blue-600 border-gray-300",value:r,onChange:e=>i(e.target.value),required:!0})]}),n&&(0,t.jsx)("div",{className:"mb-4 text-center",children:(0,t.jsx)("p",{className:"text-[#E91E63] text-sm font-medium",children:n})}),(0,t.jsx)("div",{className:"flex items-baseline justify-between mt-6",children:(0,t.jsx)("button",{className:"px-6 py-2 text-white bg-[#0082ca] rounded-lg hover:bg-[#006bb3] w-full font-semibold transition-colors duration-200",children:"Giriş Yap"})})]})})]})})}e.s(["default",()=>l])}]);