Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung | |||
| fortbildungsplattform:start [01/06/2026 19:50] – TillNiels.Gades@bbz-rd-eck.de | fortbildungsplattform:start [01/06/2026 20:16] (aktuell) – TillNiels.Gades@bbz-rd-eck.de | ||
|---|---|---|---|
| Zeile 50: | Zeile 50: | ||
| </ | </ | ||
| </ | </ | ||
| - | |||
| - | < | ||
| - | (function () { | ||
| - | const listeEl | ||
| - | const sucheEl | ||
| - | const katEl = document.getElementById(' | ||
| - | const sortEl | ||
| - | const resetEl | ||
| - | const source | ||
| - | |||
| - | let alleFortbildungen = []; | ||
| - | |||
| - | function escapeHtml(s) { | ||
| - | if (s == null) return ''; | ||
| - | return String(s) | ||
| - | .replace(/&/ | ||
| - | .replace(/</ | ||
| - | .replace(/>/ | ||
| - | .replace(/"/ | ||
| - | .replace(/'/ | ||
| - | } | ||
| - | |||
| - | function formatDatum(iso) { | ||
| - | if (!iso) return ''; | ||
| - | const d = new Date(iso); | ||
| - | if (isNaN(d.getTime())) return iso; | ||
| - | return d.toLocaleDateString(' | ||
| - | } | ||
| - | |||
| - | function render() { | ||
| - | const suche = (sucheEl.value || '' | ||
| - | const kat = katEl.value; | ||
| - | let liste = alleFortbildungen.filter(fb => { | ||
| - | if (kat && fb.kategorie !== kat) return false; | ||
| - | if (suche) { | ||
| - | const hay = (fb.titel + ' ' + (fb.beschreibung || '' | ||
| - | if (!hay.includes(suche)) return false; | ||
| - | } | ||
| - | return true; | ||
| - | }); | ||
| - | |||
| - | const sortKey = sortEl.value; | ||
| - | liste.sort((a, | ||
| - | if (sortKey === ' | ||
| - | if (sortKey === ' | ||
| - | if (sortKey === ' | ||
| - | return (a.datum || '' | ||
| - | }); | ||
| - | |||
| - | if (liste.length === 0) { | ||
| - | listeEl.innerHTML = '< | ||
| - | return; | ||
| - | } | ||
| - | |||
| - | const html = liste.map(fb => { | ||
| - | const ausgebucht = (fb.freie_plaetze | 0) <= 0; | ||
| - | const statusFarbe = ausgebucht ? '# | ||
| - | const statusText | ||
| - | const anmeldeLink = ausgebucht | ||
| - | ? '< | ||
| - | : '<a class=" | ||
| - | |||
| - | return '' | ||
| - | + '< | ||
| - | + '< | ||
| - | + '< | ||
| - | + '< | ||
| - | + '< | ||
| - | + '< | ||
| - | + '< | ||
| - | + | ||
| - | + | ||
| - | + '</ | ||
| - | + | ||
| - | + | ||
| - | + '</ | ||
| - | + '</ | ||
| - | + '< | ||
| - | + '< | ||
| - | + | ||
| - | + '</ | ||
| - | + '</ | ||
| - | + '</ | ||
| - | }).join('' | ||
| - | |||
| - | listeEl.innerHTML = html; | ||
| - | } | ||
| - | |||
| - | function fuelleKategorien() { | ||
| - | const kats = Array.from(new Set(alleFortbildungen.map(fb => fb.kategorie).filter(Boolean))).sort((a, | ||
| - | katEl.innerHTML = '< | ||
| - | } | ||
| - | |||
| - | fetch(source, | ||
| - | .then(r => r.json()) | ||
| - | .then(data => { | ||
| - | alleFortbildungen = Array.isArray(data) ? data : []; | ||
| - | fuelleKategorien(); | ||
| - | render(); | ||
| - | }) | ||
| - | .catch(err => { | ||
| - | listeEl.innerHTML = '< | ||
| - | console.error(' | ||
| - | }); | ||
| - | |||
| - | [sucheEl, katEl, sortEl].forEach(el => el.addEventListener(' | ||
| - | resetEl.addEventListener(' | ||
| - | sucheEl.value = ''; | ||
| - | katEl.value | ||
| - | sortEl.value | ||
| - | render(); | ||
| - | }); | ||
| - | })(); | ||
| - | </ | ||
| ===== Eigene Fortbildung erstellen ===== | ===== Eigene Fortbildung erstellen ===== | ||