diff --git a/assets/css/style.css b/assets/css/style.css index 2f967eb..f3f9842 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -176,12 +176,12 @@ input[type="number"] { /* Ligne de semaine contenant au moins un jour de vacances scolaires */ .fc-row--school-holiday { - background-color: #fff5cc; + background-color: #fff8d5; /* jaune clair uniforme */ } /* Jour individuel en vacances scolaires (cellule) */ .fc-day--school-holiday { - background-color: #ffe9a6; + background-color: #ffe9a6; /* un ton un peu plus marqué mais pas orange vif */ } /* Tableau recap vacances scolaires */ @@ -202,3 +202,7 @@ input[type="number"] { .fc-holidays-table th { background-color: #f0f4f8; } + +.fc-row--school-holiday td:first-child { + background-color: #ffffff; +} diff --git a/assets/js/family-calendar.js b/assets/js/family-calendar.js index 5fde820..b85be74 100644 --- a/assets/js/family-calendar.js +++ b/assets/js/family-calendar.js @@ -164,27 +164,55 @@ function addSchoolHolidayEventsFromRecords(records, events) { const tbody = document.querySelector("#schoolHolidaysTable tbody"); if (tbody) tbody.innerHTML = ""; + // 1) Normaliser et regrouper par periode (start_date, end_date, description) + const groups = new Map(); + records.forEach((record) => { - const start = new Date(record.start_date); - const end = new Date(record.end_date); + const startIso = record.start_date; // ISO string + const endIso = record.end_date; + const desc = record.description || ""; + const zones = record.zones || ""; - // Remplir le tableau recap - if (tbody) { - const tr = document.createElement("tr"); - const startStr = formatDayMonth(start) + "/" + start.getFullYear(); - const endStr = formatDayMonth(end) + "/" + end.getFullYear(); + const key = `${startIso}|${endIso}|${desc}`; - tr.innerHTML = ` - ${record.description || ""} - ${startStr} - ${endStr} - ${record.zones || ""} - ${record.location || ""} - `; - tbody.appendChild(tr); + const existing = groups.get(key); + if (!existing) { + groups.set(key, { + startIso, + endIso, + description: desc, + zones, // pour Zone C, ça suffira + }); } + // on ignore les académies (location) pour le tableau recap + }); + + // 2) Construire le tableau recap avec un seul record par groupe + if (tbody) { + Array.from(groups.values()) + .sort((a, b) => new Date(a.startIso) - new Date(b.startIso)) + .forEach((g) => { + const start = new Date(g.startIso); + const end = new Date(g.endIso); + const startStr = formatDayMonth(start) + "/" + start.getFullYear(); + const endStr = formatDayMonth(end) + "/" + end.getFullYear(); + + const tr = document.createElement("tr"); + tr.innerHTML = ` + ${g.description} + ${startStr} + ${endStr} + ${g.zones} + `; + tbody.appendChild(tr); + }); + } + + // 3) Créer les événements jour par jour (VACANCES_SCOLAIRES) + groups.forEach((g) => { + const start = new Date(g.startIso); + const end = new Date(g.endIso); - // Chaque jour de la plage -> event VACANCES_SCOLAIRES let current = new Date(start); while (current <= end) { const year = current.getFullYear(); diff --git a/family-calendar.php b/family-calendar.php index db7d758..06580b7 100644 --- a/family-calendar.php +++ b/family-calendar.php @@ -114,19 +114,18 @@ require __DIR__ . '/header.php';

Source : data.education.gouv.fr - calendrier officiel.

- - - - - - - - - - - - -
PériodeDuAuZonesAcadémies
+ + + Période + Du + Au + Zones + + + + + +