|
|
@@ -161,9 +161,11 @@ $spiele = $pdo->query("SELECT s.*, r.name as r_name, p.titel as parent_titel
|
|
|
<?php foreach($reihen as $r): ?><option value="<?=$r['id']?>"><?=$r['name']?></option><?php endforeach; ?>
|
|
|
</select>
|
|
|
<input type="text" name="titel" placeholder="Titel des Abenteuers" required>
|
|
|
- <select name="parent_id">
|
|
|
- <option value="0">Hauptbox (optional)...</option>
|
|
|
- <?php foreach($spiele as $ps): if(!$ps['parent_id']): ?><option value="<?=$ps['id']?>"><?=$ps['titel']?></option><?php endif; endforeach; ?>
|
|
|
+ <select name="parent_id" id="p_new">
|
|
|
+ <option value="0" data-p="0">Hauptbox (optional)...</option>
|
|
|
+ <?php foreach($spiele as $ps): if(!$ps['parent_id']): ?>
|
|
|
+ <option data-p="<?=$ps['game_reihe_id']?>" value="<?=$ps['id']?>"><?=$ps['titel']?></option>
|
|
|
+ <?php endif; endforeach; ?>
|
|
|
</select>
|
|
|
<select name="game_typ_id" id="t_new"><option value="0" data-p="0">Typ...</option><?php foreach($typen as $t): ?><option data-p="<?=$t['game_reihe_id']?>" value="<?=$t['id']?>"><?=$t['bezeichnung']?></option><?php endforeach; ?></select>
|
|
|
<select name="game_level_id" id="l_new"><option value="0" data-p="0">Level...</option><?php foreach($levels as $l): ?><option data-p="<?=$l['game_reihe_id']?>" value="<?=$l['id']?>"><?=$l['bezeichnung']?></option><?php endforeach; ?></select>
|
|
|
@@ -181,10 +183,10 @@ $spiele = $pdo->query("SELECT s.*, r.name as r_name, p.titel as parent_titel
|
|
|
<td><select name="game_reihe_id" id="r_<?=$s['id']?>" onchange="filter(<?=$s['id']?>)"><?php foreach($reihen as $r): ?><option value="<?=$r['id']?>" <?=$s['game_reihe_id']==$r['id']?'selected':''?>><?=$r['name']?></option><?php endforeach; ?></select></td>
|
|
|
<td>
|
|
|
<input type="text" name="titel" value="<?=htmlspecialchars($s['titel'])?>" style="margin-bottom:3px; font-weight:bold;">
|
|
|
- <select name="parent_id" style="font-size:0.85em; color:#e67e22;">
|
|
|
- <option value="0">- Eigenständiges Spiel -</option>
|
|
|
+ <select name="parent_id" id="p_<?=$s['id']?>" style="font-size:0.85em; color:#e67e22;">
|
|
|
+ <option value="0" data-p="0">- Eigenständiges Spiel -</option>
|
|
|
<?php foreach($spiele as $ps): if($ps['id'] != $s['id']): ?>
|
|
|
- <option value="<?=$ps['id']?>" <?=$s['parent_id']==$ps['id']?'selected':''?>>📦 Teil von: <?=$ps['titel']?></option>
|
|
|
+ <option data-p="<?=$ps['game_reihe_id']?>" value="<?=$ps['id']?>" <?=$s['parent_id']==$ps['id']?'selected':''?>>📦 Teil von: <?=$ps['titel']?></option>
|
|
|
<?php endif; endforeach; ?>
|
|
|
</select>
|
|
|
</td>
|
|
|
@@ -249,13 +251,15 @@ function openTab(evt, name) {
|
|
|
function filter(id) {
|
|
|
let r_el = document.getElementById('r_'+id); if(!r_el) return;
|
|
|
let r_val = r_el.value;
|
|
|
- ['t_'+id, 'l_'+id].forEach(sid => {
|
|
|
+
|
|
|
+ // t = Typ, l = Level, p = Parent/Hauptbox
|
|
|
+ ['t_'+id, 'l_'+id, 'p_'+id].forEach(sid => {
|
|
|
let sel = document.getElementById(sid); if(!sel) return;
|
|
|
sel.querySelectorAll('option').forEach(o => {
|
|
|
let p = o.getAttribute('data-p');
|
|
|
o.style.display = (p == "0" || p == r_val) ? "block" : "none";
|
|
|
});
|
|
|
- if(sel.options[sel.selectedIndex].style.display == "none") sel.value = "0";
|
|
|
+ if(sel.options[sel.selectedIndex] && sel.options[sel.selectedIndex].style.display == "none") sel.value = "0";
|
|
|
});
|
|
|
}
|
|
|
|