Files
service-finder/frontend_admin/.nuxt/dist/client/_nuxt/BrLYzdOF.js
2026-07-01 02:27:38 +00:00

2 lines
10 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 j}from"./CuTzR9Y8.js";import{e as L,f as P,g as z,c,a as t,t as s,i as e,y as _,C as y,F as k,r as w,z as C,k as S,h as D,l as p,o as d,b as A,w as H,d as T}from"./Duy9QquX.js";import{u as E}from"./iEY_AUwe.js";import"./BmPpcd_L.js";const I={class:"mb-8"},Q={class:"text-2xl font-bold text-white"},R={class:"text-slate-400 mt-1"},q={class:"bg-slate-800 rounded-xl border border-slate-700 p-4 mb-6"},G={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4"},J={class:"block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider"},K={value:""},O=["value"],W={class:"block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider"},X={class:"block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider"},Y={class:"block text-xs font-medium text-slate-400 mb-1.5 uppercase tracking-wider"},Z={value:""},tt={value:!0},et={value:!1},st={class:"flex items-center gap-3 mt-4 pt-4 border-t border-slate-700/50"},ot={class:"text-xs text-slate-500 ml-auto"},it={key:0,class:"flex items-center justify-center py-20"},at={class:"text-slate-400 flex items-center gap-3"},nt={key:1,class:"bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8"},lt={class:"text-rose-400"},rt={key:2,class:"bg-slate-800 rounded-xl border border-slate-700 p-6"},ct={class:"text-slate-400 text-center py-12"},dt={key:3,class:"bg-slate-800 rounded-xl border border-slate-700 overflow-hidden"},ut={class:"overflow-x-auto"},pt={class:"w-full"},xt={class:"border-b border-slate-700"},mt={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},_t={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},ft={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},gt={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},ht={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},bt={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},vt={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},yt={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},kt={class:"text-left px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},wt={class:"text-right px-4 py-3 text-xs font-medium text-slate-400 uppercase tracking-wider"},Ct={class:"divide-y divide-slate-700/50"},St={class:"px-4 py-3 text-sm text-white font-mono"},Mt={class:"px-4 py-3 text-sm text-white"},Vt={class:"px-4 py-3"},Bt={class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-indigo-500/10 text-indigo-400 border border-indigo-500/20"},Ft={class:"px-4 py-3 text-sm text-slate-300"},Ut={class:"px-4 py-3"},$t={key:0,class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-rose-500/10 text-rose-400 border border-rose-500/20"},Nt={key:1,class:"text-sm text-slate-500"},jt={class:"px-4 py-3"},Lt={key:0,class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400 border border-amber-500/20"},Pt={key:1,class:"text-sm text-slate-500"},zt={class:"px-4 py-3 text-sm text-slate-300"},Dt={class:"px-4 py-3 text-sm text-slate-300"},At={class:"px-4 py-3 text-sm text-slate-500"},Ht={class:"px-4 py-3 text-right"},Tt={class:"flex items-center justify-between px-4 py-3 border-t border-slate-700"},Et=["disabled"],It={class:"text-sm text-slate-500"},Qt=["disabled"],Ot=L({__name:"index",setup(Rt){const{t:o}=P(),{formatNumber:v,formatDate:M}=E(),f=p(!1),g=p(!1),h=p([]),x=p(0),n=p(0),u=p(50),a=p({level:"",min_xp:null,max_xp:null,has_penalty:""});function V(r){switch(r){case 1:return o("gamification.users.restriction_mild");case 2:return o("gamification.users.restriction_moderate");case 3:return o("gamification.users.restriction_severe");default:return`${r}. ${o("gamification.users.restriction_level")}`}}function B(){const r=new URLSearchParams;return r.set("limit",String(u.value)),r.set("offset",String(n.value)),a.value.level!==""&&r.set("level",String(a.value.level)),a.value.min_xp!==null&&r.set("min_xp",String(a.value.min_xp)),a.value.max_xp!==null&&r.set("max_xp",String(a.value.max_xp)),a.value.has_penalty!==""&&r.set("has_penalty",String(a.value.has_penalty)),r.toString()}async function m(){f.value=!0,g.value=!1;try{const l=D("access_token").value,b=l?{Authorization:`Bearer ${l}`}:{},i=await $fetch(`/api/v1/admin/gamification/user-stats?${B()}`,{headers:b});h.value=i,x.value=i.length<u.value?n.value+i.length:n.value+u.value+1}catch(r){console.error("Failed to load user stats:",r),g.value=!0}finally{f.value=!1}}function F(){n.value=0,m()}function U(){a.value={level:"",min_xp:null,max_xp:null,has_penalty:""},n.value=0,m()}function $(){n.value>0&&(n.value=Math.max(0,n.value-u.value),m())}function N(){n.value+=u.value,m()}return z(()=>{m()}),(r,l)=>{const b=j;return d(),c("div",null,[t("div",I,[t("h1",Q,s(e(o)("gamification.users.title")),1),t("p",R,s(e(o)("gamification.users.subtitle")),1)]),t("div",q,[t("div",G,[t("div",null,[t("label",J,s(e(o)("gamification.users.filter_level")),1),_(t("select",{"onUpdate:modelValue":l[0]||(l[0]=i=>e(a).level=i),class:"w-full bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},[t("option",K,s(e(o)("gamification.users.all_levels")),1),(d(),c(k,null,w(20,i=>t("option",{key:i,value:i},s(i)+". "+s(e(o)("gamification.users.level_suffix")),9,O)),64))],512),[[y,e(a).level]])]),t("div",null,[t("label",W,s(e(o)("gamification.users.filter_min_xp")),1),_(t("input",{"onUpdate:modelValue":l[1]||(l[1]=i=>e(a).min_xp=i),type:"number",min:"0",placeholder:"0",class:"w-full bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,512),[[C,e(a).min_xp,void 0,{number:!0}]])]),t("div",null,[t("label",X,s(e(o)("gamification.users.filter_max_xp")),1),_(t("input",{"onUpdate:modelValue":l[2]||(l[2]=i=>e(a).max_xp=i),type:"number",min:"0",placeholder:"100000",class:"w-full bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,512),[[C,e(a).max_xp,void 0,{number:!0}]])]),t("div",null,[t("label",Y,s(e(o)("gamification.users.filter_penalty")),1),_(t("select",{"onUpdate:modelValue":l[3]||(l[3]=i=>e(a).has_penalty=i),class:"w-full bg-slate-700 border border-slate-600 rounded-lg px-3 py-2 text-sm text-white focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},[t("option",Z,s(e(o)("gamification.users.penalty_any")),1),t("option",tt,s(e(o)("gamification.users.penalty_only")),1),t("option",et,s(e(o)("gamification.users.penalty_none")),1)],512),[[y,e(a).has_penalty]])])]),t("div",st,[t("button",{onClick:F,class:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 text-white text-sm font-medium rounded-lg transition"},s(e(o)("gamification.users.filter_apply")),1),t("button",{onClick:U,class:"px-4 py-2 bg-slate-700 hover:bg-slate-600 text-slate-300 text-sm font-medium rounded-lg transition"},s(e(o)("gamification.users.filter_reset")),1),t("span",ot,s(e(o)("gamification.users.total_count",{count:e(x)})),1)])]),e(f)?(d(),c("div",it,[t("div",at,[l[4]||(l[4]=t("svg",{class:"w-5 h-5 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1)),t("span",null,s(e(o)("gamification.users.loading")),1)])])):e(g)?(d(),c("div",nt,[t("p",lt,s(e(o)("gamification.users.load_error")),1),t("button",{onClick:m,class:"mt-3 text-sm text-rose-300 hover:text-rose-200 underline"},s(e(o)("gamification.users.retry")),1)])):e(h).length===0?(d(),c("div",rt,[t("p",ct,s(e(o)("gamification.users.empty")),1)])):(d(),c("div",dt,[t("div",ut,[t("table",pt,[t("thead",null,[t("tr",xt,[t("th",mt,s(e(o)("gamification.users.col_user_id")),1),t("th",_t,s(e(o)("gamification.users.col_xp")),1),t("th",ft,s(e(o)("gamification.users.col_level")),1),t("th",gt,s(e(o)("gamification.users.col_points")),1),t("th",ht,s(e(o)("gamification.users.col_penalty")),1),t("th",bt,s(e(o)("gamification.users.col_restriction")),1),t("th",vt,s(e(o)("gamification.users.col_services")),1),t("th",yt,s(e(o)("gamification.users.col_discoveries")),1),t("th",kt,s(e(o)("gamification.users.col_updated")),1),t("th",wt,s(e(o)("gamification.users.col_actions")),1)])]),t("tbody",Ct,[(d(!0),c(k,null,w(e(h),i=>(d(),c("tr",{key:i.user_id,class:"hover:bg-slate-700/30 transition"},[t("td",St,"#"+s(i.user_id),1),t("td",Mt,s(e(v)(i.total_xp)),1),t("td",Vt,[t("span",Bt,s(i.current_level),1)]),t("td",Ft,s(e(v)(i.total_points)),1),t("td",Ut,[i.penalty_points>0?(d(),c("span",$t," -"+s(i.penalty_points),1)):(d(),c("span",Nt,"—"))]),t("td",jt,[i.restriction_level>0?(d(),c("span",Lt,s(V(i.restriction_level)),1)):(d(),c("span",Pt,s(e(o)("gamification.users.none")),1))]),t("td",zt,s(i.services_submitted),1),t("td",Dt,s(i.places_discovered),1),t("td",At,s(i.updated_at?e(M)(i.updated_at):"—"),1),t("td",Ht,[A(b,{to:`/gamification/users/${i.user_id}`,class:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-indigo-600/10 hover:bg-indigo-600/20 text-indigo-400 text-xs font-medium rounded-lg transition"},{default:H(()=>[T(s(e(o)("gamification.users.details"))+" ",1),l[5]||(l[5]=t("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1))]),_:1},8,["to"])])]))),128))])])]),t("div",Tt,[t("button",{onClick:$,disabled:e(n)===0,class:S(["px-3 py-1.5 text-sm rounded-lg transition",e(n)===0?"text-slate-600 cursor-not-allowed":"text-slate-300 hover:bg-slate-700"])},s(e(o)("gamification.users.prev")),11,Et),t("span",It,s(e(n)+1)+""+s(Math.min(e(n)+e(u),e(x)))+" / "+s(e(x)),1),t("button",{onClick:N,disabled:e(n)+e(u)>=e(x),class:S(["px-3 py-1.5 text-sm rounded-lg transition",e(n)+e(u)>=e(x)?"text-slate-600 cursor-not-allowed":"text-slate-300 hover:bg-slate-700"])},s(e(o)("gamification.users.next")),11,Qt)])]))])}}});export{Ot as default};