CC1 R3B-P1 — sportaš panel klikabilnost

- Klub naziv → openKlub(klub_id) on click
- Sport, mjesto rođenja, datum (godina) → cross-section filter
- HOO / REPR / AKTIVAN / STIP badges → clickable filters
- OIB → opens sudreg.pravosudje.hr lookup
- New helpers: filterSportasiBy, filterSportasiByYear, filterKluboviByCity/Sport, filterObjektiByCity, openOIB
- New CSS .link-chip for inline cyan→gold underlined chips

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
claude-cc1
2026-05-05 00:01:13 +02:00
parent 1bd34ed678
commit 4ecd7fafa3
+92 -7
View File
@@ -143,6 +143,12 @@ table tbody tr.no-click:hover{background:transparent}
@keyframes spin{to{transform:rotate(360deg)}}
.tag{display:inline-block;padding:2px 7px;font-size:10px;border-radius:3px;background:var(--bg4);color:var(--t1);font-weight:600;text-transform:uppercase;letter-spacing:.5px;margin-right:3px}
a.tag,.tag[onclick]{cursor:pointer;text-decoration:none;transition:transform .12s,filter .12s}
a.tag:hover,.tag[onclick]:hover{transform:translateY(-1px);filter:brightness(1.15)}
.link-chip{color:var(--cyan);cursor:pointer;text-decoration:none;border-bottom:1px dashed transparent;transition:all .15s}
.link-chip:hover{color:var(--pgz-gold);border-bottom-color:var(--pgz-gold)}
.kv .v a{color:var(--cyan)}
.kv .v a:hover{color:var(--pgz-gold)}
.tag.b{background:var(--pgz-blue);color:#fff}
.tag.gd{background:var(--pgz-gold);color:var(--bg0)}
.tag.gr{background:var(--green);color:var(--bg0)}
@@ -1078,6 +1084,72 @@ function renderSportasiShell(){
$('#sp-rep').addEventListener('change', applySportasiFilter);
$('#sp-foto').addEventListener('change', applySportasiFilter);
}
function openOIB(oib){
const cleanOib = String(oib||'').replace(/[^0-9]/g,'');
const url = 'https://sudreg.pravosudje.hr/registar/oc/index.html#osnovniPodaci?o='+encodeURIComponent(cleanOib);
// Open external — sudreg supports OIB lookup
window.open(url, '_blank', 'noopener');
}
function filterKluboviByCity(grad){
closePanel();
navTo('klubovi');
setTimeout(() => {
const sel = $('#kl-grad');
if(sel){ sel.value = grad; applyKluboviFilter(); }
}, 100);
}
function filterKluboviBySport(sport){
closePanel();
navTo('klubovi');
setTimeout(() => {
const sel = $('#kl-sport');
if(sel){ sel.value = sport; applyKluboviFilter(); }
}, 100);
}
function filterObjektiByCity(grad){
closePanel();
navTo('objekti');
setTimeout(() => {
const sel = $('#ob-grad');
if(sel){ sel.value = grad; applyObjektiFilter(); }
}, 100);
}
function filterSportasiBy(field, value){
closePanel();
navTo('sportasi');
setTimeout(() => {
if(field === 'sport'){
// Use search box since there's no sport dropdown
const q = $('#sp-q'); if(q){ q.value = value; }
} else if(field === 'mjesto_rodjenja' || field === 'grad'){
const q = $('#sp-q'); if(q){ q.value = value; }
} else if(field === 'reprezentativac'){
const cb = $('#sp-rep'); if(cb){ cb.checked = !!value; }
} else if(field === 'hoo'){
const sel = $('#sp-hoo'); if(sel){ sel.value = String(value); }
} else if(field === 'aktivan'){
// Add to extra-filters slot if exists; else search by status string
_state.spExtraAktivan = value ? 'true' : 'false';
} else if(field === 'stipendiran'){
_state.spExtraStipendiran = !!value;
}
applySportasiFilter();
}, 100);
}
function filterSportasiByYear(year){
closePanel();
navTo('sportasi');
setTimeout(() => {
_state.spYear = String(year);
applySportasiFilter();
}, 100);
}
function clearSportasiExtras(){
_state.spExtraAktivan = '';
_state.spExtraStipendiran = false;
_state.spYear = '';
}
function setSportasiView(v){
_state.viewSportasi = v;
$('#sp-card').classList.toggle('active', v==='card');
@@ -1094,6 +1166,12 @@ function applySportasiFilter(){
if(rep) rows = rows.filter(c => c.reprezentativac);
if(foto) rows = rows.filter(c => c.slika_url);
if(hoo) rows = rows.filter(c => String(c.hoo_kategorija||c.kategorija_hoo||'')===hoo);
if(_state.spYear){
rows = rows.filter(c => String(c.datum_rodenja||c.datum_rodjenja||'').slice(0,4) === _state.spYear);
}
if(_state.spExtraAktivan==='true') rows = rows.filter(c => c.aktivan);
if(_state.spExtraAktivan==='false') rows = rows.filter(c => !c.aktivan);
if(_state.spExtraStipendiran) rows = rows.filter(c => c.stipendiran);
if(_sort.sportasi) rows = sortRows(rows, _sort.sportasi.key, _sort.sportasi.dir);
$('#sp-cnt').textContent = rows.length+' sportaša';
const top = rows.slice(0, 300);
@@ -1165,14 +1243,21 @@ async function openSportas(id){
<div class="pp-foto">${photo}</div>
<div class="pp-info">
<div class="pp-name">${esc(d.ime||'')} ${esc(d.prezime||'')}</div>
<div class="pp-meta">${txt(d.sport,'—')} · ${txt(d.pozicija,'')} · <b>${esc(d.klub_naziv_full||d.klub_naziv_godisnjak||'—')}</b></div>
<div class="pp-meta">📅 ${fmtDate(dob)}${(d.mjesto_rodjenja||d.mjesto_rodenja)?' · '+esc(d.mjesto_rodjenja||d.mjesto_rodenja):''}</div>
<div class="pp-meta">
${d.sport?'<a class="link-chip" onclick="filterSportasiBy(&quot;sport&quot;,&quot;'+esc(d.sport)+'&quot;)">'+esc(d.sport)+'</a>':''} ·
${txt(d.pozicija,'')} ·
${d.klub_id ? '<a class="link-chip" onclick="closePanel();setTimeout(()=>openKlub('+d.klub_id+'),250)"><b>'+esc(d.klub_naziv_full||d.klub_naziv_godisnjak||'—')+'</b></a>' : '<b>'+esc(d.klub_naziv_full||d.klub_naziv_godisnjak||'—')+'</b>'}
</div>
<div class="pp-meta">
${dob ? '<a class="link-chip" onclick="filterSportasiByYear(&quot;'+esc((dob||'').slice(0,4))+'&quot;)">📅 '+fmtDate(dob)+'</a>' : '📅 —'}
${(d.mjesto_rodjenja||d.mjesto_rodenja)?' · <a class="link-chip" onclick="filterSportasiBy(&quot;mjesto_rodjenja&quot;,&quot;'+esc(d.mjesto_rodjenja||d.mjesto_rodenja)+'&quot;)">'+esc(d.mjesto_rodjenja||d.mjesto_rodenja)+'</a>':''}
</div>
<div class="pp-tags">
${d.aktivan?'<span class="tag gr">AKTIVAN</span>':'<span class="tag rd">NEAKTIVAN</span>'}
${d.reprezentativac?'<span class="tag gd">REPR</span>':''}
${hooCat?'<span class="tag b">HOO '+esc(hooCat)+'</span>':''}
<a class="tag ${d.aktivan?'gr':'rd'}" onclick="filterSportasiBy('aktivan',${d.aktivan?'true':'false'})">${d.aktivan?'AKTIVAN':'NEAKTIVAN'}</a>
${d.reprezentativac?'<a class="tag gd" onclick="filterSportasiBy(&quot;reprezentativac&quot;,true)">REPR</a>':''}
${hooCat?'<a class="tag b" onclick="filterSportasiBy(&quot;hoo&quot;,&quot;'+esc(hooCat)+'&quot;)">HOO '+esc(hooCat)+'</a>':''}
${d.broj_dresa?'<span class="tag">#'+esc(d.broj_dresa)+'</span>':''}
${d.stipendiran?'<span class="tag am">STIP</span>':''}
${d.stipendiran?'<a class="tag am" onclick="filterSportasiBy(&quot;stipendiran&quot;,true)">STIP</a>':''}
</div>
</div>
</div>
@@ -1233,7 +1318,7 @@ async function openSportas(id){
<div id="p-bio" class="ptab" style="display:none">
<div class="kv">
<div class="k">OIB</div><div class="v">${txt(d.oib)}</div>
<div class="k">OIB</div><div class="v">${d.oib?'<a class="link-chip" onclick="openOIB(&quot;'+esc(d.oib)+'&quot;)">'+esc(d.oib)+'</a>':'—'}</div>
<div class="k">Datum rođenja</div><div class="v">${fmtDate(dob)}</div>
<div class="k">Mjesto rođenja</div><div class="v">${txt(d.mjesto_rodjenja||d.mjesto_rodenja)}</div>
<div class="k">Spol</div><div class="v">${txt(d.spol)}</div>