(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{48312:function(e,s,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return a(28405)}])},28405:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return o}});var i=a(85893);a(26185);var n=a(67294),t=a(25675),l=a.n(t),r=()=>{let[e,s]=(0,n.useState)(!1),[a,t]=(0,n.useState)(""),[r,o]=(0,n.useState)(""),[c,d]=(0,n.useState)(""),[u,h]=(0,n.useState)(""),p=async e=>{e.preventDefault();try{let e=await fetch("https://milimanibackend.sigraelfasolutions.com/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({email:a,password:r})}),s=await e.json().catch(()=>(console.error("Login: Failed to parse JSON"),{message:"Invalid server response"}));e.ok?window.location.href="/dashboard/admin":alert(s.message||"Invalid login credentials")}catch(e){console.error("Login fetch failed:",e),alert("Network error. Please try again later.")}},m=async e=>{e.preventDefault();try{let e=await fetch("https://milimanibackend.sigraelfasolutions.com/api/auth/signup",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({first_name:c,last_name:u,email:a,password:r})}),s=await e.json().catch(()=>(console.error("Signup: Failed to parse JSON"),{message:"Invalid server response"}));e.ok?window.location.href="/":alert(s.message||"Signup failed")}catch(e){console.error("Signup fetch failed:",e),alert("Network error. Please try again later.")}};return(0,i.jsxs)("div",{className:"login-container",children:[(0,i.jsxs)("div",{className:"login-left",children:[(0,i.jsx)("div",{className:"logo",children:(0,i.jsx)(l(),{src:"/AIC_logo.png",alt:"Logo"})}),(0,i.jsx)(l(),{src:"/login_Image.jpg",alt:"Login Visual",className:"login-image"})]}),(0,i.jsx)("div",{className:"login-right",children:(0,i.jsxs)("div",{className:"form-popup ".concat(e?"show-signup":""),children:[(0,i.jsxs)("div",{className:"form-box login ".concat(e?"":"active"),children:[(0,i.jsxs)("div",{className:"form-details",children:[(0,i.jsx)("h2",{children:"Welcome Back"}),(0,i.jsx)("p",{children:"Please log in using your personal information to stay connected with us."})]}),(0,i.jsxs)("div",{className:"form-content",children:[(0,i.jsx)("h2",{children:"LOGIN"}),(0,i.jsxs)("form",{onSubmit:p,children:[(0,i.jsxs)("div",{className:"input-field",children:[(0,i.jsx)("input",{type:"text",value:a,onChange:e=>t(e.target.value),required:!0}),(0,i.jsx)("label",{children:"Email"})]}),(0,i.jsxs)("div",{className:"input-field",children:[(0,i.jsx)("input",{type:"password",value:r,onChange:e=>o(e.target.value),required:!0}),(0,i.jsx)("label",{children:"Password"})]}),(0,i.jsx)("a",{href:"#",className:"forgot-pass-link",children:"Forgot password?"}),(0,i.jsx)("button",{type:"submit",children:"Log In"})]}),(0,i.jsxs)("div",{className:"bottom-link",children:["Don’t have an account?"," ",(0,i.jsx)("a",{href:"#",onClick:e=>{e.preventDefault(),s(!0)},children:"Signup"})]})]})]}),(0,i.jsxs)("div",{className:"form-box signup ".concat(e?"active":""),children:[(0,i.jsxs)("div",{className:"form-details",children:[(0,i.jsx)("h2",{children:"Create Account"}),(0,i.jsx)("p",{children:"To become a part of our community, please sign up using your personal information."})]}),(0,i.jsxs)("div",{className:"form-content",children:[(0,i.jsx)("h2",{children:"SIGNUP"}),(0,i.jsxs)("form",{onSubmit:m,children:[(0,i.jsxs)("div",{className:"input-field",children:[(0,i.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),required:!0}),(0,i.jsx)("label",{children:"First Name"})]}),(0,i.jsxs)("div",{className:"input-field",children:[(0,i.jsx)("input",{type:"text",value:u,onChange:e=>h(e.target.value),required:!0}),(0,i.jsx)("label",{children:"Last Name"})]}),(0,i.jsxs)("div",{className:"input-field",children:[(0,i.jsx)("input",{type:"text",value:a,onChange:e=>t(e.target.value),required:!0}),(0,i.jsx)("label",{children:"Email"})]}),(0,i.jsxs)("div",{className:"input-field",children:[(0,i.jsx)("input",{type:"password",value:r,onChange:e=>o(e.target.value),required:!0}),(0,i.jsx)("label",{children:"Password"})]}),(0,i.jsxs)("div",{className:"policy-text",children:[(0,i.jsx)("input",{type:"checkbox",id:"policy"}),(0,i.jsxs)("label",{htmlFor:"policy",children:["I agree to the"," ",(0,i.jsx)("a",{href:"#",className:"option",children:"Terms & Conditions"})]})]}),(0,i.jsx)("button",{type:"submit",children:"Sign Up"})]}),(0,i.jsxs)("div",{className:"bottom-link",children:["Already have an account?"," ",(0,i.jsx)("a",{href:"#",onClick:e=>{e.preventDefault(),s(!1)},children:"Login"})]})]})]})]})})]})},o=()=>(0,i.jsx)("div",{children:(0,i.jsx)(r,{})})},26185:function(){}},function(e){e.O(0,[675,888,774,179],function(){return e(e.s=48312)}),_N_E=e.O()}]);