fix: Kabel-Auswahl behaelt Zustand beim Aktualisieren
- Neues Hidden-Feld cable_filter zeigt an ob Formular submitted wurde - Beim ersten Laden: alle Kabel ausgewaehlt - Nach Submit: nur ausgewaehlte Kabel behalten Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b4b8348c1f
commit
f2ccdbac2a
1 changed files with 5 additions and 2 deletions
|
|
@ -294,6 +294,7 @@ if (!empty($cablesWithKupfer) && !empty($chartData['labels'])) {
|
||||||
// Parameter auslesen
|
// Parameter auslesen
|
||||||
$cableIds = GETPOST('cable_ids', 'array');
|
$cableIds = GETPOST('cable_ids', 'array');
|
||||||
$cableMode = GETPOST('cable_mode', 'alpha') ?: 'per_meter';
|
$cableMode = GETPOST('cable_mode', 'alpha') ?: 'per_meter';
|
||||||
|
$cableFilterSubmitted = GETPOST('cable_filter', 'int');
|
||||||
|
|
||||||
// URL-Basis fuer Links
|
// URL-Basis fuer Links
|
||||||
$baseUrl = $_SERVER["PHP_SELF"].'?chart_days='.$chartDays;
|
$baseUrl = $_SERVER["PHP_SELF"].'?chart_days='.$chartDays;
|
||||||
|
|
@ -311,9 +312,10 @@ if (!empty($cablesWithKupfer) && !empty($chartData['labels'])) {
|
||||||
|
|
||||||
// Kabel-Auswahl (Checkboxen)
|
// Kabel-Auswahl (Checkboxen)
|
||||||
print '<div class="div-table-responsive-no-min" style="margin-bottom: 15px;">';
|
print '<div class="div-table-responsive-no-min" style="margin-bottom: 15px;">';
|
||||||
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'" id="cableFilterForm">';
|
||||||
print '<input type="hidden" name="chart_days" value="'.$chartDays.'">';
|
print '<input type="hidden" name="chart_days" value="'.$chartDays.'">';
|
||||||
print '<input type="hidden" name="cable_mode" value="'.$cableMode.'">';
|
print '<input type="hidden" name="cable_mode" value="'.$cableMode.'">';
|
||||||
|
print '<input type="hidden" name="cable_filter" value="1">';
|
||||||
|
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
@ -323,7 +325,8 @@ if (!empty($cablesWithKupfer) && !empty($chartData['labels'])) {
|
||||||
|
|
||||||
$colCount = 0;
|
$colCount = 0;
|
||||||
foreach ($cablesWithKupfer as $cable) {
|
foreach ($cablesWithKupfer as $cable) {
|
||||||
$checked = (empty($cableIds) || in_array($cable->rowid, $cableIds)) ? ' checked' : '';
|
// Beim ersten Laden alle auswaehlen, danach nur die ausgewaehlten
|
||||||
|
$checked = (!$cableFilterSubmitted || in_array($cable->rowid, $cableIds)) ? ' checked' : '';
|
||||||
print '<td style="width: 25%;">';
|
print '<td style="width: 25%;">';
|
||||||
print '<label>';
|
print '<label>';
|
||||||
print '<input type="checkbox" name="cable_ids[]" value="'.$cable->rowid.'"'.$checked.'> ';
|
print '<input type="checkbox" name="cable_ids[]" value="'.$cable->rowid.'"'.$checked.'> ';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue