Add AP-Name filter to linework search and improve input handling in Index.php
This commit is contained in:
@@ -105,8 +105,8 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="filter_linework_doku_delay">Dokuaufschub</label>
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_linework_doku_delay">Dokuaufsch.</label>
|
||||
<select name="filter[linework_doku_delay]" id="filter_linework_doku_delay" class="form-control">
|
||||
<option value="0">Ausblenden</option>
|
||||
<option value="1" <?=($filter['linework_doku_delay'] == 1) ? "selected='selected'" : ""?>>Anzeigen</option>
|
||||
@@ -115,12 +115,17 @@
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_code">Objekt ID</label>
|
||||
<input type="text" class="form-control" name="filter[code]" id="filter_code" value="<?=$filter['code']?>" />
|
||||
<input type="text" class="form-control" name="filter[code]" id="filter_code" value="<?=$filter['code'] ?? ''?>" />
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_building_street">Straße</label>
|
||||
<input type="text" class="form-control" name="filter[building_street]" id="filter_building_street" value="<?=$filter['building_street']?>" />
|
||||
<input type="text" class="form-control" name="filter[building_street]" id="filter_building_street" value="<?=$filter['building_street'] ?? ''?>" />
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_ap_name">AP-Name</label>
|
||||
<input type="text" class="form-control" name="filter[ap_name]" id="filter_ap_name" value="<?=$filter['ap_name'] ?? ''?>" />
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
|
||||
@@ -121,8 +121,33 @@ class LineworkController extends mfBaseController {
|
||||
}*/
|
||||
//var_dump($termination_search);exit;
|
||||
$networks = [];
|
||||
|
||||
// Store ap_name filter separately for post-processing
|
||||
$ap_name_filter = null;
|
||||
if(array_key_exists('ap_name', $termination_search) && $termination_search['ap_name']) {
|
||||
$ap_name_filter = $termination_search['ap_name'];
|
||||
unset($termination_search['ap_name']); // Remove from search as it's a workflow value
|
||||
}
|
||||
|
||||
if($ap_name_filter) {
|
||||
$all_terminations = TerminationModel::search($termination_search, false);
|
||||
$filtered_terminations = [];
|
||||
|
||||
foreach($all_terminations as $term) {
|
||||
$ap_name = $term->building->getWorkflowvalue('ist_anschlusspunkt_name') ?: $term->building->getWorkflowvalue('anschlusspunkt_name');
|
||||
if($ap_name && stripos($ap_name, $ap_name_filter) !== false) {
|
||||
$filtered_terminations[] = $term;
|
||||
}
|
||||
}
|
||||
|
||||
$pagination['maxItems'] = count($filtered_terminations);
|
||||
$terminations = array_slice($filtered_terminations, $pagination['start'], $pagination['count']);
|
||||
} else {
|
||||
$pagination['maxItems'] = TerminationModel::count($termination_search);
|
||||
foreach(TerminationModel::search($termination_search, $pagination) as $term) {
|
||||
$terminations = TerminationModel::search($termination_search, $pagination);
|
||||
}
|
||||
|
||||
foreach($terminations as $term) {
|
||||
if(!array_key_exists($term->building->network->name, $networks)) {
|
||||
$networks[$term->building->network->name] = [];
|
||||
}
|
||||
@@ -189,6 +214,8 @@ class LineworkController extends mfBaseController {
|
||||
continue;
|
||||
}*/
|
||||
|
||||
// AP-Name filter is passed through to be handled by the model
|
||||
// It will filter by workflow values: ist_anschlusspunkt_name or anschlusspunkt_name
|
||||
$new_filter[$name] = $value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user