1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4905],{64905:function(e,n,s){Promise.resolve().then(s.bind(s,11449)),Promise.resolve().then(s.bind(s,40685)),Promise.resolve().then(s.bind(s,83748)),Promise.resolve().then(s.bind(s,14312)),Promise.resolve().then(s.bind(s,27539)),Promise.resolve().then(s.bind(s,62007)),Promise.resolve().then(s.bind(s,5269)),Promise.resolve().then(s.bind(s,50203)),Promise.resolve().then(s.bind(s,74519)),Promise.resolve().then(s.bind(s,88544)),Promise.resolve().then(s.bind(s,86730)),Promise.resolve().then(s.bind(s,57073)),Promise.resolve().then(s.bind(s,81567)),Promise.resolve().then(s.bind(s,90697)),Promise.resolve().then(s.bind(s,29157)),Promise.resolve().then(s.bind(s,47696)),Promise.resolve().then(s.bind(s,28687)),Promise.resolve().then(s.bind(s,26922)),Promise.resolve().then(s.bind(s,77472)),Promise.resolve().then(s.bind(s,40859)),Promise.resolve().then(s.bind(s,25772)),Promise.resolve().then(s.bind(s,73414)),Promise.resolve().then(s.bind(s,85250)),Promise.resolve().then(s.bind(s,61859)),Promise.resolve().then(s.bind(s,31269)),Promise.resolve().then(s.bind(s,57220)),Promise.resolve().then(s.bind(s,82771)),Promise.resolve().then(s.bind(s,10741)),Promise.resolve().then(s.bind(s,74764)),Promise.resolve().then(s.bind(s,79501)),Promise.resolve().then(s.bind(s,6188)),Promise.resolve().then(s.bind(s,89973)),Promise.resolve().then(s.bind(s,27403)),Promise.resolve().then(s.bind(s,570)),Promise.resolve().then(s.bind(s,88522)),Promise.resolve().then(s.bind(s,7548)),Promise.resolve().then(s.bind(s,73389)),Promise.resolve().then(s.bind(s,83949)),Promise.resolve().then(s.bind(s,13672)),Promise.resolve().then(s.bind(s,93098)),Promise.resolve().then(s.bind(s,73547)),Promise.resolve().then(s.bind(s,80348)),Promise.resolve().then(s.bind(s,78473)),Promise.resolve().then(s.bind(s,49325)),Promise.resolve().then(s.bind(s,59198)),Promise.resolve().then(s.bind(s,6110)),Promise.resolve().then(s.bind(s,94551)),Promise.resolve().then(s.bind(s,7958)),Promise.resolve().then(s.bind(s,55164)),Promise.resolve().then(s.bind(s,73458)),Promise.resolve().then(s.bind(s,27350)),Promise.resolve().then(s.bind(s,29578)),Promise.resolve().then(s.bind(s,60122)),Promise.resolve().then(s.bind(s,40227)),Promise.resolve().then(s.bind(s,35860)),Promise.resolve().then(s.bind(s,82816)),Promise.resolve().then(s.bind(s,46062)),Promise.resolve().then(s.bind(s,50687)),Promise.resolve().then(s.bind(s,86559)),Promise.resolve().then(s.bind(s,90240)),Promise.resolve().then(s.bind(s,41952)),Promise.resolve().then(s.bind(s,2118)),Promise.resolve().then(s.bind(s,99085)),Promise.resolve().then(s.bind(s,35589)),Promise.resolve().then(s.t.bind(s,38173,23)),Promise.resolve().then(s.t.bind(s,231,23))},40685:function(e,n,s){"use strict";s.d(n,{BulletinForm:function(){return h}});var r=s(57437),i=s(2265);s(74590);var l=s(58064),t=(0,l.$)("cd5b453747e48e9c887641295e4e1d1cfc5a8bc6");(0,l.$)("e0c5e2d166c3befc2f4d3407267b0b0b6fcc6c0e");var a=(0,l.$)("360d20381401b2ae3e9daae4abf1df180bf226d2");(0,l.$)("01a4686edf01f934e9aa9a5e5766163ebf6e0648");var o=(0,l.$)("41bd075fcbdd27327babbeec58dade937fc28a80"),d=(0,l.$)("b4867397cf6cc173ea451fc860d67af3de3f981c");(0,l.$)("de0c6dcbd48b4fa9fc5bbb6cce00e14774e8e326"),(0,l.$)("d47966221634c8bdf8192d3826f6d6f8b2468d23");var c=(0,l.$)("138c70237fc40e2479bd15de6926d30d6360a2de"),b=(0,l.$)("9aca49cd735805ecbed09b54a0b02b1b25e97291");(0,l.$)("676d999941771f5d954d9850bc7ba907e09c0198");var u=(0,l.$)("191c952670673bcec7ad56371f5484d6b4f38ea4"),v=s(16463),m=s(19141);function h(e){var n,s,l,h,p,x;let{mode:f,organizationId:P,initial:j,defaultNumber:N}=e,g=(0,v.useRouter)(),[y,w]=(0,i.useState)(null!==(s=null!==(n=null==j?void 0:j.number)&&void 0!==n?n:N)&&void 0!==s?s:100*new Date().getFullYear()+1),[S,k]=(0,i.useState)(null!==(l=null==j?void 0:j.dateISO)&&void 0!==l?l:new Date().toISOString().slice(0,10)),[C,$]=(0,i.useState)(null!==(h=null==j?void 0:j.isPublishable)&&void 0!==h&&h),[I,B]=(0,i.useState)(null!==(p=null==j?void 0:j.observations)&&void 0!==p?p:""),[E,L]=(0,i.useState)(!1),[A,T]=(0,i.useState)(null),[z,D]=(0,i.useState)(""),[F,O]=(0,i.useState)(new Set("edit"===f?(null!==(x=null==j?void 0:j.sanctions)&&void 0!==x?x:[]).map(e=>e.id):[]));async function _(){if(null===A){L(!0);try{if("edit"===f){if(!j)return;if(j.canEditSanctions){let e=await t(P,j.id);T(e)}else{var e;T(null!==(e=j.sanctions)&&void 0!==e?e:[])}}else{let e=await a(P);T(e)}}finally{L(!1)}}}(0,i.useEffect)(()=>
1{if("edit"!==f)return;let e=!1;return async function(){L(!0);try{if(!j)return;if(j.canEditSanctions){let n=await t(P,j.id);e||T(n)}else{var n;e||T(null!==(n=j.sanctions)&&void 0!==n?n:[])}}finally{e||L(!1)}}(),()=>{e=!0}},[f,j,P]);let M=(0,i.useMemo)(()=>{if(!A)return[];let e=z.trim().toLowerCase();return e?A.filter(n=>{var s,r,i,l,t,a,o,d,c,b,u;let v=null!==(t=n.involvedLabel)&&void 0!==t?t:"";return[null!==(a=null===(r=n.match)||void 0===r?void 0:null===(s=r.localTeam)||void 0===s?void 0:s.name)&&void 0!==a?a:"",null!==(o=null===(l=n.match)||void 0===l?void 0:null===(i=l.visitorTeam)||void 0===i?void 0:i.name)&&void 0!==o?o:"",null!==(d=n.targetKind)&&void 0!==d?d:"",null!==(c=n.description)&&void 0!==c?c:"",null!==(b=n.article)&&void 0!==b?b:"",null!==(u=n.inciso)&&void 0!==u?u:"",v].join(" ").toLowerCase().includes(e)}):A},[A,z]),q=e=>{("edit"!==f||(null==j?void 0:j.canEditSanctions))&&O(n=>{let s=new Set(n);return s.has(e)?s.delete(e):s.add(e),s})},G=async()=>{let e=await (0,m.Vp)();if(!e)return{success:!1,error:"No autenticado"};L(!0);try{if("create"===f){if(0===F.size){alert("Deb\xe9s seleccionar al menos una sanci\xf3n para crear el bolet\xedn.");return}if(!window.confirm("Vas a crear el bolet\xedn N\xb0 ".concat(y," con ").concat(F.size," sanci\xf3n/es para la fecha ").concat(S,". \xbfConfirm\xe1s?")))return;let n=await b({organizationId:P,number:y,dateISO:S,isPublishable:C,observations:I,createdById:e.id,sanctionIds:Array.from(F)});if(n.ok){alert("Bolet\xedn creado"),g.replace("/discipline/".concat(P,"/bulletins/").concat(n.id)),g.refresh();return}alert("No se pudo crear: ".concat(n.reason))}else{if(!j||!window.confirm("Guardar cambios del bolet\xedn N\xb0 ".concat(y," (fecha ").concat(S,") con ").concat(F.size," sanci\xf3n/es seleccionada/s?")))return;let n=await u({id:j.id,number:y,dateISO:S,isPublishable:C,observations:I,updatedById:e.id,sanctionIds:Array.from(F)});if(n.ok){g.refresh(),alert("Bolet\xedn guardado.");return}alert("No se pudo guardar: ".concat(n.reason))}}finally{L(!1)}},K=async()=>{if(j&&confirm("\xbfInactivar el bolet\xedn? Las sanciones seguir\xe1n vinculadas (bloqueadas).")){L(!0);try{(await o(j.id)).ok?(g.replace("/discipline/".concat(P,"/bulletins")),g.refresh()):alert("No se pudo inactivar.")}finally{L(!1)}}},V=async()=>{if(j&&confirm("\xbfActivar nuevamente este bolet\xedn?")){L(!0);try{(await c(j.id)).ok?(g.refresh(),alert("Bolet\xedn activado.")):alert("No se pudo activar.")}finally{L(!1)}}},R=async()=>{if(j){L(!0);try{(await d(j.id,!C)).ok&&$(e=>!e)}finally{L(!1)}}};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"rounded-xl border border-purple-200 p-3 bg-white shadow-sm",children:(0,r.jsxs)("div",{className:"grid md:grid-cols-4 gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"N\xfamero"}),(0,r.jsx)("input",{type:"number",className:"w-full border rounded px-2 py-1 text-sm",value:y,onChange:e=>w(parseInt(e.target.value||"0",10))})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Fecha"}),(0,r.jsx)("input",{type:"date",className:"w-full border rounded px-2 py-1 text-sm",value:S,onChange:e=>k(e.target.value)})]}),(0,r.jsxs)("div",{className:"flex items-end gap-2",children:[(0,r.jsxs)("label",{className:"inline-flex items-center gap-2 text-sm",children:[(0,r.jsx)("input",{type:"checkbox",className:"accent-purple-600",checked:C,onChange:e=>$(e.target.checked)}),"Publicable en web"]}),"edit"===f&&(0,r.jsx)("button",{type:"button",onClick:R,className:"px-2 py-1 border rounded text-xs text-purple-700 border-purple-400 hover:bg-purple-50",children:C?"Marcar NO publicable":"Marcar publicable"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs text-gray-500 mb-1",children:"Observaciones"}),(0,r.jsx)("input",{type:"text",className:"w-full border rounded px-2 py-1 text-sm",value:I,onChange:e=>B(e.target.value),placeholder:"(opcional)"})]})]})}),"edit"===f&&j&&!j.canEditSanctions&&(0,r.jsx)("div",{className:"rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm text-amber-900",children:"Las sanciones de este bolet\xedn est\xe1n en solo lectura. Solo se pueden modificar las de los 2 boletines activos m\xe1s recientes."}),(0,r.jsxs)("div",{className:"rounded-xl border border-purple-200 bg-white shadow-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 border-b bg-purple-50",children:[(0,r.jsx)("div",{className:"text-sm font-semibold text-purple-800",children:"create"===f?"Sanciones dis
1ponibles (sin bolet\xedn)":(null==j?void 0:j.canEditSanctions)?"Sanciones del bolet\xedn y disponibles para agregar":"Sanciones del bolet\xedn"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{placeholder:"Buscar por partido, jugador, cancha, art\xedculo...",className:"border rounded px-2 py-1 text-sm",value:z,onChange:e=>D(e.target.value),onFocus:_}),(0,r.jsx)("button",{type:"button",onClick:_,className:"px-2 py-1 border rounded text-xs text-purple-700 border-purple-400 hover:bg-purple-50",children:"Cargar sanciones"}),(0,r.jsxs)("span",{className:"text-xs text-gray-600",children:["Seleccionadas: ",F.size]})]})]}),(0,r.jsx)("div",{className:"",children:(0,r.jsxs)("table",{className:"w-full text-xs",children:[(0,r.jsx)("thead",{className:"sticky top-0 bg-white shadow-sm",children:(0,r.jsxs)("tr",{className:"text-gray-500",children:[(0,r.jsx)("th",{className:"p-2 w-8"}),(0,r.jsx)("th",{className:"text-left p-2",children:"Partido"}),(0,r.jsx)("th",{className:"text-left p-2",children:"Involucrado"}),(0,r.jsx)("th",{className:"text-left p-2",children:"Target"}),(0,r.jsx)("th",{className:"text-left p-2",children:"Detalle"}),(0,r.jsx)("th",{className:"text-left p-2",children:"Art\xedculo"}),(0,r.jsx)("th",{className:"text-left p-2",children:"Unidad"})]})}),(0,r.jsxs)("tbody",{children:[null===A&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"p-4 text-center text-gray-500",children:"Click en âBuscarâ¦â para cargar."})}),null!==A&&0===M.length&&(0,r.jsx)("tr",{children:(0,r.jsx)("td",{colSpan:7,className:"p-4 text-center text-gray-500",children:"Sin resultados."})}),M.map(e=>{var n,s,i,l,t,a,o,d,c,b;let u=e.match,v=u?"".concat(null!==(i=null===(n=u.localTeam)||void 0===n?void 0:n.name)&&void 0!==i?i:"â"," vs ").concat(null!==(l=null===(s=u.visitorTeam)||void 0===s?void 0:s.name)&&void 0!==l?l:"â"):null!==(t=e.involvedLabel)&&void 0!==t?t:"â",m=F.has(e.id),h="edit"===f&&!(null==j?void 0:j.canEditSanctions);return(0,r.jsxs)("tr",{className:"border-t hover:bg-purple-50/40",children:[(0,r.jsx)("td",{className:"p-2",children:(0,r.jsx)("input",{type:"checkbox",className:"accent-purple-600",checked:m,disabled:h,onChange:()=>q(e.id)})}),(0,r.jsx)("td",{className:"p-2",children:v}),(0,r.jsx)("td",{className:"p-2",children:null!==(a=e.involvedLabel)&&void 0!==a?a:"â"}),(0,r.jsx)("td",{className:"p-2",children:null!==(o=e.targetKind)&&void 0!==o?o:"â"}),(0,r.jsx)("td",{className:"p-2",children:null!==(d=e.description)&&void 0!==d?d:"â"}),(0,r.jsx)("td",{className:"p-2",children:[e.article,e.inciso].filter(Boolean).join(" - ")||"â"}),(0,r.jsxs)("td",{className:"p-2",children:[null!==(c=e.quantity)&&void 0!==c?c:"â"," ",null!==(b=e.unit)&&void 0!==b?b:""]})]},e.id)})]})]})}),(0,r.jsxs)("div",{className:"p-2 flex items-center justify-end gap-2 border-t bg-purple-50",children:["edit"===f&&j&&(j.isActive?(0,r.jsx)("button",{onClick:K,disabled:E,className:"px-3 py-1.5 rounded border text-red-700 border-red-400 hover:bg-red-50",children:"Inactivar bolet\xedn"}):(0,r.jsx)("button",{onClick:V,disabled:E,className:"px-3 py-1.5 rounded border text-green-700 border-green-500 hover:bg-green-50",children:"Activar bolet\xedn"})),(0,r.jsx)("button",{onClick:G,disabled:E,className:"px-3 py-1.5 rounded bg-purple-600 text-white hover:bg-purple-700 disabled:opacity-50",children:"create"===f?"Crear bolet\xedn":"Guardar cambios"})]})]})]})}}}]);
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.