From e5890280ccabdc3ad7553384080a1fb3b959457a Mon Sep 17 00:00:00 2001 From: Ramon Date: Sat, 18 Jul 2026 04:14:27 +0200 Subject: [PATCH] feat: snel-toevoegen-knop onder elke groep in Gebruikers (v0.4.05-beta) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Net als bij systeemmanagers (vorige commit) krijgt nu elke groep in de Gebruikers-tab (schoolbeheerder, groepsleiding, en elke klas incl. "geen klas") direct een eigen "+ ..."-knop eronder om iemand toe te voegen zonder naar een ander tabblad te hoeven. Bij een klas staat die klas al vast ingevuld (presetClassId, bestond al als parameter maar werd nog nergens gebruikt). Een groep blijft zichtbaar zolang er iets aan toegevoegd kan worden, ook als hij nu leeg is (bv. een gloednieuwe klas zonder leerlingen) - anders was er nergens een knop om de eerste aan toe te voegen. Geverifieerd in een echte headless Chromium (gemockte /api/** responses): groepen en knoppen verschijnen zoals verwacht, en de klas-select bij een klasgroep staat al goed vooringesteld. --- VERSION | 2 +- public/js/admin.js | 19 ++++++++++++++----- public/js/core.js | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 10f3c0c..b2f381e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.04-beta +0.4.05-beta diff --git a/public/js/admin.js b/public/js/admin.js index faa901d..6d63607 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -1359,21 +1359,30 @@ const loose = USERS.filter(u=>["teacher","admin","pupil"].includes(u.role) && u.schoolId==null); if(loose.length) group("gnoschool", T("amNoSchoolGroup"), loose); }else{ - /* één school gekozen: groepeer op rol, leerlingen per klas */ + /* één school gekozen: groepeer op rol, leerlingen per klas - elke groep + krijgt direct een "snel toevoegen"-formulier eronder (net als bij + systeemmanagers), zodat een nieuwe schoolbeheerder/leerkracht/ + leerling niet via een ander tabblad hoeft. Een groep zonder leden + blijft zichtbaar zolang er wél iets aan toegevoegd kan worden - + anders is een lege klas nergens te vinden om iemand aan toe te voegen. */ [["admin", T("roleAdmin")], ["teacher", T("roleTeacher")]].forEach(([role, label])=>{ const us = USERS.filter(u=>u.role===role); - if(us.length) group("role:"+role, label, us, true); + if(us.length || creatableRoles().includes(role)) group("role:"+role, label, us, true); + if(creatableRoles().includes(role)) list.appendChild(addForm(role)); }); const pupils = USERS.filter(u=>u.role==="pupil"); if(currentUser.role==="teacher"){ - if(pupils.length) group("pupils", T("amPupils"), pupils, true); + if(pupils.length || creatableRoles().includes("pupil")) group("pupils", T("amPupils"), pupils, true); + if(creatableRoles().includes("pupil")) list.appendChild(addForm("pupil")); }else{ CLASSES.forEach(c=>{ const us = pupils.filter(u=>u.classId===c.id); - if(us.length) group("class:"+c.id, c.name, us, true); + if(us.length || creatableRoles().includes("pupil")) group("class:"+c.id, c.name, us, true); + if(creatableRoles().includes("pupil")) list.appendChild(addForm("pupil", c.id)); }); const noClass = pupils.filter(u=>!u.classId); - if(noClass.length) group("class:none", T("amNoClass"), noClass, true); + if(noClass.length || creatableRoles().includes("pupil")) group("class:none", T("amNoClass"), noClass, true); + if(creatableRoles().includes("pupil")) list.appendChild(addForm("pupil")); } const parents = USERS.filter(u=>u.role==="parent"); if(parents.length) group("parents", T("amParents"), parents); diff --git a/public/js/core.js b/public/js/core.js index 7434622..6614e6c 100644 --- a/public/js/core.js +++ b/public/js/core.js @@ -2,7 +2,7 @@ "use strict"; /* version — shown until /api/version resolves (or if the fetch fails, e.g. offline). Kept in sync by hand with the VERSION file at the repo root on every release. */ -const VERSION = "0.4.04-beta"; +const VERSION = "0.4.05-beta"; (function(){ const tag = document.getElementById("verTag"); tag.textContent = "v"+VERSION;