mirror of
https://github.com/appen-isen/site-interpromo-2023.git
synced 2026-03-18 21:50:39 +01:00
25
Front/assets/shuttlecock.svg
Normal file
25
Front/assets/shuttlecock.svg
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="191.000000pt" height="191.000000pt" viewBox="0 0 191.000000 191.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
|
||||
<g transform="translate(0.000000,191.000000) scale(0.100000,-0.100000)"
|
||||
fill="#dee2e6" stroke="none">
|
||||
<path d="M811 1753 c-21 -20 -86 -149 -213 -422 -169 -364 -187 -398 -242
|
||||
-458 l-59 -65 219 -219 c120 -120 223 -219 229 -219 5 0 37 27 70 59 57 57 77
|
||||
67 450 241 274 127 398 190 418 211 26 28 27 33 27 140 0 103 -1 111 -25 134
|
||||
-46 47 -125 24 -125 -35 0 -39 -41 -111 -74 -131 -17 -11 -101 -42 -187 -69
|
||||
-86 -27 -163 -58 -171 -67 -9 -10 -28 -42 -42 -71 -25 -50 -31 -54 -136 -107
|
||||
-60 -30 -120 -55 -133 -55 -13 0 -37 15 -57 35 l-34 35 112 113 112 112 103
|
||||
32 c302 94 372 118 389 135 16 16 18 37 18 208 0 257 17 240 -238 240 -183 0
|
||||
-189 -1 -210 -23 -13 -14 -48 -108 -93 -252 l-72 -230 -113 -115 -114 -114
|
||||
-35 34 c-20 20 -35 44 -35 57 0 13 25 73 55 133 l55 110 68 34 68 34 48 154
|
||||
c27 84 59 172 72 195 25 44 89 83 136 83 59 0 80 79 33 125 -23 24 -31 25
|
||||
-134 25 -107 0 -112 -1 -140 -27z"/>
|
||||
<path d="M192 708 c-53 -56 -77 -121 -76 -213 0 -95 23 -152 88 -218 109 -112
|
||||
273 -126 410 -36 26 18 50 39 53 47 4 9 -70 90 -213 233 -120 120 -221 219
|
||||
-224 219 -4 0 -20 -15 -38 -32z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -7,8 +7,11 @@ const idMatch = window.location.href.split("=")[1];
|
||||
const data = {
|
||||
"status": "in_progress",
|
||||
};
|
||||
|
||||
const record = await pb.collection('match').update(idMatch, data);
|
||||
|
||||
|
||||
|
||||
//Récupération des données du match
|
||||
const currentStatus = await pb.collection('match').getOne(idMatch, {
|
||||
expand: 'sport,team1,team2',
|
||||
@@ -116,7 +119,6 @@ if(currentStatus.expand.sport.name === "basketball"){
|
||||
arbitrageStopForm.appendChild(arbitrageStopFormDiv);
|
||||
arbitrageDiv.appendChild(arbitrageStopForm);
|
||||
|
||||
|
||||
//Comptage des points
|
||||
const point1Team1 = document.getElementById("btnPoint1Btn1");
|
||||
const point2Team1 = document.getElementById("btnPoint1Btn2");
|
||||
|
||||
@@ -39,6 +39,8 @@ matchList.forEach(match => {
|
||||
if (e.record.status === "finished") {
|
||||
document.getElementById("cardHeader" + match.id).classList.remove("text-warning-emphasis");
|
||||
document.getElementById("cardHeader" + match.id).classList.add("text-success-emphasis");
|
||||
document.getElementById("cardFooter" + match.id).classList.remove("text-warning-emphasis");
|
||||
document.getElementById("cardFooter" + match.id).classList.add("text-success-emphasis");
|
||||
document.getElementById("cardFooter" + match.id).innerHTML = "Match terminé";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,12 +80,27 @@ function getSportNextMatchText(sport){
|
||||
return "Prochain match : " + match.expand.team1.name + " vs " + match.expand.team2.name + ' ' + time_start.toLocaleString('fr', { weekday: 'long' }) + " à " + time_start.toLocaleString('fr', { hour: 'numeric', minute: 'numeric' });
|
||||
}
|
||||
|
||||
function getSportIcon(sport){
|
||||
switch(sport.name) {
|
||||
case "basketball":
|
||||
return ` <span class="material-symbols-outlined">sports_basketball</span>`
|
||||
case "volleyball":
|
||||
return ` <span class="material-symbols-outlined">sports_volleyball</span>`
|
||||
case "football":
|
||||
return ` <span class="material-symbols-outlined">sports_soccer</span>`
|
||||
case "handball":
|
||||
return ` <span class="material-symbols-outlined">sports_handball</span>`
|
||||
case "badminton":
|
||||
return ` <img src="assets/shuttlecock.svg" alt="shuttlecock" width="24" height="24">`
|
||||
}
|
||||
}
|
||||
|
||||
function getSportCard(sport){
|
||||
let winner = getSportWinningTeam(sport)
|
||||
let title = winner === "" ? "La compétition n'a pas commencé" : ("Equipe en tête : " + winner)
|
||||
return `
|
||||
<div class="card my-3">
|
||||
<div class="card-header text-center bg-light-subtle text-emphasis-light">${sport.name.toUpperCase()}</div>
|
||||
<div class="card-header text-center bg-light-subtle text-emphasis-light"><div class="d-flex justify-content-center">${sport.name.toUpperCase()}${getSportIcon(sport)}</div></div>
|
||||
<div class="card-body bg-light-subtle text-emphasis-light">
|
||||
<h5 class="card-title">${title}</h5>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,10 @@ const EquipeList = await pb.collection('equipes').getFullList({
|
||||
expand: 'promo,sport,membres,capitaine',
|
||||
});
|
||||
|
||||
const DuoBadList = await pb.collection('duo_bad').getFullList({
|
||||
expand: 'promo',
|
||||
});
|
||||
|
||||
const classBasketballList = await pb.collection('class_basketball').getFullList({
|
||||
sort: '+classement',
|
||||
expand: 'team',
|
||||
@@ -66,30 +70,80 @@ function getTeamClassement(equipe){
|
||||
}
|
||||
}
|
||||
|
||||
function getTeamRow(equipe){
|
||||
function getDuosRow(duos){
|
||||
let result = `
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">${equipe.expand.sport.name}</div>
|
||||
${equipe.name}
|
||||
</div>`
|
||||
let classement = getTeamClassement(equipe);
|
||||
if(classement != 0){
|
||||
result += `<span class="badge bg-primary rounded-pill">${classement}/...</span>`
|
||||
}
|
||||
result += `</li>`
|
||||
<li class="list-group-item">
|
||||
<div class="mx-2">
|
||||
<div class="fw-bold">Badminton</div>`
|
||||
duos.forEach(duo => {
|
||||
result += `<div class="d-flex justify-content-between align-items-start">${duo.name}`
|
||||
if(duo.stade){
|
||||
let stade = ""
|
||||
switch(duo.stade){
|
||||
case "16":
|
||||
stade = "16èmes"
|
||||
break;
|
||||
case "8":
|
||||
stade = "8èmes"
|
||||
break;
|
||||
case "4":
|
||||
stade = "Quarts"
|
||||
break;
|
||||
case "2":
|
||||
stade = "Demies"
|
||||
break;
|
||||
case "1":
|
||||
stade = "Finale"
|
||||
break;
|
||||
}
|
||||
let color = ""
|
||||
if(duo.eliminated){
|
||||
color = "bg-danger"
|
||||
} else {
|
||||
color = "bg-primary"
|
||||
}
|
||||
result += `<span class="badge ${color} rounded-pill">${stade}</span>`
|
||||
}
|
||||
result += `</div>`
|
||||
})
|
||||
result += `
|
||||
</div>
|
||||
</li>`
|
||||
return result
|
||||
}
|
||||
|
||||
function getPromoCard(promo, teamsList){
|
||||
function getTeamsRow(sport, teams){
|
||||
let result = `
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="mx-2">
|
||||
<div class="fw-bold">${sport[0].toUpperCase()}${sport.slice(1)}</div>`
|
||||
teams.forEach(equipe => {
|
||||
result += `<div>${equipe.name}`
|
||||
let classement = getTeamClassement(equipe);
|
||||
if(classement != 0){
|
||||
result += `<span class="badge bg-primary rounded-pill">${classement}/...</span>`
|
||||
}
|
||||
result += `</div>`
|
||||
})
|
||||
result += `
|
||||
</div>
|
||||
</li>`
|
||||
return result
|
||||
}
|
||||
|
||||
function getPromoCard(promo, teamsBySport){
|
||||
let cardHtml = `
|
||||
<div class="card my-3">
|
||||
<div class="card-header text-center bg-light-subtle text-emphasis-light">${promo.name}</div>
|
||||
<ul class="list-group list-group-flush list-group-item">
|
||||
<ul class="list-group list-group-flush">
|
||||
`
|
||||
teamsList.forEach(equipe => {
|
||||
cardHtml += getTeamRow(equipe)
|
||||
})
|
||||
for(let [sport, teams] of Object.entries(teamsBySport)){
|
||||
if(sport === "badminton"){
|
||||
cardHtml += getDuosRow(teams)
|
||||
} else {
|
||||
cardHtml += getTeamsRow(sport, teams)
|
||||
}
|
||||
}
|
||||
cardHtml += `</ul>`
|
||||
const nextMatch = matchList.find(match => match.expand.team1.promo === promo.id || match.expand.team2.promo === promo.id);
|
||||
if(nextMatch){
|
||||
@@ -115,7 +169,7 @@ function getSportRow(equipe){
|
||||
}
|
||||
let result = `
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="mx-2">
|
||||
<div class="fw-bold">${equipe.expand.sport.name}</div>
|
||||
Membres : ${members}
|
||||
</div>`
|
||||
@@ -132,7 +186,7 @@ function getTeamCard(teamBySport){
|
||||
let cardHtml = `
|
||||
<div class="card my-3">
|
||||
<div class="card-header text-center bg-light-subtle text-emphasis-light">${equipe.name}(${equipe.expand.promo.name})</div>
|
||||
<ul class="list-group list-group-flush list-group-item">
|
||||
<ul class="list-group list-group-flush">
|
||||
`
|
||||
for(const [sportName, team] of Object.entries(teamBySport).filter(([sportName, team]) => sportName != "team")){
|
||||
cardHtml += getSportRow(team)
|
||||
@@ -150,14 +204,17 @@ function getTeamCard(teamBySport){
|
||||
const promoCardContainer = document.getElementById("promoCardContainer");
|
||||
const teamCardContainer = document.getElementById("teamCardContainer");
|
||||
|
||||
const promoTeams = {} // Object key = promo name, value = array of promo teams objects
|
||||
const promoTeamsbySport = {} // Object key = promo name, value = array of promo teams objects
|
||||
const teamSports = {} // Object key = team name, value = Object key = sport name, value = team object
|
||||
|
||||
EquipeList.forEach(equipe => {
|
||||
if(!(equipe.expand.promo.name in promoTeams)){
|
||||
promoTeams[equipe.expand.promo.name] = [];
|
||||
if(!(equipe.expand.promo.name in promoTeamsbySport)){
|
||||
promoTeamsbySport[equipe.expand.promo.name] = {};
|
||||
}
|
||||
promoTeams[equipe.expand.promo.name].push(equipe);
|
||||
if(!(equipe.expand.sport.name in promoTeamsbySport[equipe.expand.promo.name])){
|
||||
promoTeamsbySport[equipe.expand.promo.name][equipe.expand.sport.name] = [];
|
||||
}
|
||||
promoTeamsbySport[equipe.expand.promo.name][equipe.expand.sport.name].push(equipe);
|
||||
if(!(equipe.expand.sport.name === "badminton")){
|
||||
if(!(equipe.name in teamSports)){
|
||||
teamSports[equipe.name] = {'team': equipe};
|
||||
@@ -166,12 +223,22 @@ EquipeList.forEach(equipe => {
|
||||
}
|
||||
})
|
||||
|
||||
DuoBadList.forEach(duo => {
|
||||
if(!(duo.expand.promo.name in promoTeamsbySport)){
|
||||
promoTeamsbySport[duo.expand.promo.name] = {};
|
||||
}
|
||||
if(!("badminton" in promoTeamsbySport[duo.expand.promo.name])){
|
||||
promoTeamsbySport[duo.expand.promo.name]["badminton"] = [];
|
||||
}
|
||||
promoTeamsbySport[duo.expand.promo.name]["badminton"].push(duo);
|
||||
})
|
||||
|
||||
//Affichage des équipes par promo
|
||||
PromoList.forEach(promo => {
|
||||
if(!(promo.name in promoTeams)){
|
||||
promoTeams[promo.name] = []
|
||||
if(!(promo.name in promoTeamsbySport)){
|
||||
promoTeamsbySport[promo.name] = {}
|
||||
}
|
||||
promoCardContainer.insertAdjacentHTML("beforeend", getPromoCard(promo, promoTeams[promo.name]));
|
||||
promoCardContainer.insertAdjacentHTML("beforeend", getPromoCard(promo, promoTeamsbySport[promo.name]));
|
||||
});
|
||||
|
||||
Object.values(teamSports).forEach(teamBySport => {
|
||||
|
||||
Reference in New Issue
Block a user