Added pop_id filter to Patching/Index

This commit is contained in:
Frank Schubert
2021-09-23 21:28:00 +02:00
parent 8a9e29087a
commit dd2d834c92
3 changed files with 28 additions and 9 deletions

View File

@@ -35,6 +35,22 @@
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_pop_id">POP</label>
<select name="filter[pop_id]" id="filter_pop_id" class="form-control">
<option></option>
<?php foreach($mynetworks as $fnet): ?>
<?php if(is_array($fnet->pops) && count($fnet->pops)): ?>
<optgroup label="<?=$fnet->name?>">
<?php foreach($fnet->pops as $pop): ?>
<option value="<?=$pop->id?>" <?=($filter['pop_id'] == $pop->id) ? "selected='selected'" : ""?>><?=$pop->name?></option>
<?php endforeach; ?>
</optgroup>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_patched">Patchstatus</label>
<select name="filter[patched]" id="filter_patched" class="form-control">
@@ -119,7 +135,7 @@
<th>Patchposition ODF</th>
<th>ODF Port</th>
<th>Typ</th>
<th>Splitte / Gerät</th>
<th>Splitter / Gerät</th>
<th>Port</th>
<th>Gepatched</th>
<th>Von</th>

View File

@@ -88,16 +88,12 @@ class PatchingController extends mfBaseController {
$this->layout()->set("terminations", $terms);
$this->layout()->set("pagination", $pagination);
//var_dump($pagination);exit;
/*
$terminations = PatchingModel::searchByTermination();
$terms = [];
foreach($terminations as $term) {
$terminations = [];
foreach($terms as $term) {
$term->order = OrderModel::getFirst(["termination_id" => $term->id]);
$terms[] = $term;
$terminations[] = $term;
//var_dump($term);
}
//exit;
*/
$this->layout()->set("terminations", $terms);
}
@@ -161,7 +157,7 @@ class PatchingController extends mfBaseController {
$patch_data["device_port"] = $r->device_port;
$patch_data["patched"] = ($r->patched == "1") ? 1 : 0;
if(strlen($patch_data["device_type"])) {
if(strlen($r->device_type)) {
$patch_data["device_type"] = $r->device_type;
} else {
$patch_data["device_type"] = null;

View File

@@ -211,6 +211,13 @@ class PatchingModel {
}
}
if(array_key_exists("pop_id", $filter)) {
$pop_id = $filter['pop_id'];
if(is_numeric($pop_id)) {
$where .= " AND Building.pop_id=$pop_id";
}
}
if(array_key_exists("code", $filter)) {
$code = FronkDB::singleton()->escape($filter['code']);
if($code) {