1import{c as b,r as l,Q as g,j as e,X as f}from"./index-GIzFOf59.js";import{C as N}from"./circle-check-big-nBaZdbMQ.js";import{S as j}from"./square-pen-DVRyExfc.js";import{S as y}from"./save-0CJs3sa5.js";const C=()=>{const{profile:n,updateProfile:r}=b(),[o,i]=l.useState(!1),[t,d]=l.useState({firstName:"",lastName:"",email:"",phone:""}),[m,c]=l.useState(t);l.useEffect(()=>{const s=n.data?.user||g.get("user");if(s){const a={firstName:s.firstName||"",lastName:s.lastName||"",email:s.email||"",phone:s.phone||""};d(a),c(a)}},[n.data]);const x=(s,a)=>{d(h=>({...h,[s]:a}))},u=async()=>{try{await r.mutateAsync(t),i(!1),c(t)}catch(s){console.error("Failed to update profile:",s)}},p=()=>{d(m),i(!1)};return e.jsxs("div",{className:"p-4 md:p-6 lg:p-8 max-w-7xl mx-auto",children:[e.jsx("h1",{className:"text-3xl font-semibold text-slate-900 mb-6",children:"Crew Member Settings"}),!o&&e.jsxs("div",{className:"mb-6 p-4 rounded-lg bg-emerald-50 border border-emerald-200 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(N,{className:"w-5 h-5 text-emerald-600"}),e.jsx("p",{className:"text-sm text-emerald-900",children:"Your settings are up to date."})]}),e.jsxs("button",{onClick:()=>i(!0),className:"flex items-center gap-2 px-4 py-2 text-sm font-medium text-emerald-700 border border-emerald-300 rounded-lg hover:bg-emerald-100 transition-colors",children:[e.jsx(j,{className:"w-4 h-4"}),"Edit Settings"]})]}),e.jsxs("div",{className:"bg-white rounded-xl shadow-sm border border-slate-200 p-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-6",children:"Personal Information"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"firstName",className:"block text-sm font-medium text-slate-700",children:"First Name"}),e.jsx("input",{type:"text",id:"firstName",value:t.firstName,disabled:!0,className:"w-full px-4 py-2.5 rounded-lg border border-slate-300 bg-gray-100 text-slate-600 cursor-not-allowed transition-colors",placeholder:"Enter first name"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Name cannot be changed"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"lastName",className:"block text-sm font-medium text-slate-700",children:"Last Name"}),e.jsx("input",{type:"text",id:"lastName",value:t.lastName,disabled:!0,className:"w-full px-4 py-2.5 rounded-lg border border-slate-300 bg-gray-100 text-slate-600 cursor-not-allowed transition-colors",placeholder:"Enter last name"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Name cannot be changed"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-slate-700",children:"Email Address"}),e.jsx("input",{type:"email",id:"email",value:t.email,disabled:!0,className:"w-full px-4 py-2.5 rounded-lg border border-slate-300 bg-slate-50 text-slate-900 placeholder-slate-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/20 focus:bg-white disabled:opacity-60 disabled:cursor-not-allowed transition-colors",placeholder:"[email protected]"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"phone",className:"block text-sm font-medium text-slate-700",children:"Phone Number"}),e.jsx("input",{type:"tel",id:"phone",value:t.phone,onChange:s=>x("phone",s.target.value),disabled:!o,className:"w-full px-4 py-2.5 rounded-lg border border-slate-300 bg-slate-50 text-slate-900 placeholder-slate-400 focus:border-sky-500 focus:ring-2 focus:ring-sky-500/20 focus:bg-white disabled:opacity-60 disabled:cursor-not-allowed transition-colors",placeholder:"Enter phone number"})]})]})]}),o&&e.jsxs("div",{className:"mt-6 flex items-center justify-end gap-4",children:[e.jsxs("button",{onClick:p,className:"flex items-center gap-2 px-6 py-2.5 text-sm font-medium text-slate-700 bg-white border border-slate-300 rounded-lg hover:bg-slate-50 transition-colors",children:[e.jsx(f,{className:"w-4 h-4"}),"Cancel"]}),e.jsxs("button",{onClick:u,disabled:r.isPending,className:"flex items-center gap-2 px-6 py-2.5 text-sm font-medium text-white bg-sky-600 rounded-lg hover:bg-sky-700 disabled:opacity-60 disabled:cursor-not-allowed shadow-sm transition-colors",children:[e.jsx(y,{className:"w-4 h-4"}),r.isPending?"Saving...":"Save Changes"]})]})]})};export{C as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.