added new AP Name filter in Pipework

This commit is contained in:
2025-12-15 08:58:22 +01:00
parent a96510346e
commit b43925d37e
4 changed files with 43 additions and 14 deletions

View File

@@ -47,7 +47,7 @@
<select name="filter[network_id]" id="filter_network_id" class="form-control">
<option></option>
<?php foreach($mynetworks as $fnet): ?>
<option value="<?=$fnet->id?>" <?=($filter['network_id'] == $fnet->id) ? "selected='selected'" : ""?>><?=$fnet->name?></option>
<option value="<?=$fnet->id?>" <?=(($filter['network_id'] ?? null) == $fnet->id) ? "selected='selected'" : ""?>><?=$fnet->name?></option>
<?php endforeach; ?>
</select>
</div>
@@ -60,7 +60,7 @@
<?php if(is_array($fnet->sections) && count($fnet->sections)): ?>
<optgroup label="<?=$fnet->name?>">
<?php foreach($fnet->sections as $section): ?>
<option value="<?=$section->id?>" <?=($filter['networksection_id'] == $section->id) ? "selected='selected'" : ""?>><?=$section->name?></option>
<option value="<?=$section->id?>" <?=(($filter['networksection_id'] ?? null) == $section->id) ? "selected='selected'" : ""?>><?=$section->name?></option>
<?php endforeach; ?>
</optgroup>
<?php endif; ?>
@@ -102,12 +102,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">
<label class="form-label" for="filter_street">Straße</label>
<input type="text" class="form-control" name="filter[street]" id="filter_street" value="<?=$filter['street']?>" />
<input type="text" class="form-control" name="filter[street]" id="filter_street" value="<?=$filter['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">

View File

@@ -11,7 +11,7 @@ if(preg_match('/^(.+)-1R$/', $color_name, $cmatch)) {
<select class="form-control selectpicker show-tick" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" title="Farbe wählen" data-style="btn-outline-<?=$color_name?>">
<option></option>
<?php foreach(TT_CABLE_COLORS as $name => $color): ?>
<?php if($color['two-color']): ?>
<?php if(!empty($color['two-color'])): ?>
<option
style="color: #<?=$color["hexfg"]?>;
background: rgb(<?=$color["r"]?>,<?=$color["g"]?>,<?=$color["b"]?>);
@@ -20,7 +20,7 @@ if(preg_match('/^(.+)-1R$/', $color_name, $cmatch)) {
"
value="<?=$name?>"
data-bg-color="#<?=$color["hex"]?>" <?=($color['mark']) ? "data-icon='fa-ellipsis-h'" : ""?>
data-bg-color="#<?=$color["hex"]?>" <?=(!empty($color['mark'])) ? "data-icon='fa-ellipsis-h'" : ""?>
<?=($name == $item->value->value_string) ? "selected='selected'" : ""?>
>
<?=ucfirst($name)?>
@@ -29,7 +29,7 @@ if(preg_match('/^(.+)-1R$/', $color_name, $cmatch)) {
<option
style="background-color: rgba(<?=$color["r"]?>,<?=$color["g"]?>,<?=$color["b"]?>, .5); color: #<?=$color["hexfg"]?>"
value="<?=$name?>"
data-bg-color="#<?=$color["hex"]?>" <?=($color['mark']) ? "data-icon='fa-ellipsis-h'" : ""?>
data-bg-color="#<?=$color["hex"]?>" <?=(!empty($color['mark'])) ? "data-icon='fa-ellipsis-h'" : ""?>
<?=($name == $item->value->value_string) ? "selected='selected'" : ""?>
>
<?=ucfirst($name)?>

View File

@@ -303,7 +303,7 @@ class Building extends mfBaseModel {
}
if($name == "termination_workflow_comments") {
$comments = "";
$comment = "";
foreach($this->getProperty("terminations") as $term) {
if($term->workflow_comment) {
$comment .= $term->code.": ".trim($term->workflow_comment)."\n\n";

View File

@@ -114,8 +114,32 @@ class PipeworkController extends mfBaseController {
$building_search["pipeworker_id"] = ($this->me->address->parent_id) ? $this->me->address->parent_id : $this->me->address_id;
}
$pagination['maxItems'] = BuildingModel::count($building_search);
foreach(BuildingModel::search($building_search, $pagination) as $b) {
// Store ap_name filter separately for post-processing
$ap_name_filter = null;
if(array_key_exists('ap_name', $building_search) && $building_search['ap_name']) {
$ap_name_filter = $building_search['ap_name'];
unset($building_search['ap_name']); // Remove from search as it's a workflow value
}
if($ap_name_filter) {
$all_buildings = BuildingModel::search($building_search, false);
$filtered_buildings = [];
foreach($all_buildings as $b) {
$ap_name = $b->getWorkflowvalue('ist_anschlusspunkt_name') ?: $b->getWorkflowvalue('anschlusspunkt_name');
if($ap_name && stripos($ap_name, $ap_name_filter) !== false) {
$filtered_buildings[] = $b;
}
}
$pagination['maxItems'] = count($filtered_buildings);
$buildings = array_slice($filtered_buildings, $pagination['start'], $pagination['count']);
} else {
$pagination['maxItems'] = BuildingModel::count($building_search);
$buildings = BuildingModel::search($building_search, $pagination);
}
foreach($buildings as $b) {
if(!array_key_exists($b->network->name, $networks)) {
$networks[$b->network->name] = [];
}