Compare commits
2 Commits
5f6ae79bf0
...
7ce4fbd756
| Author | SHA1 | Date | |
|---|---|---|---|
| 7ce4fbd756 | |||
| bb62acfc7f |
62
index.html
62
index.html
@@ -41,6 +41,10 @@
|
|||||||
<select id="agegroup" class="form-select">
|
<select id="agegroup" class="form-select">
|
||||||
<option value="">Tous</option>
|
<option value="">Tous</option>
|
||||||
</select>
|
</select>
|
||||||
|
<label for="subgroup" class="form-label">Sous-groupe</label>
|
||||||
|
<select id="subgroup" class="form-select">
|
||||||
|
<option value="">Tous</option>
|
||||||
|
</select>
|
||||||
<button id="fetchEvents" class="btn btn-primary" style="margin-top: 1.2rem;">Charger</button>
|
<button id="fetchEvents" class="btn btn-primary" style="margin-top: 1.2rem;">Charger</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -77,6 +81,7 @@
|
|||||||
const eventFilters = document.getElementById("eventFilters");
|
const eventFilters = document.getElementById("eventFilters");
|
||||||
const accountSelect = document.getElementById("account");
|
const accountSelect = document.getElementById("account");
|
||||||
const agegroupSelect = document.getElementById("agegroup");
|
const agegroupSelect = document.getElementById("agegroup");
|
||||||
|
const subgroupSelect = document.getElementById("subgroup");
|
||||||
const eventList = document.getElementById("eventList");
|
const eventList = document.getElementById("eventList");
|
||||||
const fetchButton = document.getElementById("fetchEvents");
|
const fetchButton = document.getElementById("fetchEvents");
|
||||||
const eventDetailsContent = document.getElementById("eventDetailsContent");
|
const eventDetailsContent = document.getElementById("eventDetailsContent");
|
||||||
@@ -335,6 +340,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
agegroupSelect.addEventListener("change", () => {
|
agegroupSelect.addEventListener("change", () => {
|
||||||
|
// Update subgroup options based on selected agegroup
|
||||||
|
updateSubgroupOptions(agegroupSelect.value, lastFetchedEvents);
|
||||||
|
displayEvents(lastFetchedEvents);
|
||||||
|
});
|
||||||
|
|
||||||
|
subgroupSelect.addEventListener("change", () => {
|
||||||
displayEvents(lastFetchedEvents);
|
displayEvents(lastFetchedEvents);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -413,12 +424,61 @@
|
|||||||
option.textContent = group;
|
option.textContent = group;
|
||||||
agegroupSelect.appendChild(option);
|
agegroupSelect.appendChild(option);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reset subgroup selector
|
||||||
|
subgroupSelect.innerHTML = '<option value="">Tous</option>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSubgroupOptions(selectedAgegroup, events) {
|
||||||
|
// Reset subgroup options
|
||||||
|
subgroupSelect.innerHTML = '<option value="">Tous</option>';
|
||||||
|
|
||||||
|
if (selectedAgegroup === "") {
|
||||||
|
// If no agegroup is selected, disable subgroup selector
|
||||||
|
subgroupSelect.disabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable subgroup selector
|
||||||
|
subgroupSelect.disabled = false;
|
||||||
|
|
||||||
|
// Extract subgroups from events matching the selected agegroup
|
||||||
|
let subgroups = new Set();
|
||||||
|
events
|
||||||
|
.filter(event => event.agegroup === selectedAgegroup)
|
||||||
|
.forEach(event => {
|
||||||
|
// Extract subgroup from event.name or event.title
|
||||||
|
// This assumes the subgroup is part of the name field
|
||||||
|
if (event.name && event.name !== selectedAgegroup) {
|
||||||
|
subgroups.add(event.name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add subgroups to the selector
|
||||||
|
Array.from(subgroups).sort().forEach(subgroup => {
|
||||||
|
const option = document.createElement("option");
|
||||||
|
option.value = subgroup;
|
||||||
|
option.textContent = subgroup;
|
||||||
|
subgroupSelect.appendChild(option);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayEvents(events) {
|
function displayEvents(events) {
|
||||||
eventList.innerHTML = "";
|
eventList.innerHTML = "";
|
||||||
let selectedAgegroup = agegroupSelect.value;
|
let selectedAgegroup = agegroupSelect.value;
|
||||||
let filteredEvents = events.filter(event => event.event === "Jeu" && (selectedAgegroup === "" || event.agegroup === selectedAgegroup));
|
let selectedSubgroup = subgroupSelect.value;
|
||||||
|
let filteredEvents = events.filter(event => {
|
||||||
|
// Filter by event type
|
||||||
|
if (event.event !== "Jeu") return false;
|
||||||
|
|
||||||
|
// Filter by agegroup
|
||||||
|
if (selectedAgegroup !== "" && event.agegroup !== selectedAgegroup) return false;
|
||||||
|
|
||||||
|
// Filter by subgroup
|
||||||
|
if (selectedSubgroup !== "" && event.name !== selectedSubgroup) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
if (filteredEvents.length === 0) {
|
if (filteredEvents.length === 0) {
|
||||||
eventList.innerHTML = "<p class='text-muted'>Aucun événement 'Jeu' trouvé.</p>";
|
eventList.innerHTML = "<p class='text-muted'>Aucun événement 'Jeu' trouvé.</p>";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "myice"
|
name = "myice"
|
||||||
version = "v0.5.5"
|
version = "v0.5.6"
|
||||||
description = "myice parsing"
|
description = "myice parsing"
|
||||||
authors = [
|
authors = [
|
||||||
{ name = "Rene Luria", "email" = "<rene@luria.ch>"},
|
{ name = "Rene Luria", "email" = "<rene@luria.ch>"},
|
||||||
|
|||||||
Reference in New Issue
Block a user