Faserplanung

* Rohrplanung Updates
 * Migrations
This commit is contained in:
Spitzer Daniel
2024-04-23 17:09:36 +02:00
parent 1db1d583da
commit 6310e2446e
12 changed files with 613 additions and 375 deletions
+94 -36
View File
@@ -37,13 +37,16 @@ foreach ($pipworkeraddresses as $pipworkeraddress):
endforeach;
foreach ($networks as $network):
$Network[$network->id] = $network->name;
foreach ($fiberplanpipeendpoints as $fiberplanpipeEndpoint):
if ($fiberplanpipeEndpoint->pop_id) {
$networks[$fiberplanpipeEndpoint->pop->network->name] = $fiberplanpipeEndpoint->pop->network->name;
} else if ($fiberplanpipeEndpoint->building_id) {
$networks[$fiberplanpipeEndpoint->building->network->name] = $fiberplanpipeEndpoint->building->network->name;
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher_id) {
$networks[$fiberplanpipeEndpoint->fiberPlanDispatcher->network->name] = $fiberplanpipeEndpoint->fiberPlanDispatcher->network->name;
}
endforeach;
$allNetworks[$fiberplanpipes->startpoint_network_id] = $Network[$fiberplanpipes->startpoint_network_id];
$allNetworks[$fiberplanpipes->endpoint_network_id] = $Network[$fiberplanpipes->endpoint_network_id];
if ($fiberplanpipes->address_id) {
$responsible = $Pipeworkers[$fiberplanpipes->address_id];
} else {
@@ -286,7 +289,7 @@ if ($fiberplanpipes->type == "3") {
</tr>
<tr>
<th>Netzgebiet (e)</th>
<td><?= implode(', ', $allNetworks) ?> </td>
<td><?= implode(', ', $networks) ?> </td>
</tr>
<tr>
<th>Rohrtyp</th>
@@ -361,6 +364,11 @@ if ($fiberplanpipes->type == "3") {
$endpointtype = $fiberplanpipestypes[$endpoint->fiberPlanDispatcher->object_type];
$gps_lat = $endpoint->fiberPlanDispatcher->gps_lat;
$gps_long = $endpoint->fiberPlanDispatcher->gps_long;
} elseif ($endpoint->building_id) {
$endpointname = $endpoint->building->street;
$endpointtype = 'Building';
$gps_lat = $endpoint->building->gps_lat;
$gps_long = $endpoint->building->gps_long;
}
$coordinates = "";
if ($gps_lat) {
@@ -391,13 +399,12 @@ if ($fiberplanpipes->type == "3") {
</tr>
</thead>
<?php
if ($gps_lat) {
$markers[] = array(
"gps_lat" => $gps_lat,
"gps_long" => $gps_long,
"name" => $endpointname,
);
}
$markers[] = array(
"gps_lat" => $gps_lat,
"gps_long" => $gps_long,
"name" => $endpointname,
"type" => $endpointtype
);
?>
</table>
<?php
@@ -447,7 +454,29 @@ if ($fiberplanpipes->type == "3") {
</button>
</div>
<div class="modal-body">
<div id="map"></div>
<div class="row">
<div id="map"></div>
</div>
<div class="row justify-content-center">
<div class="col-lg-1"></div>
<div class="col-lg-9 "><h4>Legende:</h4></div>
</div>
<div class="row justify-content-center">
<div class="col-lg-1"></div>
<div class="col-lg-4"><img src="<?= self::getResourcePath() ?>img/markers/marker-pop.png ">
<label class="font-16"> ... Pop</label></div>
<div class="col-lg-4"><img src="<?= self::getResourcePath() ?>img/markers/marker-home.png ">
<label class="font-16"> ... Building</label></div>
</div>
<div class="row justify-content-center">
<div class="col-lg-1"></div>
<div class="col-lg-4 justify-content-center"><img
src="<?= self::getResourcePath() ?>img/markers/marker-dispatcher.png "> <label
class="font-16"> ... Schacht/Verteiler</label></div>
<div class="col-lg-4"><img
src="<?= self::getResourcePath() ?>img/markers/marker-greenfield.png "> <label
class="font-16"> ... Greenfield</label></div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
@@ -458,13 +487,15 @@ if ($fiberplanpipes->type == "3") {
<?php if ($markers) :
?>
<script type="text/javascript">
var marker;
var fitmap = 0;
var marker = [];
var polylinec;
var polyline;
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
L.tileLayer('https://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
maxZoom: 19,
id: "geolandbasemap",
imgtype: "png"
}).addTo(map);
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
$(document).ready(function () {
@@ -475,7 +506,7 @@ if ($fiberplanpipes->type == "3") {
foreach ($markers as $marker):
if ($counter > 0) echo ',';
?>
['<?= $marker['name'] ?>', <?= $marker['gps_lat'] ?>, <?= $marker['gps_long'] ?>]
['<?= $marker['name'] ?>', <?= $marker['gps_lat'] ?>, <?= $marker['gps_long'] ?>, '<?= $marker['type'] ?>']
<?php
$lat = $lat + $marker['gps_lat'];
$long = $long + $marker['gps_long'];
@@ -486,43 +517,70 @@ if ($fiberplanpipes->type == "3") {
?>
];
console.log(locations);
var startlat = <?=$lat ?>;
var startlong = <?=$long ?>;
console.log('<?=$lat . " " . $long ?>')
$('#pipemap').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
map.remove();
map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
L.tileLayer('https://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
maxZoom: 19,
id: "geolandbasemap",
imgtype: "png"
}).addTo(map);
var icon_name = "town";
var icon_color = "#ec98a2";
var icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
var oldlat;
var oldlong;
map.setView([startlat, startlong], 14)
for (var i = 0; i < locations.length; i++) {
marker = new L.marker([locations[i][1], locations[i][2]]).addTo(map)
.bindPopup(locations[i][0]);
if (oldlong) {
polylinec = [
[oldlat, oldlong],
[locations[i][1], locations[i][2]]
];
polyline = L.polyline(polylinec, {color: 'red'}).addTo(map);
polyline = null;
console.log(polylinec);
for (var i = 0; i < locations.length; i++) {
if (locations[i][1]) {
if (locations[i][3] == "Greenfield") {
icon_name = "garden";
icon_color = "#abbaf0";
} else if (locations[i][3] == "Pop") {
icon_name = "village";
icon_color = "#acf0ab";
} else if (locations[i][3] == "Building") {
icon_name = "home";
icon_color = "#f0abab";
} else {
icon_name = "home";
icon_color = "#e9f0ab";
}
icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
marker.push(L.marker([locations[i][1], locations[i][2]], {icon: icon}).addTo(map).bindPopup(locations[i][0]));
if (oldlong) {
polylinec = [
[oldlat, oldlong],
[locations[i][1], locations[i][2]]
];
polyline = L.polyline(polylinec, {color: 'red'}).addTo(map);
polyline = null;
}
oldlong = locations[i][2];
oldlat = locations[i][1];
} else {
oldlong = null;
oldlat = null;
}
oldlong = locations[i][2];
oldlat = locations[i][1];
}
if (locations.length > 1) {
fitmap = 1;
}
});
$('#pipemap').on('shown.bs.modal', function (event) {
map.invalidateSize();
var group = new L.featureGroup(marker);
map.fitBounds(group.getBounds());
});
});
</script>
+368 -223
View File
@@ -20,6 +20,11 @@
</div>
</div>
<style>
#map {
height: 570px;
width: 100%;
}
.fa-circle-plus {
color: #00b125;
cursor: pointer;
@@ -35,6 +40,7 @@
margin-left: 7px;
}
.fa-up {
color: #0d6efd;
font-size: 17px;
@@ -42,6 +48,14 @@
float: right;
margin-left: 10px;
}
.fa-down {
color: #0d6efd;
font-size: 17px;
cursor: pointer;
float: right;
margin-left: 10px;
}
</style>
<?php
if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
@@ -60,184 +74,248 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
<form class="form-horizontal" method="post"
action="<?= self::getUrl("FiberPlanPipe", "save", ["returnto" => $_GET["returnto"]]) ?>">
<div class="card">
<div class="card ">
<div class="card-body">
<input type="hidden" name="id" value="<?= $fiberplanpipes->id ?>"/>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="description">Bezeichnung * / Gis
Id</label>
<div class="col-lg-2">
<input required="required" type="text" id="description" name="description"
class="form-control"
value="<?= $fiberplanpipes->description ?>"/>
</div>
<div class="col-lg-1">
<input type="text" id="gisid" name="gisid" placeholder="Gis Id"
class="form-control"
value="<?= $fiberplanpipes->gisid ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="type">Type *</label>
<div class="col-lg-3">
<select required="required" id="type" name="type" class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->type == "1") ? "selected='selected'" : "" ?>>
Einzel
</option>
<option value="2" <?= ($fiberplanpipes->type == "2") ? "selected='selected'" : "" ?>>
Schutzrohr
</option>
<option value="3" <?= ($fiberplanpipes->type == "3") ? "selected='selected'" : "" ?>>
Verband
</option>
</select>
</div>
</div>
<div class="form-group row" id="dimesion-div"
style="<?= ($fiberplanpipes->type == "3") ? "display:none" : "" ?>">
<label class="col-lg-2 col-form-label" for="type_description">Dimension *</label>
<div class="col-lg-3">
<select required="required" <?= ($fiberplanpipes->type == "3") ? 'disabled="disabled"' : "" ?>
id="type_description" name="type_description"
class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->type_description == "1") ? "selected='selected'" : "" ?>>
MR7
</option>
<option value="2" <?= ($fiberplanpipes->type_description == "2") ? "selected='selected'" : "" ?>>
MR14
</option>
<option value="3" <?= ($fiberplanpipes->type_description == "3") ? "selected='selected'" : "" ?>>
MR16
</option>
<option value="4" <?= ($fiberplanpipes->type_description == "4") ? "selected='selected'" : "" ?>>
MR20
</option>
<option value="5" <?= ($fiberplanpipes->type_description == "5") ? "selected='selected'" : "" ?>>
PE32
</option>
<option value="6" <?= ($fiberplanpipes->type_description == "6") ? "selected='selected'" : "" ?>>
PE40
</option>
<option value="7" <?= ($fiberplanpipes->type_description == "7") ? "selected='selected'" : "" ?>>
PE50
</option>
<option value="8" <?= ($fiberplanpipes->type_description == "8") ? "selected='selected'" : "" ?>>
KSR50
</option>
<option value="9" <?= ($fiberplanpipes->type_description == "9") ? "selected='selected'" : "" ?>>
KSR80
</option>
<option value="10" <?= ($fiberplanpipes->type_description == "10") ? "selected='selected'" : "" ?>>
KSR100
</option>
</select>
</div>
</div>
<div class="form-group row" id="dimension-bundle-div"
style="<?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? "display:none" : "" ?>">
<label class="col-lg-2 col-form-label" for="fiberplanpipetemplate_id">Multirohr
*</label>
<div class="col-lg-3">
<select <?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? 'disabled="disabled"' : "" ?>
required="required" id="fiberplanpipetemplate_id"
name="fiberplanpipetemplate_id"
class="select2 form-control">
<option value=""></option>
<?php foreach ($fiberplanpipetemplates as $fiberplanpipetemplate) :
$name = "";
if ($fiberplanpipetemplate->pipe7x4 && $fiberplanpipetemplate->pipe14x10) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipetemplate->pipe14x10 . "*14x10";
} else if ($fiberplanpipetemplate->pipe7x4) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4";
} else if ($fiberplanpipetemplate->pipe14x10) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe14x10 . "*14x10";
}
<div class="row">
<div class="col col-lg-8">
<input type="hidden" name="id" value="<?= $fiberplanpipes->id ?>"/>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="description">Bezeichnung * / Gis
Id</label>
<div class="col-lg-3">
<input required="required" type="text" id="description"
name="description"
class="form-control"
value="<?= $fiberplanpipes->description ?>"/>
</div>
<div class="col-lg-2">
<input type="text" id="gisid" name="gisid" placeholder="Gis Id"
class="form-control"
value="<?= $fiberplanpipes->gisid ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="type">Type *</label>
<div class="col-lg-3">
<select required="required" id="type" name="type"
class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->type == "1") ? "selected='selected'" : "" ?>>
Einzel
</option>
<option value="2" <?= ($fiberplanpipes->type == "2") ? "selected='selected'" : "" ?>>
Schutzrohr
</option>
<option value="3" <?= ($fiberplanpipes->type == "3") ? "selected='selected'" : "" ?>>
Verband
</option>
</select>
</div>
</div>
<div class="form-group row" id="dimesion-div"
style="<?= ($fiberplanpipes->type == "3") ? "display:none" : "" ?>">
<label class="col-lg-2 col-form-label" for="type_description">Dimension
*</label>
<div class="col-lg-3">
<select required="required" <?= ($fiberplanpipes->type == "3") ? 'disabled="disabled"' : "" ?>
id="type_description" name="type_description"
class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->type_description == "1") ? "selected='selected'" : "" ?>>
MR7
</option>
<option value="2" <?= ($fiberplanpipes->type_description == "2") ? "selected='selected'" : "" ?>>
MR14
</option>
<option value="3" <?= ($fiberplanpipes->type_description == "3") ? "selected='selected'" : "" ?>>
MR16
</option>
<option value="4" <?= ($fiberplanpipes->type_description == "4") ? "selected='selected'" : "" ?>>
MR20
</option>
<option value="5" <?= ($fiberplanpipes->type_description == "5") ? "selected='selected'" : "" ?>>
PE32
</option>
<option value="6" <?= ($fiberplanpipes->type_description == "6") ? "selected='selected'" : "" ?>>
PE40
</option>
<option value="7" <?= ($fiberplanpipes->type_description == "7") ? "selected='selected'" : "" ?>>
PE50
</option>
<option value="8" <?= ($fiberplanpipes->type_description == "8") ? "selected='selected'" : "" ?>>
KSR50
</option>
<option value="9" <?= ($fiberplanpipes->type_description == "9") ? "selected='selected'" : "" ?>>
KSR80
</option>
<option value="10" <?= ($fiberplanpipes->type_description == "10") ? "selected='selected'" : "" ?>>
KSR100
</option>
</select>
</div>
</div>
<div class="form-group row" id="dimension-bundle-div"
style="<?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? "display:none" : "" ?>">
<label class="col-lg-2 col-form-label" for="fiberplanpipetemplate_id">Multirohr
*</label>
<div class="col-lg-3">
<select <?= ($fiberplanpipes->type < "3" || !$fiberplanpipes->type) ? 'disabled="disabled"' : "" ?>
required="required" id="fiberplanpipetemplate_id"
name="fiberplanpipetemplate_id"
class="select2 form-control">
<option value=""></option>
<?php foreach ($fiberplanpipetemplates as $fiberplanpipetemplate) :
$name = "";
if ($fiberplanpipetemplate->pipe7x4 && $fiberplanpipetemplate->pipe14x10) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4" . "/" . $fiberplanpipetemplate->pipe14x10 . "*14x10";
} else if ($fiberplanpipetemplate->pipe7x4) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe7x4 . "*7x4";
} else if ($fiberplanpipetemplate->pipe14x10) {
$name = $fiberplanpipetemplate->name . " " . $fiberplanpipetemplate->pipe14x10 . "*14x10";
}
?>
<option <?= ($fiberplanpipetemplate->id == $fiberplanpipes->fiberPlanPipeTemplate_id) ? "selected='selected'" : "" ?>
value="<?= $fiberplanpipetemplate->id ?>"><?= $name ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="length">Länge (m) *</label>
<div class="col-lg-2">
<input required="required" type="number" step="any" id="length"
name="length"
class="form-control"
value="<?= $fiberplanpipes->length ?>"/>
</div>
</div>
<div id="endpoints">
<?php if ($fiberplanpipeendpoints) :
FiberPlanPipeModel::generateEndpoints($fiberplanpipeendpoints, $networks);
else :
$randid = rand(1000, 10000);
$typeArray[1] = 'Greenfield';
$typeArray[2] = 'POP';
$typeArray[3] = 'Building';
$typeArray[4] = 'Schacht-Verteiler';
?>
<option <?= ($fiberplanpipetemplate->id == $fiberplanpipes->fiberPlanPipeTemplate_id) ? "selected='selected'" : "" ?>
value="<?= $fiberplanpipetemplate->id ?>"><?= $name ?></option>
<div class="form-group row endpoint-maindiv">
<label class="col-lg-2 col-form-label endpoint-label"
for="startpoint_network_id"><span
class="label-text">Startpunkt * </span><span
class="endpointsymbol"><i id="add-endpoint"
class="fa-regular fa-circle-plus"></i></span></label>
<div class="col-lg-3">
<select id="<?= $randid ?>_endpoint_network_id"
required="required"
name="endpoint_network_id[]"
class="select2 form-control endpoint_network_id ">
<option value=""></option>
<?php foreach ($networks as $network): ?>
<option value="<?= $network->id ?>"><?= $network->name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-lg-2">
<select id="<?= $randid ?>_endpoint_type" required="required"
name="endpoint_type[]"
class="select2 form-control endpoint_type">
<option value=""></option>
<?php foreach ($typeArray as $key => $type) : ?>
<option value="<?= $key ?>"><?= $type ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-lg-2" id="<?= $randid ?>_end-point-building">
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="length">Länge (m) *</label>
<div class="col-lg-1">
<input required="required" type="number" step="any" id="length" name="length"
class="form-control"
value="<?= $fiberplanpipes->length ?>"/>
</div>
</div>
<div id="endpoints">
<?php if ($fiberplanpipeendpoints) :
FiberPlanPipeModel::generateEndpoints($fiberplanpipeendpoints, $networks);
endif;
?>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="status">Status *</label>
<div class="col-lg-2">
<select id="status" name="status" class="select2 form-control"
required="required">
<option value=""></option>
<option value="10" <?= ($fiberplanpipes->status == "10") ? "selected='selected'" : "" ?>>
Geplant
</option>
<option value="20" <?= ($fiberplanpipes->status == "20") ? "selected='selected'" : "" ?>>
Umsetzung
</option>
<option value="30" <?= ($fiberplanpipes->status == "30") ? "selected='selected'" : "" ?>>
Fertiggestellt
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="responsible">Zuständig</label>
<div class="col-lg-2">
<select id="responsible" name="responsible" class="select2 form-control">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->responsible == "1") ? "selected='selected'" : "" ?>>
Tiefbaufirma
</option>
<option value="2" <?= ($fiberplanpipes->responsible == "2") ? "selected='selected'" : "" ?>>
Person
</option>
</select>
</div>
<div id="responsible-div" class="col-lg-3"
style="<?= ($fiberplanpipes->responsible != "1") ? "display:none" : "" ?>">
<select id="address_id" name="address_id"
class="select2 form-control" <?= ($fiberplanpipes->responsible != "1") ? 'disabled="disabled"' : "" ?> >
<option value=""></option>
<?php foreach ($pipworkeraddresses as $pipworkeraddress): ?>
<option value="<?= $pipworkeraddress->id ?>" <?= ($fiberplanpipes->address_id == $pipworkeraddress->id) ? "selected='selected'" : "" ?>><?= $pipworkeraddress->company ?></option>
<?php endforeach; ?>
</select>
</div>
<div id="responsible_text-div" class="col-lg-3">
<input id="responsible_text" name="responsible_text"
value="<?= $fiberplanpipes->responsible_text ?>"
placeholder="Ansprechsperson"
class="form-control"/>
</div>
</div>
<?php
endif;
?>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="status">Status *</label>
<div class="col-lg-2">
<select id="status" name="status" class="select2 form-control"
required="required">
<option value=""></option>
<option value="10" <?= ($fiberplanpipes->status == "10") ? "selected='selected'" : "" ?>>
Geplant
</option>
<option value="20" <?= ($fiberplanpipes->status == "20") ? "selected='selected'" : "" ?>>
Umsetzung
</option>
<option value="30" <?= ($fiberplanpipes->status == "30") ? "selected='selected'" : "" ?>>
Fertiggestellt
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="responsible">Zuständig *</label>
<div class="col-lg-2">
<select id="responsible" name="responsible" class="select2 form-control"
required="required">
<option value=""></option>
<option value="1" <?= ($fiberplanpipes->responsible == "1") ? "selected='selected'" : "" ?>>
Tiefbaufirma
</option>
<option value="2" <?= ($fiberplanpipes->responsible == "2") ? "selected='selected'" : "" ?>>
Person
</option>
</select>
</div>
<div id="responsible-div" class="col-lg-3"
style="<?= ($fiberplanpipes->responsible != "1") ? "display:none" : "" ?>">
<select id="address_id" name="address_id"
class="select2 form-control" <?= ($fiberplanpipes->responsible != "1") ? 'disabled="disabled"' : "" ?> >
<option value=""></option>
<?php foreach ($pipworkeraddresses as $pipworkeraddress): ?>
<option value="<?= $pipworkeraddress->id ?>" <?= ($fiberplanpipes->address_id == $pipworkeraddress->id) ? "selected='selected'" : "" ?>><?= $pipworkeraddress->company ?></option>
<?php endforeach; ?>
</select>
</div>
<div id="responsible_text-div" class="col-lg-3">
<input id="responsible_text" name="responsible_text"
value="<?= $fiberplanpipes->responsible_text ?>"
placeholder="Ansprechsperson"
class="form-control"/>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="comment">Kommentar</label>
<div class="col-lg-3">
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="comment">Kommentar</label>
<div class="col-lg-3">
<textarea id="comment" name="comment"
class="form-control"><?= $fiberplanpipes->comment ?></textarea>
</div>
</div>
</div>
<div class="col col-lg-4 align-self-center">
<div class="row">
<div id="map"></div>
</div>
<div class="row">
<div class="col-lg-6"><h4>Legende:</h4></div>
</div>
<div class="row justify-content-center">
<div class="col-lg-5"><img src="<?= self::getResourcePath() ?>img/markers/marker-pop.png "> <label class="font-16"> ... Pop</label></div>
<div class="col-lg-5"><img src="<?= self::getResourcePath() ?>img/markers/marker-home.png "> <label class="font-16"> ... Building</label></div>
</div>
<div class="row justify-content-center">
<div class="col-lg-5 justify-content-center"><img src="<?= self::getResourcePath() ?>img/markers/marker-dispatcher.png "> <label class="font-16"> ... Schacht/Verteiler</label></div>
<div class="col-lg-5"><img src="<?= self::getResourcePath() ?>img/markers/marker-greenfield.png "> <label class="font-16"> ... Greenfield</label></div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row">
@@ -250,7 +328,6 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
</div>
</div>
</form>
</div>
</div>
@@ -259,13 +336,26 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
</div>
<script type="text/javascript">
var marker = [];
var polylinec;
var polyline = [];
var fitmap = 0;
var map = L.map('map').setView([47.00525090986838, 15.761075762335581], 13);
L.tileLayer('https://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
maxZoom: 19,
id: "geolandbasemap",
imgtype: "png"
}).addTo(map);
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
function checkendpoints() {
let endpointcounter = $('.endpoint-label').length;
let endpointtext;
$('.endpoint-label').each(function (index) {
$(this).find('.move-endpoint-up').remove();
$(this).find('.move-endpoint-down').remove();
if (index == 0) {
endpointtext = "Startpunkt";
$(this).find('.endpointsymbol').html('<i id="add-endpoint" class="fa-regular fa-circle-plus"></i>');
@@ -273,9 +363,13 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
endpointtext = 'Standort ' + index;
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('');
} else if (endpointcounter - 1 == index) {
endpointtext = 'Standort ' + index;
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i style="margin-right:22px;" title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('<i class="fa-regular fa-circle-minus remove-endpoint"></i>');
} else if (index > 0) {
endpointtext = 'Standort ' + index;
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).closest('.endpoint-maindiv').find('.label-text').after('<i title="nach unten verschieben" class="fa-sharp fa-solid fa-down move-endpoint-down"></i><i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('<i class="fa-regular fa-circle-minus remove-endpoint"></i>');
}
@@ -288,33 +382,44 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
const splitid = $(this).attr('id').split('_');
let thisid = splitid[0];
var options;
var options = "";
if ($.trim($("#" + thisid + "_endpoint_network_id").val()) != "" && $.trim($("#" + thisid + "_endpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#" + thisid + "_endpoint_network_id").val()) + "&bdtype=" + $.trim($("#" + thisid + "_endpoint_type").val()), {})
.done(function (data) {
$.each(data, function (k, val) {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
options = options + '<option data-gpslat="' + val.gps_lat + '" data-gpslong="' + val.gps_long + '" value="' + val.id + '">' + val.name + '</option>';
});
$("#" + thisid + "_mid-point-building").empty();
$("#" + thisid + "_mid-point-building").append('<select id=' + thisid + '_endpoint" required="required" name="endpoint[]" class="select2 form-control">' + options + '</select>');
$("#" + thisid + "_end-point-building").empty();
$("#" + thisid + "_end-point-building").append('<select id="' + thisid + '_endpoint" required="required" name="endpoint[]" class="select2 form-control endpoint_endpoint">' + options + '</select>');
$(".select2").select2({placeholder: ""});
addMarkers();
});
}
});
$("body").on("change", ".endpoint_endpoint", function () {
addMarkers();
});
$("body").on("click", ".move-endpoint-up", function () {
$(this).closest('.endpoint-maindiv').insertBefore($(this).closest('.endpoint-maindiv').prev());
checkendpoints();
addMarkers();
});
$("body").on("click", ".move-endpoint-down", function () {
$(this).closest('.endpoint-maindiv').insertAfter($(this).closest('.endpoint-maindiv').next());
checkendpoints();
addMarkers();
});
$("body").on("click", ".remove-endpoint", function () {
let endpointcounter;
$(this).closest('.endpoint-maindiv').remove();
checkendpoints();
addMarkers();
});
@@ -390,79 +495,119 @@ if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplanpipe-detail") {
$(this).off('wheel.disableScroll')
});
function addMarkers() {
removeMarkers();
removePolyline();
var oldlat;
var oldlong;
var gpsconter=0;
$.each($('.endpoint_endpoint'), function (index, value) {
if ($(this).find('option:selected').data('gpslat')) {
var lat = $(this).find('option:selected').data('gpslat');
var lng = $(this).find('option:selected').data('gpslong');
var name = $(this).find('option:selected').text();
var color = "#acf0ab";
var mapicon = "home";
var endpointtype = $(this).closest('.endpoint-maindiv').find('.endpoint_type ').val();
if (endpointtype == 1) {
color = "#abbaf0";
mapicon = "garden";
} else if (endpointtype == 2) {
color = "#acf0ab";
mapicon = "village";
} else if (endpointtype == 3) {
color = "#f0abab";
mapicon = "home";
} else if (endpointtype == 4) {
color = "#e9f0ab";
mapicon = "home";
}
var icon = L.MakiMarkers.icon({
icon: mapicon,
color: color,
size: "l"
});
var markerid = marker.length;
$(this).data('markerid', markerid);
marker.push(L.marker([lat, lng], {icon: icon}).addTo(map));
if (index == 0 && fitmap == 0) {
map.setView([lat, lng]);
}
fitmap = 1;
if (oldlong) {
polylinec = [
[oldlat, oldlong],
[$(this).find('option:selected').data('gpslat'), $(this).find('option:selected').data('gpslong')]
];
polyline.push(L.polyline(polylinec, {color: '#f00'}).addTo(map));
// polyline.bindTooltip(locations[i][4], {permanent: true});
}
oldlat = $(this).find('option:selected').data('gpslat');
oldlong = $(this).find('option:selected').data('gpslong');
gpsconter++;
} else {
oldlat = "";
oldlong = "";
}
});
if (gpsconter > 1) {
var group = new L.featureGroup(marker);
map.fitBounds(group.getBounds());
}
}
function removeMarkers() {
$.each(marker, function (index, value) {
map.removeLayer(value);
});
marker.splice(0, marker.length);
}
function removePolyline() {
$.each(polyline, function (index, value) {
map.removeLayer(value);
});
polyline.splice(0, polyline.length);
}
$(document).ready(function () {
// map.invalidateSize();
addMarkers();
$(".select2").select2({placeholder: ""});
if ($.trim($("#network_id").val()) != "" && $.trim($("#startpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id").val()) + "&bdtype=" + $.trim($("#startpoint_type").val()), {})
.done(function (data) {
var options;
$.each(data, function (k, val) {
if ($('#startpoint_type').data('startpoint') == val.id) {
options = options + '<option selected="selected" value="' + val.id + '">' + val.name + '</option>';
} else {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
}
});
$('#starting-point-building').empty();
$('#starting-point-building').append('<select id="startpoint" name="startpoint" required="required" class="select2 form-control">' + options + '</select>');
$(".select2").select2({placeholder: ""});
});
}
if ($.trim($("#network_id2").val()) != "" && $.trim($("#entpoint_type").val())) {
$.getJSON("<?= self::getUrl("FiberPlanPipe", "api", ['do' => 'getBuildingInfo']) ?>&network_id=" + $.trim($("#network_id2").val()) + "&bdtype=" + $.trim($("#entpoint_type").val()), {})
.done(function (data) {
var options;
$.each(data, function (k, val) {
if ($('#entpoint_type').data('endpoint') == val.id) {
options = options + '<option selected="selected" value="' + val.id + '">' + val.name + '</option>';
} else {
options = options + '<option value="' + val.id + '">' + val.name + '</option>';
}
});
$('#end-point-building').empty();
$('#end-point-building').append('<select id="endpoint" name="endpoint" required="required" class="select2 form-control">' + options + '</select>');
$(".select2").select2({placeholder: ""});
});
}
$("body").on("click", "#add-endpoint", function (event) {
let randid = Math.floor(Math.random() * 10000);
let endpointtype = $('#startpoint_type').html();
let endpointcounter = $('.endpoint-maindiv').length + 1;
let endpointuparrow = "";
let standorttext = "";
if (endpointcounter > 1) {
endpointuparrow = '<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>';
}
if (endpointcounter <= 7) {
$('#endpoints').append(`<div class="form-group row endpoint-maindiv">
<label class="col-lg-2 col-form-label endpoint-label" for="` + randid + `_endpoint_network_id"><span class="label-text">Standort ` + $('.endpoint-maindiv').length + ` * </span>` + endpointuparrow + `<span class="endpointsymbol"><i class="fa-regular fa-circle-minus remove-endpoint"></i></span></label>
<div class="col-lg-2"><select id="` + randid + `_endpoint_network_id" required="required" name="endpoint_network_id[]"
class="select2 form-control endpoint_network_id">` + $('#network_id').html() + `</select></div>
<div class="col-lg-3"><select id="` + randid + `_endpoint_network_id" required="required" name="endpoint_network_id[]"
class="select2 form-control endpoint_network_id">` + $('#endpoints').find('.endpoint_network_id').eq(endpointcounter - 2).html() + `</select></div>
<div class="col-lg-2 ">
<select id="` + randid + `_endpoint_type" name="endpoint_type[]" required="required"
class="select2 form-control endpoint_type" data-startpoint="" : "" >
<option value=""></option>
<option value="4">
Schacht-Verteiler
</option>
` + $('#endpoints').find('.endpoint_type').html() + `
</select>
</div>
<div class="col-lg-2" id="` + randid + `_mid-point-building">
<div class="col-lg-3" id="` + randid + `_end-point-building">
</div>
</div>`);
$('#' + randid + '_endpoint_network_id').val($('#network_id').val());
$('#' + randid + '_endpoint_network_id').val($('#endpoints').find('.endpoint_network_id').eq(endpointcounter - 2).val());
$('#' + randid + '_endpoint_type').val('');
checkendpoints();
$(".select2").select2({placeholder: ""});
}
});
});
</script>
+29 -69
View File
@@ -1,6 +1,3 @@
<?php
$typeOption[1] = "Einzel";
$typeOption[2] = "Schutzrohr";
@@ -107,7 +104,28 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
</thead>
<tbody>
<?php foreach ($fiberplanpipes as $fiberplanpipe):
unset($networks);
unset($endpoints);
foreach ($fiberplanpipeEndpoints[$fiberplanpipe->id] as $fiberplanpipeEndpoint) {
if ($fiberplanpipeEndpoint->pop_id) {
$networks[$fiberplanpipeEndpoint->pop->network->name] = $fiberplanpipeEndpoint->pop->network->name;
$endpoints[] = '<span title="POP">(P) </span>' . $fiberplanpipeEndpoint->pop->name;
} else if ($fiberplanpipeEndpoint->building_id) {
$networks[$fiberplanpipeEndpoint->building->network->name] = $fiberplanpipeEndpoint->building->network->name;
$endpoints[] = '<span title="Building">(B) </span>' . $fiberplanpipeEndpoint->building->street . " " . $fiberplanpipeEndpoint->building->number;
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher_id) {
$networks[$fiberplanpipeEndpoint->fiberPlanDispatcher->network->name] = $fiberplanpipeEndpoint->fiberPlanDispatcher->network->name;
if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "1") {
$endpoints[] = '<span title="Verteiler">(V) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
} elseif ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "2") {
$endpoints[] = '<span title="Schacht">(S) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "3") {
$endpoints[] = '<span title="Greenfield">(G) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
} else if ($fiberplanpipeEndpoint->fiberPlanDispatcher->object_type == "4") {
$endpoints[] = '<span title="Abzweigepunkt">(A) </span>' . $fiberplanpipeEndpoint->fiberPlanDispatcher->description;
}
}
}
if ($fiberplanpipe->type == "3") {
$name = "";
@@ -143,13 +161,15 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
}
?>
<tr>
<td><a href="<?= self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipe->id]) ?>"><?= $fiberplanpipe->description ?></a></td>
<td>
<a href="<?= self::getUrl("FiberPlanPipe", "Detail", ["id" => $fiberplanpipe->id]) ?>"><?= $fiberplanpipe->description ?></a>
</td>
<td style="white-space: nowrap"><?= $typeOption[$fiberplanpipe->type] . " / " . $typeDescription ?></td>
<td class="text-center"><?= $fiberplanpipe->length ?></td>
<td><?= $networkName ?></td>
<td><?= $startpoint ?></td>
<td><?= $endpoint ?></td>
<td><?= implode(',', $networks) ?></td>
<td><?= $endpoints[0] ?></td>
<td><?= $endpoints[count($endpoints) - 1] ?></td>
<td><?= $responsible ?></td>
<td><?= $statusOption[$fiberplanpipe->status] ?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
@@ -164,9 +184,6 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
<?php endforeach; ?>
</tbody>
</table>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#pipemap">
Launch demo modal
</button>
</div>
</div>
@@ -193,64 +210,7 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
</div>
</div>
</div>
<script type="text/javascript">
var startlat;
var startlong;
var endlat;
var endlong;
var startmarkertext;
var endmarkertext;
var marker;
var polylinec;
var polyline;
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
}).addTo(map);
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
var hidesearch = [2, 8];
var columnfilter = [7];
var columnoptions = '<option class="text-left" value="">Alle</option><option class="text-left" value="Geplant">Geplant</option><option class="text-left" value="Umsetzung">Umsetzung</option><option class="text-left" value="Fertiggestellt">Fertiggestellt</option>';
$(document).ready(function () {
$('#pipemap').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
map.remove();
map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19
}).addTo(map);
startlat = button.closest('tr').find('.startpoint').data('gpslat');
startlong = button.closest('tr').find('.startpoint').data('gpslong');
endlat = button.closest('tr').find('.endpoint').data('gpslat');
endlong = button.closest('tr').find('.endpoint').data('gpslong');
startmarkertext = button.closest('tr').find('.startpoint').text();
endmarkertext = button.closest('tr').find('.endpoint').text();
var icon_name = "town";
var icon_color = "#ec98a2";
var icon = L.MakiMarkers.icon({icon: icon_name, color: icon_color, size: "l"});
marker = L.marker([startlat, startlong]).addTo(map);
marker.bindPopup("" + startmarkertext);
map.setView([button.data('gpslat'), button.data('gpslong')], 13)
marker = L.marker([endlat, endlong]).addTo(map);
// marker = L.marker([endlat, endlong], {icon: icon}).addTo(map);
marker.bindPopup("" + endmarkertext);
polylinec = [
[startlat, startlong],
[endlat, endlong]
];
polyline = L.polyline(polylinec, {color: 'red'}).addTo(map);
});
$('#pipemap').on('shown.bs.modal', function (event) {
map.invalidateSize();
});
});
</script>
<script type="text/javascript"></script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>