astro-admin/dist/assets/Users-CxW1h-sB.js

1 line
4.3 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{C as e,D as t,S as n,_ as r,d as i,g as a,h as o,l as s,m as c,n as l,s as u,v as d,w as f,x as p,y as m}from"./index-DzvFzRSs.js";var h={class:`flex flex-col md:flex-row md:items-center md:justify-between gap-3 mb-4 md:mb-6`},g={key:0,class:`text-slate-500 py-12 text-center`},_={key:1,class:`hidden md:block bg-white rounded-xl shadow-sm border border-slate-200 overflow-hidden`},v={class:`w-full text-sm`},y={class:`divide-y divide-slate-100`},b={class:`px-4 py-3 font-mono text-xs text-slate-500`},x={class:`px-4 py-3`},S={class:`px-4 py-3`},C={class:`px-4 py-3 text-slate-500`},w={class:`px-4 py-3 text-slate-500`},T={class:`px-4 py-3 text-center`},E={class:`px-4 py-3 text-center`},D={class:`px-4 py-3 text-center`},O={key:0,class:`px-2 py-0.5 bg-green-100 text-green-700 rounded-full text-xs`},k={key:1,class:`text-slate-400 text-xs`},A={class:`px-4 py-3`},j={key:2,class:`md:hidden space-y-3`},M={class:`flex items-start justify-between gap-2`},N={class:`min-w-0 flex-1`},P={class:`font-semibold truncate`},F={class:`text-xs text-slate-500 truncate`},I={class:`grid grid-cols-3 gap-2 mt-3 text-xs`},L={class:`text-slate-700`},R={class:`text-slate-700`},z={class:`mt-2`},B={key:0,class:`inline-block px-2 py-0.5 bg-green-100 text-green-700 rounded-full text-xs`},V={key:1,class:`text-slate-400 text-xs`},H={key:3,class:`text-slate-400 text-center py-12`},U={__name:`Users`,setup(U){let W=f([]),G=f(!0),K=f(``),q=null;r(()=>J());async function J(){G.value=!0;try{let e=K.value?{search:K.value}:{},{data:t}=await l.get(`/admin/api/users`,{params:e});W.value=t.users}finally{G.value=!1}}function Y(){clearTimeout(q),q=setTimeout(J,400)}function X(e){return e?new Date(e).toLocaleDateString(`ru-RU`,{day:`2-digit`,month:`2-digit`,year:`2-digit`}):`—`}return(r,l)=>{let f=p(`router-link`);return d(),c(`div`,null,[i(`div`,h,[l[1]||=i(`h1`,{class:`text-xl md:text-2xl font-bold`},`👥 Клиенты`,-1),e(i(`input`,{"onUpdate:modelValue":l[0]||=e=>K.value=e,onInput:Y,placeholder:`Поиск по имени / ID...`,class:`px-3 py-2 border border-slate-300 rounded-lg text-sm w-full md:w-64 focus:ring-2 focus:ring-indigo-500`},null,544),[[u,K.value]])]),G.value?(d(),c(`div`,g,`Загрузка...`)):W.value.length?[(d(),c(`div`,_,[i(`table`,v,[l[3]||=i(`thead`,{class:`bg-slate-50 text-slate-600`},[i(`tr`,null,[i(`th`,{class:`px-4 py-3 text-left`},`ID`),i(`th`,{class:`px-4 py-3 text-left`},`Имя`),i(`th`,{class:`px-4 py-3 text-left`},`Username`),i(`th`,{class:`px-4 py-3 text-left`},`Регистрация`),i(`th`,{class:`px-4 py-3 text-left`},`Last seen`),i(`th`,{class:`px-4 py-3 text-center`},`Birth`),i(`th`,{class:`px-4 py-3 text-center`},`Запросов`),i(`th`,{class:`px-4 py-3 text-center`},`Подписка`),i(`th`,{class:`px-4 py-3`})])],-1),i(`tbody`,y,[(d(!0),c(s,null,m(W.value,e=>(d(),c(`tr`,{key:e.user_id,class:`hover:bg-slate-50`},[i(`td`,b,t(e.user_id),1),i(`td`,x,t(e.name||`—`),1),i(`td`,S,`@`+t(e.username||`—`),1),i(`td`,C,t(X(e.registered_at)),1),i(`td`,w,t(X(e.last_seen)),1),i(`td`,T,t(e.has_birth_data?`✅`:`❌`),1),i(`td`,E,t(e.request_count),1),i(`td`,D,[e.subscription_active?(d(),c(`span`,O,` до `+t(X(e.subscription_ends_at)),1)):(d(),c(`span`,k,`нет`))]),i(`td`,A,[a(f,{to:`/users/${e.user_id}`,class:`text-indigo-600 hover:underline text-xs`},{default:n(()=>[...l[2]||=[o(`открыть →`,-1)]]),_:1},8,[`to`])])]))),128))])])])),(d(),c(`div`,j,[(d(!0),c(s,null,m(W.value,e=>(d(),c(`div`,{key:e.user_id,class:`bg-white rounded-xl border border-slate-200 shadow-sm p-4`},[i(`div`,M,[i(`div`,N,[i(`p`,P,t(e.name||e.username||`Без имени`),1),i(`p`,F,`@`+t(e.username||`—`)+` · ID `+t(e.user_id),1)]),a(f,{to:`/users/${e.user_id}`,class:`text-indigo-600 text-xs whitespace-nowrap`},{default:n(()=>[...l[4]||=[o(`открыть →`,-1)]]),_:1},8,[`to`])]),i(`div`,I,[i(`div`,null,[l[5]||=i(`p`,{class:`text-slate-400`},`Рег.`,-1),i(`p`,L,t(X(e.registered_at)),1)]),i(`div`,null,[l[6]||=i(`p`,{class:`text-slate-400`},`Запросов`,-1),i(`p`,R,t(e.request_count),1)]),i(`div`,null,[l[7]||=i(`p`,{class:`text-slate-400`},`Birth`,-1),i(`p`,null,t(e.has_birth_data?`✅`:`❌`),1)])]),i(`div`,z,[e.subscription_active?(d(),c(`span`,B,` Подписка до `+t(X(e.subscription_ends_at)),1)):(d(),c(`span`,V,`нет подписки`))])]))),128))]))]:(d(),c(`div`,H,`Нет клиентов`))])}}};export{U as default};