dev #92
@ -46,7 +46,7 @@ function homePage() {
|
||||
let content = document.createElement('div');
|
||||
content.innerHTML = `
|
||||
<ul>
|
||||
<li><a onclick="setSubPage('poule')" href="javascript:void(0);">Par poule</a></li>
|
||||
<li><a onclick="setSubPage('poule')" href="javascript:void(0);">Par catégorie</a></li>
|
||||
<li><a onclick="setSubPage('comb')" href="javascript:void(0);">Par combattant</a></li>
|
||||
<li><a onclick="setSubPage('club')" href="javascript:void(0);">Par club</a></li>
|
||||
<li><a onclick="setSubPage('all')" href="javascript:void(0);">Tous les combattants</a></li>
|
||||
@ -258,7 +258,7 @@ function poulePage(location) {
|
||||
rootDiv.innerHTML = header + backButton;
|
||||
const content = document.createElement('div');
|
||||
content.style.marginTop = '1em';
|
||||
content.innerHTML = '<h4>Recherche par poule</h4>';
|
||||
content.innerHTML = '<h4>Recherche par catégorie</h4>';
|
||||
|
||||
const dataContainer = document.createElement('div');
|
||||
dataContainer.id = 'data-container';
|
||||
@ -334,8 +334,8 @@ function poulePage(location) {
|
||||
.then(poule => {
|
||||
const select = document.createElement('select');
|
||||
select.setAttribute('id', poule.id);
|
||||
select.innerHTML = `<option value="0">--Sélectionner une poule--</option>`;
|
||||
for (const pouleKey of Object.keys(poule).sort()) {
|
||||
select.innerHTML = `<option value="0">--Sélectionner une catégorie--</option>`;
|
||||
for (const pouleKey of Object.keys(poule).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))) {
|
||||
select.innerHTML += `<option value="${poule[pouleKey]}">${pouleKey}</option>`;
|
||||
}
|
||||
select.addEventListener('change', e => {
|
||||
@ -356,7 +356,7 @@ function poulePage(location) {
|
||||
loadPoule();
|
||||
}
|
||||
})
|
||||
.catch(() => rootDiv.append(new Text("Erreur de chargement des poules")))
|
||||
.catch(() => rootDiv.append(new Text("Erreur de chargement des catégories")))
|
||||
.finally(() => stopLoading(loading));
|
||||
|
||||
rfFonction = () => {
|
||||
|
||||
@ -150,14 +150,15 @@ function CategoryList({uuid}) {
|
||||
|
||||
useEffect(() => {
|
||||
if (data && Object.keys(data).length > 0)
|
||||
setCatId(data[Object.keys(data).sort()[0]])
|
||||
setCatId(data[Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]])
|
||||
}, [data]);
|
||||
|
||||
return <>
|
||||
{data ? <div className="input-group" style={{marginBottom: "1em"}}>
|
||||
<h6 style={{margin: "auto 0.5em auto 0"}}>Catégorie</h6>
|
||||
<select className="form-select" aria-label="Select Result Type" onChange={e => setCatId(e.target.value)}>
|
||||
{Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)}
|
||||
{Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))
|
||||
.map(key => <option key={key} value={data[key]}>{key}</option>)}
|
||||
</select>
|
||||
</div>
|
||||
: error
|
||||
@ -224,14 +225,15 @@ function ClubList({uuid}) {
|
||||
|
||||
useEffect(() => {
|
||||
if (data && Object.keys(data).length > 0)
|
||||
setClubId(data[Object.keys(data).sort()[0]])
|
||||
setClubId(data[Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]])
|
||||
}, [data]);
|
||||
|
||||
return <>
|
||||
{data ? <div className="input-group" style={{marginBottom: "1em"}}>
|
||||
<h6 style={{margin: "auto 0.5em auto 0"}}>Club</h6>
|
||||
<select className="form-select" aria-label="Select Result Type" onChange={e => setClubId(e.target.value)}>
|
||||
{Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)}
|
||||
{Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))
|
||||
.map(key => <option key={key} value={data[key]}>{key}</option>)}
|
||||
</select>
|
||||
</div>
|
||||
: error
|
||||
@ -310,14 +312,15 @@ function CombList({uuid}) {
|
||||
|
||||
useEffect(() => {
|
||||
if (data && Object.keys(data).length > 0)
|
||||
setCombId(data[Object.keys(data).sort()[0]])
|
||||
setCombId(data[Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))[0]])
|
||||
}, [data]);
|
||||
|
||||
return <>
|
||||
{data ? <div className="input-group" style={{marginBottom: "1em"}}>
|
||||
<h6 style={{margin: "auto 0.5em auto 0"}}>Combattant</h6>
|
||||
<select className="form-select" aria-label="Select Result Type" onChange={e => setCombId(e.target.value)}>
|
||||
{Object.keys(data).sort().map(key => <option key={key} value={data[key]}>{key}</option>)}
|
||||
{Object.keys(data).sort((a, b) => a.toLocaleLowerCase().localeCompare(b.toLocaleLowerCase()))
|
||||
.map(key => <option key={key} value={data[key]}>{key}</option>)}
|
||||
</select>
|
||||
</div>
|
||||
: error
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user