import{j as g,N as h,Y as u,H as l,K as p,E as s,L as f,B as j}from"./index-_9oFl1CS.js";import{i as b,k as N,j as v,T as w,p as _,q as i,o as n,C as k}from"./tabs-C0PjMUIJ.js";import{T as y,a as T,W as A}from"./TargetsPanel-CQ50-xD7.js";import{A as C}from"./arrow-left-Bau08B2B.js";import{M as E}from"./utensils-BKSpZcUV.js";import{T as I}from"./trending-up-531UL3kW.js";import"./label-DEMEvgd6.js";import"./card-Cp7hxujV.js";import"./textarea-Dkna8qAk.js";function W(){const{clientId:a}=g.useParams(),{user:r,loading:m,isAdmin:t}=h(),d=u(),[e,c]=l.useState(null);if(l.useEffect(()=>{!m&&(!r||!t)&&d({to:"/dashboard"})},[r,m,t,d]),l.useEffect(()=>{p.from("profiles").select("full_name,nickname,avatar_url,email,goal_weight_kg,height_cm,current_weight_kg").eq("id",a).maybeSingle().then(({data:x})=>c(x))},[a]),!r||!t)return null;const o=e?.nickname?`${e.nickname} (${e.full_name||"—"})`:e?.full_name||"Client";return s.jsx("main",{className:"bg-soft min-h-[calc(100svh-4rem)]",children:s.jsxs("div",{className:"container mx-auto px-3 sm:px-4 py-6 sm:py-8 max-w-5xl",children:[s.jsx(f,{to:"/admin",children:s.jsxs(j,{variant:"ghost",size:"sm",className:"mb-4 rounded-full -ml-2",children:[s.jsx(C,{className:"h-4 w-4 mr-1"})," Toți clienții"]})}),s.jsxs("header",{className:"relative overflow-hidden rounded-3xl border border-border bg-card p-5 sm:p-7 shadow-[var(--shadow-card)] mb-6",children:[s.jsx("div",{"aria-hidden":!0,className:"absolute -right-16 -top-16 h-56 w-56 rounded-full bg-primary/10 blur-3xl"}),s.jsxs("div",{className:"relative flex flex-col sm:flex-row sm:items-center gap-4 sm:gap-5",children:[s.jsxs(b,{className:"h-16 w-16 ring-2 ring-primary/15 ring-offset-2 ring-offset-card",children:[e?.avatar_url&&s.jsx(N,{src:e.avatar_url}),s.jsx(v,{className:"bg-primary/15 text-primary font-display font-bold text-lg",children:(e?.nickname||e?.full_name||"?").slice(0,2).toUpperCase()})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h1",{className:"font-display text-2xl sm:text-3xl font-bold tracking-tight break-words",children:o}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1 break-all",children:e?.email}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground font-num",children:[s.jsxs("span",{children:["Țintă:"," ",s.jsxs("b",{className:"text-foreground",children:[e?.goal_weight_kg??"—"," kg"]})]}),s.jsxs("span",{children:["Înălțime:"," ",s.jsxs("b",{className:"text-foreground",children:[e?.height_cm??"—"," cm"]})]}),s.jsxs("span",{children:["Curent:"," ",s.jsxs("b",{className:"text-foreground",children:[e?.current_weight_kg??"—"," kg"]})]})]})]})]})]}),s.jsxs(w,{defaultValue:"targets",children:[s.jsxs(_,{className:"w-full grid grid-cols-3 h-auto bg-card p-1.5 rounded-2xl border shadow-[var(--shadow-card)]",children:[s.jsxs(i,{value:"targets",className:"gap-1.5 text-xs sm:text-sm py-2.5 rounded-xl",children:[s.jsx(y,{className:"h-4 w-4"})," Ținte"]}),s.jsxs(i,{value:"chat",className:"gap-1.5 text-xs sm:text-sm py-2.5 rounded-xl",children:[s.jsx(E,{className:"h-4 w-4"})," Chat"]}),s.jsxs(i,{value:"weight",className:"gap-1.5 text-xs sm:text-sm py-2.5 rounded-xl",children:[s.jsx(I,{className:"h-4 w-4"})," Progres"]})]}),s.jsx(n,{value:"targets",className:"mt-5",children:s.jsx(T,{clientId:a,isAdmin:!0,currentUserId:r.id})}),s.jsx(n,{value:"chat",className:"mt-5",children:s.jsx(k,{clientId:a,currentUserId:r.id,isAdmin:!0})}),s.jsx(n,{value:"weight",className:"mt-5",children:s.jsx(A,{userId:a,canAdd:!1,goalKg:e?.goal_weight_kg})})]})]})})}export{W as component};
