1import{e as S,b as F,f as L,r as y,m as H,g as f,j as e,an as K,C as Q,ai as o,b5 as Z,B as N,L as R,T as U,b_ as z,b$ as C,c0 as k,c1 as w,c2 as _,c3 as A,c4 as D,c5 as T,s as b}from"./index-5ZAWLHa7.js";import{A as $}from"./AdminLayout-BUKoFlVJ.js";import{C as q,c as P}from"./card-Oa34omM-.js";import{T as E,a as B,b as d,c as r,d as I,e as a}from"./table-D0xIy6es.js";import{C as G}from"./circle-check-big-CQQOfw9A.js";import"./layout-dashboard-C0M2opqQ.js";import"./list-DES9x6Jt.js";import"./plus-CNrvElMC.js";import"./users-DY6hoq56.js";import"./zap-BR9T_a4I.js";import"./shopping-cart-IQImUVR3.js";import"./package-B3mUj7PH.js";import"./circle-dot-RefO1h_o.js";import"./truck-CiGAK9ox.js";import"./mic-BrJUUKir.js";import"./eye-EaCa6FW1.js";import"./upload-hDTYLIFH.js";import"./code-CfR0yrLo.js";import"./file-code-CIsw_UtE.js";import"./refresh-cw-CZx3qSSi.js";import"./shield-BYg-Ymw1.js";import"./credit-card-DEGk0FvZ.js";import"./globe-enaP-c8h.js";import"./search-BrRMA8aZ.js";import"./ticket-Ba_SANqY.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const J=S("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function fe(){const{toast:c}=F(),v=L(),[i,j]=y.useState(null),[n,p]=y.useState(null),{data:l,isLoading:M}=H({queryKey:["admin-user-deletions"],queryFn:async()=>{const{data:s,error:t}=await b.from("oz1_users").select("id, supabase_uid, email, nickname, deletion_status, membership_expires_at").in("deletion_status",["requested","completed"]).order("id",{ascending:!1});if(t)throw t;return s||[]},refetchInterval:3e4}),m=f({mutationFn:async s=>{const{data:t,error:x}=await b.functions.invoke("process-user-deletion",{body:{user_id:s}});if(x)throw x;return t},onSuccess:s=>{var t;v.invalidateQueries({queryKey:["admin-user-deletions"]}),c({title:"ÃÄet smazán",description:e.jsx("div",{className:"mt-2 text-xs space-y-1",children:(t=s==null?void 0:s.log)==null?void 0:t.map((x,O)=>e.jsx("div",{children:x},O))})})},onError:s=>{c({variant:"destructive",title:"Chyba",description:s.message})}}),u=f({mutationFn:async s=>{const{error:t}=await b.from("oz1_users").update({deletion_status:null}).eq("id",s);if(t)throw t},onSuccess:()=>{v.invalidateQueries({queryKey:["admin-user-deletions"]}),c({title:"Žádost odvolána",description:"Uživatel byl odebrán ze seznamu."})},onError:s=>{c({variant:"destructive",title:"Chyba",description:s.message})}}),h=(l==null?void 0:l.filter(s=>s.deletion_status==="requested"))||[],g=(l==null?void 0:l.filter(s=>s.deletion_status==="completed"))||[];return e.jsxs($,{title:"Ke smazánÃ",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsx(q,{children:e.jsxs(P,{className:"p-0",children:[e.jsx("div",{className:"px-6 py-4 border-b border-border",children:e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(K,{className:"w-4 h-4 text-yellow-500"}),"ÄekajÃcà na zpracovánÃ",h.length>0&&e.jsx(Q,{variant:"destructive",className:"ml-2",children:h.length})]})}),e.jsxs(E,{children:[e.jsx(B,{children:e.jsxs(d,{children:[e.jsx(r,{children:"ID"}),e.jsx(r,{children:"Email"}),e.jsx(r,{children:"PÅezdÃvka"}),e.jsx(r,{children:"Expirace"}),e.jsx(r,{className:"text-right",children:"Akce"})]})}),e.jsx(I,{children:M?[...Array(3)].map((s,t)=>e.jsxs(d,{children:[e.jsx(a,{children:e.jsx(o,{className:"h-4 w-12"})}),e.jsx(a,{children:e.jsx(o,{className:"h-4 w-40"})}),e.jsx(a,{children:e.jsx(o,{className:"h-4 w-24"})}),e.jsx(a,{children:e.jsx(o,{className:"h-4 w-24"})}),e.jsx(a,{children:e.jsx(o,{className:"h-8 w-24 ml-auto"})})]},t)):h.length===0?e.jsx(d,{children:e.jsx(a,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"Žádné úÄty ke smazánÃ"})}):h.map(s=>e.jsxs(d,{children:[e.jsx(a,{className:"font-mono text-sm",children:s.id}),e.jsx(a,{children:s.email}),e.jsx(a,{children:s.nickname||"â"}),e.jsx(a,{className:"text-muted-foreground",children:s.membership_expires_at?Z(s.membership_expires_at,"d. M. yyyy"):"â"}),e.jsx(a,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsxs(N,{variant:"outline",size:"sm",onClick:()=>p(s),disabled:m.isPending||u.isPending,children:[e.jsx(J,{className:"w-4 h-4 mr-1"}),"Odvolat žádost"]}),e.jsx(N,{variant:"destructive",size:"sm",onClick:()=>j(s),disabled:m.isPending||u.isPending,children:m.isPending?e.jsx(R,{className:"w-4 h-4 animate-spin"}):e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-4 h-4 mr-1"}),"Zpracovat"]})})]})})]},s.id))})]})]})}),g.length>0&&e.jsx(q,{children:e.jsxs(P,{className:"p-0",children:[e.jsx("div",{className:"px-6 py-4 border-b border-border",children:e.jsxs("h2",{className:"font-semibold flex items-center gap-2",children:[e.jsx(G,{className:"w-4 h-4 text-green-500"}),"Zpracované (",g.length,")"]})}),e.jsxs(E,{children:[e.jsx(B,{children:e.jsxs(d,{children:[e.jsx(r,{children:"ID"}),e.jsx(r,{children:"Email"}),e.jsx(r,{children:"PÅezdÃvka"})]})}),e.jsx(I,{children:g.map(s=>e.jsxs(d,{className:"opacity-60",children:[e.jsx(a,{className:"font-mono text-sm",children:s.id}),e.jsx(a,{children:s.email}),e.jsx(a,{children:s.nickname||"â"})]},s.id))})]})]})})]}),e.jsx(z,{open:!!i,onOpenChange:s=>!s&&j(null),children:e.jsxs(C,{children:[e.jsxs(k,{children:[e.jsx(w,{children:"Potvrdit smazánà úÄtu"}),e.jsxs(_,{children:["Opravdu chceÅ¡ zpracovat smazánà úÄtu ",e.jsx("strong",{children:i==null?void 0:i.email})," (ID: ",i==null?void 0:i.id,")?",e.jsx("br",{}),e.jsx("br",{}),"Tato akce je ",e.jsx("strong",{children:"nevratná"}),". Bude provedena anonymizace dat, skrytà komentáÅů, smazánà auth záznamu, odpojenà Transistoru a odhlášenà z Ecomailu."]})]}),e.jsxs(A,{children:[e.jsx(D,{children:"ZruÅ¡it"}),e.jsx(T,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>
6{i&&(m.mutate(i.id),j(null))},children:"Ano, smazat úÄet"})]})]})}),e.jsx(z,{open:!!n,onOpenChange:s=>!s&&p(null),children:e.jsxs(C,{children:[e.jsxs(k,{children:[e.jsx(w,{children:"Odvolat žádost o smazánÃ"}),e.jsxs(_,{children:["Opravdu chceÅ¡ odvolat žádost o smazánà úÄtu ",e.jsx("strong",{children:n==null?void 0:n.email})," (ID: ",n==null?void 0:n.id,")?",e.jsx("br",{}),e.jsx("br",{}),"Uživatel bude odebrán ze seznamu a jeho úÄet zůstane plnÄ funkÄnÃ."]})]}),e.jsxs(A,{children:[e.jsx(D,{children:"ZruÅ¡it"}),e.jsx(T,{onClick:()=>{n&&(u.mutate(n.id),p(null))},children:"Ano, odvolat"})]})]})})]})}export{fe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.