Weltkueche Teil A: Land pro Lehrer persistent (teachers.country) + Sim-Verdrahtung

- profil.html: Länderauswahl (AT/DE/CH/LI) im Lehrer-Profil, lädt/zeigt aktuelles Land.
- profile.php: speichert country in teachers.country; gibt country zurück.
- weltkueche.php: injiziert window.WK_COUNTRY = Country::current() (Kaskade Schüler→Klasse→Lehrer→AT) — Fundament für die konsumentenland-basierte Herkunft (Teil B).
Spalte teachers.country existierte bereits, keine Migration nötig.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-21 12:13:27 +02:00
parent c3e61f4da7
commit a68c58ac9e
3 changed files with 13 additions and 2 deletions
+6 -1
View File
@@ -416,6 +416,10 @@ function renderTeacherProfile(p) {
html += '<div class="field"><label>Anzeigename</label><input type="text" id="pf-name" value="' + (p.display_name || '') + '"></div>';
html += '<div class="field"><label>E-Mail</label><input type="email" id="pf-email" value="' + (p.email || '') + '"></div>';
html += '<div class="field"><label>Schule</label><input type="text" id="pf-school" value="' + (p.school_name || '') + '"></div>';
html += '<div class="field"><label>Land (bestimmt die „lokale" Herkunft der Zutaten in Weltküche)</label><select id="pf-country">' +
[['AT','🇦🇹 Österreich'],['DE','🇩🇪 Deutschland'],['CH','🇨🇭 Schweiz'],['LI','🇱🇮 Liechtenstein']]
.map(function(o){ return '<option value="'+o[0]+'"'+(((p.country||'AT').toUpperCase())===o[0]?' selected':'')+'>'+o[1]+'</option>'; }).join('') +
'</select></div>';
html += '<button class="btn" onclick="saveTeacher()">Speichern</button>';
html += '<div class="msg" id="msg-teacher"></div>';
html += '</div>';
@@ -488,7 +492,8 @@ async function saveTeacher() {
var name = document.getElementById('pf-name').value.trim();
var email = document.getElementById('pf-email').value.trim();
var school = document.getElementById('pf-school').value.trim();
var r = await api('profile', {displayName: name, email: email, schoolName: school});
var country = (document.getElementById('pf-country') || {}).value || 'AT';
var r = await api('profile', {displayName: name, email: email, schoolName: school, country: country});
var m = document.getElementById('msg-teacher');
m.className = r.error ? 'msg err' : 'msg ok';
m.textContent = r.error || 'Gespeichert!';