Files
doormile_crm_build/dist/assets/Login-yAAi8q2k.js

2 lines
4.0 KiB
JavaScript

import{aq as f,b as a,j as e,B as t,ar as j,T as r,S as g,I as v,as as y}from"./index-DpAn5wLF.js";import{d as w,a as S}from"./VisibilityOff-DwiupP03.js";import{C as k,L as I}from"./Link-Bme8npFv.js";import{T as u}from"./TextField-C0dUZvW0.js";import{I as C}from"./InputAdornment-BWnl4jqW.js";import{F as W,C as z}from"./FormControlLabel-DwXmo7ko.js";import{B as A}from"./Button-BGNvVfej.js";import"./SwitchBase-1TkNOx4a.js";const D="/assets/mid-mile-approach-Drwn-ig9.jpg";function _(){const b=f(),[s,h]=a.useState(!1),[n,p]=a.useState(""),[i,m]=a.useState(""),[l,d]=a.useState(""),c=async()=>{try{d("");const o=await y(n,i);localStorage.setItem("logged_in","true"),localStorage.setItem("auth_token",o.token),localStorage.setItem("user",JSON.stringify(o.user)),b("/dashboard")}catch(o){d(o.message||"Invalid email or password")}},x=o=>{o.key==="Enter"&&c()};return e.jsxs(t,{sx:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundImage:`url(${D})`,backgroundSize:"cover",backgroundPosition:"center",position:"relative","&::before":{content:'""',position:"absolute",inset:0,background:"linear-gradient(180deg, rgba(15,23,42,0.6) 0%, rgba(192, 18, 39, 0.8) 100%)",zIndex:1}},children:[e.jsxs(k,{sx:{position:"relative",zIndex:2,width:"100%",maxWidth:440,p:{xs:4,sm:5},m:2,background:"rgba(255, 255, 255, 0.85)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",border:"1px solid rgba(255, 255, 255, 0.5)",boxShadow:"0 24px 48px rgba(0,0,0,0.2)",borderRadius:4},children:[e.jsx(t,{sx:{mb:4,display:"flex",justifyContent:"center"},children:e.jsx(j,{})}),e.jsx(r,{variant:"h3",sx:{fontWeight:800,textAlign:"center",letterSpacing:"-0.5px",color:"#1e293b"},children:"Welcome back"}),e.jsx(r,{variant:"body1",sx:{mt:1,mb:4,textAlign:"center",color:"#475569"},children:"Sign in to your Doormile operations account."}),e.jsxs(g,{spacing:2.5,children:[e.jsxs(t,{children:[e.jsx(r,{variant:"subtitle2",sx:{mb:.75,color:"#334155",fontWeight:600},children:"Email"}),e.jsx(u,{fullWidth:!0,placeholder:"Enter your email address",value:n,onChange:o=>p(o.target.value),onKeyDown:x,sx:{"& .MuiOutlinedInput-root":{bgcolor:"rgba(255,255,255,0.6)",borderRadius:2,transition:"all 0.2s ease","&:hover":{bgcolor:"rgba(255,255,255,0.9)"},"&.Mui-focused":{bgcolor:"#fff",boxShadow:"0 4px 12px rgba(0,0,0,0.05)"}}}})]}),e.jsxs(t,{children:[e.jsx(r,{variant:"subtitle2",sx:{mb:.75,color:"#334155",fontWeight:600},children:"Password"}),e.jsx(u,{fullWidth:!0,type:s?"text":"password",placeholder:"Enter your password",value:i,onChange:o=>m(o.target.value),onKeyDown:x,sx:{"& .MuiOutlinedInput-root":{bgcolor:"rgba(255,255,255,0.6)",borderRadius:2,transition:"all 0.2s ease","&:hover":{bgcolor:"rgba(255,255,255,0.9)"},"&.Mui-focused":{bgcolor:"#fff",boxShadow:"0 4px 12px rgba(0,0,0,0.05)"}}},InputProps:{endAdornment:e.jsx(C,{position:"end",children:e.jsx(v,{onClick:()=>h(o=>!o),edge:"end",size:"small",children:s?e.jsx(w,{fontSize:"small",sx:{color:"#94a3b8"}}):e.jsx(S,{fontSize:"small",sx:{color:"#94a3b8"}})})})}})]}),e.jsxs(g,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(W,{control:e.jsx(z,{defaultChecked:!0,size:"small",sx:{color:"#cbd5e1","&.Mui-checked":{color:"primary.main"}}}),label:e.jsx(r,{variant:"body2",sx:{color:"#475569",fontWeight:500},children:"Remember me"})}),e.jsx(I,{href:"#",underline:"hover",variant:"body2",color:"primary",sx:{fontWeight:600},children:"Forgot password?"})]}),l&&e.jsx(r,{variant:"body2",color:"error",textAlign:"center",sx:{fontWeight:600},children:l}),e.jsx(A,{fullWidth:!0,size:"large",variant:"contained",onClick:c,sx:{mt:2,py:1.5,borderRadius:2,fontSize:"1.05rem",fontWeight:700,textTransform:"none",boxShadow:"0 8px 16px rgba(192, 18, 39, 0.25)","&:hover":{boxShadow:"0 12px 20px rgba(192, 18, 39, 0.35)"},transition:"box-shadow 0.2s ease"},children:"Sign In"})]})]}),e.jsx(t,{sx:{position:"absolute",bottom:20,zIndex:2},children:e.jsxs(r,{variant:"caption",sx:{color:"rgba(255,255,255,0.8)",fontSize:"0.8rem"},children:["© ",new Date().getFullYear()," Doormile Technologies. All rights reserved."]})})]})}export{_ as default};