Évaluation des compétences

Évaluation des compétences

Choisir un enfant Chargement…
const API_URL = « https://script.google.com/macros/s/AKfyc…/exec »; let rows = []; let currentChild = null; fetch(API_URL) .then(r => r.json()) .then(data => { rows = data; populateChildren(); }); function populateChildren() { const select = document.getElementById(« enfants »); select.innerHTML = « — Choisir –« ; const unique = new Map(); rows.forEach(r => unique.set(r.nom + « _ » + r.prenom, r)); unique.forEach((v, k) => { const o = document.createElement(« option »); o.value = k; o.textContent = v.prenom +  »  » + v.nom; select.appendChild(o); }); select.onchange = e => { if (!e.target.value) return; const [nom, prenom] = e.target.value.split(« _ »); currentChild = { nom, prenom }; renderCompetences(); }; } function renderCompetences() { const container = document.getElementById(« competences »); container.innerHTML = «  »; rows .filter(r => r.nom === currentChild.nom && r.prenom === currentChild.prenom) .forEach(r => { const d = document.createElement(« div »); d.className = « competence »; d.innerHTML = ` ${r.competence} Acquis Non acquis ${r.commentaire || «  »} `; d.querySelectorAll(« input »).forEach(i => { i.onchange = e => { r.note = e.target.value; save(); }; }); d.querySelector(« textarea »).oninput = e => { r.commentaire = e.target.value; save(); }; container.appendChild(d); }); } function save() { fetch(API_URL, { method: « POST », body: JSON.stringify(rows) }); }