PageSourceSearch

https://bd.chile.rugby/assets/SanctionsPage-_9b-7CnC.js

js chile.rugby collected 2026-10-02 20:35:19 UTC 7,885 bytes, 6 lines download raw bytes

1import{u as O,j as e}from"./vendor-query-DXQz-G-n.js";import{u as $,r as I}from"./vendor-react-UDtOjBVY.js";import{u as q}from"./usePersistedTableFilters-C1Q5Rtsf.js";import{I as Q}from"./IconCircleCheck-BuKbSHII.js";import{I as J}from"./IconCircleX-v0UGrPox.js";import{I as H}from"./IconDownload-BI5_73u3.js";import{e as U,u as X,aQ as G,aR as E,aS as W,K as Y,T as y,aT as Z}from"./index-UEZkOO2I.js";import{u as M}from"./vendor-ui-GdHffJNH.js";import{P as R}from"./PageHeader-CDex3Fjd.js";import{u as ee}from"./use-table-state-CuVM3Qyx.js";import{u as ae}from"./use-server-paginated-query-CjNpbYyj.js";import{F as l}from"./field-8Wba4m0H.js";import{S as t}from"./select-DPuFNQOi.js";import{B as te}from"./button-CNe8f_9i.js";import{P as se}from"./pill-tabs-C8fmSbt1.js";import{D as re}from"./data-table-DGa0Yf7J.js";import{d as ie}from"./download-CBSMuAGV.js";import"./index-i5a15ItW.js";import"./IconCheck-C4yarnKh.js";import"./IconSearch-DNXPliZk.js";import"./IconChevronLeft-CKebVIDy.js";import"./IconChevronRight-CUgA3LJg.js";import"./input-xyAn92SA.js";import"./IconCalendar-BkKdedXD.js";/**
2 * @license @tabler/icons-react v3.40.0 - MIT
3 *
4 * This source code is licensed under the MIT license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const oe=[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]],ne=U("outline","external-link","ExternalLink",oe),le=[{id:"all",label:"Todas"},{id:"active",label:"Activas"},{id:"served",label:"Cumplidas"}],ce=le.map(c=>({label:c.label,value:c.id}));function z({label:c,to:m,onNavigate:n}){return m?e.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),n(m)},className:"inline-flex items-center gap-1 text-sm font-medium text-primary-700 transition-colors hover:text-primary-900",children:[e.jsx("span",{children:c}),e.jsx(ne,{size:14})]}):e.jsx("span",{className:"text-sm text-primary-400",children:"-"})}function Re(){var C,_,T,F,P,k;const c=X(),m=$(),{filters:n,setFilter:d}=q({activeStatus:"all",championshipFilter:"",matchFilter:"",clubFilter:""}),g=n.activeStatus,f=n.championshipFilter,v=n.matchFilter,p=n.clubFilter,[D,N]=I.useState(!1),r=ee({initialSortKey:"fromdate",initialSortDir:"desc"}),h=O({queryKey:[...E.all,"filter-options"],queryFn:Z}),L=async()=>{N(!0);try{const a=await G();ie(a,"sanciones.csv"),M.success("Exportacion descargada")}catch{M.error("Error al exportar")}finally{N(!1)}},S={...g!=="all"?{status:g}:void 0,...f!==""?{championship_id:Number(f)}:void 0,...v!==""?{match_id:Number(v)}:void 0,...p!==""&&Number.isFinite(Number(p))?{club_id:Number(p)}:p!==""?{club:p}:void 0},{data:i,isLoading:A,isError:K}=ae({queryKey:E.list(S),queryFn:a=>W(a,S),tableState:r}),b=I.useMemo(()=>{const a=(i==null?void 0:i.items)??[],o=new Map,x=new Map,w=new Map;for(const s of a)s.championship_id!=null&&s.championship_name&&o.set(s.championship_id,s.championship_name),s.match_id!=null&&s.match_description&&x.set(s.match_id,s.match_description),s.player_club&&w.set(s.player_club,s.player_club);return{championships:Array.from(o.entries()).map(([s,u])=>({id:s,name:u})),matches:Array.from(x.entries()).map(([s,u])=>({id:s,label:u})),clubs:Array.from(w.entries()).map(([s,u])=>({id:s,name:u}))}},[i==null?void 0:i.items]),j={championships:(_=(C=h.data)==null?void 0:C.data.championships)!=null&&_.length?h.data.data.championships:b.championships,matches:(F=(T=h.data)==null?void 0:T.data.matches)!=null&&F.length?h.data.data.matches:b.matches,clubs:(k=(P=h.data)==null?void 0:P.data.clubs)!=null&&k.length?h.data.data.clubs:b.clubs};if(K)return e.jsxs("div",{children:[e.jsx(R,{title:"Sanciones"}),e.jsx("div",{className:"rounded-lg bg-error-50 p-4 text-center text-error-600",children:"Error al cargar los datos"})]});const V=[{key:"player",header:"Jugador",sortable:!0,render:a=>e.jsx("span",{className:"text-sm font-semibold text-primary-900",children:a.player_name||"-"})},{key:"player_club",header:"Club",render:a=>e.jsx("span",{className:"text-sm text-primary-700",children:a.player_club||"-"})},{key:"details",header:"Detalle",className:"min-w-[24rem] w-[32rem]",render:a=>e.jsx("div",{className:"max-w-2xl whitespace-normal text-sm text-primary-800",children:a.details||"-"})},{key:"todate",header:"Fin",sortable:!0,className:"w-28",render:a=>e.jsx("span",{className:"text-xs text-primary-600",children:a.todate?Y(a.todate):"—"})},{key:"championship_id",header:"Torneo",className:"w-52",render:a=>{var o;return e.jsx(z,{label:((o=a.championship_name)==null?void 0:o.trim())||"-",to:a.championship_id!=null?`/torneo/${a.championship_id}`:null,onNavigate:m})}},{key:"match_id",header:"Partido",className:"w-72",render:a=>{var o;return e.jsx(z,{label:((o=a.match_description)==null?void 0:o.trim())||"-",to:a.match_id!=null?`/match/${a.match_id}`:null,onNavigate:m})}},{key:"resolved",header:"Estado",className:"w-24 text-center",render:a=>{const o=!!a.is_active_by_rule,x=o?"Jugador inhabilitado":"Jugador habilitado";return e.jsx("div",{className:"flex justify-center",children:e.jsxs(y.Root,{children:[e.jsx(y.Trigger,{asChild:!0,children:e.jsx("span",{className:"inline-flex",children:o?e.jsx(J,{size:18,className:"text-error-600"}):e.jsx(Q,{size:18,className:"text-success-600"})})}),e.jsx(y.Content,{side:"top",children:x})]})})}}],B=e.jsxs(e.Fragment,{children:[e.jsxs(l.Root,{className:"flex-row items-center gap-2",children:[e.jsx(l.Label,{className:"text-xs font-medium text-primary-600",children:"Torneo:"}),e.jsx(l.Control,{children:e.jsxs(t.Root,{value:n.championshipFilter||"all",onValueChange:a=>{d("championshipFilter",a==="all"?"":a),r.onPageChange(1)},children:[e.jsx(t.Trigger,{className:"h-9 w-64 text-sm",children:e.jsx(t.Value,{placeholder:"Todos"})}),e.jsxs(t.Content,{children:[e.jsx(t.Item,{value:"all",children:"Todos"}),j.championships.map(a=>e.jsx(t.Item,{value:String(a.id),children:a.name},a.id))]})]})})]}),e.jsxs(l.Root,{className:"flex-row items-center gap-2",children:[e.jsx(l.Label,{className:"text-xs font-medium text-primary-600",children:"Partido:"}),e.jsx(l.Control,{children:e.jsxs(t.Root,{value:n.matchFilter||"all",onValueChange:a=>{d("matchFilter",a==="all"?"":a),r.onPageChange(1)},children:[e.jsx(t.Trigger,{className:"h-9 w-80 text-sm",children:e.jsx(t.Value,{placeholder:"Todos"})}),e.jsxs(t.Content,{children:[e.jsx(t.Item,{value:"all",children:"Todos"}),j.matches.map(a=>e.jsx(t.Item,{value:String(a.id),children:a.label},a.id))]})]})})]}),e.jsxs(l.Root,{className:"flex-row items-center gap-2",children:[e.jsx(l.Label,{className:"text-xs font-medium text-primary-600",children:"Club:"}),e.jsx(l.Control,{children:e.jsxs(t.Root,{value:n.clubFilter||"all",onValueChange:a=>{d("clubFilter",a==="all"?"":a),r.onPageChange(1)},children:[e.jsx(t.Trigger,{className:"h-9 w-64 text-sm",children:e.jsx(t.Value,{placeholder:"Todos"})}),e.jsxs(t.Content,{children:[e.jsx(t.Item,{value:"all",children:"Todos"}),j.clubs.map(a=>e.jsx(t.Item,{value:String(a.id),children:a.name},a.id))]})]})})]})]});return e.jsxs("div",{children:[e.jsx(R,{title:"Sanciones",actions:e.jsxs(te,{variant:"outline",size:"sm",onClick:L,loading:D,children:[e.jsx(H,{size:16}),"Exportar"]})}),e.jsx(se,{items:ce,activeTab:g,onTabChange:a=>{d("activeStatus",a),r.onPageChange(1)},className:"mb-5"}),e.jsx(re,{columns:V,data:(i==null?void 0:i.items)??[],loading:A,emptyMessage:r.search?`No se encontraron sanciones para "${r.search}"`:"No hay sanciones",sortKey:r.sortKey,sortDir:r.sortDir,onSort:r.onSort,page:r.page,pageSize:r.pageSize,total:(i==null?void 0:i.total)??0,onPageChange:r.onPageChange,onPageSizeChange:r.onPageSizeChange,searchValue:r.search,onSearchChange:r.onSearchChange,searchPlaceholder:c("identity.search.byPlayerOrShortOrClub"),toolbar:B,onRowClick:a=>m(`/sanctions/${a.id}`),getRowHref:a=>`/sanctions/${a.id}`})]})}
6export{Re 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.