Pop Feature Updates
* Vorbereitung für erweiterte Faserdarstellungen * Pop Map Übersicht * Leere Pop Kategorien werden nun als Unbekannt dargestellt
This commit is contained in:
@@ -367,7 +367,7 @@ foreach ($devicesall as $deviceall) {
|
||||
<h4 class="float-left">Config Backups</h4>
|
||||
<span><i class="fa-sharp fa-solid fa-arrows-spin fa-backup-check <?= ($devices->backup_check) ? '' : 'fa-backup-check-uncheck' ?>"
|
||||
title=" <?= ($devices->backup_check) ? 'Backup Check aktiv' : 'Backup Check inaktiv' ?>"></i></span>
|
||||
<?php if ($devices->devicetype->devicemanufactor->config_backup > count()): ?>
|
||||
<?php if ($devices->devicetype->devicemanufactor->config_backup): ?>
|
||||
<span><i title="Switch config" class="fa-light fa-rectangle-code code-ico"
|
||||
data-toggle="modal" data-target="#configCode"></i></span>
|
||||
<?php endif;
|
||||
|
||||
@@ -722,12 +722,12 @@ if (!empty(trim($pops->vlan_ipv6)))
|
||||
$('[data-toggle="popover"]').popover();
|
||||
});
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script>
|
||||
<!--<script src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"></script>-->
|
||||
<script type="text/javascript" src="<?= self::getResourcePath() ?>assets/js/print.min.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript" src="<?= self::getResourcePath() ?>js/pages/pop/detail.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript" src="<?= self::getResourcePath() ?>js/pages/pop/fiber.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>js/pages/pop/fibertable.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript" src="<?= self::getResourcePath() ?>js/pages/Pop/detail/detail.js?<?= $git_merge_ts ?>"></script>
|
||||
<script type="text/javascript" src="<?= self::getResourcePath() ?>js/pages/Pop/detail/fiber.js?<?= $git_merge_ts ?>"></script>
|
||||
<!--script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>js/pages/pop/fibertable.js?<?= $git_merge_ts ?>"></script-->
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= $git_merge_ts ?>"></script>
|
||||
|
||||
|
||||
@@ -17,6 +17,25 @@ class PopController extends mfBaseController
|
||||
}
|
||||
}
|
||||
|
||||
private function getMapCategories()
|
||||
{
|
||||
$categories = [];
|
||||
foreach (PopModel::$categoryArray as $id => $cat) {
|
||||
$categories[] = [
|
||||
'id' => $id,
|
||||
'name' => $cat['name'],
|
||||
'icon' => 'assets/img/markers/pop_' . $id . '.png',
|
||||
];
|
||||
}
|
||||
|
||||
$categories[] = [
|
||||
'id' => null,
|
||||
'name' => 'Unbekannt',
|
||||
'icon' => 'assets/img/markers/pop_unknown.png',
|
||||
];
|
||||
return $categories;
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
$networks = array_map(function ($network) {
|
||||
@@ -30,7 +49,7 @@ class PopController extends mfBaseController
|
||||
return [
|
||||
"id" => $pop->id,
|
||||
"name" => $pop->name,
|
||||
"category" => $pop->category,
|
||||
"category" => $pop->category ?: 99,
|
||||
"networkArea" => $pop->networks,
|
||||
"location" => $pop->location,
|
||||
"state" => $pop->state,
|
||||
@@ -45,6 +64,8 @@ class PopController extends mfBaseController
|
||||
];
|
||||
}, PopModel::getAlladv());
|
||||
|
||||
$categories = $this->getMapCategories();
|
||||
|
||||
$JSGlobals = ["BASE_URL" => self::getUrl(""),
|
||||
"DASHBOARD_URL" => self::getUrl("Dashboard"),
|
||||
"MFAPPNAME" => MFAPPNAME_SLUG,
|
||||
@@ -55,11 +76,20 @@ class PopController extends mfBaseController
|
||||
],
|
||||
"NETWORKS" => $networks,
|
||||
"POPS" => $pops,
|
||||
"CATEGORIES" => $categories,
|
||||
"IS_ADMIN" => $this->me->is("Admin"),
|
||||
"MAPBOX_TOKEN" => TT_MAPBOX_TILE_API_TOKEN,
|
||||
];
|
||||
|
||||
$this->layout()->set("vueViewName", "Pop");
|
||||
$this->layout()->set("JSGlobals", $JSGlobals);
|
||||
$this->layout()->set("additionalCSS", [
|
||||
"assets/css/leaflet.css",
|
||||
]);
|
||||
$this->layout()->set("additionalJS", [
|
||||
"assets/js/leaflet.js",
|
||||
"assets/js/leaflet.MakiMarkers.js"
|
||||
]);
|
||||
$this->layout()->setTemplate("VueViews/Vue");
|
||||
|
||||
}
|
||||
@@ -112,6 +142,7 @@ class PopController extends mfBaseController
|
||||
{
|
||||
$network_id = 90;
|
||||
$this->layout()->set("network_id", $network_id);
|
||||
$this->layout()->set("categories", $this->getMapCategories());
|
||||
$this->layout()->setTemplate("Pop/Map");
|
||||
}
|
||||
|
||||
@@ -258,28 +289,220 @@ class PopController extends mfBaseController
|
||||
$home_id = $this->request->home_id;
|
||||
|
||||
if (!$fiber_id && !$home_id) {
|
||||
return mfBaseController::returnJson(mfResponse::BadRequest(['message' => 'Ungültige Faser-ID oder Home-ID']));
|
||||
return mfBaseController::returnJson(mfResponse::BadRequest(['message' => 'Ungültige ID']));
|
||||
}
|
||||
|
||||
if ($home_id) {
|
||||
if ($home_id && !$fiber_id) {
|
||||
$sql = "SELECT id FROM FiberPlanFiber WHERE home_id = '" . $db->escape($home_id) . "' LIMIT 1";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
$row = $db->fetch_array($res);
|
||||
$fiber_id = $row['id'];
|
||||
} else {
|
||||
return mfBaseController::returnJson(mfResponse::NotFound(['message' => 'Keine Faser für Home-ID gefunden']));
|
||||
}
|
||||
}
|
||||
|
||||
$fiber = new FiberPlanFiber($fiber_id);
|
||||
|
||||
if (!$fiber->id) {
|
||||
return mfBaseController::returnJson(mfResponse::NotFound(['message' => 'Faser nicht gefunden']));
|
||||
}
|
||||
|
||||
$this->log->debug("Lade Faser-Strecke für Faser ID: $fiber_id");
|
||||
$details = $fiber->toArray();
|
||||
$details['customer_cable_type'] = $fiber->customer_cable_type;
|
||||
$details['customer_cable_fiber_nr'] = $fiber->customer_cable_fiber_nr;
|
||||
$details['customer_connector_type'] = $fiber->customer_connector_type;
|
||||
$details['customer_cable_spec'] = $fiber->customer_cable_spec;
|
||||
$details['customer_fiber_range'] = $fiber->customer_fiber_range;
|
||||
$details['bundle_nr'] = $fiber->bundle_nr;
|
||||
$details['bundle_color'] = $fiber->bundle_color;
|
||||
$details['bundle_color_hex'] = $fiber->bundle_color_hex;
|
||||
$details['fiber_nr_bundle'] = $fiber->fiber_nr_bundle;
|
||||
|
||||
if ($fiber->address || $fiber->home_id) {
|
||||
$customerGps = $this->geocodeAddress($fiber->address, $fiber->home_id);
|
||||
if ($customerGps) $details['customer_gps'] = $customerGps;
|
||||
}
|
||||
|
||||
$debug = [];
|
||||
|
||||
if ($home_id) {
|
||||
$cableChain = $this->buildCompleteCableChain($fiber);
|
||||
if (count($cableChain) > 0) {
|
||||
$mainCable = $cableChain[0]['cable'];
|
||||
$mainFiber = $cableChain[0]['fiber'];
|
||||
$cable_route_data = FiberPlanCableModel::getCableRoute($mainCable->id);
|
||||
$cable_route_array = [];
|
||||
foreach ($cable_route_data as $station) $cable_route_array[] = $station['name'];
|
||||
$allFibers = FiberPlanFiberModel::getByCableAndSheet($mainCable->id, null);
|
||||
$fibersArray = [];
|
||||
foreach ($allFibers as $f) {
|
||||
$fibersArray[] = [
|
||||
'id' => $f->id, 'fiber_nr_cable' => $f->fiber_nr_cable,
|
||||
'fiber_color' => $f->fiber_color, 'fiber_color_hex' => $f->fiber_color_hex,
|
||||
'bundle_nr' => $f->bundle_nr, 'bundle_color' => $f->bundle_color, 'bundle_color_hex' => $f->bundle_color_hex,
|
||||
'branch_type' => $f->branch_type, 'branch_cable_nr' => $f->branch_cable_nr,
|
||||
'branch_from_location' => $f->branch_from_location, 'branch_fiber_nr' => $f->branch_fiber_nr
|
||||
];
|
||||
}
|
||||
|
||||
$branchPoints = [];
|
||||
$sql = "SELECT id, description as name, gps_lat, gps_long, object_type, 'dispatcher' as type
|
||||
FROM FiberPlanDispatcher WHERE network_id = 90 AND object_type = 4 AND gps_lat IS NOT NULL";
|
||||
$res = $db->query($sql);
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$branchPoints[] = ['id' => $data['id'], 'name' => $data['name'], 'gps_lat' => $data['gps_lat'], 'gps_long' => $data['gps_long'], 'object_type' => intval($data['object_type']), 'type' => $data['type']];
|
||||
}
|
||||
|
||||
$details['cable_info'] = [
|
||||
'id' => $mainCable->id, 'description' => $mainCable->description, 'fibers' => $fibersArray,
|
||||
'diameter' => $mainCable->diameter, 'cable_route_array' => $cable_route_array,
|
||||
'cable_route_full' => $cable_route_data, 'coordinates' => $mainCable->coordinates,
|
||||
'location' => $mainFiber->location, 'branch_points' => $branchPoints
|
||||
];
|
||||
|
||||
$allCablesForMatching = [];
|
||||
foreach ($cableChain as $chainItem) {
|
||||
$c = $chainItem['cable'];
|
||||
$coords = json_decode($c->coordinates, true);
|
||||
if ($coords) $allCablesForMatching[] = ['id' => $c->id, 'description' => $c->description, 'coordinates' => $coords];
|
||||
}
|
||||
$sql = "SELECT id, description, coordinates FROM FiberPlanCable WHERE network_id = 90 AND coordinates IS NOT NULL AND coordinates != '' AND coordinates != '[]'";
|
||||
$res = $db->query($sql);
|
||||
while ($c = $db->fetch_array($res)) {
|
||||
$coords = json_decode($c['coordinates'], true);
|
||||
if ($coords) {
|
||||
$exists = false; foreach($allCablesForMatching as $ex) { if($ex['id'] == $c['id']) $exists=true; }
|
||||
if(!$exists) $allCablesForMatching[] = ['id' => $c['id'], 'description' => $c['description'], 'coordinates' => $coords];
|
||||
}
|
||||
}
|
||||
$details['all_cables'] = $allCablesForMatching;
|
||||
}
|
||||
|
||||
if (count($cableChain) > 1) {
|
||||
$details['branch_path'] = $this->buildBranchPathFromChain($cableChain, 1, $debug);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->log->debug("=== MODUS: Vorwärts-Trace ===");
|
||||
|
||||
if ($fiber->cable_id) {
|
||||
$cable = new FiberPlanCable($fiber->cable_id);
|
||||
if ($cable->id) {
|
||||
$cable_route_data = FiberPlanCableModel::getCableRoute($cable->id);
|
||||
$cable_route_array = [];
|
||||
foreach ($cable_route_data as $station) $cable_route_array[] = $station['name'];
|
||||
|
||||
$branchPoints = [];
|
||||
$sql = "SELECT id, description as name, gps_lat, gps_long, object_type, 'dispatcher' as type
|
||||
FROM FiberPlanDispatcher WHERE network_id = 90 AND object_type = 4 AND gps_lat IS NOT NULL";
|
||||
$res = $db->query($sql);
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$branchPoints[] = ['id' => $data['id'], 'name' => $data['name'], 'gps_lat' => $data['gps_lat'], 'gps_long' => $data['gps_long'], 'object_type' => intval($data['object_type']), 'type' => $data['type']];
|
||||
}
|
||||
|
||||
$allFibers = FiberPlanFiberModel::getByCableAndSheet($cable->id, null);
|
||||
$fibersArray = [];
|
||||
foreach ($allFibers as $f) {
|
||||
$fibersArray[] = [
|
||||
'id' => $f->id, 'fiber_nr_cable' => $f->fiber_nr_cable, 'fiber_color' => $f->fiber_color, 'fiber_color_hex' => $f->fiber_color_hex,
|
||||
'bundle_nr' => $f->bundle_nr, 'bundle_color' => $f->bundle_color, 'bundle_color_hex' => $f->bundle_color_hex,
|
||||
'branch_type' => $f->branch_type, 'branch_cable_nr' => $f->branch_cable_nr,
|
||||
'branch_from_location' => $f->branch_from_location, 'branch_fiber_nr' => $f->branch_fiber_nr
|
||||
];
|
||||
}
|
||||
|
||||
$details['cable_info'] = [
|
||||
'id' => $cable->id, 'description' => $cable->description, 'fibers' => $fibersArray,
|
||||
'diameter' => $cable->diameter, 'cable_route_array' => $cable_route_array,
|
||||
'cable_route_full' => $cable_route_data, 'coordinates' => $cable->coordinates,
|
||||
'location' => $fiber->location, 'branch_points' => $branchPoints
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($fiber->branch_type === 'Abzweigkabel' && $fiber->branch_cable_nr) {
|
||||
$details['branch_path'] = $this->traceBranchPath($fiber, 0, 10, $debug);
|
||||
}
|
||||
|
||||
$allCablesForMatching = [];
|
||||
$sql = "SELECT id, description, coordinates FROM FiberPlanCable WHERE network_id = 90 AND coordinates IS NOT NULL AND coordinates != '' AND coordinates != '[]'";
|
||||
$res = $db->query($sql);
|
||||
while ($c = $db->fetch_array($res)) {
|
||||
$coords = json_decode($c['coordinates'], true);
|
||||
if ($coords) $allCablesForMatching[] = ['id' => $c['id'], 'description' => $c['description'], 'coordinates' => $coords];
|
||||
}
|
||||
$details['all_cables'] = $allCablesForMatching;
|
||||
}
|
||||
|
||||
$details['debug'] = $debug;
|
||||
return mfBaseController::returnJson(mfResponse::Ok(['fiber' => $details]));
|
||||
}
|
||||
|
||||
protected function getAllFiberPathsForHomeAction()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
$home_id = $this->request->home_id;
|
||||
|
||||
if (!$home_id) {
|
||||
return mfBaseController::returnJson(mfResponse::BadRequest(['message' => 'Ungültige Home-ID']));
|
||||
}
|
||||
|
||||
$sql = "SELECT id FROM FiberPlanFiber WHERE home_id = '" . $db->escape($home_id) . "'";
|
||||
$res = $db->query($sql);
|
||||
|
||||
$fiberIds = [];
|
||||
if ($db->num_rows($res)) {
|
||||
while ($row = $db->fetch_array($res)) {
|
||||
$fiberIds[] = $row['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($fiberIds)) {
|
||||
return mfBaseController::returnJson(mfResponse::NotFound(['message' => 'Keine Fasern für Home-ID gefunden']));
|
||||
}
|
||||
|
||||
$globalBranchPoints = [];
|
||||
$sqlBP = "SELECT id, description as name, gps_lat, gps_long, object_type, 'dispatcher' as type
|
||||
FROM FiberPlanDispatcher
|
||||
WHERE network_id = 90 AND object_type IN (1,2,3,4)
|
||||
AND gps_lat IS NOT NULL AND gps_long IS NOT NULL";
|
||||
$resBP = $db->query($sqlBP);
|
||||
if ($db->num_rows($resBP)) {
|
||||
while ($data = $db->fetch_array($resBP)) {
|
||||
$globalBranchPoints[] = [
|
||||
'id' => $data['id'],
|
||||
'name' => $data['name'],
|
||||
'gps_lat' => $data['gps_lat'],
|
||||
'gps_long' => $data['gps_long'],
|
||||
'object_type' => intval($data['object_type']),
|
||||
'type' => $data['type']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$globalCablesWithCoords = [];
|
||||
$sqlCables = "SELECT id, description, coordinates
|
||||
FROM FiberPlanCable
|
||||
WHERE network_id = 90
|
||||
AND coordinates IS NOT NULL
|
||||
AND coordinates != ''
|
||||
AND coordinates != '[]'";
|
||||
$resCables = $db->query($sqlCables);
|
||||
while ($cableData = $db->fetch_array($resCables)) {
|
||||
$coords = json_decode($cableData['coordinates'], true);
|
||||
if ($coords && is_array($coords) && count($coords) > 0) {
|
||||
$globalCablesWithCoords[] = [
|
||||
'id' => $cableData['id'],
|
||||
'description' => $cableData['description'],
|
||||
'coordinates' => $coords
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$allPaths = [];
|
||||
|
||||
foreach ($fiberIds as $fiber_id) {
|
||||
$fiber = new FiberPlanFiber($fiber_id);
|
||||
if (!$fiber->id) continue;
|
||||
$details = $fiber->toArray();
|
||||
$details['customer_cable_type'] = $fiber->customer_cable_type;
|
||||
$details['customer_cable_fiber_nr'] = $fiber->customer_cable_fiber_nr;
|
||||
@@ -295,7 +518,6 @@ class PopController extends mfBaseController
|
||||
$customerGps = $this->geocodeAddress($fiber->address, $fiber->home_id);
|
||||
if ($customerGps) {
|
||||
$details['customer_gps'] = $customerGps;
|
||||
$this->log->debug("GPS für Kunde gefunden: " . json_encode($customerGps));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,16 +525,11 @@ class PopController extends mfBaseController
|
||||
$debug['start_fiber'] = [
|
||||
'id' => $fiber->id,
|
||||
'fiber_nr_cable' => $fiber->fiber_nr_cable,
|
||||
'branch_type' => $fiber->branch_type,
|
||||
'branch_cable_nr' => $fiber->branch_cable_nr,
|
||||
'branch_fiber_nr' => $fiber->branch_fiber_nr
|
||||
'branch_type' => $fiber->branch_type
|
||||
];
|
||||
|
||||
if ($home_id) {
|
||||
$this->log->debug("=== MODUS: Rückwärts-Trace (von home_id) ===");
|
||||
|
||||
$cableChain = $this->buildCompleteCableChain($fiber);
|
||||
$debug['cable_chain_count'] = count($cableChain);
|
||||
|
||||
$debug['cable_chain'] = array_map(function($item) {
|
||||
return [
|
||||
'cable_id' => $item['cable']->id,
|
||||
@@ -333,12 +550,17 @@ class PopController extends mfBaseController
|
||||
$cable_route_array[] = $station['name'];
|
||||
}
|
||||
|
||||
$allFibers = FiberPlanFiberModel::getByCableAndSheet($mainCable->id, null);
|
||||
$allMainFibers = FiberPlanFiberModel::getByCableAndSheet($mainCable->id, null);
|
||||
$fibersArray = [];
|
||||
foreach ($allFibers as $f) {
|
||||
foreach ($allMainFibers as $f) {
|
||||
$fibersArray[] = [
|
||||
'id' => $f->id,
|
||||
'fiber_nr_cable' => $f->fiber_nr_cable,
|
||||
'fiber_color' => $f->fiber_color,
|
||||
'fiber_color_hex' => $f->fiber_color_hex,
|
||||
'bundle_nr' => $f->bundle_nr,
|
||||
'bundle_color' => $f->bundle_color,
|
||||
'bundle_color_hex' => $f->bundle_color_hex,
|
||||
'branch_type' => $f->branch_type,
|
||||
'branch_cable_nr' => $f->branch_cable_nr,
|
||||
'branch_from_location' => $f->branch_from_location,
|
||||
@@ -346,26 +568,6 @@ class PopController extends mfBaseController
|
||||
];
|
||||
}
|
||||
|
||||
$branchPoints = [];
|
||||
$sql = "SELECT id, description as name, gps_lat, gps_long, object_type, 'dispatcher' as type
|
||||
FROM FiberPlanDispatcher
|
||||
WHERE network_id = 90 AND object_type = 4
|
||||
AND gps_lat IS NOT NULL AND gps_long IS NOT NULL";
|
||||
$res = $db->query($sql);
|
||||
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$branchPoints[] = [
|
||||
'id' => $data['id'],
|
||||
'name' => $data['name'],
|
||||
'gps_lat' => $data['gps_lat'],
|
||||
'gps_long' => $data['gps_long'],
|
||||
'object_type' => intval($data['object_type']),
|
||||
'type' => $data['type']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$details['cable_info'] = [
|
||||
'id' => $mainCable->id,
|
||||
'description' => $mainCable->description,
|
||||
@@ -375,139 +577,54 @@ class PopController extends mfBaseController
|
||||
'cable_route_full' => $cable_route_data,
|
||||
'coordinates' => $mainCable->coordinates,
|
||||
'location' => $mainFiber->location,
|
||||
'branch_points' => $branchPoints
|
||||
'branch_points' => $globalBranchPoints
|
||||
];
|
||||
|
||||
$allCablesForMatching = [];
|
||||
|
||||
foreach ($cableChain as $chainItem) {
|
||||
$cable = $chainItem['cable'];
|
||||
|
||||
$coords = $cable->coordinates;
|
||||
$c = $chainItem['cable'];
|
||||
$coords = $c->coordinates;
|
||||
if (is_string($coords)) {
|
||||
$coords = json_decode($coords, true);
|
||||
}
|
||||
|
||||
if ($coords && is_array($coords) && count($coords) > 0) {
|
||||
$allCablesForMatching[] = [
|
||||
'id' => $cable->id,
|
||||
'description' => $cable->description,
|
||||
'id' => $c->id,
|
||||
'description' => $c->description,
|
||||
'coordinates' => $coords
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT id, description, coordinates
|
||||
FROM FiberPlanCable
|
||||
WHERE network_id = 90
|
||||
AND coordinates IS NOT NULL
|
||||
AND coordinates != ''
|
||||
AND coordinates != '[]'";
|
||||
$res = $db->query($sql);
|
||||
|
||||
while ($cableData = $db->fetch_array($res)) {
|
||||
$coords = json_decode($cableData['coordinates'], true);
|
||||
|
||||
if ($coords && is_array($coords) && count($coords) > 0) {
|
||||
foreach ($globalCablesWithCoords as $gc) {
|
||||
$exists = false;
|
||||
foreach ($allCablesForMatching as $existing) {
|
||||
if ($existing['id'] == $cableData['id']) {
|
||||
if ($existing['id'] == $gc['id']) {
|
||||
$exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$exists) {
|
||||
$allCablesForMatching[] = [
|
||||
'id' => $cableData['id'],
|
||||
'description' => $cableData['description'],
|
||||
'coordinates' => $coords
|
||||
];
|
||||
}
|
||||
$allCablesForMatching[] = $gc;
|
||||
}
|
||||
}
|
||||
|
||||
$details['all_cables'] = $allCablesForMatching;
|
||||
$this->log->debug("Hausanschluss-Matching: " . count($allCablesForMatching) . " Kabel verfügbar");
|
||||
}
|
||||
|
||||
if (count($cableChain) > 1) {
|
||||
$details['branch_path'] = $this->buildBranchPathFromChain($cableChain, 1, $debug);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->log->debug("=== MODUS: Vorwärts-Trace (von fiber_id) ===");
|
||||
|
||||
if ($fiber->cable_id) {
|
||||
$cable = new FiberPlanCable($fiber->cable_id);
|
||||
if ($cable->id) {
|
||||
$cable_route_data = FiberPlanCableModel::getCableRoute($cable->id);
|
||||
$cable_route_array = [];
|
||||
foreach ($cable_route_data as $station) {
|
||||
$cable_route_array[] = $station['name'];
|
||||
}
|
||||
|
||||
$branchPoints = [];
|
||||
$sql = "SELECT id, description as name, gps_lat, gps_long, object_type, 'dispatcher' as type
|
||||
FROM FiberPlanDispatcher
|
||||
WHERE network_id = 90 AND object_type = 4
|
||||
AND gps_lat IS NOT NULL AND gps_long IS NOT NULL";
|
||||
$res = $db->query($sql);
|
||||
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$branchPoints[] = [
|
||||
'id' => $data['id'],
|
||||
'name' => $data['name'],
|
||||
'gps_lat' => $data['gps_lat'],
|
||||
'gps_long' => $data['gps_long'],
|
||||
'object_type' => intval($data['object_type']),
|
||||
'type' => $data['type']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$allFibers = FiberPlanFiberModel::getByCableAndSheet($cable->id, null);
|
||||
$fibersArray = [];
|
||||
foreach ($allFibers as $f) {
|
||||
$fibersArray[] = [
|
||||
'id' => $f->id,
|
||||
'fiber_nr_cable' => $f->fiber_nr_cable,
|
||||
'branch_type' => $f->branch_type,
|
||||
'branch_cable_nr' => $f->branch_cable_nr,
|
||||
'branch_from_location' => $f->branch_from_location,
|
||||
'branch_fiber_nr' => $f->branch_fiber_nr
|
||||
];
|
||||
}
|
||||
|
||||
$details['cable_info'] = [
|
||||
'id' => $cable->id,
|
||||
'description' => $cable->description,
|
||||
'fibers' => $fibersArray,
|
||||
'diameter' => $cable->diameter,
|
||||
'cable_route_array' => $cable_route_array,
|
||||
'cable_route_full' => $cable_route_data,
|
||||
'coordinates' => $cable->coordinates,
|
||||
'location' => $fiber->location,
|
||||
'branch_points' => $branchPoints
|
||||
];
|
||||
|
||||
if ($cable->cable_route) {
|
||||
$routeArray = json_decode($cable->cable_route, true);
|
||||
if (is_array($routeArray)) {
|
||||
$details['cable_info']['cable_route_array'] = $routeArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($fiber->branch_type === 'Abzweigkabel' && $fiber->branch_cable_nr) {
|
||||
$details['branch_path'] = $this->traceBranchPath($fiber, 0, 10, $debug);
|
||||
}
|
||||
}
|
||||
|
||||
$details['debug'] = $debug;
|
||||
|
||||
return mfBaseController::returnJson(mfResponse::Ok(['fiber' => $details]));
|
||||
$allPaths[] = [
|
||||
'fiber' => $details
|
||||
];
|
||||
}
|
||||
|
||||
return mfBaseController::returnJson(mfResponse::Ok(['paths' => $allPaths]));
|
||||
}
|
||||
|
||||
private function buildCompleteCableChain($endFiber)
|
||||
@@ -530,9 +647,12 @@ class PopController extends mfBaseController
|
||||
]);
|
||||
|
||||
while ($depth < $maxDepth) {
|
||||
$currentFiberNr = intval($currentFiber->fiber_nr_cable);
|
||||
|
||||
$sql = "SELECT * FROM FiberPlanFiber
|
||||
WHERE branch_type = 'Abzweigkabel'
|
||||
AND branch_cable_nr = '" . $db->escape($currentCable->description) . "'
|
||||
AND branch_fiber_nr = $currentFiberNr
|
||||
LIMIT 1";
|
||||
|
||||
$this->log->debug("Depth $depth: Suche Parent-Faser für Kabel: {$currentCable->description}");
|
||||
@@ -1267,6 +1387,9 @@ class PopController extends mfBaseController
|
||||
case "getFiberPath":
|
||||
return $this->getFiberPathAction();
|
||||
break;
|
||||
case "getAllFiberPathsForHome":
|
||||
return $this->getAllFiberPathsForHomeAction();
|
||||
break;
|
||||
case "saveCableFibers":
|
||||
return $this->saveCableFibersAction();
|
||||
break;
|
||||
@@ -1276,6 +1399,9 @@ class PopController extends mfBaseController
|
||||
case "getNetworkMapData":
|
||||
return $this->getNetworkMapDataAction();
|
||||
break;
|
||||
case "getSplicePlanForElement":
|
||||
return $this->getSplicePlanForElementAction();
|
||||
break;
|
||||
default:
|
||||
$return = false;
|
||||
}
|
||||
@@ -1459,7 +1585,7 @@ class PopController extends mfBaseController
|
||||
$cables = [];
|
||||
$cableRes = $db->select(
|
||||
"FiberPlanCable",
|
||||
"id, description, fibers, diameter, state, coordinates",
|
||||
"id, description, fibers, diameter, state, coordinates, level, cable_type, status",
|
||||
"network_id=$network_id"
|
||||
);
|
||||
|
||||
@@ -1491,7 +1617,10 @@ class PopController extends mfBaseController
|
||||
'coordinates' => $convertedCoords,
|
||||
'fibers' => $cableData->fibers,
|
||||
'diameter' => $cableData->diameter,
|
||||
'state' => $cableData->state
|
||||
'state' => $cableData->state,
|
||||
'level' => $cableData->level,
|
||||
'cable_type' => $cableData->cable_type,
|
||||
'status' => $cableData->status
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1648,4 +1777,126 @@ class PopController extends mfBaseController
|
||||
'customerConnections' => $customerConnections
|
||||
]));
|
||||
}
|
||||
|
||||
protected function getSplicePlanForElementAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
if (!is_numeric($id)) {
|
||||
return mfBaseController::returnJson(mfResponse::BadRequest(['message' => 'Invalid ID']));
|
||||
}
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$dispatcherRes = $db->select("FiberPlanDispatcher", "*", "id=$id");
|
||||
if (!$db->num_rows($dispatcherRes)) {
|
||||
return mfBaseController::returnJson(mfResponse::NotFound(['message' => 'Verteiler nicht gefunden']));
|
||||
}
|
||||
$dispatcher = $db->fetch_object($dispatcherRes);
|
||||
$dispatcherName = $dispatcher->description;
|
||||
|
||||
$cableIds = [];
|
||||
$sql = "SELECT DISTINCT cable_id FROM FiberPlanCableStation WHERE station_type='dispatcher' AND station_id=$id";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($row = $db->fetch_array($res)) {
|
||||
$cableIds[] = $row['cable_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$result = [];
|
||||
|
||||
if (!empty($cableIds)) {
|
||||
$cableIdsStr = implode(',', $cableIds);
|
||||
|
||||
$cableMap = [];
|
||||
$cableRes = $db->select("FiberPlanCable", "id, description", "id IN ($cableIdsStr)");
|
||||
while ($c = $db->fetch_object($cableRes)) {
|
||||
$cableMap[$c->id] = $c->description;
|
||||
}
|
||||
|
||||
$escapedName = $db->escape($dispatcherName);
|
||||
$sqlFibers = "SELECT * FROM FiberPlanFiber WHERE cable_id IN ($cableIdsStr) AND (branch_from_location = '$escapedName' OR location = '$escapedName')";
|
||||
|
||||
$fiberRes = $db->query($sqlFibers);
|
||||
|
||||
$rawFibers = [];
|
||||
$targetCableNames = [];
|
||||
|
||||
while ($fiber = $db->fetch_object($fiberRes)) {
|
||||
$rawFibers[] = $fiber;
|
||||
if ($fiber->branch_cable_nr) {
|
||||
$targetCableNames[$fiber->branch_cable_nr] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$targetColorMap = [];
|
||||
|
||||
if (!empty($targetCableNames)) {
|
||||
$namesList = [];
|
||||
foreach (array_keys($targetCableNames) as $name) {
|
||||
$namesList[] = "'" . $db->escape($name) . "'";
|
||||
}
|
||||
$namesStr = implode(',', $namesList);
|
||||
$targetCablesRes = $db->select("FiberPlanCable", "id, description", "description IN ($namesStr)");
|
||||
$targetCableIds = [];
|
||||
$targetCableIdToName = [];
|
||||
while ($tc = $db->fetch_object($targetCablesRes)) {
|
||||
$targetCableIds[] = $tc->id;
|
||||
$targetCableIdToName[$tc->id] = $tc->description;
|
||||
}
|
||||
|
||||
if (!empty($targetCableIds)) {
|
||||
$tcIdsStr = implode(',', $targetCableIds);
|
||||
$targetFibersRes = $db->select("FiberPlanFiber", "cable_id, fiber_nr_cable, fiber_color, fiber_color_hex", "cable_id IN ($tcIdsStr)");
|
||||
while ($tf = $db->fetch_object($targetFibersRes)) {
|
||||
$cName = $targetCableIdToName[$tf->cable_id] ?? null;
|
||||
if ($cName) {
|
||||
$targetColorMap[$cName][$tf->fiber_nr_cable] = [
|
||||
'color' => $tf->fiber_color,
|
||||
'hex' => $tf->fiber_color_hex
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($rawFibers as $fiber) {
|
||||
$targetColorInfo = null;
|
||||
if ($fiber->branch_cable_nr && $fiber->branch_fiber_nr) {
|
||||
$targetColorInfo = $targetColorMap[$fiber->branch_cable_nr][$fiber->branch_fiber_nr] ?? null;
|
||||
}
|
||||
|
||||
$result[] = [
|
||||
'cable_name' => $cableMap[$fiber->cable_id] ?? 'Unknown',
|
||||
'fiber_nr' => $fiber->fiber_nr_cable,
|
||||
'fiber_color' => $fiber->fiber_color,
|
||||
'fiber_color_hex' => $fiber->fiber_color_hex,
|
||||
'bundle_color' => $fiber->bundle_color,
|
||||
'bundle_color_hex' => $fiber->bundle_color_hex,
|
||||
|
||||
'target_cable' => $fiber->branch_cable_nr,
|
||||
'target_fiber' => $fiber->branch_fiber_nr,
|
||||
'target_fiber_color' => $targetColorInfo['color'] ?? null,
|
||||
'target_fiber_color_hex' => $targetColorInfo['hex'] ?? null,
|
||||
'target_bundle_color' => $fiber->branch_bundle_color,
|
||||
'target_bundle_color_hex' => $fiber->branch_bundle_color_hex,
|
||||
|
||||
'connector' => $fiber->connector_nr,
|
||||
'description' => $fiber->comment,
|
||||
'home_id' => $fiber->home_id,
|
||||
'address' => $fiber->address ?? null,
|
||||
'customer_cable_type' => $fiber->customer_cable_type ?? null,
|
||||
'customer_cable_fiber_nr' => $fiber->customer_cable_fiber_nr ?? null,
|
||||
'customer_connector_type' => $fiber->customer_connector_type ?? null,
|
||||
'customer_cable_spec' => $fiber->customer_cable_spec ?? null,
|
||||
'customer_fiber_range' => $fiber->customer_fiber_range ?? null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return mfBaseController::returnJson(mfResponse::Ok([
|
||||
'dispatcher' => $dispatcher,
|
||||
'connections' => $result
|
||||
]));
|
||||
}
|
||||
}
|
||||
BIN
public/img/markers/marker-pop-b.png
Normal file
BIN
public/img/markers/marker-pop-b.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
public/img/markers/marker-pop-bl.png
Normal file
BIN
public/img/markers/marker-pop-bl.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
public/img/markers/marker-pop-o.png
Normal file
BIN
public/img/markers/marker-pop-o.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
public/img/markers/marker-pop-v.png
Normal file
BIN
public/img/markers/marker-pop-v.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
10
public/js/pages/Pop/Pop.css
Normal file
10
public/js/pages/Pop/Pop.css
Normal file
@@ -0,0 +1,10 @@
|
||||
.fa-map-location-dot:before
|
||||
{
|
||||
color: #d80000;
|
||||
}
|
||||
.fa-map-location-dot:after
|
||||
{
|
||||
color: #147d00;
|
||||
opacity: 0.9;
|
||||
|
||||
}
|
||||
353
public/js/pages/Pop/PopMap.js
Normal file
353
public/js/pages/Pop/PopMap.js
Normal file
@@ -0,0 +1,353 @@
|
||||
Vue.component('pop-map-modal', {
|
||||
template: `
|
||||
<div>
|
||||
<div class="modal fade" id="popMapModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-xl modal-dialog-centered" style="max-width: 95vw;">
|
||||
<div class="modal-content" style="height: 90vh;">
|
||||
<div class="modal-header bg-dark text-white">
|
||||
<h5 class="modal-title"><i class="fas fa-map-marked-alt"></i><span class="text-light mt-1 d-inline-block"> POP Übersicht</span></h5>
|
||||
<div class="d-flex align-items-center ml-auto">
|
||||
<div class="input-group mr-3 position-relative" style="width: 300px;">
|
||||
<input type="text" class="form-control form-control-sm"
|
||||
v-model="searchQuery"
|
||||
@input="filterPops"
|
||||
@keydown.down.prevent="moveSelection(1)"
|
||||
@keydown.up.prevent="moveSelection(-1)"
|
||||
@keydown.enter.prevent="handleEnter"
|
||||
placeholder="POP suchen...">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-primary btn-sm" @click="searchPop"><i class="fas fa-search"></i></button>
|
||||
<button v-if="searchQuery" class="btn btn-secondary btn-sm" @click="clearSearch"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
|
||||
<div v-if="filteredPops.length > 0 && showSuggestions" class="list-group position-absolute w-100" style="top: 100%; z-index: 1050; max-height: 300px; overflow-y: auto; box-shadow: 0 4px 6px rgba(0,0,0,0.1);">
|
||||
<a href="#" v-for="(pop, index) in filteredPops" :key="pop.id"
|
||||
class="list-group-item list-group-item-action py-2"
|
||||
:class="{ 'active': index === selectedIndex }"
|
||||
@click.prevent="selectPop(pop)">
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<h6 class="mb-1" :class="{ 'text-white': index === selectedIndex }">{{ pop.name }}</h6>
|
||||
</div>
|
||||
<small :class="index === selectedIndex ? 'text-white' : 'text-muted'">{{ categories[pop.category || 99] }} | {{ pop.location }}</small>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body p-0 position-relative">
|
||||
<div id="pop-map" style="width: 100%; height: 100%;"></div>
|
||||
|
||||
<div class="legend-box" style="position: absolute; bottom: 30px; right: 20px; background: white; padding: 15px; border-radius: 5px; box-shadow: 0 0 15px rgba(0,0,0,0.2); z-index: 1000; min-width: 200px;">
|
||||
<h6 class="border-bottom p-0 pb-2 mb-2 mt-0"><strong>Kategorien</strong></h6>
|
||||
<div v-for="(label, key) in categories" :key="key" class="mb-1 d-flex align-items-center">
|
||||
<div class="custom-control custom-checkbox mr-2">
|
||||
<input type="checkbox" class="custom-control-input" :id="'cat-'+key" v-model="visibleCategories[key]" @change="updateMap(false)">
|
||||
<label class="custom-control-label" :for="'cat-'+key" style="cursor: pointer;">
|
||||
</label>
|
||||
</div>
|
||||
<img :src="window.TT_CONFIG.BASE_URL + '/' + categoryImages[key]" style="height: 20px; margin-right: 5px;">
|
||||
<label :for="'cat-'+key" style="cursor: pointer; margin-bottom: 0;">{{ label }} ({{ categoryCounts[key] || 0 }})</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
map: null,
|
||||
popLayer: null,
|
||||
searchQuery: '',
|
||||
filteredPops: [],
|
||||
showSuggestions: false,
|
||||
selectedIndex: -1,
|
||||
categories: {
|
||||
1: 'Outdoor (Kasten/Schrank)',
|
||||
2: 'Indoor (Keller Gebäude)',
|
||||
3: 'Sender/Funk (Sendemast)',
|
||||
4: 'Container (Garage, Container)',
|
||||
99: 'Unbekannt'
|
||||
},
|
||||
states: {
|
||||
1: "Planung (Innenleben)",
|
||||
2: "Bauphase (Schrank)",
|
||||
3: "Grobdoku",
|
||||
4: "in Betrieb",
|
||||
5: "von Techniker abgenommen (Altbestand)"
|
||||
},
|
||||
categoryImages: {
|
||||
1: 'img/markers/marker-pop.png',
|
||||
2: 'img/markers/marker-pop-o.png',
|
||||
3: 'img/markers/marker-pop-b.png',
|
||||
4: 'img/markers/marker-pop-v.png',
|
||||
99: 'img/markers/marker-pop-bl.png'
|
||||
},
|
||||
categoryColors: {
|
||||
1: '#a1dfa0', // Outdoor - Green
|
||||
2: '#f8b767', // Indoor - Orange
|
||||
3: '#a9b8ec', // Sender - Blue
|
||||
4: '#f89797', // Container - Yellow
|
||||
99: '#808080' // Unbekannt - Gray
|
||||
},
|
||||
visibleCategories: {
|
||||
1: true,
|
||||
2: true,
|
||||
3: true,
|
||||
4: true,
|
||||
99: true
|
||||
},
|
||||
categoryCounts: {
|
||||
1: 0,
|
||||
2: 0,
|
||||
3: 0,
|
||||
4: 0,
|
||||
99: 0
|
||||
},
|
||||
allPops: [],
|
||||
markers: []
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// Prepare data
|
||||
const popsObj = window.TT_CONFIG.POPS || {};
|
||||
this.allPops = Object.values(popsObj);
|
||||
|
||||
this.calculateCounts();
|
||||
|
||||
// Listen to modal open event to init map correctly (fix render issues)
|
||||
$(document).on('shown.bs.modal', '#popMapModal', this.initMap);
|
||||
|
||||
// Close suggestions when clicking outside
|
||||
document.addEventListener('click', this.handleClickOutside);
|
||||
},
|
||||
beforeDestroy() {
|
||||
$(document).off('shown.bs.modal', '#popMapModal', this.initMap);
|
||||
document.removeEventListener('click', this.handleClickOutside);
|
||||
},
|
||||
methods: {
|
||||
calculateCounts() {
|
||||
// Reset counts
|
||||
for (let key in this.categoryCounts) {
|
||||
this.categoryCounts[key] = 0;
|
||||
}
|
||||
|
||||
this.allPops.forEach(pop => {
|
||||
const category = pop.category || 99;
|
||||
if (this.categoryCounts.hasOwnProperty(category)) {
|
||||
this.categoryCounts[category]++;
|
||||
} else {
|
||||
// Just in case we have a category not in our list, count it as 99 or ignore
|
||||
this.categoryCounts[99]++;
|
||||
}
|
||||
});
|
||||
},
|
||||
open() {
|
||||
$('#popMapModal').modal('show');
|
||||
},
|
||||
initMap() {
|
||||
if (this.map) {
|
||||
setTimeout(() => {
|
||||
this.map.invalidateSize();
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof L === 'undefined' || !L.MakiMarkers) {
|
||||
console.error('Leaflet or MakiMarkers not loaded');
|
||||
return;
|
||||
}
|
||||
|
||||
L.MakiMarkers.accessToken = window.TT_CONFIG.MAPBOX_TOKEN;
|
||||
|
||||
this.map = L.map('pop-map').setView([51.1657, 10.4515], 6);
|
||||
|
||||
const standardLayer = L.tileLayer('https://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
|
||||
maxZoom: 19,
|
||||
id: "geolandbasemap",
|
||||
imgtype: "png",
|
||||
attribution: 'Basemap.at'
|
||||
});
|
||||
|
||||
const satelliteLayer = L.tileLayer('https://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
|
||||
maxZoom: 19,
|
||||
id: "bmaporthofoto30cm",
|
||||
imgtype: "jpeg",
|
||||
attribution: 'Basemap.at'
|
||||
});
|
||||
|
||||
standardLayer.addTo(this.map);
|
||||
|
||||
const baseMaps = {
|
||||
"Karte": standardLayer,
|
||||
"Satellit": satelliteLayer
|
||||
};
|
||||
|
||||
L.control.layers(baseMaps).addTo(this.map);
|
||||
|
||||
this.popLayer = L.featureGroup().addTo(this.map);
|
||||
|
||||
this.updateMap();
|
||||
},
|
||||
updateMap(shouldFit = true) {
|
||||
if (!this.map) return;
|
||||
|
||||
this.popLayer.clearLayers();
|
||||
this.markers = [];
|
||||
|
||||
const bounds = L.latLngBounds();
|
||||
let hasMarkers = false;
|
||||
|
||||
this.allPops.forEach(pop => {
|
||||
const category = pop.category || 99;
|
||||
|
||||
if (!this.visibleCategories[category]) return;
|
||||
|
||||
const gps = pop.gps;
|
||||
if (!gps) return;
|
||||
|
||||
const parts = gps.split(',');
|
||||
if (parts.length !== 2) return;
|
||||
|
||||
const lat = parseFloat(parts[0]);
|
||||
const lng = parseFloat(parts[1]);
|
||||
|
||||
if (isNaN(lat) || isNaN(lng) || (lat === 0 && lng === 0)) return;
|
||||
|
||||
let iconUrl = this.categoryImages[category] || this.categoryImages[99];
|
||||
let color = this.categoryColors[category] || '#808080';
|
||||
|
||||
const marker = L.marker([lat, lng], {
|
||||
icon: L.MakiMarkers.icon({
|
||||
icon: 'village',
|
||||
color: color,
|
||||
size: 'l'
|
||||
})
|
||||
});
|
||||
|
||||
let categoryName = this.categories[category] || 'Unbekannt';
|
||||
let stateText = this.states[pop.state] || pop.state || '-';
|
||||
|
||||
const popupContent = `
|
||||
<div style="min-width: 200px;">
|
||||
<h6 class="p-0"><i class="fas fa-building"></i> <strong>${pop.name}</strong></h6>
|
||||
<hr class="my-2">
|
||||
<div><strong>Kategorie:</strong> ${categoryName}</div>
|
||||
<div><strong>Status:</strong> ${stateText}</div>
|
||||
<div><strong>Zutritt:</strong> ${pop.location || '-'}</div>
|
||||
<div class="mt-2">
|
||||
<a target="_blank" href="${window.TT_CONFIG.BASE_URL}/Pop/Detail?id=${pop.id}" class="btn btn-sm btn-info btn-block text-light"><i class="fas fa-info-circle"></i> Details</a>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
marker.bindPopup(popupContent);
|
||||
marker.popData = pop;
|
||||
|
||||
this.popLayer.addLayer(marker);
|
||||
this.markers.push(marker);
|
||||
bounds.extend([lat, lng]);
|
||||
hasMarkers = true;
|
||||
});
|
||||
|
||||
if (shouldFit === true && hasMarkers && !this.searchQuery) {
|
||||
this.map.fitBounds(bounds, {padding: [50, 50]});
|
||||
}
|
||||
},
|
||||
filterPops() {
|
||||
const query = this.searchQuery.toLowerCase().trim();
|
||||
this.selectedIndex = -1;
|
||||
|
||||
if (query.length < 1) {
|
||||
this.filteredPops = [];
|
||||
this.showSuggestions = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.filteredPops = this.allPops.filter(pop =>
|
||||
pop.name.toLowerCase().includes(query) ||
|
||||
(pop.location && pop.location.toLowerCase().includes(query))
|
||||
).slice(0, 10);
|
||||
|
||||
this.showSuggestions = true;
|
||||
},
|
||||
moveSelection(step) {
|
||||
if (!this.showSuggestions || this.filteredPops.length === 0) return;
|
||||
|
||||
this.selectedIndex += step;
|
||||
|
||||
if (this.selectedIndex < 0) {
|
||||
this.selectedIndex = this.filteredPops.length - 1;
|
||||
} else if (this.selectedIndex >= this.filteredPops.length) {
|
||||
this.selectedIndex = 0;
|
||||
}
|
||||
},
|
||||
handleEnter() {
|
||||
if (this.showSuggestions && this.selectedIndex >= 0 && this.selectedIndex < this.filteredPops.length) {
|
||||
this.selectPop(this.filteredPops[this.selectedIndex]);
|
||||
} else {
|
||||
this.searchPop();
|
||||
}
|
||||
},
|
||||
selectPop(pop) {
|
||||
this.searchQuery = pop.name;
|
||||
this.showSuggestions = false;
|
||||
this.selectedIndex = -1;
|
||||
this.searchPop();
|
||||
},
|
||||
handleClickOutside(event) {
|
||||
if (!event.target.closest('.input-group')) {
|
||||
this.showSuggestions = false;
|
||||
this.selectedIndex = -1;
|
||||
}
|
||||
},
|
||||
searchPop() {
|
||||
const query = this.searchQuery.toLowerCase().trim();
|
||||
if (!query) {
|
||||
this.clearSearch();
|
||||
return;
|
||||
}
|
||||
|
||||
this.showSuggestions = false;
|
||||
this.selectedIndex = -1;
|
||||
|
||||
let found = this.markers.find(m => m.popData.name.toLowerCase().includes(query));
|
||||
|
||||
if (!found) {
|
||||
const hiddenPop = this.allPops.find(p => p.name.toLowerCase().includes(query));
|
||||
if (hiddenPop) {
|
||||
const category = hiddenPop.category || 99;
|
||||
if (!this.visibleCategories[category]) {
|
||||
this.visibleCategories[category] = true;
|
||||
this.updateMap(false);
|
||||
found = this.markers.find(m => m.popData.id === hiddenPop.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
this.map.flyTo(found.getLatLng(), 15);
|
||||
setTimeout(() => {
|
||||
found.openPopup();
|
||||
}, 500);
|
||||
} else {
|
||||
alert('Kein POP gefunden (oder keine GPS Koordinaten).');
|
||||
}
|
||||
},
|
||||
clearSearch() {
|
||||
this.searchQuery = '';
|
||||
this.filteredPops = [];
|
||||
this.showSuggestions = false;
|
||||
this.selectedIndex = -1;
|
||||
const bounds = L.latLngBounds();
|
||||
this.markers.forEach(m => bounds.extend(m.getLatLng()));
|
||||
if (this.markers.length > 0) {
|
||||
this.map.fitBounds(bounds, {padding: [50, 50]});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -11,12 +11,19 @@ Vue.component('Pop', {
|
||||
<i class="fas fa-plus"></i>
|
||||
Pop hinzufügen
|
||||
</button>
|
||||
<button type="button" class="btn btn-light mr-2" @click="$refs.mapModal.open()">
|
||||
<i class="fa-duotone fa-regular fa-map-location-dot"></i> <span class="font-weight-semibold">Übersichtskarte</span>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<template v-slot:name="{ row }">
|
||||
<a target="_blank" :href="window['TT_CONFIG']['BASE_URL'] +'/Pop/Detail?id=' + row.id">{{row.name}}</a>
|
||||
</template>
|
||||
|
||||
<template v-slot:category="{ row }">
|
||||
{{ {1: 'Outdoor', 2: 'Indoor', 3: 'Sender/Funk', 4: 'Container', 99: 'Unbekannt'}[row.category] || 'Unbekannt' }}
|
||||
</template>
|
||||
|
||||
<template v-slot:doku_date="{ row }">
|
||||
<span>{{row.doku_date ? window.moment.unix(row.doku_date).format('DD.MM.YYYY') : ''}}</span>
|
||||
</template>
|
||||
@@ -45,6 +52,7 @@ Vue.component('Pop', {
|
||||
|
||||
</tt-table>
|
||||
|
||||
<pop-map-modal ref="mapModal"></pop-map-modal>
|
||||
</tt-card>
|
||||
`,
|
||||
data() {
|
||||
@@ -60,7 +68,8 @@ Vue.component('Pop', {
|
||||
{value: '1', text: 'Outdoor (Kasten/Schrank)'},
|
||||
{value: '2', text: 'Indoor (Keller Gebäude)'},
|
||||
{value: '3', text: 'Sender/Funk (Sendemast)'},
|
||||
{value: '4', text: 'Container (Garage, Container)'}]},
|
||||
{value: '4', text: 'Container (Garage, Container)'},
|
||||
{value: '99', text: 'Unbekannt'}]},
|
||||
{text: 'Netzgebiet', key: 'networkArea', class: 'text-center',
|
||||
// TODO: fix autocomplete Filter
|
||||
// filter: 'autocomplete',
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user