Initial clean version
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
Options -Indexes
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [QSA,L]
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,18 @@
|
||||
document.querySelectorAll('[data-filter]').forEach(input=>input.addEventListener('input',()=>{
|
||||
const q=input.value.normalize('NFD').replace(/[\u0300-\u036f]/g,'').toLowerCase();
|
||||
document.querySelectorAll(input.dataset.filter+' tbody tr').forEach(row=>{if(!row.dataset.section){
|
||||
const excluded=row.dataset.profilePlayer==='0'&&document.getElementById('toggle-profiles')?.getAttribute('aria-pressed')!=='true'&&!row.querySelector('input[name="players[]"]:checked');
|
||||
const wanted=document.querySelector('[data-spond-filter]')?.value||'';
|
||||
const filtered=wanted&&row.dataset.spondStatus!==wanted&&!row.querySelector('input[name="players[]"]:checked');
|
||||
row.hidden=excluded||filtered||!row.textContent.normalize('NFD').replace(/[\u0300-\u036f]/g,'').toLowerCase().includes(q);
|
||||
}});
|
||||
}));
|
||||
document.addEventListener('click',event=>{
|
||||
const button=event.target.closest('[data-badge-detail]');if(!button)return;
|
||||
const opened=button.getAttribute('aria-expanded')==='true';
|
||||
if(button.nextElementSibling?.classList.contains('badge-explanation'))button.nextElementSibling.remove();
|
||||
button.setAttribute('aria-expanded',String(!opened));
|
||||
if(!opened){const detail=document.createElement('span');detail.className='badge-explanation';detail.setAttribute('role','status');detail.textContent=button.dataset.badgeDetail;button.after(detail);}
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-spond-filter]').forEach(s=>s.addEventListener('change',()=>document.querySelectorAll('[data-filter]').forEach(i=>i.dispatchEvent(new Event('input')))));
|
||||
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
(() => {
|
||||
document.querySelectorAll('[data-availability]').forEach(control=>{
|
||||
const save=control.querySelector('[data-availability-save]');if(!save)return;
|
||||
const status=control.querySelector('[data-availability-status]'),note=control.querySelector('[data-availability-note]'),result=control.querySelector('[data-availability-result]');
|
||||
[status,note].forEach(input=>input.addEventListener('input',()=>{control.dataset.dirty='1';result.textContent='Modification non enregistrée.';}));
|
||||
save.addEventListener('click',async()=>{
|
||||
save.disabled=true;status.disabled=true;note.disabled=true;result.textContent='Enregistrement…';
|
||||
try{
|
||||
const response=await fetch('/availability/save',{method:'POST',credentials:'same-origin',body:new URLSearchParams({csrf:document.querySelector('input[name="csrf"]').value,player_id:control.dataset.availability,week:control.dataset.week,version:control.dataset.version,status:status.value,note:note.value})});
|
||||
if(!response.ok)throw new Error('Non enregistré : la disponibilité a peut-être été modifiée ailleurs. Enregistrez votre groupe puis rechargez la page.');
|
||||
const data=await response.json();if(!data.saved)throw new Error('Session expirée : reconnectez-vous.');
|
||||
control.dataset.version=data.availability.version;control.querySelector('[data-availability-label]').textContent=({available:'Disponible',injured:'Blessé',unavailable:'Indisponible'}[data.availability.status])+' · cette semaine';delete control.dataset.dirty;result.textContent='Enregistré pour toutes les équipes cette semaine.';
|
||||
document.dispatchEvent(new CustomEvent('availability-saved',{detail:{id:control.dataset.availability,availability:data.availability}}));
|
||||
}catch(error){result.textContent=error.message;}finally{save.disabled=false;status.disabled=false;note.disabled=false;}
|
||||
});
|
||||
});
|
||||
window.addEventListener('beforeunload',event=>{if(document.querySelector('[data-availability][data-dirty="1"]')){event.preventDefault();event.returnValue='';}});
|
||||
})();
|
||||
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
(async () => {
|
||||
const data=JSON.parse(document.getElementById('share-data').textContent),canvas=document.getElementById('convocation-canvas'),ctx=canvas.getContext('2d'),groups=data.groups,n=groups.length;
|
||||
const brand=data.branding||{short_name:'ESBSC',primary:'#143852',accent:'#246b80',logo:''};
|
||||
let logo=null;if(brand.logo){try{logo=await new Promise((resolve,reject)=>{const i=new Image();i.onload=()=>resolve(i);i.onerror=reject;i.src=brand.logo;});}catch(e){document.getElementById('image-status').textContent='Logo indisponible : image créée sans logo.';}}
|
||||
const rgb=brand.primary.match(/[a-f0-9]{2}/gi).map(x=>parseInt(x,16)/255).map(x=>x<=.04045?x/12.92:((x+.055)/1.055)**2.4),light=rgb[0]*.2126+rgb[1]*.7152+rgb[2]*.0722>.179;
|
||||
const width=n===1?900:1800,margin=40,col=(width-2*margin)/n;
|
||||
function lines(text,bold=false,size=26,available=col-36){
|
||||
ctx.font=`${bold?'bold ':''}${size}px sans-serif`;
|
||||
const result=[];let line='';
|
||||
for(const char of text){if(ctx.measureText(line+char).width>available&&line){const cut=line.lastIndexOf(' ');if(cut>line.length/2){result.push(line.slice(0,cut));line=line.slice(cut+1);}else{result.push(line);line='';}}line+=char;}
|
||||
result.push(line);return result;
|
||||
}
|
||||
const rows=[{kind:'team',values:groups.map(g=>g.team)},{kind:'opponent',values:groups.map(g=>g.opponent)},{kind:'date',values:groups.map(g=>g.when)},{kind:'section',values:groups.map(()=>'JOUEURS CONVOQUÉS')}];
|
||||
for(let i=0;i<Math.max(...groups.map(g=>g.players.length));i++)rows.push({kind:'player',values:groups.map(g=>g.players[i]||'')});
|
||||
if(data.include_staff){rows.push({kind:'section',values:groups.map(()=>'STAFF ACCOMPAGNATEUR')});for(let i=0;i<Math.max(1,...groups.map(g=>g.staff.length));i++)rows.push({kind:'staff',values:groups.map(g=>g.staff[i]||(i===0?'—':''))});}
|
||||
rows.forEach(row=>{row.bold=['team','opponent','section'].includes(row.kind);row.size=row.kind==='team'?32:row.kind==='section'?20:row.kind==='date'?22:26;row.lines=row.values.map(v=>lines(v,row.bold,row.size,col-(row.kind==='opponent'?84:36)));row.height=Math.max(...row.lines.map(l=>l.length))*(row.size+10)+24;});
|
||||
canvas.width=width;canvas.height=160+rows.reduce((h,r)=>h+r.height,0)+(data.legend?100:40);ctx.fillStyle='#ffffff';ctx.fillRect(0,0,canvas.width,canvas.height);
|
||||
ctx.fillStyle=brand.primary;ctx.fillRect(margin,20,8,100);let tx=margin+26;if(logo){const scale=Math.min(105/logo.width,105/logo.height);ctx.drawImage(logo,tx,20+(105-logo.height*scale)/2,logo.width*scale,logo.height*scale);tx+=130;}
|
||||
const title=brand.short_name+' · CONVOCATIONS';let titleSize=42;do{ctx.font=`bold ${titleSize}px sans-serif`;if(ctx.measureText(title).width<=width-margin-tx)break;titleSize--;}while(titleSize>18);ctx.fillStyle='#162b38';ctx.fillText(title,tx,65);ctx.font='24px sans-serif';ctx.fillText('Semaine du '+data.week.split('-').reverse().join('/'),tx,110);
|
||||
function symbol(x,y,side){
|
||||
ctx.save();ctx.translate(x,y);ctx.scale(2,2);ctx.fillStyle=brand.primary;ctx.beginPath();
|
||||
const pts=side==='home'?[[0,5],[7,-2],[14,5],[12,5],[12,13],[8,13],[8,8],[5,8],[5,13],[2,13],[2,5]]:[[0,8],[6,7],[6,0],[8,-2],[9,7],[15,10],[15,12],[9,11],[9,15],[11,16],[11,18],[7,16],[3,18],[3,16],[6,15],[6,11],[0,10]];
|
||||
if(side==='unknown'){ctx.font='bold 16px sans-serif';ctx.fillText('?',2,12);}else{pts.forEach(([a,b],i)=>i?ctx.lineTo(a,b):ctx.moveTo(a,b));ctx.closePath();ctx.fill();}ctx.restore();
|
||||
}
|
||||
let y=145;rows.forEach((r,index)=>{
|
||||
r.lines.forEach((ls,i)=>{const x=margin+i*col;ctx.fillStyle=r.kind==='team'?brand.primary:r.kind==='section'?'#d4e6ef':index%2?'#eef4f7':'#ffffff';ctx.fillRect(x,y,col-3,r.height);ctx.fillStyle=r.kind==='team'?(light?'#111111':'#ffffff'):'#162b38';ctx.font=`${r.bold?'bold ':''}${r.size}px sans-serif`;ls.forEach((line,j)=>ctx.fillText(line,x+(r.kind==='opponent'?62:18),y+12+r.size+j*(r.size+10)));if(r.kind==='opponent')symbol(x+16,y+18,groups[i].side);});y+=r.height;
|
||||
});
|
||||
if(data.legend){symbol(margin,y+30,'home');symbol(margin+225,y+25,'away');ctx.fillStyle=brand.primary;ctx.font='23px sans-serif';ctx.fillText('Domicile',margin+45,y+53);ctx.fillText('Extérieur',margin+270,y+53);}
|
||||
canvas.toBlob(blob=>{const status=document.getElementById('image-status');if(!blob){status.textContent='Image indisponible : utilisez le PDF ou Excel.';return;}const link=document.getElementById('download-convocations');link.href=URL.createObjectURL(blob);link.download=`convocations-${data.week}.png`;link.hidden=false;status.textContent='Image prête à télécharger.';},'image/png');
|
||||
})();
|
||||
@@ -0,0 +1,46 @@
|
||||
'use strict';
|
||||
(() => {
|
||||
const dataNode=document.getElementById('convocation-data');if(!dataNode)return;
|
||||
const data=JSON.parse(dataNode.textContent),form=document.getElementById('convocation-form'),profile=data.profile;
|
||||
function update(){
|
||||
const selected=[...form.querySelectorAll('input[name="players[]"]:checked')].map(n=>data.players[n.value]);
|
||||
const mut=selected.filter(p=>['normal','outside'].includes(p.mutation)).length,hp=selected.filter(p=>p.mutation==='outside').length,ten=selected.filter(p=>p.higher_total>Number(profile?.higher_threshold??10)).length;
|
||||
document.getElementById('selection-count').textContent=`${selected.length} joueur(s) / ${profile?profile.max_players:'maximum non configuré'}`;
|
||||
document.getElementById('mutation-count').textContent=`Mutés : ${mut} / ${profile?Number(profile.mutation_base)+Number(profile.mutation_bonus):'?'} (inconnus exclus du compteur)`;
|
||||
document.getElementById('outside-count').textContent=`Dont hors période : ${hp} / ${profile?profile.outside_limit:'?'}`;
|
||||
document.getElementById('ten-count').textContent=`Plus de ${profile?.higher_threshold??10} matchs supérieurs : ${ten}${profile?.ten_active?' / '+profile.ten_limit:' — indicatif'}`;
|
||||
const availabilityAlerts=document.getElementById('availability-alerts');availabilityAlerts.replaceChildren();selected.filter(p=>p.availability&&p.availability.status!=='available').forEach(p=>{const warning=document.createElement('p');warning.className='availability-warning';warning.textContent=p.name+' : '+({injured:'Blessé',unavailable:'Indisponible'}[p.availability.status])+' (informatif, non bloquant)';availabilityAlerts.appendChild(warning);});
|
||||
selected.filter(p=>['absent','unanswered','conflict'].includes(p.spond?.status)).forEach(p=>{const warning=document.createElement('p');warning.className='availability-warning';warning.textContent=p.name+' · Spond : '+({absent:'Absent',unanswered:'Sans réponse',conflict:'Réponses contradictoires'}[p.spond.status])+' (informatif)';availabilityAlerts.appendChild(warning);});
|
||||
const list=document.getElementById('selected-list');list.replaceChildren();
|
||||
selected.forEach(p=>{const li=document.createElement('li');li.textContent=p.name+' ';
|
||||
(p.badges||[]).forEach(b=>{const badge=document.createElement('button');badge.type='button';badge.className='player-badge '+b.kind;badge.textContent=b.label;badge.title=b.detail;badge.dataset.badgeDetail=b.detail;badge.setAttribute('aria-label',b.label+' : '+b.detail);badge.setAttribute('aria-expanded','false');li.appendChild(badge);li.appendChild(document.createTextNode(' '));});
|
||||
const status=document.createElement('small');status.textContent=({blocked:'Blocage',review:'À contrôler',available:'Contrôles renseignés OK'}[p.status]);li.appendChild(status);list.appendChild(li);});
|
||||
document.getElementById('suspension-count').textContent='Suspendus pour cette équipe : '+selected.filter(p=>p.issues.some(i=>i.code==='suspension'&&i.level==='blocked')).length;
|
||||
document.getElementById('qualification-count').textContent='Non qualifiés à la date du match : '+selected.filter(p=>p.issues.some(i=>i.code==='qualification'&&i.level==='blocked')).length;
|
||||
const messages=[...(data.warnings||[])];if(!profile||!Number(profile.confirmed))messages.push('Règlement de cette compétition non confirmé.');
|
||||
if(profile && (mut>Number(profile.mutation_base)+Number(profile.mutation_bonus)||hp>Number(profile.outside_limit)||selected.length>Number(profile.max_players)||(profile.ten_active&&ten>Number(profile.ten_limit))))messages.push('Un quota est dépassé.');
|
||||
selected.forEach(p=>p.issues.forEach(i=>messages.push(p.name+' : '+i.message)));
|
||||
const quota=profile&&Number(profile.confirmed)&&(mut>Number(profile.mutation_base)+Number(profile.mutation_bonus)||hp>Number(profile.outside_limit)||selected.length>Number(profile.max_players)||(profile.ten_active&&ten>Number(profile.ten_limit)));
|
||||
document.getElementById('group-status').textContent=!selected.length?'Aucun joueur sélectionné':quota||selected.some(p=>p.status==='blocked')?'Groupe bloqué pour ce match':messages.length?'Groupe : informations précises à compléter':'Groupe conforme aux contrôles configurés pour ce match';
|
||||
const alerts=document.getElementById('selection-alerts');alerts.replaceChildren();messages.forEach(m=>{const p=document.createElement('p');p.textContent=m;alerts.appendChild(p);});
|
||||
}
|
||||
form.querySelectorAll('[data-favorite]').forEach(select=>select.addEventListener('change',async()=>{
|
||||
const notice=document.getElementById('favorite-status'),old=select.dataset.saved;
|
||||
const body=new URLSearchParams({csrf:form.elements.csrf.value,revision:form.elements.revision.value,match_id:form.elements.match_id.value,player_id:select.dataset.favorite,preference:select.value});
|
||||
select.disabled=true;notice.textContent='Enregistrement du favori…';
|
||||
try{
|
||||
const response=await fetch('/favorites/save',{method:'POST',body,credentials:'same-origin'});
|
||||
if(!response.ok)throw new Error('Favori non enregistré. Les données ont peut-être changé : enregistre ton groupe avant de recharger la page.');
|
||||
const result=await response.json();if(!result.saved)throw new Error('Session expirée ou enregistrement refusé.');
|
||||
const row=select.closest('tr'),on=select.value==='pin'||(select.value==='auto'&&row.dataset.autoFavorite==='1');
|
||||
const target=document.getElementById(on?'favorite-players':'other-players');
|
||||
if(select.value==='pin')target.insertBefore(row,target.children[1]||null);else target.appendChild(row);
|
||||
select.dataset.saved=select.value;notice.textContent='Favori enregistré pour cette équipe et cette saison. Le groupe sélectionné est conservé.';
|
||||
}catch(error){select.value=old;notice.textContent=error.message;}
|
||||
finally{select.disabled=false;}
|
||||
}));
|
||||
const toggle=document.getElementById('toggle-profiles'),search=form.querySelector('[data-filter]');
|
||||
if(toggle)toggle.addEventListener('click',()=>{const show=toggle.getAttribute('aria-pressed')!=='true';toggle.setAttribute('aria-pressed',String(show));toggle.textContent=show?'Afficher uniquement les profils joueurs':'Afficher aussi les autres profils du registre';search.dispatchEvent(new Event('input'));});
|
||||
document.addEventListener('availability-saved',event=>{if(data.players[event.detail.id])data.players[event.detail.id].availability=event.detail.availability;update();});
|
||||
form.addEventListener('change',()=>{update();search.dispatchEvent(new Event('input'));});update();
|
||||
})();
|
||||
@@ -0,0 +1,6 @@
|
||||
.convocation-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,360px);gap:20px;align-items:start}.selection-panel{position:sticky;top:16px;max-height:90vh;overflow:auto}.selection-panel button{margin-top:10px;width:100%}.selection-panel li{padding:6px 0}fieldset{border:0;padding:0}#selection-alerts p{padding:8px;border-left:3px solid #d59424;background:#fff7e7;font-size:.9rem}textarea{min-height:85px;width:100%}@media(max-width:1000px){.convocation-grid{grid-template-columns:1fr}.selection-panel{position:static;max-height:none;grid-row:1}}@media print{.sidebar,button{display:none}.convocation-grid{display:block}.selection-panel{position:static;max-height:none}}
|
||||
|
||||
.player-badges{display:inline-flex;gap:.3rem;flex-wrap:wrap;vertical-align:middle;margin:.15rem .25rem}.player-badge{display:inline-flex;align-items:center;font-size:.8rem;font-weight:750;line-height:1.4;padding:.15rem .45rem;border-radius:5px;border:1px solid transparent;cursor:pointer;white-space:nowrap}.player-badge.mn,.player-badge.mn:hover{background:#e3f0ff;color:#174d82;border-color:#b3d3f4}.player-badge.mh,.player-badge.mh:hover{background:#eee5fa;color:#63308c;border-color:#d4b6ed}.player-badge.suspended,.player-badge.suspended:hover{background:#fde8e7;color:#922525;border-color:#ecbbbb}.player-badge.yellow,.player-badge.yellow:hover{background:#fff5cc;color:#68500b;border-color:#e7d38e}.badge-explanation{display:block;background:#f4f7f8;color:#243c47;font-size:.85rem;padding:.5rem;border-radius:5px}.badge-legend{font-size:.85rem;color:#526770}#selected-list li{margin-bottom:.6rem}
|
||||
.selection-panel .player-badge{width:auto;margin:0;display:inline-flex}.player-badges .badge-explanation{flex-basis:100%;white-space:normal}@media print{.player-badge{display:inline-flex!important}}
|
||||
/* V3.2 : weekly planning and shareable groups. */
|
||||
.groups-table th,.groups-table td{min-width:180px;vertical-align:top}.groups-table th:first-child{min-width:120px}.groups-table ol{padding-left:1.3rem;margin:0}.groups-table li{margin:.5rem 0}.availability-control{font-size:.85rem;margin:.6rem 0;max-width:25rem}.availability-control label{margin:.35rem 0}.availability-control input,.availability-control select{padding:.4rem}.availability-control button{padding:.4rem .65rem;font-size:.8rem}.availability-warning{color:#81570b;background:#fff4d9;padding:.2rem .4rem;border-radius:.3rem}.add-to-group{display:block;margin:.45rem 0}.export-options{display:flex;gap:1.5rem;flex-wrap:wrap;margin:1rem 0}#convocation-canvas{width:100%;height:auto;margin-top:1rem;border:1px solid #dce5eb}
|
||||
@@ -0,0 +1 @@
|
||||
:root{--club-primary:#143852;--club-accent:#246b80;--club-text:#fff}.sidebar,button:not(.quiet):not(.player-badge){background:var(--club-primary);color:var(--club-text)}a{color:var(--club-accent)}.sidebar a{color:inherit}.brand-logo{width:54px;height:54px;object-fit:contain;background:#fff;border-radius:8px;padding:3px}.club-logo-preview{max-width:160px;max-height:160px;object-fit:contain}.season-picker{padding:12px}.season-picker select{max-width:100%;color:#172f40}.season-picker button{margin-top:8px}.location{display:inline-flex;gap:.35rem;padding:4px 9px;border-radius:6px;font-weight:650;white-space:nowrap}.location.home{background:#e5f2e9;color:#215b35}.location.away{background:#e8eef9;color:#254476}.location.unknown{background:#fff0d6;color:#725012}.calendar-alert{border-left:5px solid #d49827}.calendar-alert.resolved{border-left-color:#3c8c62}.spond-state{display:block;padding:3px 0;font-weight:600}.spond-state.present{color:#237243}.spond-state.absent,.spond-state.conflict{color:#9a3c25}.spond-state.unanswered{color:#78632a}.archive-banner{border:1px solid #ba8f36;padding:12px;background:#fff5de}.archive-mode form[method="post"] button{opacity:.65}.archive-mode .season-picker button,.archive-mode .account button{opacity:1}#convocation-canvas{width:100%;height:auto;border:1px solid #dfe6ea;border-radius:8px}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #f7bc50;outline-offset:3px}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require dirname(__DIR__).'/bootstrap.php';
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('X-Frame-Options: DENY');
|
||||
header('Referrer-Policy: same-origin');
|
||||
header("Content-Security-Policy: default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self' data:; form-action 'self'; frame-ancestors 'none'; base-uri 'none'");
|
||||
header('Cache-Control: no-store');
|
||||
App\Auth::start();
|
||||
try {(new App\Application())->run();}
|
||||
catch(Throwable $e){error_log((string)$e);http_response_code(500);echo '<!doctype html><html lang="fr"><meta charset="utf-8"><title>ESBSC</title><p>Le service est indisponible. Consultez les journaux du serveur et vérifiez la migration de la base.</p></html>';}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// PHP development server only: php -S 127.0.0.1:8080 -t public public/router.php
|
||||
$path=parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH);
|
||||
if(str_starts_with($path,'/assets/') && is_file(__DIR__.$path))return false;
|
||||
require __DIR__.'/index.php';
|
||||
Reference in New Issue
Block a user