2 lines
34 KiB
JavaScript
2 lines
34 KiB
JavaScript
import{_ as ne}from"./15rOo9Uq.js";import{e as re,s as de,g as ue,c as n,a as e,t as l,F as L,d as p,k as m,j as _,r as N,y as d,z as c,C as S,I as F,K as ce,l as b,m as y,h as D,D as pe,o as r,b as me,w as _e}from"./BMplCfh_.js";const be={key:0,class:"flex items-center justify-center py-20"},xe={class:"flex flex-col items-center gap-3"},ve={class:"text-slate-400 text-sm"},he={key:1,class:"flex flex-col items-center justify-center py-20 text-center"},ge={class:"text-red-400 text-sm mb-2"},fe={class:"mb-8"},ke={class:"flex items-center justify-between"},we={class:"flex items-center gap-4"},ye={class:"flex items-center gap-3"},$e={class:"text-2xl font-bold text-white"},Ce={key:0,class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-500/10 text-yellow-400"},Me={class:"text-sm text-slate-400 mt-0.5"},je={key:0,class:"ml-2 text-slate-500"},Be={class:"flex items-center gap-3"},Ee={class:"border-b border-slate-700 mb-6"},ze={class:"flex gap-6"},Ve=["onClick"],Ue={key:0,class:"space-y-6"},Le={class:"bg-slate-800/50 border border-slate-700 rounded-xl p-6"},Se={class:"flex items-center gap-3 mb-5"},De={class:"text-base font-semibold text-white"},Ie={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},Re={class:"block text-xs text-slate-400 mb-1"},Ae={class:"text-sm text-white font-mono"},Ne={class:"block text-xs text-slate-400 mb-1"},Fe={class:"text-sm text-white"},Pe={class:"block text-xs text-slate-400 mb-1"},Te={class:"block text-xs text-slate-400 mb-1"},He={class:"text-sm text-white"},Oe={class:"block text-xs text-slate-400 mb-1"},Ge={class:"text-sm text-white"},Je={class:"block text-xs text-slate-400 mb-1"},Ke={class:"text-sm text-white capitalize"},qe={class:"block text-xs text-slate-400 mb-1"},Qe={class:"text-sm text-white uppercase"},We={class:"block text-xs text-slate-400 mb-1"},Xe={class:"text-sm text-white"},Ye={class:"block text-xs text-slate-400 mb-1"},Ze={class:"text-sm text-white"},et={class:"bg-slate-800/50 border border-slate-700 rounded-xl p-6"},tt={class:"flex items-center gap-3 mb-5"},st={class:"text-base font-semibold text-white"},lt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},ot={class:"block text-xs text-slate-400 mb-1"},at={class:"block text-xs text-slate-400 mb-1"},it={class:"text-sm text-white"},nt={class:"block text-xs text-slate-400 mb-1"},rt={class:"text-sm text-white"},dt={class:"block text-xs text-slate-400 mb-1"},ut={class:"text-sm text-white"},ct={class:"block text-xs text-slate-400 mb-1"},pt={class:"text-sm text-white"},mt={key:0,class:"bg-slate-800/50 border border-slate-700 rounded-xl p-6"},_t={class:"flex items-center gap-3 mb-5"},bt={class:"text-base font-semibold text-white"},xt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},vt={class:"block text-xs text-slate-400 mb-1"},ht={class:"text-sm text-white"},gt={class:"block text-xs text-slate-400 mb-1"},ft={class:"text-sm text-white"},kt={class:"block text-xs text-slate-400 mb-1"},wt={class:"text-sm text-white"},yt={class:"block text-xs text-slate-400 mb-1"},$t={class:"text-sm text-white"},Ct={class:"block text-xs text-slate-400 mb-1"},Mt={class:"text-sm text-white"},jt={class:"block text-xs text-slate-400 mb-1"},Bt={class:"text-sm text-white"},Et={key:0,class:"mt-6 pt-6 border-t border-slate-700"},zt={class:"text-sm font-semibold text-slate-300 mb-3"},Vt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},Ut={class:"block text-xs text-slate-400 mb-1"},Lt={class:"text-sm text-white"},St={class:"block text-xs text-slate-400 mb-1"},Dt={class:"text-sm text-white"},It={class:"block text-xs text-slate-400 mb-1"},Rt={class:"text-sm text-white"},At={class:"block text-xs text-slate-400 mb-1"},Nt={class:"text-sm text-white"},Ft={key:1,class:"bg-slate-800/50 border border-slate-700 rounded-xl p-6 text-center"},Pt={class:"text-sm text-slate-400"},Tt={key:1,class:"space-y-6"},Ht={class:"flex items-center justify-between"},Ot={class:"flex items-center gap-3"},Gt={class:"text-base font-semibold text-white"},Jt={class:"text-xs text-slate-400 mt-0.5"},Kt={key:0,class:"flex items-center justify-center py-12"},qt={key:1,class:"bg-slate-800/50 border border-slate-700 rounded-xl p-12 text-center"},Qt={class:"text-sm text-slate-400"},Wt={key:2,class:"bg-slate-800/50 border border-slate-700 rounded-xl overflow-hidden"},Xt={class:"overflow-x-auto"},Yt={class:"w-full text-sm"},Zt={class:"border-b border-slate-700"},es={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},ts={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},ss={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},ls={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},os={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},as={class:"px-4 py-3"},is={class:"px-4 py-3"},ns={class:"px-4 py-3"},rs={class:"px-4 py-3 text-slate-300 text-xs"},ds={class:"px-4 py-3"},us={key:0,class:"inline-flex items-center gap-1 text-xs text-emerald-400"},cs={key:1,class:"text-xs text-slate-500"},ps={key:2,class:"fixed inset-0 z-50 flex items-center justify-center p-4"},ms={class:"relative w-full max-w-2xl bg-slate-800 border border-slate-700 rounded-2xl shadow-2xl max-h-[90vh] overflow-hidden flex flex-col"},_s={class:"px-6 py-4 border-b border-slate-700 flex items-center justify-between flex-shrink-0"},bs={class:"text-lg font-semibold text-white"},xs={class:"flex-1 overflow-y-auto p-6 space-y-5"},vs={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},hs={class:"block text-xs font-medium text-slate-400 mb-1.5"},gs={class:"block text-xs font-medium text-slate-400 mb-1.5"},fs={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},ks={class:"block text-xs font-medium text-slate-400 mb-1.5"},ws={class:"block text-xs font-medium text-slate-400 mb-1.5"},ys={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},$s={class:"block text-xs font-medium text-slate-400 mb-1.5"},Cs={class:"block text-xs font-medium text-slate-400 mb-1.5"},Ms={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},js={class:"block text-xs font-medium text-slate-400 mb-1.5"},Bs={class:"block text-xs font-medium text-slate-400 mb-1.5"},Es={class:"flex items-center gap-6 pt-2"},zs={class:"flex items-center gap-2 cursor-pointer"},Vs={class:"text-sm text-slate-300"},Us={class:"flex items-center gap-2 cursor-pointer"},Ls={class:"text-sm text-slate-300"},Ss={class:"border-t border-slate-700 pt-5"},Ds={class:"text-sm font-semibold text-white mb-4"},Is={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Rs={class:"block text-xs font-medium text-slate-400 mb-1.5"},As={class:"block text-xs font-medium text-slate-400 mb-1.5"},Ns={class:"block text-xs font-medium text-slate-400 mb-1.5"},Fs={class:"block text-xs font-medium text-slate-400 mb-1.5"},Ps={class:"block text-xs font-medium text-slate-400 mb-1.5"},Ts={class:"block text-xs font-medium text-slate-400 mb-1.5"},Hs={class:"block text-xs font-medium text-slate-400 mb-1.5"},Os={class:"px-6 py-4 border-t border-slate-700 flex items-center justify-end gap-3 flex-shrink-0"},Gs=["disabled"],Js={key:0,class:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24"},Ks={class:"flex items-center gap-2"},qs={key:0,class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Qs={key:1,class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Zs=re({__name:"index",setup(Ws){const P=ce(),T=pe(),g=de(),B=P.params.id,E=b(!0),$=b(null),i=b(null),f=b([]),z=b(!1),C=b("profile"),V=b(!1),k=b(!1),a=b({email:"",preferred_language:"",region_code:"",preferred_currency:"",subscription_plan:"",subscription_expires_at:"",scope_level:"",scope_id:"",is_active:!0,is_vip:!1,person_last_name:"",person_first_name:"",person_phone:"",person_mothers_last_name:"",person_mothers_first_name:"",person_birth_place:"",person_birth_date:""}),h=b({show:!1,type:"success",message:""}),H=[{key:"profile",label:"users.details.profile_tab"},{key:"memberships",label:"users.details.memberships_tab"}],U=y(()=>{if(!i.value)return"";const t=i.value.person;return t?.last_name||t?.first_name?[t.last_name,t.first_name].filter(Boolean).join(" "):i.value.email||"User #"+i.value.id}),O=y(()=>i.value?{active:"Active",inactive:"Inactive",deleted:"Deleted",banned:"Banned"}[i.value.status?.toLowerCase()]||i.value.status||"Active":""),G=y(()=>i.value?{active:"bg-emerald-500/10 text-emerald-400",inactive:"bg-slate-500/10 text-slate-400",deleted:"bg-red-500/10 text-red-400",banned:"bg-red-500/10 text-red-400"}[i.value.status?.toLowerCase()]||"bg-emerald-500/10 text-emerald-400":""),J=y(()=>i.value?{active:"bg-emerald-400",inactive:"bg-slate-400",deleted:"bg-red-400",banned:"bg-red-400"}[i.value.status?.toLowerCase()]||"bg-emerald-400":""),K=y(()=>g.isAdmin?!0:!!g.user?.system_capabilities?.["users:edit"]);async function I(){E.value=!0,$.value=null;try{const u={Authorization:`Bearer ${(D("access_token").value||g.token||"").trim()}`,"Content-Type":"application/json"},o=await fetch(`/api/v1/admin/users/${B}`,{headers:u});if(!o.ok)throw o.status===404?new Error("User not found"):o.status===403?new Error("Access denied"):new Error(`Failed to fetch user: ${o.status}`);const x=await o.json();i.value=x,q()}catch(t){$.value=t.message||"Failed to load user details"}finally{E.value=!1}}async function q(){z.value=!0;try{const u={Authorization:`Bearer ${(D("access_token").value||g.token||"").trim()}`,"Content-Type":"application/json"},o=await fetch(`/api/v1/admin/users/${B}/memberships`,{headers:u});if(!o.ok)throw new Error(`Failed to fetch memberships: ${o.status}`);const x=await o.json();f.value=Array.isArray(x)?x:x.memberships||[]}catch(t){console.error("Memberships fetch error:",t),f.value=[]}finally{z.value=!1}}function Q(){if(!i.value)return;const t=i.value,s=t.person||{};a.value={email:t.email||"",preferred_language:t.preferred_language||"",region_code:t.region_code||"",preferred_currency:t.preferred_currency||"",subscription_plan:t.subscription_plan||"",subscription_expires_at:t.subscription_expires_at?t.subscription_expires_at.slice(0,16):"",scope_level:t.scope_level||"",scope_id:t.scope_id||"",is_active:t.status==="active",is_vip:t.is_vip||!1,person_last_name:s.last_name||"",person_first_name:s.first_name||"",person_phone:s.phone||"",person_mothers_last_name:s.mothers_last_name||"",person_mothers_first_name:s.mothers_first_name||"",person_birth_place:s.birth_place||"",person_birth_date:s.birth_date?s.birth_date.slice(0,10):""},V.value=!0}function M(){V.value=!1}async function W(){k.value=!0;try{const u={Authorization:`Bearer ${(D("access_token").value||g.token||"").trim()}`,"Content-Type":"application/json"},o={email:a.value.email||void 0,preferred_language:a.value.preferred_language||void 0,region_code:a.value.region_code||void 0,preferred_currency:a.value.preferred_currency||void 0,subscription_plan:a.value.subscription_plan||void 0,subscription_expires_at:a.value.subscription_expires_at?new Date(a.value.subscription_expires_at).toISOString():null,scope_level:a.value.scope_level||void 0,scope_id:a.value.scope_id?Number(a.value.scope_id):void 0,is_active:a.value.is_active,is_vip:a.value.is_vip};(a.value.person_last_name||a.value.person_first_name||a.value.person_phone||a.value.person_mothers_last_name||a.value.person_mothers_first_name||a.value.person_birth_place||a.value.person_birth_date)&&(o.person={last_name:a.value.person_last_name||void 0,first_name:a.value.person_first_name||void 0,phone:a.value.person_phone||void 0,mothers_last_name:a.value.person_mothers_last_name||void 0,mothers_first_name:a.value.person_mothers_first_name||void 0,birth_place:a.value.person_birth_place||void 0,birth_date:a.value.person_birth_date?new Date(a.value.person_birth_date).toISOString():void 0}),Object.keys(o).forEach(v=>{o[v]===void 0&&delete o[v]}),o.person&&(Object.keys(o.person).forEach(v=>{o.person[v]===void 0&&delete o.person[v]}),Object.keys(o.person).length===0&&delete o.person);const j=await fetch(`/api/v1/admin/users/${B}`,{method:"PATCH",headers:u,body:JSON.stringify(o)});if(!j.ok){const v=await j.json().catch(()=>({}));throw new Error(v.detail||`Save failed: ${j.status}`)}const ie=await j.json();i.value=ie,M(),R("success","User updated successfully")}catch(t){R("error",t.message||"Failed to save")}finally{k.value=!1}}function R(t,s){h.value={show:!0,type:t,message:s},setTimeout(()=>{h.value.show=!1},4e3)}function X(){T.push("/users")}function Y(t){return t?t.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2):"?"}function Z(t){const s=["bg-red-500","bg-yellow-500","bg-green-500","bg-blue-500","bg-indigo-500","bg-purple-500","bg-pink-500","bg-teal-500"];let u=0;for(let o=0;o<(t||"").length;o++)u=t.charCodeAt(o)+((u<<5)-u);return s[Math.abs(u)%s.length]}function w(t){if(!t)return"";try{return new Date(t).toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric"})}catch{return String(t)}}function ee(t){return{admin:"Admin",user:"User",staff:"Staff",superadmin:"Superadmin"}[t?.toLowerCase()]||t||"User"}function A(t){return{admin:"bg-purple-500/10 text-purple-400",user:"bg-blue-500/10 text-blue-400",staff:"bg-cyan-500/10 text-cyan-400",superadmin:"bg-amber-500/10 text-amber-400"}[t?.toLowerCase()]||"bg-slate-500/10 text-slate-400"}function te(t){return{FREE:"bg-slate-500/10 text-slate-400",PREMIUM:"bg-emerald-500/10 text-emerald-400",ENTERPRISE:"bg-amber-500/10 text-amber-400"}[t?.toUpperCase()]||"bg-slate-500/10 text-slate-400"}function se(t){return{admin:"Admin",manager:"Manager",member:"Member",owner:"Owner"}[t?.toLowerCase()]||t||"Member"}function le(t){return{active:"Active",invited:"Invited",suspended:"Suspended",inactive:"Inactive"}[t?.toLowerCase()]||t||"Unknown"}function oe(t){return{active:"bg-emerald-500/10 text-emerald-400",invited:"bg-blue-500/10 text-blue-400",suspended:"bg-red-500/10 text-red-400",inactive:"bg-slate-500/10 text-slate-400"}[t?.toLowerCase()]||"bg-slate-500/10 text-slate-400"}function ae(t){return{active:"bg-emerald-400",invited:"bg-blue-400",suspended:"bg-red-400",inactive:"bg-slate-400"}[t?.toLowerCase()]||"bg-slate-400"}return ue(()=>{I()}),(t,s)=>{const u=ne;return r(),n("div",null,[E.value?(r(),n("div",be,[e("div",xe,[s[17]||(s[17]=e("svg",{class:"w-8 h-8 text-indigo-400 animate-spin",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})],-1)),e("p",ve,l(t.$t("users.details.loading")),1)])])):$.value?(r(),n("div",he,[s[18]||(s[18]=e("svg",{class:"w-12 h-12 text-red-500 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),e("p",ge,l($.value),1),e("button",{onClick:I,class:"px-4 py-2 text-sm bg-indigo-600/20 text-indigo-300 hover:bg-indigo-600/30 rounded-lg transition"},l(t.$t("users.details.retry")),1)])):i.value?(r(),n(L,{key:2},[e("div",fe,[e("button",{onClick:X,class:"inline-flex items-center gap-1.5 text-sm text-slate-400 hover:text-white transition mb-4"},[s[19]||(s[19]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)),p(" "+l(t.$t("users.details.back")),1)]),e("div",ke,[e("div",we,[e("div",{class:m(["w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold text-white",Z(U.value)])},l(Y(U.value)),3),e("div",null,[e("div",ye,[e("h1",$e,l(U.value),1),e("span",{class:m(["inline-flex items-center px-3 py-1 rounded-full text-xs font-medium",G.value])},[e("span",{class:m(["w-1.5 h-1.5 rounded-full mr-1.5",J.value])},null,2),p(" "+l(O.value),1)],2),i.value.is_vip?(r(),n("span",Ce,[...s[20]||(s[20]=[e("svg",{class:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20"},[e("path",{d:"M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"})],-1),p(" VIP ",-1)])])):_("",!0)]),e("p",Me,[p(l(i.value.email)+" ",1),i.value.person?.phone?(r(),n("span",je,"· "+l(i.value.person.phone),1)):_("",!0)])])]),e("div",Be,[K.value?(r(),n("button",{key:0,onClick:Q,class:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium bg-indigo-600/20 text-indigo-300 hover:bg-indigo-600/30 rounded-lg transition"},[s[21]||(s[21]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})],-1)),p(" "+l(t.$t("users.details.edit")),1)])):_("",!0)])])]),e("div",Ee,[e("nav",ze,[(r(),n(L,null,N(H,o=>e("button",{key:o.key,onClick:x=>C.value=o.key,class:m(["pb-3 text-sm font-medium transition border-b-2 -mb-px",C.value===o.key?"text-indigo-400 border-indigo-400":"text-slate-400 border-transparent hover:text-slate-300"])},l(t.$t(o.label)),11,Ve)),64))])]),C.value==="profile"?(r(),n("div",Ue,[e("div",Le,[e("div",Se,[s[22]||(s[22]=e("div",{class:"p-2 rounded-lg bg-indigo-500/10 text-indigo-400"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})])],-1)),e("h3",De,l(t.$t("users.details.account_info")),1)]),e("div",Ie,[e("div",null,[e("label",Re,l(t.$t("users.details.user_id")),1),e("p",Ae,l(i.value.id),1)]),e("div",null,[e("label",Ne,l(t.$t("users.email")),1),e("p",Fe,l(i.value.email),1)]),e("div",null,[e("label",Pe,l(t.$t("users.role")),1),e("span",{class:m(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",A(i.value.role)])},l(ee(i.value.role)),3)]),e("div",null,[e("label",Te,l(t.$t("users.details.registration_date")),1),e("p",He,l(w(i.value.created_at)),1)]),e("div",null,[e("label",Oe,l(t.$t("users.details.last_login")),1),e("p",Ge,l(w(i.value.last_login_at)||"—"),1)]),e("div",null,[e("label",Je,l(t.$t("users.details.ui_mode")),1),e("p",Ke,l(i.value.ui_mode||"personal"),1)]),e("div",null,[e("label",qe,l(t.$t("users.language")),1),e("p",Qe,l(i.value.preferred_language||"—"),1)]),e("div",null,[e("label",We,l(t.$t("users.details.region")),1),e("p",Xe,l(i.value.region_code||"—"),1)]),e("div",null,[e("label",Ye,l(t.$t("users.details.currency")),1),e("p",Ze,l(i.value.preferred_currency||"—"),1)])])]),e("div",et,[e("div",tt,[s[23]||(s[23]=e("div",{class:"p-2 rounded-lg bg-emerald-500/10 text-emerald-400"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"})])],-1)),e("h3",st,l(t.$t("users.details.subscription_info")),1)]),e("div",lt,[e("div",null,[e("label",ot,l(t.$t("users.package")),1),e("span",{class:m(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",te(i.value.subscription_plan)])},l(i.value.subscription_plan||"—"),3)]),e("div",null,[e("label",at,l(t.$t("users.details.subscription_expires")),1),e("p",it,l(w(i.value.subscription_expires_at)||"—"),1)]),e("div",null,[e("label",nt,l(t.$t("users.details.scope_level")),1),e("p",rt,l(i.value.scope_level||"individual"),1)]),e("div",null,[e("label",dt,l(t.$t("users.details.max_vehicles")),1),e("p",ut,l(i.value.max_vehicles),1)]),e("div",null,[e("label",ct,l(t.$t("users.details.max_garages")),1),e("p",pt,l(i.value.max_garages),1)])])]),i.value.person?(r(),n("div",mt,[e("div",_t,[s[24]||(s[24]=e("div",{class:"p-2 rounded-lg bg-cyan-500/10 text-cyan-400"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})])],-1)),e("h3",bt,l(t.$t("users.details.personal_info")),1)]),e("div",xt,[e("div",null,[e("label",vt,l(t.$t("users.details.last_name")),1),e("p",ht,l(i.value.person.last_name||"—"),1)]),e("div",null,[e("label",gt,l(t.$t("users.details.first_name")),1),e("p",ft,l(i.value.person.first_name||"—"),1)]),e("div",null,[e("label",kt,l(t.$t("users.details.phone")),1),e("p",wt,l(i.value.person.phone||"—"),1)]),e("div",null,[e("label",yt,l(t.$t("users.details.birth_place")),1),e("p",$t,l(i.value.person.birth_place||"—"),1)]),e("div",null,[e("label",Ct,l(t.$t("users.details.birth_date")),1),e("p",Mt,l(w(i.value.person.birth_date)||"—"),1)]),e("div",null,[e("label",jt,l(t.$t("users.details.mothers_name")),1),e("p",Bt,l([i.value.person.mothers_last_name,i.value.person.mothers_first_name].filter(Boolean).join(" ")||"—"),1)])]),i.value.person.address?(r(),n("div",Et,[e("h4",zt,l(t.$t("users.details.address")),1),e("div",Vt,[e("div",null,[e("label",Ut,l(t.$t("users.details.zip")),1),e("p",Lt,l(i.value.person.address.address_zip||"—"),1)]),e("div",null,[e("label",St,l(t.$t("users.details.city")),1),e("p",Dt,l(i.value.person.address.address_city||"—"),1)]),e("div",null,[e("label",It,l(t.$t("users.details.street")),1),e("p",Rt,l([i.value.person.address.address_street_type,i.value.person.address.address_street_name].filter(Boolean).join(" ")||"—"),1)]),e("div",null,[e("label",At,l(t.$t("users.details.house_number")),1),e("p",Nt,l(i.value.person.address.address_house_number||"—"),1)])])])):_("",!0)])):(r(),n("div",Ft,[s[25]||(s[25]=e("svg",{class:"w-10 h-10 text-slate-600 mx-auto mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1)),e("p",Pt,l(t.$t("users.details.no_person_record")),1)]))])):_("",!0),C.value==="memberships"?(r(),n("div",Tt,[e("div",Ht,[e("div",Ot,[s[26]||(s[26]=e("div",{class:"p-2 rounded-lg bg-purple-500/10 text-purple-400"},[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16l3.5-2 3.5 2 3.5-2 3.5 2M10 8.5a.5.5 0 11-1 0 .5.5 0 011 0zm5 5a.5.5 0 11-1 0 .5.5 0 011 0z"})])],-1)),e("div",null,[e("h3",Gt,l(t.$t("users.details.memberships")),1),e("p",Jt,l(t.$t("users.details.memberships_count",{count:f.value.length})),1)])])]),z.value?(r(),n("div",Kt,[...s[27]||(s[27]=[e("svg",{class:"w-6 h-6 text-indigo-400 animate-spin",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})],-1)])])):f.value.length===0?(r(),n("div",qt,[s[28]||(s[28]=e("svg",{class:"w-10 h-10 text-slate-600 mx-auto mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"})],-1)),e("p",Qt,l(t.$t("users.details.no_memberships")),1)])):(r(),n("div",Wt,[e("div",Xt,[e("table",Yt,[e("thead",null,[e("tr",Zt,[e("th",es,l(t.$t("users.details.org_name")),1),e("th",ts,l(t.$t("users.details.org_role")),1),e("th",ss,l(t.$t("users.details.member_status")),1),e("th",ls,l(t.$t("users.details.joined_at")),1),e("th",os,l(t.$t("users.details.verified")),1)])]),e("tbody",null,[(r(!0),n(L,null,N(f.value,o=>(r(),n("tr",{key:o.id,class:"border-b border-slate-700/50 last:border-b-0 hover:bg-slate-700/30 transition"},[e("td",as,[me(u,{to:"/garages/"+o.organization_id,class:"text-sm font-medium text-white hover:text-indigo-400 hover:underline transition-colors"},{default:_e(()=>[p(l(o.organization_display_name||o.organization_name),1)]),_:2},1032,["to"])]),e("td",is,[e("span",{class:m(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",A(o.role)])},l(se(o.role)),3)]),e("td",ns,[e("span",{class:m(["inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium",oe(o.status)])},[e("span",{class:m(["w-1.5 h-1.5 rounded-full",ae(o.status)])},null,2),p(" "+l(le(o.status)),1)],2)]),e("td",rs,l(w(o.joined_at)||"—"),1),e("td",ds,[o.is_verified?(r(),n("span",us,[s[29]||(s[29]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),p(" "+l(t.$t("users.details.verified_yes")),1)])):(r(),n("span",cs,l(t.$t("users.details.verified_no")),1))])]))),128))])])])]))])):_("",!0),V.value?(r(),n("div",ps,[e("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:M}),e("div",ms,[e("div",_s,[e("h3",bs,l(t.$t("users.details.edit_user")),1),e("button",{onClick:M,class:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition"},[...s[30]||(s[30]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),e("div",xs,[e("div",vs,[e("div",null,[e("label",hs,l(t.$t("users.email")),1),d(e("input",{"onUpdate:modelValue":s[0]||(s[0]=o=>a.value.email=o),type:"email",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.email]])]),e("div",null,[e("label",gs,l(t.$t("users.details.preferred_language")),1),d(e("select",{"onUpdate:modelValue":s[1]||(s[1]=o=>a.value.preferred_language=o),class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},[...s[31]||(s[31]=[e("option",{value:"hu"},"HU",-1),e("option",{value:"en"},"EN",-1),e("option",{value:"de"},"DE",-1),e("option",{value:"ro"},"RO",-1)])],512),[[S,a.value.preferred_language]])])]),e("div",fs,[e("div",null,[e("label",ks,l(t.$t("users.details.region")),1),d(e("input",{"onUpdate:modelValue":s[2]||(s[2]=o=>a.value.region_code=o),type:"text",maxlength:"5",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.region_code]])]),e("div",null,[e("label",ws,l(t.$t("users.details.currency")),1),d(e("input",{"onUpdate:modelValue":s[3]||(s[3]=o=>a.value.preferred_currency=o),type:"text",maxlength:"3",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.preferred_currency]])])]),e("div",ys,[e("div",null,[e("label",$s,l(t.$t("users.package")),1),d(e("select",{"onUpdate:modelValue":s[4]||(s[4]=o=>a.value.subscription_plan=o),class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},[...s[32]||(s[32]=[e("option",{value:"FREE"},"FREE",-1),e("option",{value:"PREMIUM"},"PREMIUM",-1),e("option",{value:"ENTERPRISE"},"ENTERPRISE",-1)])],512),[[S,a.value.subscription_plan]])]),e("div",null,[e("label",Cs,l(t.$t("users.details.subscription_expires")),1),d(e("input",{"onUpdate:modelValue":s[5]||(s[5]=o=>a.value.subscription_expires_at=o),type:"datetime-local",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.subscription_expires_at]])])]),e("div",Ms,[e("div",null,[e("label",js,l(t.$t("users.details.scope_level")),1),d(e("select",{"onUpdate:modelValue":s[6]||(s[6]=o=>a.value.scope_level=o),class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},[...s[33]||(s[33]=[e("option",{value:"individual"},"individual",-1),e("option",{value:"organization"},"organization",-1),e("option",{value:"group"},"group",-1)])],512),[[S,a.value.scope_level]])]),e("div",null,[e("label",Bs,l(t.$t("users.details.scope_id")),1),d(e("input",{"onUpdate:modelValue":s[7]||(s[7]=o=>a.value.scope_id=o),type:"text",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.scope_id]])])]),e("div",Es,[e("label",zs,[d(e("input",{"onUpdate:modelValue":s[8]||(s[8]=o=>a.value.is_active=o),type:"checkbox",class:"rounded border-slate-600 bg-slate-700 text-indigo-600 focus:ring-indigo-500/50"},null,512),[[F,a.value.is_active]]),e("span",Vs,l(t.$t("users.details.is_active")),1)]),e("label",Us,[d(e("input",{"onUpdate:modelValue":s[9]||(s[9]=o=>a.value.is_vip=o),type:"checkbox",class:"rounded border-slate-600 bg-slate-700 text-indigo-600 focus:ring-indigo-500/50"},null,512),[[F,a.value.is_vip]]),e("span",Ls,l(t.$t("users.details.is_vip")),1)])]),e("div",Ss,[e("h4",Ds,l(t.$t("users.details.personal_info")),1),e("div",Is,[e("div",null,[e("label",Rs,l(t.$t("users.details.last_name")),1),d(e("input",{"onUpdate:modelValue":s[10]||(s[10]=o=>a.value.person_last_name=o),type:"text",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.person_last_name]])]),e("div",null,[e("label",As,l(t.$t("users.details.first_name")),1),d(e("input",{"onUpdate:modelValue":s[11]||(s[11]=o=>a.value.person_first_name=o),type:"text",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.person_first_name]])]),e("div",null,[e("label",Ns,l(t.$t("users.details.phone")),1),d(e("input",{"onUpdate:modelValue":s[12]||(s[12]=o=>a.value.person_phone=o),type:"text",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.person_phone]])]),e("div",null,[e("label",Fs,l(t.$t("users.details.mothers_name")),1),d(e("input",{"onUpdate:modelValue":s[13]||(s[13]=o=>a.value.person_mothers_last_name=o),type:"text",placeholder:"Last name",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.person_mothers_last_name]])]),e("div",null,[e("label",Ps,l(t.$t("users.details.mothers_first_name")),1),d(e("input",{"onUpdate:modelValue":s[14]||(s[14]=o=>a.value.person_mothers_first_name=o),type:"text",placeholder:"First name",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.person_mothers_first_name]])]),e("div",null,[e("label",Ts,l(t.$t("users.details.birth_place")),1),d(e("input",{"onUpdate:modelValue":s[15]||(s[15]=o=>a.value.person_birth_place=o),type:"text",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.person_birth_place]])]),e("div",null,[e("label",Hs,l(t.$t("users.details.birth_date")),1),d(e("input",{"onUpdate:modelValue":s[16]||(s[16]=o=>a.value.person_birth_date=o),type:"date",class:"w-full px-3 py-2 text-sm bg-slate-700/50 border border-slate-600 rounded-lg text-white focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500"},null,512),[[c,a.value.person_birth_date]])])])])]),e("div",Os,[e("button",{onClick:M,class:"px-4 py-2 text-sm font-medium text-slate-300 hover:text-white bg-slate-700/50 hover:bg-slate-700 rounded-lg transition"},l(t.$t("users.details.cancel")),1),e("button",{onClick:W,disabled:k.value,class:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium bg-indigo-600 text-white hover:bg-indigo-500 rounded-lg transition disabled:opacity-50"},[k.value?(r(),n("svg",Js,[...s[34]||(s[34]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},null,-1)])])):_("",!0),p(" "+l(k.value?t.$t("users.details.saving"):t.$t("users.details.save")),1)],8,Gs)])])])):_("",!0),h.value.show?(r(),n("div",{key:3,class:m(["fixed bottom-6 right-6 z-50 px-5 py-3 rounded-xl shadow-2xl text-sm font-medium transition-all",h.value.type==="success"?"bg-emerald-600 text-white":"bg-red-600 text-white"])},[e("div",Ks,[h.value.type==="success"?(r(),n("svg",qs,[...s[35]||(s[35]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])):(r(),n("svg",Qs,[...s[36]||(s[36]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)])])),p(" "+l(h.value.message),1)])],2)):_("",!0)],64)):_("",!0)])}}});export{Zs as default};
|