Files
service-finder/frontend_admin/.nuxt/dist/client/_nuxt/bPZppHdV.js
2026-06-29 14:11:15 +00:00

2 lines
15 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as q}from"./C94yYWrE.js";import{e as G,s as J,B as z,g as K,c as a,a as e,t as s,y as b,z as O,C,F,d as y,j as g,r as W,k as f,D as X,m as k,l as r,h as Y,o as n,b as A,w as D}from"./Dc9IRd06.js";const Z={class:"mb-8"},ee={class:"text-2xl font-bold text-white"},te={class:"text-slate-400 mt-1"},se={class:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-6"},oe={class:"relative flex-1 max-w-md"},le=["placeholder"],ae={class:"flex items-center gap-2 flex-wrap"},ne={value:"all"},ie={value:"no"},re={value:"yes"},de={value:"all"},ue={value:"active"},ce={value:"inactive"},pe={value:"all"},xe={value:"yes"},ve={value:"no"},_e={value:"all"},he={value:"no"},me={value:"yes"},ge={key:0,class:"flex items-center justify-center py-20"},fe={class:"flex flex-col items-center gap-3"},be={class:"text-slate-400 text-sm"},ye={key:1,class:"flex flex-col items-center justify-center py-20 text-center"},ke={class:"text-red-400 text-sm mb-2"},we={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mb-8"},$e={class:"bg-slate-800 rounded-xl border border-slate-700 p-4"},Ce={class:"flex items-center gap-3"},Me={class:"text-xs text-slate-400 uppercase tracking-wider"},Be={class:"text-2xl font-bold text-white"},je={class:"bg-slate-800 rounded-xl border border-slate-700 p-4"},Ve={class:"flex items-center gap-3"},ze={class:"text-xs text-slate-400 uppercase tracking-wider"},Fe={class:"text-2xl font-bold text-emerald-400"},Ae={class:"bg-slate-800 rounded-xl border border-slate-700 p-4"},De={class:"flex items-center gap-3"},He={class:"text-xs text-slate-400 uppercase tracking-wider"},Le={class:"text-2xl font-bold text-amber-400"},Pe={class:"bg-slate-800 rounded-xl border border-slate-700 p-4"},Ue={class:"flex items-center gap-3"},Ne={class:"text-xs text-slate-400 uppercase tracking-wider"},Te={class:"text-2xl font-bold text-red-400"},Se={key:0,class:"mb-4 text-xs text-slate-500"},Ee={class:"text-slate-300 font-semibold"},Ie={class:"bg-slate-800/50 border border-slate-700 rounded-xl overflow-hidden"},Qe={class:"overflow-x-auto"},Re={class:"w-full text-sm"},qe={class:"border-b border-slate-700 bg-slate-800/80"},Ge={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},Je={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},Ke={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},Oe={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},We={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},Xe={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},Ye={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},Ze={class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},et={class:"py-3.5 px-4 text-slate-400 font-mono text-xs"},tt={class:"py-3.5 px-4"},st={class:"py-3.5 px-4 text-slate-300"},ot={class:"py-3.5 px-4 text-slate-300 text-xs"},lt={class:"py-3.5 px-4"},at={class:"flex flex-wrap gap-1"},nt={key:0,class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-purple-500/20 text-purple-300"},it={key:1,class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-500/20 text-red-300"},rt={class:"py-3.5 px-4"},dt={class:"text-slate-300"},ut={class:"py-3.5 px-4"},ct={key:0},pt={class:"text-slate-300 text-xs"},xt={key:1,class:"text-slate-500"},vt={class:"py-3.5 px-4"},_t={key:0,class:"text-slate-300 text-xs"},ht={key:1,class:"text-slate-500"},mt={class:"py-3.5 px-4"},gt={class:"flex items-center gap-2"},ft={key:0,class:"flex flex-col items-center justify-center py-16 text-center"},bt={class:"text-slate-400 text-sm"},yt={key:1,class:"flex items-center justify-between mt-6"},kt={class:"text-xs text-slate-500"},wt={class:"flex items-center gap-2"},$t=["disabled"],Ct=["disabled"],zt=G({__name:"index",setup(Mt){const H=X(),M=J();!k(()=>M.isAdmin?!0:!!M.user?.system_capabilities?.["persons:view"]).value&&!M.isAdmin&&H.push("/");const w=r(!0),$=r(null),c=r([]),d=r(0),i=r(0),u=r(50),p=r(""),x=r("all"),v=r("all"),_=r("all"),h=r("all"),B=r(null),L=k(()=>c.value.filter(t=>t.is_active).length),P=k(()=>c.value.filter(t=>t.is_ghost).length),U=k(()=>c.value.filter(t=>t.merged_into_id).length);let j=null;function N(){j&&clearTimeout(j),j=setTimeout(()=>{i.value=0,m()},400)}z(p,()=>{N()}),z([x,v,_,h],()=>{i.value=0,m()});const T=k(()=>p.value!==""||x.value!=="all"||v.value!=="all"||_.value!=="all"||h.value!=="all");function S(){const o=Y("access_token").value;return o?{Authorization:`Bearer ${o}`}:{}}async function m(){w.value=!0,$.value=null;try{const t={skip:i.value,limit:u.value};p.value&&(t.search=p.value),x.value!=="all"&&(t.is_ghost=x.value==="yes"),v.value!=="all"&&(t.is_active=v.value==="active"),_.value!=="all"&&(t.has_user=_.value==="yes"),h.value!=="all"&&(t.is_merged=h.value==="yes");const o=await $fetch("/api/v1/admin/persons",{params:t,headers:S()});c.value=o.items,d.value=o.total}catch(t){console.error("[Persons] Failed to fetch persons:",t),$.value=t?.data?.detail||t?.message||"Failed to load persons"}finally{w.value=!1}}function E(){i.value+u.value<d.value&&(i.value+=u.value,m())}function I(){i.value>0&&(i.value=Math.max(0,i.value-u.value),m())}function Q(t){const o=(t||"").toLowerCase();return o==="superadmin"?"bg-purple-500/20 text-purple-300":o==="admin"?"bg-indigo-500/20 text-indigo-300":o==="staff"?"bg-cyan-500/20 text-cyan-300":"bg-slate-500/20 text-slate-300"}function R(t){if(!t)return"—";try{return new Date(t).toLocaleDateString("hu-HU",{year:"numeric",month:"short",day:"numeric"})}catch{return t}}return K(()=>{m()}),(t,o)=>{const V=q;return n(),a("div",null,[e("div",Z,[e("h1",ee,s(t.$t("persons.title")),1),e("p",te,s(t.$t("persons.subtitle")),1)]),e("div",se,[e("div",oe,[o[5]||(o[5]=e("svg",{class:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),b(e("input",{"onUpdate:modelValue":o[0]||(o[0]=l=>p.value=l),type:"text",placeholder:t.$t("persons.search_placeholder"),class:"w-full pl-10 pr-4 py-2.5 bg-slate-800 border border-slate-700 rounded-lg text-sm text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 transition"},null,8,le),[[O,p.value]])]),e("div",ae,[b(e("select",{"onUpdate:modelValue":o[1]||(o[1]=l=>x.value=l),class:"px-3 py-2.5 bg-slate-800 border border-slate-700 rounded-lg text-sm text-slate-300 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 transition"},[e("option",ne,s(t.$t("persons.all_ghost_statuses")),1),e("option",ie,s(t.$t("persons.ghost_no")),1),e("option",re,s(t.$t("persons.ghost_yes")),1)],512),[[C,x.value]]),b(e("select",{"onUpdate:modelValue":o[2]||(o[2]=l=>v.value=l),class:"px-3 py-2.5 bg-slate-800 border border-slate-700 rounded-lg text-sm text-slate-300 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 transition"},[e("option",de,s(t.$t("persons.all_active_statuses")),1),e("option",ue,s(t.$t("persons.active_yes")),1),e("option",ce,s(t.$t("persons.active_no")),1)],512),[[C,v.value]]),b(e("select",{"onUpdate:modelValue":o[3]||(o[3]=l=>_.value=l),class:"px-3 py-2.5 bg-slate-800 border border-slate-700 rounded-lg text-sm text-slate-300 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 transition"},[e("option",pe,s(t.$t("persons.all_user_statuses")),1),e("option",xe,s(t.$t("persons.has_user_yes")),1),e("option",ve,s(t.$t("persons.has_user_no")),1)],512),[[C,_.value]]),b(e("select",{"onUpdate:modelValue":o[4]||(o[4]=l=>h.value=l),class:"px-3 py-2.5 bg-slate-800 border border-slate-700 rounded-lg text-sm text-slate-300 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 transition"},[e("option",_e,s(t.$t("persons.all_merged_statuses")),1),e("option",he,s(t.$t("persons.merged_no")),1),e("option",me,s(t.$t("persons.merged_yes")),1)],512),[[C,h.value]])])]),w.value?(n(),a("div",ge,[e("div",fe,[o[6]||(o[6]=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",be,s(t.$t("persons.loading")),1)])])):$.value?(n(),a("div",ye,[o[7]||(o[7]=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",ke,s($.value),1),e("button",{onClick:m,class:"px-4 py-2 text-sm bg-indigo-600/20 text-indigo-300 hover:bg-indigo-600/30 rounded-lg transition"},s(t.$t("persons.retry")),1)])):(n(),a(F,{key:2},[e("div",we,[e("div",$e,[e("div",Ce,[o[8]||(o[8]=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:"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("div",null,[e("p",Me,s(t.$t("persons.total_persons")),1),e("p",Be,s(d.value),1)])])]),e("div",je,[e("div",Ve,[o[9]||(o[9]=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:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),e("div",null,[e("p",ze,s(t.$t("persons.active_persons")),1),e("p",Fe,s(L.value),1)])])]),e("div",Ae,[e("div",De,[o[10]||(o[10]=e("div",{class:"p-2 rounded-lg bg-amber-500/10 text-amber-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:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"})])],-1)),e("div",null,[e("p",He,s(t.$t("persons.ghost_persons")),1),e("p",Le,s(P.value),1)])])]),e("div",Pe,[e("div",Ue,[o[11]||(o[11]=e("div",{class:"p-2 rounded-lg bg-red-500/10 text-red-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:"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)),e("div",null,[e("p",Ne,s(t.$t("persons.merged_persons")),1),e("p",Te,s(U.value),1)])])])]),T.value?(n(),a("div",Se,[y(s(t.$t("persons.filtered_results"))+": ",1),e("span",Ee,s(c.value.length),1),y(" / "+s(d.value)+" db ",1)])):g("",!0),e("div",Ie,[e("div",Qe,[e("table",Re,[e("thead",null,[e("tr",qe,[o[12]||(o[12]=e("th",{class:"text-left py-3.5 px-4 text-xs font-semibold uppercase tracking-wider text-slate-400"},"ID",-1)),e("th",Ge,s(t.$t("persons.name")),1),e("th",Je,s(t.$t("persons.phone")),1),e("th",Ke,s(t.$t("persons.birth_date")),1),e("th",Oe,s(t.$t("persons.status")),1),e("th",We,s(t.$t("persons.users_count")),1),e("th",Xe,s(t.$t("persons.active_user")),1),e("th",Ye,s(t.$t("persons.address")),1),e("th",Ze,s(t.$t("persons.actions")),1)])]),e("tbody",null,[(n(!0),a(F,null,W(c.value,l=>(n(),a("tr",{key:l.id,class:"border-b border-slate-700/50 hover:bg-slate-700/30 transition"},[e("td",et,s(l.id),1),e("td",tt,[A(V,{to:"/persons/"+l.id,class:"text-sm font-medium text-white hover:underline cursor-pointer hover:text-indigo-400 transition-colors"},{default:D(()=>[y(s(l.last_name)+" "+s(l.first_name),1)]),_:2},1032,["to"])]),e("td",st,s(l.phone||"—"),1),e("td",ot,s(R(l.birth_date)),1),e("td",lt,[e("div",at,[e("span",{class:f(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",l.is_active?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"])},[e("span",{class:f(["w-1.5 h-1.5 rounded-full mr-1.5",l.is_active?"bg-emerald-400":"bg-amber-400"])},null,2),y(" "+s(l.is_active?t.$t("persons.active"):t.$t("persons.inactive")),1)],2),l.is_ghost?(n(),a("span",nt,s(t.$t("persons.ghost")),1)):g("",!0),l.merged_into_id?(n(),a("span",it,s(t.$t("persons.merged")),1)):g("",!0)])]),e("td",rt,[e("span",dt,s(l.users_count),1)]),e("td",ut,[l.active_user?(n(),a("div",ct,[e("p",pt,s(l.active_user.email),1),e("span",{class:f(["inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",Q(l.active_user.role)])},s(l.active_user.role),3)])):(n(),a("span",xt,"—"))]),e("td",vt,[l.address?(n(),a("span",_t,s(l.address.full_address_text||l.address.address_city+", "+l.address.address_street_name+" "+(l.address.address_house_number||"")),1)):(n(),a("span",ht,"—"))]),e("td",mt,[e("div",gt,[A(V,{to:"/persons/"+l.id,class:"px-3 py-1.5 text-xs font-medium bg-slate-600/20 text-slate-300 hover:bg-slate-600/30 rounded-lg transition"},{default:D(()=>[y(s(t.$t("persons.view")),1)]),_:1},8,["to"])])])]))),128))])])]),c.value.length===0&&!w.value?(n(),a("div",ft,[o[13]||(o[13]=e("svg",{class:"w-12 h-12 text-slate-600 mb-4",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",bt,s(t.$t("persons.no_results")),1)])):g("",!0)]),d.value>u.value?(n(),a("div",yt,[e("p",kt,s(t.$t("persons.showing"))+" "+s(i.value+1)+""+s(Math.min(i.value+u.value,d.value))+" / "+s(d.value),1),e("div",wt,[e("button",{onClick:I,disabled:i.value===0,class:f(["px-3 py-1.5 text-xs font-medium rounded-lg transition disabled:opacity-30 disabled:cursor-not-allowed",i.value>0?"bg-slate-700 text-slate-300 hover:bg-slate-600":"bg-slate-800 text-slate-600"])},s(t.$t("persons.prev")),11,$t),e("button",{onClick:E,disabled:i.value+u.value>=d.value,class:f(["px-3 py-1.5 text-xs font-medium rounded-lg transition disabled:opacity-30 disabled:cursor-not-allowed",i.value+u.value<d.value?"bg-slate-700 text-slate-300 hover:bg-slate-600":"bg-slate-800 text-slate-600"])},s(t.$t("persons.next")),11,Ct)])])):g("",!0)],64)),B.value?(n(),a("div",{key:3,class:f(["fixed bottom-6 right-6 px-5 py-3 rounded-xl shadow-xl text-sm font-medium z-50",B.value.type==="success"?"bg-emerald-600 text-white":"bg-red-600 text-white"])},s(B.value.message),3)):g("",!0)])}}});export{zt as default};