1import{c as S,a6 as o,a7 as n,a8 as i,bk as _,r as C,y as a,au as k,w as t,j as s,v as x}from"./index-eJyS5X3E.js";import{u as p}from"./useMutation-B8U2HRV2.js";import{R as q}from"./refresh-cw-dtkvYXw4.js";import{S as F}from"./shield-check-DSzzMys_.js";const E=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],L=S("shield-x",E),M=o({method:"GET"}).middleware([n]).handler(i("8b9d49df47ad37fd095c11fa9aa69a385ba6c03e2d7d9ebd064e5821961ed3cf")),Q=o({method:"POST"}).middleware([n]).handler(i("81f0edb29314f6483afedf3f89a59a9b9dc47b24cdd3fc9bea4b05745c99f5a0")),U=o({method:"POST"}).middleware([n]).handler(i("5f16e6b1eb2888821455090dd293e60d898ef1520a4a60831fd03e6cef84a356"));function T(){const c=_(),[l,r]=C.useState(null),f=a(M),h=a(Q),b=a(U),{data:g,isLoading:v,isFetching:j,refetch:y,error:u}=k({queryKey:["unverified-rounds"],queryFn:()=>f()}),N=p({mutationFn:e=>h({data:{id:e}}),onMutate:e=>r(e),onSettled:()=>r(null),onSuccess:()=>{t.success("Round approved â results verified and fees released."),c.invalidateQueries({queryKey:["unverified-rounds"]})},onError:e=>t.error(e.message)}),w=p({mutationFn:({id:e,reason:d})=>b({data:{id:e,reason:d}}),onMutate:({id:e})=>r(e),onSettled:()=>r(null),onSuccess:()=>{t.success("Round rejected â fees voided."),c.invalidateQueries({queryKey:["unverified-rounds"]})},onError:e=>t.error(e.message)}),m=g??[];return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("header",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"font-display text-2xl",children:"Unverified rounds"}),s.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Rounds finalised by a member or guest without the scorer role. Results are saved but marked unverified, and their fees are held until you approve them."})]}),s.jsxs("button",{type:"button",onClick:()=>{y()},className:"inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm hover:border-gold",children:[j?s.jsx(x,{className:"h-4 w-4 animate-spin"}):s.jsx(q,{className:"h-4 w-4"}),"Refresh"]})]}),u&&s.jsx("div",{role:"alert",className:"rounded-lg border border-destructive/40 bg-destructive/10 p-4 text-sm",children:u.message}),v?s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(x,{className:"h-4 w-4 animate-spin"})," Loading roundsâ¦"]}):m.length===0?s.jsx("p",{className:"rounded-lg border border-border/50 bg-surface p-6 text-sm text-muted-foreground",children:"Nothing waiting for approval."}):s.jsx("ul",{className:"space-y-3",children:m.map(e=>s.jsxs("li",{className:"rounded-xl border border-border/50 bg-surface p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[s.jsxs("div",{children:[s.jsxs("p",{className:"font-semibold",children:[e.shoot_date," · ",e.range??"â"," · Round ",e.round_number,s.jsx("span",{className:"ml-2 rounded-full border border-amber-500/40 bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-amber-300",children:e.rejected_at?"Rejected":"Unverified"})]}),s.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[e.discipline,e.external_club?` · ${e.external_club}`:" · Home club"," · scored by"," ",e.scorer_name]})]}),s.jsxs("div",{className:"text-right text-xs text-muted-foreground",children:[s.jsxs("p",{className:"font-semibold text-foreground",children:[e.charge_currency," ",e.charge_total.toFixed(2)]}),s.jsxs("p",{children:[e.charge_count," fee",e.charge_count===1?"":"s"," pending"]})]})]}),s.jsx("ul",{className:"mt-3 flex flex-wrap gap-2 text-xs",children:e.shooters.map((d,R)=>s.jsxs("li",{className:"rounded-md border border-border/50 px-2 py-1",children:[d.name," · ",s.jsxs("span",{className:"font-semibold",children:[d.score,"/25"]})]},`${e.id}-${R}`))}),s.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[s.jsxs("button",{type:"button",disabled:l===e.id,onClick:()=>N.mutate(e.id),className:"inline-flex items-center gap-2 rounded-md bg-gold px-3 py-2 text-sm font-medium text-primary-foreground hover:bg-gold/90 disabled:opacity-60",children:[s.jsx(F,{className:"h-4 w-4"})," Approve"]}),s.jsxs("button",{type:"button",disabled:l===e.id,onClick:()=>{const d=typeof window>"u"?void 0:window.prompt("Reason for rejecting this round? (optional)")??void 0;w.mutate({id:e.id,reason:d})},className:"inline-flex items-center gap-2 rounded-md border border-destructive/50 px-3 py-2 text-sm text-destructive hover:bg-destructive/10 disabled:opacity-60",children:[s.jsx(L,{className:"h-4 w-4"})," Reject"]})]})]},e.id))})]})}export{T as component};
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.