1import{r as h,j as e,c as E,a as B,b as U,d as O}from"./index-CzmJM_YO.js";import{L as b,a as F,b as I,c as R,F as D}from"./layout-TYnrk8G2.js";import{C as o,a as l,b as p,c as j,d as f}from"./card-BScvVoSC.js";import{c as M,B as c}from"./button-B2gaLUmu.js";import{B as y}from"./badge-BebfJ1g7.js";import{T as z,a as H,b as N,c as g}from"./tabs-Di9FoOAf.js";import{L as w}from"./loader-circle-D9ScIJf0.js";import{U as V}from"./user-BmPmeBj2.js";import{C}from"./calendar-CL_QJG96.js";import{F as Y}from"./file-text-C-Xpw6rr.js";import{S as $}from"./settings-B59Njn9h.js";import{L as q}from"./log-out-CBDkFA14.js";import{S as Z}from"./sun-DT9fZbVl.js";import{B as K}from"./building-2-Cx4NIH1V.js";import{Z as Q}from"./zap-yimKpgJh.js";import{H as W}from"./house-CfWW9YvN.js";import{f as _}from"./format-BvTdJDIw.js";import"./dialog-kKOEf6VN.js";import"./index-PqVQnQtK.js";import"./index-d8g4igqy.js";import"./adviser-callback-booking-DItmzqEm.js";import"./input-2nGTnjxV.js";import"./label-BRujE6Hs.js";import"./textarea-BXkVEcL_.js";import"./checkbox-DrUWVPwR.js";import"./index-ClF_vpwU.js";import"./check--VzGE8M0.js";import"./select-BtcNnZZK.js";import"./index-BdQq_4o_.js";import"./index-Cj0Cher6.js";import"./chevron-down-D5Kn0jyO.js";import"./chevron-up-DwQXqafC.js";import"./index-BVBcwF4m.js";import"./address-autocomplete-Dl1-asEH.js";import"./map-pin-CAl7KMLz.js";import"./public-booking-availability-D6yfAzUh.js";import"./subMonths-BcMqcARP.js";import"./endOfMonth-Dc5d4tmj.js";import"./chevron-left-t5qu0JMd.js";import"./phone-BFA3oW6s.js";import"./download-YSIbFRxZ.js";import"./search-Md3td_G4.js";import"./chevron-right-uKqayVl5.js";import"./radio-group-tlns-sRR.js";import"./index-BdRc1Epc.js";import"./circle-BNQWaiyl.js";import"./zod-gQskRRti.js";import"./arrow-right-DhWjwd5A.js";import"./types-DqHNHyJ7.js";import"./dropdown-menu-CpHtnbPp.js";import"./menu-B9IyItu0.js";var G=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],J=G.reduce((t,s)=>{const n=M(`Primitive.${s}`),a=h.forwardRef((m,r)=>{const{asChild:d,...x}=m,v=d?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(v,{...x,ref:r})});return a.displayName=`Primitive.${s}`,{...t,[s]:a}},{}),X="Separator",k="horizontal",ee=["horizontal","vertical"],P=h.forwardRef((t,s)=>{const{decorative:n,orientation:a=k,...m}=t,r=se(a)?a:k,x=n?{role:"none"}:{"aria-orientation":r==="vertical"?r:void 0,role:"separator"};return e.jsx(J.div,{"data-orientation":r,...x,...m,ref:s})});P.displayName=X;function se(t){return ee.includes(t)}var S=P;const u=h.forwardRef(({className:t,orientation:s="horizontal",decorative:n=!0,...a},m)=>e.jsx(S,{ref:m,decorative:n,orientation:s,className:E("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...a}));u.displayName=S.displayName;function Xe(){const[,t]=B(),{user:s,isAuthenticated:n,isLoading:a,logout:m}=U(),[r,d]=h.useState("bookings");h.useEffect(()=>{!a&&!n&&t("/login")},[a,n,t]);const{data:x,isLoading:v}=O({queryKey:["customer","bookings"],queryFn:async()=>{const i=await fetch("/api/customer/bookings",{credentials:"include"});return i.ok?i.json():[]},enabled:n}),A=async()=>{await m(),t("/")};if(a)return e.jsx(b,{children:e.jsx("div",{className:"min-h-[60vh] flex items-center justify-center",children:e.jsx(w,{className:"h-8 w-8 animate-spin text-primary"})})});if(!s)return null;const L=()=>{const i=s.firstName?.[0]||"",T=s.lastName?.[0]||"";return(i+T).toUpperCase()||s.username[0].toUpperCase()};return e.jsx(b,{children:e.jsx("div",{className:"container mx-auto px-4 py-8 max-w-6xl pt-24",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-6",children:[e.jsx("div",{className:"lg:col-span-1",children:e.jsx(o,{children:e.jsxs(l,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsxs(F,{className:"h-20 w-20 mb-4",children:[e.jsx(I,{src:s.avatarUrl||void 0}),e.jsx(R,{className:"text-2xl bg-primary text-primary-foreground",children:L()})]}),e.jsxs("h2",{className:"text-xl font-semibold","data-testid":"text-user-name",children:[s.firstName," ",s.lastName]}),e.jsx("p",{className:"text-sm text-muted-foreground","data-testid":"text-user-email",children:s.email}),e.jsx(y,{variant:"secondary",className:"mt-2","data-testid":"badge-user-role",children:"Customer"})]}),e.jsx(u,{className:"my-6"}),e.jsxs("nav",{className:"space-y-2",children:[e.jsxs(c,{variant:r==="profile"?"secondary":"ghost",className:"w-full justify-start gap-2",onClick:()=>d("profile"),children:[e.jsx(V,{className:"h-4 w-4"}),"Profile"]}),e.jsxs(c,{variant:r==="bookings"?"secondary":"ghost",className:"w-full justify-start gap-2",onClick:()=>d("bookings"),children:[e.jsx(C,{className:"h-4 w-4"}),"My Bookings"]}),e.jsxs(c,{variant:r==="plans"?"secondary":"ghost",className:"w-full justify-start gap-2",onClick:()=>d("plans"),children:[e.jsx(Y,{className:"h-4 w-4"}),"My Plans"]}),e.jsxs(c,{variant:r==="settings"?"secondary":"ghost",className:"w-full justify-start gap-2",onClick:()=>d("settings"),children:[e.jsx($,{className:"h-4 w-4"}),"Settings"]}),e.jsx(u,{className:"my-2"}),e.jsxs(c,{variant:"ghost",className:"w-full justify-start gap-2 text-red-600 hover:text-red-700 hover:bg-red-50",onClick:A,"data-testid":"button-logout",children:[e.jsx(q,{className:"h-4 w-4"}),"Sign out"]})]})]})})}),e.jsxs("div",{className:"lg:col-span-3",children:[e.jsxs("div",{className:"mb-6",children:[e.jsxs("h1",{className:"text-3xl font-bold","data-testid":"text-dashboard-title",children:["Welcome back, ",s.firstName,"!"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Here's an overview of your energy efficie
1ncy journey"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",children:[e.jsx(o,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t("/solutions/solar"),children:e.jsxs(l,{className:"pt-4 text-center",children:[e.jsx(Z,{className:"h-8 w-8 mx-auto mb-2 text-yellow-500"}),e.jsx("p",{className:"text-sm font-medium",children:"Solar"})]})}),e.jsx(o,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t("/solutions/heating"),children:e.jsxs(l,{className:"pt-4 text-center",children:[e.jsx(D,{className:"h-8 w-8 mx-auto mb-2 text-orange-500"}),e.jsx("p",{className:"text-sm font-medium",children:"Heating"})]})}),e.jsx(o,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t("/solutions/insulation"),children:e.jsxs(l,{className:"pt-4 text-center",children:[e.jsx(K,{className:"h-8 w-8 mx-auto mb-2 text-blue-500"}),e.jsx("p",{className:"text-sm font-medium",children:"Insulation"})]})}),e.jsx(o,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t("/solutions/ev-charging"),children:e.jsxs(l,{className:"pt-4 text-center",children:[e.jsx(Q,{className:"h-8 w-8 mx-auto mb-2 text-green-500"}),e.jsx("p",{className:"text-sm font-medium",children:"EV Charging"})]})})]}),e.jsxs(z,{value:r,onValueChange:d,className:"space-y-4",children:[e.jsxs(H,{
1children:[e.jsx(N,{value:"bookings","data-testid":"tab-bookings",children:"My Bookings"}),e.jsx(N,{value:"plans","data-testid":"tab-plans",children:"My Plans"}),e.jsx(N,{value:"profile","data-testid":"tab-profile",children:"Profile"}),e.jsx(N,{value:"settings","data-testid":"tab-settings",children:"Settings"})]}),e.jsx(g,{value:"bookings",children:e.jsxs(o,{children:[e.jsxs(p,{children:[e.jsx(j,{children:"Upcoming Bookings"}),e.jsx(f,{children:"Your scheduled assessments and appointments"})]}),e.jsx(l,{children:v?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(w,{className:"h-6 w-6 animate-spin"})}):x&&x.length>0?e.jsx("div",{className:"space-y-4",children:x.map(i=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:i.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:_(new Date(i.scheduledAt),"PPP 'at' p")})]}),e.jsx(y,{variant:i.status==="completed"?"secondary":"default",children:i.status})]},i.id))}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx(C,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"font-medium mb-2",children:"No bookings yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Schedule a free assessment to start your energy efficiency journey"}),e.jsx(c,{onClick:()=>t("/plan-builder"),"data-testid":"button-book-assessment",children:"Book Assessment"})]})})]})}),e.jsx(g,{value:"plans",children:e.jsxs(o,{children:[e.jsxs(p,{children:[e.jsx(j,{children:"Saved Plans"}),e.jsx(f,{children:"Your custom energy efficiency plans"})]}),e.jsx(l,{children:e.jsxs("div",{className:"text-center py-8",children:[e.jsx(W,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"font-medium mb-2",children:"No saved plans"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Use our plan builder to create a custom energy efficiency plan for your home"}),e.jsx(c,{onClick:()=>t("/plan-builder"),"data-testid":"button-create-plan",children:"Create Your Plan"})]})})]})}),e.jsx(g,{value:"profile",children:e.jsxs(o,{children:[e.jsxs(p,{children:[e.jsx(j,{children:"Profile Information"}),e.jsx(f,{children:"Manage your account details"})]}),e.jsx(l,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"First Name"}),e.jsx("p",{className:"mt-1","data-testid":"profile-first-name",children:s.firstName})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Last Name"}),e.jsx("p",{className:"mt-1","data-testid":"profile-last-name",children:s.lastName||"-"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Email"}),e.jsx("p",{className:"mt-1","data-testid":"profile-email",children:s.email})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Username"}),e.jsx("p",{className:"mt-1","data-testid":"profile-username",children:s.username})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"Phone"}),e.jsx("p",{className:"mt-1","data-testid":"profile-phone",children:s.phone||"Not provided"})]})]})})]})}),e.jsx(g,{value:"settings",children:e.jsxs(o,{children:[e.jsxs(p,{children:[e.jsx(j,{children:"Account Settings"}),e.jsx(f,{children:"Manage your account preferences"})]}),e.jsx(l,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2",children:"Email Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Receive updates about your bookings and energy plans"})]}),e.jsx(u,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2",children:"Password"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Update your password to keep your account secure"}),e.jsx(c,{variant:"outline",size:"sm",children:"Change Password"})]}),e.jsx(u,{}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium mb-2 text-red-600",children:"Delete Account"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Permanently delete your account and all associated data"}),e.jsx(c,{variant:"destructive",size:"sm",children:"Delete Account"})]})]})})]})})]})]})]})})})}export{Xe 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.