Faserplanung Vorbereitung für Kabelverschaltung

* Menüpunkt Kabelverschaltung hinzugefügt
 * Initialfiles für Kabelverschaltung
This commit is contained in:
Daniel Spitzer
2024-06-30 12:01:56 +02:00
parent dc94204b9c
commit 1554d6cf72
21 changed files with 4261 additions and 9 deletions

View File

@@ -0,0 +1,805 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<?php
$markers = [];
$fibers[1]['name'] = "1x4";
$fibers[1]['fibers'] = "4";
$fibers[2]['name'] = "1x12";
$fibers[2]['fibers'] = "12";
$fibers[3]['name'] = "1x24";
$fibers[3]['fibers'] = "24";
$fibers[4]['name'] = "2x12";
$fibers[4]['fibers'] = "24";
$fibers[5]['name'] = "4x12";
$fibers[5]['fibers'] = "48";
$fibers[6]['name'] = "8x12";
$fibers[6]['fibers'] = "96";
$fibers[7]['name'] = "6x24";
$fibers[7]['fibers'] = "144";
$fibers[8]['name'] = "12x12";
$fibers[8]['fibers'] = "144";
$fibers[9]['name'] = "8x24";
$fibers[9]['fibers'] = "192";
$fibers[10]['name'] = "12x24";
$fibers[10]['fibers'] = "288";
$state[10] = 'Geplant';
$state[20] = 'Umsetzung';
$state[30] = 'Fertiggestellt';
foreach ($lineworkeraddresses as $lineworkeraddress):
$Lineworker[$lineworkeraddress->id] = $lineworkeraddress->company;
endforeach;
if ($fiberplancables->address_id) {
$responsible = $Lineworker[$fiberplancables->address_id];
} else {
$responsible = "Person";
}
?>
<style>
#map {
height: 600px;
width: 100%;
}
.card-border {
border-left: 1px solid #428bca;
border-left-width: 5px;
border-radius: 3px;
}
.fiber-rack-div {
margin-top: 5px;
margin-bottom: 5px;
}
.fiber-color {
color: #0d6efd;
float: right;
margin-left: 5px;
}
.fiber-module-div {
padding-left: 5px;
padding-right: 5px;
margin-left: 5px;
margin-right: 5px;
margin-bottom: 5px;
border: 1px solid #e3e3e3;
}
.sp-border-rl {
padding-left: 5px;
padding-right: 5px;
}
.sp-table-border {
border: 1px solid #bfbfbf;
border-radius: 10px;
display: inline;
}
.sp-table-border > tbody {
padding: 10px;
}
.sp-table-border > thead td {
padding: 10px 0px 0px 0px;
font-weight: bold;
text-align: center;
font-size: 20px;
}
.sp-port-lines {
width: 50px;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
}
#olt-splitter td {
height: 30px;
width: 150px;
border: 1px solid #bfbfbf;
margin-top: 15px;
display: block;
border-radius: 5px;
}
#olt-splitter-table thead {
padding: 10px 0px 0px 0px;
font-weight: bold;
font-size: 20px;
}
#olt-splitter-table thead td {
padding-top: 12px;
text-align: center;
}
.sp-splitter-count {
padding: 3px 10px 3px 10px;
width: 50px;
}
.sp-splitter-count-left {
padding: 3px 0px 3px 10px;
width: 50px;
}
.sp-splitter-count-right {
padding: 3px 10px 3px 0px;
width: 50px;
text-align: right;
}
.sp-splitter-count-edit {
-ms-user-select: None;
-moz-user-select: None;
-webkit-user-select: None;
user-select: None;
cursor: pointer;
}
.sp-splitter-count-show {
width: 46px;
display: inline-block;
text-align: center;
cursor: pointer;
text-decoration: underline;
padding-top: 2px;
-ms-user-select: None;
-moz-user-select: None;
-webkit-user-select: None;
user-select: None;
}
.sp-white-border {
border-color: #fff !important;
}
.sp-ont-text {
padding: 0px 5px 0px 5px;
}
.fa-circle-check {
color: #07ad2b;
}
.fa-circle-xmark {
color: #ff0000;
}
.fa-rotate-right {
color: #0d6efd;
cursor: pointer;
}
.ont-refresh-span, .ontdetail-refresh-span {
display: inline-block;
width: 20px;
margin-right: 50px;
min-height: 1px;
color: #0d6efd;
}
.text-decoration-underline {
text-decoration: underline;
cursor: pointer;
}
.condensed-ont th {
padding: 6px 0.85rem 6px 0.85rem !important;
}
.condensed-ont td {
padding: 6px 0.85rem 6px 0.85rem !important;
}
.inner-table td {
border: none !important;
padding: 5px 5px 5px 0px !important;
}
.inner-table th {
border: none !important;
padding: 5px 10px 5px 0px !important;
}
.pipe-striped {
height: 100%;
background-color: #000;
width: 35%;
margin-left: auto;
margin-right: auto;
}
.overflowme {
overflow-x: auto;
white-space: nowrap;
margin-bottom: 20px;
}
</style>
<?php
function generateendpointbody($destinations, $destinationinfo, $oldsummcounter = 0)
{
$plug[1] = "LC/APC";
$plug[2] = "SC/APC";
$plug[3] = "E2000/APC";
$oldrack = "";
$counter = 1;
$startport = 0;
$endport = 0;
$sumcounter = 0;
$pop_id = $destinations['pop_id'];
$body = "";
foreach ($destinations as $destination) {
$endport = $sumcounter + $destination->endport - $destination->startport + 1;
$startport = $sumcounter + 1;
if ($destinationinfo == "pop"):
if ($oldrack != $destination->poprack_id) {
if ($counter != 1) {
echo '</tbody>';
}
$body .= ' <tbody class="font-13" style="border-top: 1px solid #000;margin-top:5px;">
<tr>
<td class="pl-2 pr-2 font-weight-bold" colspan="3">
<div class="fiber-rack-div">' . $destination->poprack->name . '</div>
</td>
</tr>';
}
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">HE(' . $destination->poprackmodule->start_he . ') ' . $destination->poprackmodule->name . ' (' . $destination->startport . '-' . $destination->endport . ') ' . $plug[$destination->poprackmodule->plug] . ' <span class="fiber-color">(' . $startport . '-' . $endport . ')</span>
</div>
</td>
</tr>';
$counter++;
$oldrack = $destination->poprack_id;
$sumcounter = $sumcounter + $destination->endport - $destination->startport + 1;
endif;
if ($destinationinfo == "building"):
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">' . $destination->fiberPlanDispatchersleeve->name . ' <span class="fiber-color">(' . $destination->startport . '-' . $destination->endport . ')</span>
</div>
</td>
</tr>';
$sumcounter = $sumcounter + $destination->endport - $destination->startport + 1;
endif;
if ($destinationinfo == "sleeve"):
if ($destination->dropout) {
$body .= '<tr>
<th colspan="3"
class="text-center font-15">
<div class="pt-2 pl-2 pr-2">Dropout</div>
</th>
</tr>';
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">' . $destination->fiberPlanDispatchersleeve->name . ' <span class="fiber-color">(' . $destination->startport . '-' . $destination->endport . ')</span>
</div>
</td>
</tr>';
$body .= '<tr>
<td colspan="3"></td>
</tr>';
$dropcounter = $destination->endport - $destination->startport + 1;
$dropout .= '<div style="height:70px;width: 3px;background-color: #000; margin-left: auto; margin-right: auto;"></div>
<div style="margin-left: auto; margin-right: auto;">' . $dropcounter . ' Fasern</div>';
} else {
$body .= '<tr>
<td class="text-left sp-border-rl" colspan="3">
<div class="fiber-module-div">' . $destination->fiberPlanDispatchersleeve->name . ' <span class="fiber-color">(' . $destination->startport . '-' . $destination->endport . ')</span>
</div>
</td>
</tr>';
$sumcounter = $sumcounter + $destination->endport - $destination->startport + 1;
}
endif;
}
if ($sumcounter==0){
$sumcounter = $oldsummcounter;
}
return array($body, $sumcounter, $dropout);
}
function generatedestinationmidpoint($markers, $midpoints, $cableendpoints, $fiberPlanCablePipes, $pipesubs)
{
$oldendpoint = "";
$midpointcounter = count($midpoints);
$pipecolorsmanu = FiberPlanPipeManufacturerModel::getAll();
$pipecolors = json_decode($pipecolorsmanu[0]->colors, true);
$counter = 0;
$width = 0;
$oldsummcounter = 0;
foreach ($midpoints as $midpoint):
$pipecol = $pipesubs[$counter]['pipecolor'];
$midcounter = 0;
foreach ($midpoint as $endpoint):
$pipecolor = $pipecolors[$endpoint->fiberPlanCablePipe->fiberPlanPipe_sub];
if ($endpoint->pop_id) {
$enpointid = $endpoint->pop_id;
} elseif ($endpoint->fiberPlanDispatcher_id) {
$enpointid = $endpoint->fiberPlanDispatcher_id;
} elseif ($endpoint->building_id) {
$enpointid = $endpoint->building_id;
}
if ($oldendpoint != $enpointid && $width == 0) {
echo '<div class="overflowme">';
}
if (($counter != 0 || $midcounter != 0) && $oldendpoint != $enpointid):
echo ' <table id="olt-port-table" class="float-left" style="width: 80px">
<thead>
<tr>
<td style="height: 60px;"></td>
</tr>
</thead>
<tbody id="olt-ports">
<tr>
<td data-oltport="0"
class="font-13">' . $summcounter . '</td>
</tr>
<tr>
<td data-oltport="0" class="sp-port-lines" style="width: 70px; background-color: ' . $pipecol . ' ;height: 7px;">' . $pipesubs[$counter]['pipsstriped'] . '</td>
</tr>
<tr>
<td data-oltport="0" class="font-13"></td>
</tr>
</tbody>
</table>';
$width = $width + 80;
// $summcounter = 0;
endif;
$endpointbody = "";
if ($endpoint->pop_id) {
$url = mfBaseController::getUrl("Pop", "detail", ["id" => $endpoint->pop->id]);
$endpointname = '<a href="' . $url . '" target="_blank">' . $endpoint->pop->name . '</a>';
$endpointtype = "Pop";
$gps_lat = $endpoint->pop->gps_lat;
$gps_long = $endpoint->pop->gps_long;
$enpointid = $endpoint->pop_id;
if ($cableendpoints[$endpoint->id]) {
list($endpointbody, $summcounter, $dropout) = generateendpointbody($cableendpoints[$endpoint->id], 'pop', $oldsummcounter);
}
$width = $width + 300;
} elseif ($endpoint->fiberPlanDispatcher_id) {
$endpointname = $endpoint->fiberPlanDispatcher->description;
if ($endpoint->fiberPlanDispatcher->object_type == 3) $endpointtype = "Greenfield";
else if ($endpoint->fiberPlanDispatcher->object_type == 1) $endpointtype = "Verteiler";
else if ($endpoint->fiberPlanDispatcher->object_type == 2) $endpointtype = "Schacht";
else $endpointtype = "Schacht/Verteiler";
$gps_lat = $endpoint->fiberPlanDispatcher->gps_lat;
$gps_long = $endpoint->fiberPlanDispatcher->gps_long;
$enpointid = $endpoint->fiberPlanDispatcher_id;
list($endpointbody, $summcounter, $dropout) = generateendpointbody($cableendpoints[$endpoint->id], 'sleeve', $oldsummcounter);
$width = $width + 150;
} elseif ($endpoint->building_id) {
$endpointname = $endpoint->building->street;
$endpointtype = 'Building';
$gps_lat = $endpoint->building->gps_lat;
$gps_long = $endpoint->building->gps_long;
$enpointid = $endpoint->fiberPlanDispatcher_id;
list($endpointbody, $summcounter, $dropout) = generateendpointbody($cableendpoints[$endpoint->id], 'building', $oldsummcounter);
$width = $width + 150;
}
if ($oldendpoint != $enpointid):
$coordinates = "";
if ($gps_lat) {
$coordinates = round($gps_lat, 5) . " , " . round($gps_long, 5);
$coordinates = '<a title="Google-Maps: ' . $coordinates . '" class="mapsLink" href="http://maps.google.com/?q=' . $coordinates . '" target="_blank">' . $coordinates . '</a>';
}
if ($gps_lat) {
$markers[] = array(
"gps_lat" => $gps_lat,
"gps_long" => $gps_long,
"name" => $endpointname,
"color" => $pipecol,
"type" => $endpointtype,
);
}
echo '<div class="float-left"><table class="sp-table-border "
style="min-height: 150px;display:block">
<thead >
<tr>
<th colspan="3"
class="text-center font-15">
<div class="pt-2 pl-2 pr-2" style="min-width: min-width: 170px;">' . $endpointtype . '</div>
</th>
</tr>
<tr>
<th colspan="3"
class="text-center font-15">
<div class="pl-2 pr-2" style="min-width: min-width: 170px;">' . $endpointname . '</div>
</th>
</tr>
<tr>
<th colspan="3" class="text-center font-13">
<div class="pl-2 pr-2 pb-2">' . $coordinates . '</div>
</th>
</tr>
<tbody>';
echo $endpointbody;
echo '</tbody>
</table>';
echo $dropout;
echo '</div>';
endif;
$midcounter++;
$oldendpoint = $enpointid;
if ($width > 1500) {
echo '</div>';
echo '<div class="overflowme">';
$width = 0;
}
$oldsummcounter = $summcounter;
endforeach;
$counter++;
endforeach;
return $markers;
}
$counter = 0;
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe) {
//var_dump($fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4);
$pipsstriped = "";
if ($fiberPlanCablePipe->fiberPlanPipe_sub <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 && $fiberPlanCablePipe->fiberPlanPipe_sub <= 12) {
$pipesub = "7x4";
$pipeheight = "7px";
$pipeheightinfoheight = "12px";
$pipeheightinfomarge = "4px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1]->colordescription;
} elseif ($fiberPlanCablePipe->fiberPlanPipe_sub <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 && $fiberPlanCablePipe->fiberPlanPipe_sub > 12) {
$pipesub = "7x4";
$pipeheight = "7px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13]->colordescstriped;
$pipeheightinfoheight = "12px";
$pipeheightinfomarge = "4px";
$pipsstriped = '<div class="pipe-striped"></div>';
} else if ($fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe14x10 && $fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 <= 12) {
$pipesub = "14x10";
$pipeheight = "10px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 1 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->colordescription;
$pipeheightinfoheight = "15px";
$pipeheightinfomarge = "3px";
} else if ($fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 <= $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe14x10 && $fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4 > 12) {
$pipesub = "14x10";
$pipeheight = "10px";
$pipecolor = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->color;
$pipecolordesc = $fiberplanpipemanufacturers->colors[$fiberPlanCablePipe->fiberPlanPipe_sub - 13 - $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4]->colordescstriped;
$pipeheightinfoheight = "15px";
$pipeheightinfomarge = "3px";
$pipsstriped = '<div class="pipe-striped"></div>';
}
/* var_dump($fiberPlanCablePipe->fiberPlanpipe->fiberPlanPipeTemplate);
echo $fiberPlanCablePipe->fiberPlanPipe_sub;
echo ".<br>";
echo $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe7x4;
echo "<br>";
echo $fiberPlanCablePipe->fiberPlanPipe->fiberPlanPipeTemplate->pipe14x10;
echo "<br>";
echo $fiberPlanCablePipe->fiberPlanPipe_sub - $fiberPlanCablePipe->fiberPlanpipe->fiberPlanPipeTemplate->pipe7x4;*/
$pipesubs[$counter]['pipesub'] = $pipesub;
$pipesubs[$counter]['pipeheight'] = $pipeheight;
$pipesubs[$counter]['pipecolor'] = $pipecolor;
$pipesubs[$counter]['pipecolordesc'] = $pipecolordesc;
$pipesubs[$counter]['pipeheightinfoheight'] = $pipeheightinfoheight;
$pipesubs[$counter]['pipeheightinfomarge'] = $pipeheightinfomarge;
$pipesubs[$counter]['pipsstriped'] = $pipsstriped;
$counter++;
}
foreach ($fiberPlanCableEndpoints as $fiberPlanCableEndpoint) {
$markers = generatedestinationmidpoint($markers, $fiberPlanCableEndpoints, $fiberPlanCableEndpoints, $fiberPlanCablePipes, $pipesubs);
}
?>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a href="<?= self::getUrl("FiberPlanCable") ?>">Kabelverzeichnis</a>
</li>
<li class="breadcrumb-item active">Kabelverzeichnis Detail</li>
</ol>
</div>
<h4 class="page-title">Kabel: <span
class="font-weight-normal ml-1"><?= $fiberplancables->description ?></span>
<span class="ml-2">
<a href="<?= self::getUrl("FiberPlanCable", "edit", ["id" => $fiberplancables->id, 'returnto' => "fiberplancable-detail"]) ?>">
<button class="btn btn-primary">Bearbeiten</button>
</a>
</span></h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-5 card-border">
<div>
<h4>Allgemeine Informationen </h4>
</div>
<div>
<table class="table table-sm">
<tbody>
<tr>
<th class="w-30">Bezeichnung</th>
<td><?= $fiberplancables->description ?> </td>
</tr>
<tr>
<th>Fasern / Länge (m)</th>
<td><?= $fibers[$fiberplancables->fibers]['name'] . " (" . $fibers[$fiberplancables->fibers]['fibers'] . ")" ?>
/ <?= $fiberplancables->lenght ?> Meter
</td>
</tr>
<tr>
<th>Netzgebiet</th>
<td><?= $fiberplancables->network->name ?> </td>
</tr>
<tr>
<th>Verwendete(s) Rohr(e)</th>
<td>
<table class="inner-table">
<?php
$counter = 0;
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe):?>
<tr>
<th><?= '<a href="' . self::getUrl("FiberPlanPipe", "detail", ["id" => $fiberPlanCablePipe->fiberPlanPipe->id]) . '" target="_blanc">' . $fiberPlanCablePipe->fiberPlanPipe->description . '</a>' ?></th>
<td><?= '<div style="height: ' . $pipesubs[$counter]['pipeheightinfoheight'] . ';margin-top: ' . $pipesubs[$counter]['pipeheightinfomarge'] . '; background-color: ' . $pipesubs[$counter]['pipecolor'] . '; width: 50px; display: inline-block; vertical-align: top; border-radius: 10px;border: 1px solid;">' . $pipesubs[$counter]['pipsstriped'] . '</div>' ?>
<?= $pipesubs[$counter]['pipesub'] ?>
(<?= $pipesubs[$counter]['pipecolordesc'] ?>)
</td>
</tr>
<?php
$counter++;
endforeach; ?>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-4 ">
<div>
<h4>&nbsp;</h4>
</div>
<table class="table table-sm">
<tbody>
<tr>
<th>Status</th>
<td><?= $state[$fiberplancables->state] ?> </td>
</tr>
<tr>
<th>Zuständig</th>
<td><?= $responsible ?> </td>
</tr>
<tr>
<th>Kontakt</th>
<td><?= $fiberplancables->responsible_text ?> </td>
</tr>
<tr>
<th>Bemerkung</th>
<td><?= nl2br($fiberplancables->comment) ?> </td>
</tr>
</tbody>
</table>
</div>
<div class="col-3 ">
</div>
</div>
<div class="row pb-3 pt-4 ">
<div class="col-12 text-center card-border">
<div>
<h4 class="text-left mb-3">Schematische Darstellung <i data-toggle="modal"
data-target="#pipemap"
class="fa-duotone fa-map-location-dot font-24"
style="--fa-primary-color: #fa0000; --fa-secondary-color: #232423;margin-left:5px;cursor:pointer"></i>
</h4>
</div>
<?php
if ($fiberPlanPipesEndpoints) {
$markers = generatedestinationmidpoint($markers, $fiberPlanPipesEndpoints, $fiberPlanCableEndpoints, $fiberPlanCablePipes, $pipesubs);
}
?>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="pipemap" tabindex="-1" role="dialog" aria-labelledby="pipemap"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="pipemapLabel">Rohrverzeichnis</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<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 class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<?php
?>
<script type="text/javascript">
var marker = [];
var polylinec;
var polyline;
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://mapsneu.wien.gv.at/basemap/{id}/normal/google3857/{z}/{y}/{x}.{imgtype}', {
maxZoom: 19,
id: "bmaporthofoto30cm",
imgtype: "jpeg"
}).addTo(map);
L.MakiMarkers.accessToken = '<?=TT_MAPBOX_TILE_API_TOKEN?>';
$(document).ready(function () {
var locations = [<?php
$counter = 0;
$lat = 0;
$long = 0;
foreach ($markers as $marker):
if ($counter > 0) echo ',';
?>
['<?= $marker['name'] ?>', <?= $marker['gps_lat'] ?>, <?= $marker['gps_long'] ?>, '<?= $marker['color'] ?>', '<?= $marker['type'] ?>']
<?php
$lat = $lat + $marker['gps_lat'];
$long = $long + $marker['gps_long'];
$counter++;
endforeach;
$lat = $lat / $counter;
$long = $long / $counter;
?>
];
var startlat = <?=$lat ?>;
var startlong = <?=$long ?>;
console.log(locations);
$('#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://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++) {
if (locations[i][4] == "Greenfield") {
icon_name = "garden";
icon_color = "#abbaf0";
} else if (locations[i][4] == "Pop") {
icon_name = "village";
icon_color = "#acf0ab";
} else if (locations[i][4] == "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: locations[i][3]}).addTo(map);
//polyline.bindTooltip(locations[i][4], {permanent: true});
polyline = 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>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -0,0 +1,639 @@
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item"><a
href="<?= self::getUrl("FiberPlanCable") ?>">Kabelverzeichnis</a></li>
<li class="breadcrumb-item active"><?= ($fiberplancables->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title"><?= ($fiberplancables->id) ? "Kabelverzeichnis bearbeiten" : "Neues Kabel" ?></h4>
</div>
</div>
</div>
<?php
if ($fiberplancables->fiberPlanPipe->startpoint_network_id != $fiberplancables->network_id && $fiberplancables->fiberPlanPipe->endpoint_network_id != $fiberplancables->network_id) {
$networkId = $fiberplancables->fiberPlanPipe->startpoint_network_id;
} else {
$networkId = $fiberplancables->network_id;
}
if (isset($_GET['returnto']) && $_GET['returnto'] == "fiberplancable-detail") {
$cancelUrl = self::getUrl("FiberPlanCable", "Detail", ["id" => $fiberplancables->id]);
} else {
$cancelUrl = self::getUrl("FiberPlanCable");
}
//var_dump($fiberPlanCableEndpoints);
?>
<script>
const pipes = [];
const pipesid = [];
const subpipes = [];
</script>
<style>
.fa-circle-plus {
color: #00b125;
cursor: pointer;
font-size: 17px;
float: right;
}
.remove-module, .remove-rack {
cursor: pointer;
color: #ff0606;
font-size: 17px;
float: right;
margin-left: 7px;
}
.up-module {
cursor: pointer;
color: #0c06ff;
font-size: 17px;
float: right;
margin-left: 7px;
}
.fa-square-caret-down, .fa-square-caret-up {
font-size: 17px;
margin-top: 10px;
margin-right: 10px;
color: #007bffa3;
cursor: pointer;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none;
}
.destination-dropdown {
cursor: pointer;
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none;
}
.add-pipe {
float: unset !important;
margin-left: 10px;
}
.remove-endpoint {
cursor: pointer;
color: #ff0606;
font-size: 17px;
float: right;
margin-left: 7px;
}
.fa-up {
color: #0d6efd;
font-size: 17px;
cursor: pointer;
float: right;
margin-left: 10px;
}
.fa-down {
color: #0d6efd;
font-size: 17px;
cursor: pointer;
float: right;
margin-left: 10px;
}
.fiberplancablepipe-div {
border-top: 1px dotted #ccc;
padding-top: 5px;
}
.fiberplancablepipe-div .form-group {
margin-bottom: 5px;
}
.fiberplanpipe-main-div {
padding: 5px 5px 5px 5px;
border: 1px dotted #656161;
border-radius: 10px;
margin-bottom: 10px;
}
.change-fiberplanpipe-body {
cursor: pointer;
}
.add-module, .add-sleeve {
float: unset;
display: inline-block;
vertical-align: top;
margin-left: 5px;
margin-top: 6px;
}
.fiberplancableendpoint-div {
border: 1px dotted #ccc;
padding: 5px;
margin-top: 10px;
border-radius: 10px;
}
</style>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-2"><?= ($fiberplancables->id) ? "Kabelverzeichnis bearbeiten" : "Neues Kabel" ?></h4>
<form class="form-horizontal" method="post"
action="<?= self::getUrl("FiberPlanCable", "save", ["returnto" => $_GET["returnto"]]) ?>">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col col-lg-6">
<input type="hidden" name="id" value="<?= $fiberplancables->id ?>"/>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="description">Bezeichnung
*</label>
<div class="col-lg-4">
<input required="required" type="text" id="description"
name="description"
class="form-control"
value="<?= $fiberplancables->description ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="fibers">Fasern *</label>
<div class="col-lg-3">
<select required="required" id="fibers" name="fibers"
class="select2select form-control">
<option value=""></option>
<option value="1"
data-fibers="4" <?= ($fiberplancables->fibers == "1") ? "selected='selected'" : "" ?>>
1x4
</option>
<option value="2"
data-fibers="12" <?= ($fiberplancables->fibers == "2") ? "selected='selected'" : "" ?>>
1x12 <i class="fad fa-fw fa-hdd text-info"></i></option>
<option value="3"
data-fibers="24" <?= ($fiberplancables->fibers == "3") ? "selected='selected'" : "" ?>>
1x24
</option>
<option value="4"
data-fibers="24" <?= ($fiberplancables->fibers == "4") ? "selected='selected'" : "" ?>>
2x12
</option>
<option value="5"
data-fibers="48" <?= ($fiberplancables->fibers == "5") ? "selected='selected'" : "" ?>>
4x12
</option>
<option value="6"
data-fibers="96" <?= ($fiberplancables->fibers == "6") ? "selected='selected'" : "" ?>>
8x12
</option>
<option value="7"
data-fibers="144" <?= ($fiberplancables->fibers == "7") ? "selected='selected'" : "" ?>>
6x24
</option>
<option value="8"
data-fibers="144" <?= ($fiberplancables->fibers == "8") ? "selected='selected'" : "" ?>>
12x12
</option>
<option value="9"
data-fibers="192" <?= ($fiberplancables->fibers == "9") ? "selected='selected'" : "" ?>>
8x24
</option>
<option value="10"
data-fibers="288" <?= ($fiberplancables->fibers == "10") ? "selected='selected'" : "" ?>>
12x24
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="diameter">Durchmesser (MM)
*</label>
<div class="col-lg-3">
<input required="required" type="text" id="diameter" name="diameter"
class="form-control"
value="<?= $fiberplancables->diameter ?>"/>
</div>
</div>
<!--div class="form-group row">
<label class="col-lg-3 col-form-label" for="starting_point">Netzgebiet
*</label>
<div class="col-lg-6">
<select required="required" id="network_id" name="network_id"
class="select2 form-control">
<option value=""></option>
<?php foreach ($networks as $network): ?>
<option value="<?= $network->id ?>" <?= ($networkId == $network->id) ? "selected='selected'" : "" ?>><?= $network->name ?></option>
<?php endforeach; ?>
</select>
</div>
</--div-->
<div class="form-group row">
<div class="col-lg-12">
<h4>Rohr(e) <i id="add-pipe" data-popid="5"
class="fa-regular fa-circle-plus add-pipe"></i></h4>
</div>
</div>
<div id="fiberplancablepipes-div">
<?php
$counter = 1;
if ($fiberPlanCablePipes) :
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe): ?>
<div class="fiberplancablepipe-div">
<div class=" form-group row">
<label class="col-lg-3 col-form-label fiberplanpipe-label"
for="fiberPlanPipe_id"><span
class=" label-text">Rohr *</span> <span
class="endpointsymbol"></span>
</label>
<div class="col-lg-4">
<select required="required"
name="fiberplanpipenetwork[]"
class="select2select form-control pipe-network">
<option value=""></option>
<?php
foreach ($networks as $network): ?>
<option value="<?= $network->id ?>" <?= ($fiberPlanPipeNetworks[$fiberPlanCablePipe->fiberPlanPipe_id] == $network->id) ? "selected='selected'" : "" ?>><?= $network->name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-lg-4 pipe-div">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label"
for="fiberPlanPipe_sub">Subrohr
*</label>
<div class="col-lg-4 subpipe-div">
</div>
</div>
<script>
pipes.push(<?= $fiberPlanCablePipe->fiberPlanPipe_id ?>);
pipesid.push(<?= $fiberPlanCablePipe->id ?>);
subpipes.push(<?= $fiberPlanCablePipe->fiberPlanPipe_sub ?>);
</script>
</div>
<?php
$counter++;
endforeach; ?>
<?php else: ?>
<div class="fiberplancablepipe-div">
<div class=" form-group row">
<label class="col-lg-3 col-form-label fiberplanpipe-label"
for="fiberPlanPipe_id"><span
class=" label-text">Rohr *</span> <span
class="endpointsymbol"></span>
</label>
<div class="col-lg-4">
<select required="required"
name="fiberplanpipenetwork[]"
class="select2select form-control pipe-network">
<option value=""></option>
<?php
foreach ($networks as $network): ?>
<option value="<?= $network->id ?>"><?= $network->name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-lg-4 pipe-div">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label"
for="fiberPlanPipe_sub">Subrohr
*</label>
<div class="col-lg-4 subpipe-div">
</div>
</div>
</div>
<?php endif; ?>
</div>
<div class="form-group row">
<div class="col-lg-12" style="border-top: 1px dotted #a3a3a3;">
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="lenght">Länge (M) *</label>
<div class="col-lg-3">
<input required="required" type="text" id="lenght" name="lenght"
class="form-control"
value="<?= $fiberplancables->lenght ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="state">Status *</label>
<div class="col-lg-6">
<select required="required" id="state" name="state"
class="select2select form-control">
<option value=""></option>
<option value="10" <?= ($fiberplancables->state == "10") ? "selected='selected'" : "" ?>>
Geplant
</option>
<option value="20" <?= ($fiberplancables->state == "20") ? "selected='selected'" : "" ?>>
Umsetzung
</option>
<option value="30" <?= ($fiberplancables->state == "30") ? "selected='selected'" : "" ?>>
Fertiggestellt
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="responsible">Zuständig *</label>
<div class="col-lg-3">
<select required="required" id="responsible" name="responsible"
class="select2select form-control">
<option value=""></option>
<option value="1" <?= ($fiberplancables->responsible == "1") ? "selected='selected'" : "" ?>>
Leitungsbaufirma
</option>
<option value="2" <?= ($fiberplancables->responsible == "2") ? "selected='selected'" : "" ?>>
Person
</option>
</select>
</div>
</div>
<div class="form-group row" id="responsible-row"
style="<?= ($fiberplancables->responsible != "1") ? "display:none" : "" ?>">
<label class="col-lg-3 col-form-label" for="responsible">Firma</label>
<div id="responsible-div" class="col-lg-6"
style="<?= ($fiberplancables->responsible != "1") ? "display:none" : "" ?>">
<select id="address_id" name="address_id"
class="select2select form-control" <?= ($fiberplancables->responsible != "1") ? 'disabled="disabled"' : "" ?> >
<option value=""></option>
<?php foreach ($lineworkeraddresses as $lineworkeraddress): ?>
<option value="<?= $lineworkeraddress->id ?>" <?= ($fiberplancables->address_id == $lineworkeraddress->id) ? "selected='selected'" : "" ?>><?= $lineworkeraddress->company ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="responsible">Person</label>
<div id="responsible_text-div" class="col-lg-6">
<input id="responsible_text" name="responsible_text"
value="<?= $fiberplancables->responsible_text ?>"
placeholder="Ansprechsperson"
class="form-control"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="comment">Kommentar</label>
<div class="col-lg-6">
<textarea id="comment" name="comment"
class="form-control"><?= $fiberplancables->comment ?></textarea>
</div>
</div>
</div>
<div class="col col-lg-6" id="fiberplancableendpoints">
<div id="destination-div"></div>
<h3 class="text-center">Verwendete Rohre/Endpunkte <span><i
class="fa-regular ml-2 fa-square-chevron-down change-fiberplanpipe-main"></i></span>
</h3>
<?php
$fiberPlanPipesEndpointcounter = 0;
foreach ($fiberPlanPipesEndpoints
as $fiberPlanPipesEndpoint):
$counter = 0;
?>
<?php foreach ($fiberPlanPipesEndpoint
as $fiberPlanPipesEndpointdetail):
$endpointbody = "";
if ($counter == 0):
if ($fiberPlanPipesEndpointcounter > 0) :
?>
</div>
</div>
<?php endif; ?>
<div class="fiberplanpipe-main-div">
<h4 class="text-center"><span
class="mr-1">Rohr:</span><span><?= $fiberPlanPipesEndpointdetail->fiberPlanPipe->description ?></span><span
class="fiberplanpipe-subpipe ml-2"></span><span><i
class="fa-regular ml-2 fa-square-chevron-down change-fiberplanpipe-body"></i></span>
</h4>
<?php
if ($fiberPlanPipesEndpointcounter > 0) :
?>
<?php endif; ?>
<div class="fiberplanpipe-body-div">
<?php
endif;
if ($fiberPlanPipesEndpointdetail->pop_id) {
$endpointname = '<img src="/img/markers/marker-pop.png" height="33px" class="mr-1">' . $fiberPlanPipesEndpointdetail->pop->name;
$endpointtype = '<span class="fiberplanpipe-pop-racks" data-popid="' . $fiberPlanPipesEndpointdetail->pop_id . '">(POP)</span><i class="fa-regular fa-circle-plus add-module" data-poprackid=""></i>';
if ($fiberPlanCableEndpoints[$fiberPlanPipesEndpointdetail->id]) {
$endpointcounter = 0;
foreach ($fiberPlanCableEndpoints[$fiberPlanPipesEndpointdetail->id] as $fiberPlanCableEndpoint):
$endpointbody .= '<div class="form-group module-row row">
<label class="col-lg-2 col-form-label" for="lenght"><i class="fa-regular fa-circle-minus remove-module"></i><i title="nach unten verschieben" class="fa-sharp fa-solid fa-down down-module"></i><i class="fa-sharp fa-solid fa-up up-module"></i></label>';
$endpointbody .= '<div class="col-lg-4">
<select data-poprackmodule_id="' . $fiberPlanCableEndpoint->poprackmodule_id . '" name="poprackmodule_id[]" required="required" class="select2select form-control poprackmodule_id"></select>
</div>
<div class="col-lg-4">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="poprackmodule_start[]" value="' . $fiberPlanCableEndpoint->startport . '" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="poprackmodule_end[]" value="' . $fiberPlanCableEndpoint->endport . '" type="number" class="form-control ports-end">
<input style="display:none" name="poprackmodule_rackid[]" value="' . $poprackid . '" type="number" class="form-control ports-rackid">
</div>
</div></div>
</div>
<div class="col-2"><label class="fibersum col-form-label"></label></div>
</div>';
$endpointcounter++;
endforeach;
}
} else if ($fiberPlanPipesEndpointdetail->fiberPlanDispatcher_id) {
$endpointname = $fiberPlanPipesEndpointdetail->fiberPlanDispatcher->description;
$endpointtype = $fiberPlanPipesEndpointdetail->fiberPlanDispatcher->object_type;
if ($fiberPlanPipesEndpointdetail->fiberPlanDispatcher->object_type == 1) {
$endpointtype = '<span class="fiberplanpipe-dispatcher-sleeves" data-id="' . $fiberPlanPipesEndpointdetail->fiberPlanDispatcher_id . '">(Verteiler)</span><i class="fa-regular fa-circle-plus add-sleeve" data-poprackid=""></i>';
$endpointname = '<img src="/img/markers/marker-dispatcher.png" height="33px" class="mr-1">' . $endpointname;
} else if ($fiberPlanPipesEndpointdetail->fiberPlanDispatcher->object_type == 2) {
$endpointtype = '<span class="fiberplanpipe-dispatcher-sleeves" data-id="' . $fiberPlanPipesEndpointdetail->fiberPlanDispatcher_id . '">(Schacht)</span><i class="fa-regular fa-circle-plus add-sleeve" data-poprackid=""></i>';
$endpointname = '<img src="/img/markers/marker-dispatcher.png" height="33px" class="mr-1">' . $endpointname;
} else if ($fiberPlanPipesEndpointdetail->fiberPlanDispatcher->object_type == 3) {
$endpointname = '<img src="/img/markers/marker-greenfield.png" height="33px" class="mr-1">' . $endpointname;
$endpointtype = "(Greenfield)";
}
if ($fiberPlanPipesEndpointdetail->fiberPlanDispatcher->object_type == 1 || $fiberPlanPipesEndpointdetail->fiberPlanDispatcher->object_type == 2) {
if ($fiberPlanCableEndpoints[$fiberPlanPipesEndpointdetail->id]) {
foreach ($fiberPlanCableEndpoints[$fiberPlanPipesEndpointdetail->id] as $fiberPlanCableEndpoint):
if ($fiberPlanCableEndpoint->dropout == "1") {
$endpointbody .= '<div class="form-group row">
<div class="col-lg-12">
<h5 class="text-center"><span">Dropout</span></h5>
</div>
</div> ';
}
$endpointbody .= '<div class="form-group row">
<label class="col-lg-2 col-form-label" for="lenght"><span class="ml-2">Muffe</span></label>
<div class="col-lg-4">
<select name="sleeve_id[]" data-id="' . $fiberPlanCableEndpoint->fiberPlanDispatchersleeve_id . '" required="required" class="select2select form-control fiberplandispatcher_id sleeveid"></select>
</div>
<div class="col-lg-4">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="sleeve_start[]" value="' . $fiberPlanCableEndpoint->startport . '" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="sleeve_end[]" value="' . $fiberPlanCableEndpoint->endport . '" type="number" class="form-control ports-end">
</div>
</div></div>
</div>
<div class="col-2"><span class="fibersum"></span></div>
</div>';
endforeach;
}
}
} else if ($fiberPlanPipesEndpointdetail->building_id) {
$endpointname = '<img src="/img/markers/marker-home.png " height="32px" class="mr-1">' . $fiberPlanPipesEndpointdetail->building->street;
$endpointtype = '(Building)';
}
if ($fiberPlanCableEndpoints[$fiberPlanPipesEndpointdetail->id]) {
}
?>
<div class="fiberplancableendpoint-div">
<h5 class="text-center"><span><?= $endpointname ?></span><span
class="ml-1"><?= $endpointtype ?></span></h5>
<div><?= $endpointbody ?></div>
</div>
<?php
$counter++;
endforeach; ?>
<?php
$fiberPlanPipesEndpointcounter++;
endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class=" form-group row
">
<label class="col-lg-1"></label>
<div class="col-lg-8">
<button type="submit" class="btn btn-primary">Speichern</button>
<a href="<?= $cancelUrl ?>">
<button type="button" class="btn btn-secondary">Abbrechen</button>
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="rackModal" tabindex="-1" role="dialog" aria-labelledby="rackModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="rackModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row">
<div class="col-lg-1"></div>
<label class="col-lg-3 col-form-label" for="diameter">Schrank Name*</label>
<div class="col-lg-6">
<input required="required" type="text" id="rackname" name="rackname"
class="form-control"/>
</div>
</div>
<div class="form-group row">
<div class="col-lg-1"></div>
<label class="col-lg-3 col-form-label" for="diameter">Höheneinheiten*</label>
<div class="col-lg-3">
<input required="required" type="number" id="rackhe" name="rackhe"
class="form-control"/>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
<button type="button" class="btn btn-primary">Schrank hinzufügen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [1, 2, 3, 6];
let dispatchersleeve = "<?= self::getUrl("Timerecording", "save") ?>";
let deleteUrl = "<?= self::getUrl("Timerecording", "delete") ?>";
let dispatchersleeveUrl = "<?= self::getUrl("FiberPlanCable", "api", ['do' => 'dispatchersleeve']) ?>";
let poprackUrl = "<?= self::getUrl("FiberPlanCable", "api", ['do' => 'poprack']) ?>";
let poprackmoduleUrl = "<?= self::getUrl("FiberPlanCable", "api", ['do' => 'poprackmodule']) ?>";
let poprackmoduleallUrl = "<?= self::getUrl("FiberPlanCable", "api", ['do' => 'poprackmoduleall']) ?>";
let fiberPlanPipeUrl = "<?= self::getUrl("FiberPlanCable", "api", ['do' => 'FiberPlanPipe']) ?>";
let fiberPlanPipeSubUrl = "<?= self::getUrl("FiberPlanCable", "api", ['do' => 'FiberPlanPipeSub']) ?>";
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>js/pages/FiberPlanCable/Form.js?<?= date('U') ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -0,0 +1,203 @@
<?php
$fibersOption[1] = "1x4";
$fibersOption[2] = "1x12";
$fibersOption[3] = "1x24";
$fibersOption[4] = "2x12";
$fibersOption[5] = "4x12";
$fibersOption[6] = "8x12";
$fibersOption[7] = "6x24";
$fibersOption[8] = "12x12";
$fibersOption[9] = "8x24";
$fibersOption[10] = "12x24";
$stateOption[10] = "Geplant";
$stateOption[20] = "Umsetzung";
$stateOption[30] = "Fertiggestellt";
$responsibleOption[1] = "(F)";
$responsibleOption[2] = "(P)";
foreach ($lineworkeraddresses as $lineworkeraddress):
$Lineworker[$lineworkeraddress->id] = $lineworkeraddress->company;
endforeach;
foreach ($networks as $network):
$Networks[$network->id] = $network->name;
endforeach;
foreach ($fiberplanpipemanufacturers as $fiberplanpipemanufacturer) {
$colors = json_decode($fiberplanpipemanufacturer->colors, true);
$pipemanufacturercolors[$fiberplanpipemanufacturer->id]['colors'] = $colors;
}
foreach ($fiberplanpipes as $fiberplanpipe) {
$fiberPlanPipe[$fiberplanpipe->id]['description'] = $fiberplanpipe->description;
$fiberPlanPipe[$fiberplanpipe->id]['type'] = $fiberplanpipe->type;
$fiberPlanPipe[$fiberplanpipe->id]['type_description'] = $fiberplanpipe->type_description;
$fiberPlanPipe[$fiberplanpipe->id]['startpoint_network_id'] = $fiberplanpipe->startpoint_network_id;
$fiberPlanPipe[$fiberplanpipe->id]['endpoint_network_id'] = $fiberplanpipe->endpoint_network_id;
$fiberPlanPipe[$fiberplanpipe->id]['fiberPlanPipeManufacturer_id'] = $fiberplanpipe->fiberPlanPipeManufacturer_id;
$fiberPlanPipe[$fiberplanpipe->id]['pipe7x4'] = $fiberplanpipe->pipe7x4;
$fiberPlanPipe[$fiberplanpipe->id]['pipe14x10'] = $fiberplanpipe->pipe14x10;
}
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li>
<li class="breadcrumb-item active">Kabelverzeichnis</li>
</ol>
</div>
<h4 class="page-title">Kabelverzeichnis</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="card">
<div class="card-body mb-3">
<div class="row">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Liste aller Kabelverzeichnis</h4>
</div>
<div class="float-right">
<a class="btn btn-primary mb-2" href="<?= self::getUrl("FiberPlanCable", "add") ?>"><i
class="fas fa-plus"></i> Neues Kabel anlegen</a>
</div>
</div>
</div>
<table id="datatable" class="table table-striped table-hover table-sm font-13">
<thead>
<tr>
<th class="text-center">Bezeichnung</th>
<th class="text-center">Fasern / Dm.</th>
<th class="text-center">Netzgebiet(e)</th>
<th class="text-center " style=" white-space: nowrap;">Verwendete(s) Rohr(e)</th>
<th class="text-center ">Länge (M)</th>
<th class="text-center">Zuständig</th>
<th class="text-center">Status</th>
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($fiberplancables as $fiberplancable):
if ($fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['startpoint_network_id'] == $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['endpoint_network_id']) {
$networkName = $Networks[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['startpoint_network_id']];
} else {
$networkName = $Networks[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['startpoint_network_id']] . " / " . $Networks[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['endpoint_network_id']];
}
if ($fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['type'] == "3") {
if ($fiberplancable->fiberPlanPipe_sub <= $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4'] && $fiberplancable->fiberPlanPipe_sub <= 12) {
$color = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 1]['color'];
$striped = "";
$height = "10px";
$title = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 1]['colordescription'];
$description = '7x4 ';
} else if ($fiberplancable->fiberPlanPipe_sub <= $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4'] && $fiberplancable->fiberPlanPipe_sub > 12) {
$striped = 'style="background-color: #000;height: 100%;width: 45%;text-align: center;margin-left: auto;margin-right: auto;"';
$color = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 13]['color'];
$height = "10px";
$title = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 13]['colordescstriped'];
$description = '7x4 ';
} else if ($fiberplancable->fiberPlanPipe_sub - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4'] <= $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe14x10'] && $fiberplancable->fiberPlanPipe_sub - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4'] <= 12) {
$color = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 1 - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4']]['color'];
$striped = "";
$height = "12px";
$title = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 1 - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4']]['colordescription'];
$description = '14x10 ';
} else if ($fiberplancable->fiberPlanPipe_sub - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4'] <= $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe14x10'] && $fiberplancable->fiberPlanPipe_sub - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4'] > 12) {
$color = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 13 - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4']]['color'];
$striped = 'style="background-color: #000;height: 100%;width: 45%;text-align: center;margin-left: auto;margin-right: auto;"';
$height = "12px";
$title = $pipemanufacturercolors[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['fiberPlanPipeManufacturer_id']]['colors'][$fiberplancable->fiberPlanPipe_sub - 13 - $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['pipe7x4']]['colordescstriped'];
$description = '14x10 ';
}
if ($color == "#ffffff" || $color == "#ffff01" || $color == "#01ffff") {
$border = 'border:1px solid #9d9d9d;';
} else {
$border = "";
}
$subPipe = '<div style="display:inline-block; text-align: left; width: 90px;"><div title="' . $title . '" style="display:inline-block;height:' . $height . ';width: 50px;margin-top:5px;border-radius: 14px;background-color:' . $color . ';' . $border . '"><div ' . $striped . '></div></div><span style="margin-right:3px;margin-left:3px; font-size:11px;margin-top:3px" >' . $description . '</span><span style="display: none">' . $title . ' </span></div>';
} else {
$subPipe = '<div style="display:inline-block; text-align: left; width: 90px;">' . $type_descrition_definition[$fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['type_description']] . ' </div>';
}
$responsible=$responsibleOption[$fiberplancable->responsible];
if ($fiberplancable->address_id)
{
$responsible.=" ".$Lineworker[$fiberplancable->address_id];
if ($fiberplancable->responsible_text)
{
$responsible.=" (".$fiberplancable->responsible_text.")";
}
} else if ($fiberplancable->responsible_text)
{
$responsible.=" ".$fiberplancable->responsible_text;
}
?>
<tr>
<td><a href="<?= self::getUrl("FiberPlanCable", "Detail", ["id" => $fiberplancable->id]) ?>"><?= $fiberplancable->description ?></a></td>
<td class="text-center"><?= $fibersOption[$fiberplancable->fibers] . " / " . $fiberplancable->diameter." mm" ?>
</td>
<td><?= $networkName; ?></td>
<td style=" white-space: nowrap;"><?= $subPipe . $fiberPlanPipe[$fiberplancable->fiberPlanPipe_id]['description'] ?></td>
<td class="text-center"><?= $fiberplancable->lenght ?></td>
<td><?= $responsible ?></td>
<td><?= $stateOption[$fiberplancable->state] ?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?= self::getUrl("FiberPlanCable", "edit", ["id" => $fiberplancable->id]) ?>"><i
class="far fa-edit" title="Bearbeiten"></i></a>
<a href="<?= self::getUrl("FiberPlanCable", "delete", ["id" => $fiberplancable->id]) ?>"
onclick="if(!confirm('Kabelverzeichnis wirklich löschen?')) return false;"
class="text-danger"
title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var hidesearch = [1,4,7];
var columnfilter = [6];
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 () {
});
</script>
<script type="text/javascript"
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>

View File

@@ -130,6 +130,7 @@ if ($fiberplanpipes->type == "3") {
width: 50px;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
background-color: #000;
}
@@ -423,7 +424,7 @@ if ($fiberplanpipes->type == "3") {
</tr>
<tr>
<td data-oltport="0" class="sp-port-lines"
style="width: 70px; background-color: <?= $pipecolor; ?> ;height: <?= $pipeheight; ?>;"></td>
style="width: 70px;"></td>
</tr>
<tr>
<td data-oltport="0" class="font-13"><?= $pipesub; ?>

View File

@@ -75,10 +75,8 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
<table id="datatable" class="table table-striped table-hover table-sm font-13">
<thead>
<tr>
<th class="text-center">Bezeichnung</th>
<th class="text-center">Type/Bezeichnung</th>
<th class="text-center">Länge (m)</th>
<th>Netzgebiet(e)</th>
<th class="text-center">Anfangspunkt</th>
@@ -88,10 +86,8 @@ foreach ($pipworkeraddresses as $pipworkeraddress) {
<th class="edit-width"></th>
</tr>
<tr id="filterrow">
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>

View File

@@ -98,7 +98,7 @@
<?php if($me->is(["Admin","netowner","pipeplanner","lineplanner","pipeworker","netoperator","lineworker"]) && $me->can("Filestore")): ?><li><a href="<?=self::getUrl("Filestore")?>"><i class="fas fa-fw fa-file text-info"></i> Dateiablage</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeplanner"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanDispatcher")?>"><i class="fas fa-building-circle-arrow-right text-info"></i> Verteiler und Schächte</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><li><a href="<?=self::getUrl("FiberPlanPipe")?>"><i class="fas fa-pipe text-info pl-1"></i> Rohrverzeichnis</a></li><?php endif; ?>
<!-- --><?php //if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><!--<li><a href="--><?php //=self::getUrl("FiberPlanCable")?><!--"><i class="fas fa-pipe text-info pl-1"></i> Kabelverzeichnis</a></li>--><?php //endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->is("employee")): ?><li><a href="--><?=self::getUrl("FiberPlanCable")?>"><i class="fas fa-pipe text-info pl-1"></i> Kabelverzeichnis</a></li><?php endif; ?>
</ul>
</li>
<?php endif; ?>

View File

@@ -0,0 +1,62 @@
<?php
class FiberPlanCable extends mfBaseModel
{
private $editor;
private $creator;
private $fiberPlanPipe;
private $network;
private $address;
public function getProperty($name)
{
if ($this->$name == null) {
if (!$this->id) {
return null;
}
if($name == "creator") {
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
if($this->creator === null) {
$this->creator = new User($this->create_by);
if($this->creator->id) {
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
}
}
return $this->creator;
}
if($name == "editor") {
$this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
if($this->editor === null) {
$this->editor = new User($this->edit_by);
if($this->editor->id) {
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
}
}
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-".$this->$idfield);
if(!$this->$name) {
$this->$name = new $classname($this->$idfield);
}
if($this->$name->id) {
mfValuecache::singleton()->set("mfObjectmodel-$name-".$this->$name->id, $this->$name);
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
}

View File

@@ -0,0 +1,425 @@
<?php
class FiberPlanCableController extends mfBaseController
{
protected function init()
{
$this->needlogin = true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me", $me);
if (!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
}
protected function indexAction()
{
$this->layout()->setTemplate("FiberPlanCable/Index");
$fiberplanpipemanufacturers = FiberPlanPipeModel::getAllPipeManufacturer();
$fiberplanpipes = FiberPlanPipeModel::getAllPipe();
$fiberplancables = FiberPlanCableModel::getAll();
$type_descrition_definition = FiberPlanPipeModel::$type_descrition_definition;
$lineworkeraddresses = FiberPlanCableModel::getLineworkerAddresses();
$networks = NetworkModel::getAll();
$this->layout()->set("lineworkeraddresses", $lineworkeraddresses);
$this->layout()->set("networks", $networks);
$this->layout()->set("type_descrition_definition", $type_descrition_definition);
$this->layout()->set("fiberplanpipemanufacturers", $fiberplanpipemanufacturers);
$this->layout()->set("fiberplanpipes", $fiberplanpipes);
$this->layout()->set("fiberplancables", $fiberplancables);
}
protected function apiAction()
{
$do = $this->request->do;
$fiberplanpipe_id = $this->request->fiberplanpipe_id;
$network_id = $this->request->network_id;
$pop_id = $this->request->pop_id;
$dispatcher_id = $this->request->dispatcher_id;
$poprack_id = $this->request->poprack_id;
$bdtype = $this->request->bdtype;
switch ($do) {
case "FiberPlanPipe":
$return = $this->getFiberPlanPipe($network_id);
break;
case "FiberPlanPipeSub":
$return = $this->getFiberPlanPipeSub($fiberplanpipe_id);
break;
case "getPops":
$return = $this->getPops($network);
break;
case "poprack":
$return = $this->getpoprack($pop_id);
break;
case "poprackmodule":
$return = $this->getpoprackmodule($poprack_id);
break;
case "poprackmoduleall":
$return = $this->getpoprackmoduleall($pop_id);
break;
case "dispatchersleeve":
$return = $this->getdispatchersleeve($dispatcher_id);
break;
default:
$return = false;
}
}
protected function detailAction()
{
$id = $this->request->id;
if (!is_numeric($id) || !$id) {
$this->layout()->setFlash("Kabelverzeichnis nicht gefunden", "error");
$this->redirect("FiberPlanCable");
}
$fiberplancables = new FiberPlanCable($id);
if ($fiberplancables->id != $id) {
$this->layout()->setFlash("Kabelverzeichnis nicht gefunden", "error");
$this->redirect("FiberPlanCable");
}
$fiberPlanCablePipes = FiberPlanCablePipeModel::search(['fiberPlanCable_id' => $id]);
if ($fiberPlanCablePipes) {
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe) {
$fiberPlanPipesEndpoints[] = FiberPlanPipeEndpointModel::search(['fiberPlanPipe_id' => $fiberPlanCablePipe->fiberPlanPipe_id]);
}
}
$fiberPlanCableEndpoints = FiberPlanCableEndpointModel::search(['fiberPlanCable_id' => $id]);
//$fiberPlanPipeSub = FiberPlanCableModel::getFiberPlanPipeSub($fiberplancables->data->fiberPlanPipe_id, 1);
$fiberPlanPipeTemplates = FiberPlanPipeTemplateModel::getAll();
$lineworkeraddresses = FiberPlanCableModel::getLineworkerAddresses();
$fiberplanpipemanufacturers = FiberPlanPipeManufacturerModel::getOne(1);
$this->layout()->set("lineworkeraddresses", $lineworkeraddresses);
$this->layout()->set("fiberplanpipemanufacturers", $fiberplanpipemanufacturers);
// $this->layout()->set("fiberPlanPipeSub", $fiberPlanPipeSub);
$this->layout()->set("fiberplancables", $fiberplancables);
$this->layout()->set("fiberPlanPipeTemplates", $fiberPlanPipeTemplates);
$this->layout()->set("fiberPlanCablePipes", $fiberPlanCablePipes);
$this->layout()->set("fiberPlanPipesEndpoints", $fiberPlanPipesEndpoints);
$this->layout()->set("fiberPlanCableEndpoints", $fiberPlanCableEndpoints);
}
protected function getFiberPlanPipe($network_id)
{
FiberPlanCableModel::getFiberPlanPipe($network_id);
}
protected function getFiberPlanPipeSub($fiberplanpipe_id)
{
FiberPlanCableModel::getFiberPlanPipeSub($fiberplanpipe_id);
}
protected function getpoprack($pop_id)
{
PoprackModel::getpoprack($pop_id);
}
protected function getdispatchersleeve($dispatcher_id)
{
PoprackModel::getdispatchersleeve($dispatcher_id);
}
protected function getpoprackmodule($poprack_id)
{
PoprackmoduleModel::getpoprackmodule($poprack_id);
}
protected function getpoprackmoduleall($pop_id)
{
PoprackmoduleModel::getpoprackmoduleall($pop_id);
}
protected function addAction()
{
$networks = NetworkModel::getAll();
$fiberPlanPipes = FiberPlanPipeModel::getAll();
$lineworkeraddresses = FiberPlanCableModel::getLineworkerAddresses();
$this->layout()->set("networks", $networks);
$this->layout()->set("fiberPlanPipes", $fiberPlanPipes);
$this->layout()->set("lineworkeraddresses", $lineworkeraddresses);
$this->layout()->setTemplate("FiberPlanCable/Form");
}
protected function editAction()
{
$id = $this->request->id;
if (!is_numeric($id) || !$id) {
$this->layout()->setFlash("Kabelverzeichnis nicht gefunden", "error");
$this->redirect("FiberPlanCable");
}
$fiberplancables = new FiberPlanCable($id);
if ($fiberplancables->id != $id) {
$this->layout()->setFlash("Kabelverzeichnis nicht gefunden", "error");
$this->redirect("FiberPlanCable");
}
$fiberPlanCablePipes = FiberPlanCablePipeModel::search(['fiberPlanCable_id' => $id]);
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe) {
$fiberPlanPipeNetworks[$fiberPlanCablePipe->fiberPlanPipe_id] = FiberPlanPipeEndpointModel::searchNetworks(['fiberPlanPipe_id' => $fiberPlanCablePipe->fiberPlanPipe_id]);
}
if ($fiberPlanCablePipes) {
foreach ($fiberPlanCablePipes as $fiberPlanCablePipe) {
$fiberPlanPipesEndpoints[] = FiberPlanPipeEndpointModel::search(['fiberPlanPipe_id' => $fiberPlanCablePipe->fiberPlanPipe_id]);
}
}
$fiberPlanCableEndpoints = FiberPlanCableEndpointModel::search(['fiberPlanCable_id' => $id]);
$this->layout()->set("fiberplancables", $fiberplancables);
$this->layout()->set("fiberPlanPipeNetworks", $fiberPlanPipeNetworks);
$this->layout()->set("fiberPlanCablePipes", $fiberPlanCablePipes);
$this->layout()->set("fiberPlanPipesEndpoints", $fiberPlanPipesEndpoints);
$this->layout()->set("fiberPlanCableEndpoints", $fiberPlanCableEndpoints);
return $this->addAction();
}
protected function saveAction()
{
$r = $this->request;
$id = $r->id;
if (is_numeric($id) && $id > 0) {
$mode = "edit";
$fiberplancables = new FiberPlanCable($id);
if (!$fiberplancables->id) {
$this->layout()->setFlash("Kabelverzeichnis nicht gefunden", "error");
$this->redirect("FiberPlanCable");
}
} else {
$mode = "add";
}
// $destinationendpoint_sleeve_id = $r->destinationendpoint_sleeve_id;
// $destinationendpoint_sleeve_start = $r->destinationendpoint_sleeve_start;
// $destinationendpoint_sleeve_end = $r->destinationendpoint_sleeve_end;
// if (!empty($destinationendpoint_sleeve_id)) {
// $counter = 0;
// foreach ($destinationendpoint_sleeve_id as $key => $sleeve) {
// if ($destinationendpoint_sleeve_start[$key] && $destinationendpoint_sleeve_end[$key] && $sleeve) {
//
// $endpoint['data'][$counter]['sleeve_id'] = $sleeve;
// $endpoint['data'][$counter]['startport'] = $destinationendpoint_sleeve_start[$key];
// $endpoint['data'][$counter]['endport'] = $destinationendpoint_sleeve_end[$key];
// }
// }
// }
// $endpoint = json_encode($endpoint);
// $destinationstartpoint_poprackmodule_id = $r->destinationstartpoint_poprackmodule_id;
// $destinationstartpoint_poprackmodule_start = $r->destinationstartpoint_poprackmodule_start;
// $destinationstartpoint_poprackmodule_end = $r->destinationstartpoint_poprackmodule_end;
// $destinationstartpoint_poprackmodule_rackid = $r->destinationstartpoint_poprackmodule_rackid;
// $destinationendpoint_poprackmodule_id = $r->destinationendpoint_poprackmodule_id;
// $destinationendpoint_poprackmodule_start = $r->destinationendpoint_poprackmodule_start;
// $destinationendpoint_poprackmodule_end = $r->destinationendpoint_poprackmodule_end;
// $destinationendpoint_poprackmodule_rackid = $r->destinationendpoint_poprackmodule_rackid;
// if (!empty($destinationstartpoint_poprackmodule_id)) {
// $counter = 0;
// $startpoint['pop_id'] = $r->destinationstartpoint_id;
// foreach ($destinationstartpoint_poprackmodule_id as $key => $poprackmodule) {
// $startpoint['data'][$counter]['rack_id'] = $destinationstartpoint_poprackmodule_rackid[$key];
// $startpoint['data'][$counter]['module_id'] = $poprackmodule;
// $startpoint['data'][$counter]['startport'] = $destinationstartpoint_poprackmodule_start[$key];
// $startpoint['data'][$counter]['endport'] = $destinationstartpoint_poprackmodule_end[$key];
// $counter++;
// }
// $startpoint = json_encode($startpoint);
// }
// if (!empty($destinationendpoint_poprackmodule_id)) {
// $counter = 0;
// $endpoint['pop_id'] = $r->destinationendpoint_id;
// foreach ($destinationendpoint_poprackmodule_id as $key => $poprackmodule) {
// $endpoint['data'][$counter]['rack_id'] = $destinationendpoint_poprackmodule_rackid[$key];
// $endpoint['data'][$counter]['module_id'] = $poprackmodule;
// $endpoint['data'][$counter]['startport'] = $destinationendpoint_poprackmodule_start[$key];
// $endpoint['data'][$counter]['endport'] = $destinationendpoint_poprackmodule_end[$key];
// $counter++;
// }
// $endpoint = json_encode($endpoint);
// }
$data = [];
$data['description'] = trim($r->description);
$data['fibers'] = trim($r->fibers);
$data['diameter'] = trim($r->diameter);
$data['lenght'] = trim($r->lenght);
$data['state'] = trim($r->state);
$data['responsible'] = trim($r->responsible);
$data['responsible_text'] = trim($r->responsible_text);
$data['address_id'] = trim($r->address_id);
$data['comment'] = trim($r->comment);
$returnUrl = "FiberPlanCable";
$returnAction = "Index";
$returnVariables = array();
$returnAnker = "";
if ($this->request->returnto) {
if (strpos($this->request->returnto, "-") !== false) {
$urls = explode('-', $this->request->returnto);
$urlCounter = 0;
$returnUrlGen = "";
foreach ($urls as $url) {
if ($urlCounter > 0) {
$returnUrlGen .= "/";
$returnUrlGen .= ucfirst($url);
} else {
$returnUrlGen .= 'FiberPlanCable';
}
$urlCounter++;
}
$returnAction = "";
$returnVariables['id'] = $id;
$returnUrl = $returnUrlGen;
} else {
$returnUrl = ucfirst($this->request->returnto);
}
}
if (!$data['description']) {
$this->layout()->setFlash("Bezeichnung darf nicht leer sein", "error");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
if (!$data['fibers']) {
$this->layout()->setFlash("Fasern darf nicht leer sein", "error");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
if (!$data['diameter']) {
$this->layout()->setFlash("Durchmesser (MM) darf nicht leer sein", "error");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
if (!$data['lenght']) {
$this->layout()->setFlash("Länge (M) darf nicht leer sein", "error");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
if (!$data['state']) {
$this->layout()->setFlash("Status darf nicht leer sein", "error");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
if (!$data['responsible']) {
$this->layout()->setFlash("Zuständig darf nicht leer sein", "error");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
if (!$data['responsible_text']) {
$data['responsible_text'] = NULL;
}
if (!$data['address_id']) {
$data['address_id'] = NULL;
}
if (!$data['comment']) {
$data['comment'] = NULL;
}
if ($mode == "edit") {
$fiberplancables->update($data);
} else {
$fiberplancables = FiberPlanCableModel::create($data);
}
$id = $fiberplancables->save();
if (!$id) {
$this->layout()->setFlash("Kabelverzeichnis konnte nicht angelegt werden", "error");
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
$fiberplanpipe = $r->fiberplanpipe;
$fiberplanpipe_id = $r->fiberplanpipe_id;
$fiberplanpipesub = $r->fiberplanpipesub;
if ($fiberplanpipe) {
$FiberPlanCablePipes = FiberPlanCablePipeModel::search(['fiberPlanCable_id' => $id]);
$counter = 1;
foreach ($fiberplanpipe as $key => $pipe) {
$data = [];
$data['fiberPlanCable_id'] = $id;
$data['fiberPlanPipe_id'] = $pipe;
$data['fiberPlanPipe_sub'] = $fiberplanpipesub[$key];
$data['sort'] = $counter;
$data['direction'] = 0;
if (is_numeric($fiberplanpipe_id[$key])) {
$fiberPlanCablePipe = new FiberPlanCablePipe($fiberplanpipe_id[$key]);
$fiberPlanCablePipe->update($data);
unset($FiberPlanCablePipes[$fiberplanpipe_id[$key]]);
} else {
$fiberPlanCablePipe = FiberPlanCablePipeModel::create($data);
}
$idfpp = $fiberPlanCablePipe->save();
$counter++;
}
foreach ($FiberPlanCablePipes as $FiberPlanCablePipe) {
$FiberPlanCablePipe->delete();
}
}
// if ($r->destinationstartpoint_poprackmodule_id) {
// PoprackmodulepatchModel::clearPort($id);
// $destinationstartpoint_poprackmodule_start = $r->destinationstartpoint_poprackmodule_start;
// $destinationstartpoint_poprackmodule_end = $r->destinationstartpoint_poprackmodule_end;
// foreach ($r->destinationstartpoint_poprackmodule_id as $key => $poprackmodule) {
// $startport = $destinationstartpoint_poprackmodule_start[$key];
// $endport = $destinationstartpoint_poprackmodule_end[$key];
// PoprackmodulepatchModel::updatebyPortRange($poprackmodule, $startport, $endport, $id);
// }
//
// }
// if ($r->destinationendpoint_poprackmodule_id) {
// PoprackmodulepatchModel::clearPort($id);
// $destinationendpoint_poprackmodule_start = $r->destinationendpoint_poprackmodule_start;
// $destinationendpoint_poprackmodule_end = $r->destinationendpoint_poprackmodule_end;
// foreach ($r->destinationendpoint_poprackmodule_id as $key => $poprackmodule) {
// $startport = $destinationendpoint_poprackmodule_start[$key];
// $endport = $destinationendpoint_poprackmodule_end[$key];
// PoprackmodulepatchModel::updatebyPortRange($poprackmodule, $startport, $endport, $id);
// }
//
// }
if ($mode == "edit") {
$this->layout()->setFlash("Kabelverzeichnis erfolgreich geändert", "success");
} else if ($mode = "add") {
$this->layout()->setFlash("Kabelverzeichnis erfolgreich angelegt", "success");
}
$this->redirect($returnUrl, $returnAction, $returnVariables, $returnAnker);
}
protected function deleteAction()
{
$id = $this->request->id;
$fiberplancables = new FiberPlanCable($id);
if (!$fiberplancables->id || $fiberplancables->id != $id) {
$this->layout()->setFlash("Kabelverzeichnis nicht gefunden.", "error");
$this->redirect("FiberPlanCable");
}
$fiberplancables->delete();
$this->redirect("FiberPlanCable");
}
}

View File

@@ -0,0 +1,424 @@
<?php
class FiberPlanCableModel
{
private $description;
private $fibers;
private $diameter;
private $fiberPlanPipe_id;
private $fiberPlanPipe_sub;
private $startpoint_rack_id;
private $endpoint_rack_id;
private $startpoint_rackmodule_id;
private $endpoint_rackmodule_id;
private $startpoint_port;
private $endpoint_port;
private $startpoint_system;
private $endpoint_system;
private $lenght;
private $state;
private $responsible;
private $responsible_text;
private $address_id;
private $network_id;
private $comment;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanCable();
foreach ($data as $field => $value) {
if (property_exists(get_called_class(), $field)) {
if (substr($field, 0, 5) == "vlan_" && !$value) {
$model->$field = null;
continue;
}
$model->$field = $value;
}
}
$me = mfValuecache::singleton()->get("me");
if (!$me) {
$me = new User();
$me->loadMe();
mfValuecache::singleton()->set("me", $me);
}
if ($model->create_by === null) {
$model->create_by = $me->id;
}
if ($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getOne($id)
{
if (!is_numeric($id) || !$id) {
throw new Exception("Invalid number", 400);
}
$item = [];
$db = FronkDB::singleton();
$res = $db->select("FiberPlanCable", "*", "id=$id LIMIT 1");
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new FiberPlanCable($data);
}
return $item;
}
public static function getAll()
{
$items = [];
$db = FronkDB::singleton();
$res = $db->select("FiberPlanCable", "*", "1=1");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new FiberPlanCable($data);
}
}
return $items;
}
public static function getFirst()
{
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("FiberPlanCable", "*", "$where ");
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new FiberPlanCable($data);
if ($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter)
{
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("FiberPlanCable", "*", "$where");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new FiberPlanCable($data);
}
}
return $items;
}
private static function getSqlFilter($filter)
{
$where = "1=1 ";
//var_dump($filter);exit;
if (array_key_exists("network_id", $filter)) {
$networkid = $filter['network_id'];
if (is_numeric($networkid)) {
$where .= " AND network_id=$networkid";
}
}
//var_dump($filter, $where);exit;
return $where;
}
public static function getFiberPlanPipe($network_id)
{
{
$items = [];
$db = FronkDB::singleton();
$sql = "SELECT * FROM `FiberPlanPipeEndpoint`";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$ok=0;
$FiberplanPipeEndpoint = new FiberPlanPipeEndpoint($data);
if ($data->fiberPlanDispatcher_id) {
if ($FiberplanPipeEndpoint->fiberPlanDispatcher->network_id == $network_id) {
$ok=1;
}
}
if ($data->building_id) {
if ($FiberplanPipeEndpoint->building->network_id == $network_id) {
$ok=1;
}
}
if ($data->pop_id) {
$sql = "SELECT id FROM PopNetwork WHERE pop_id='" . $data->pop_id . "' AND network_id='" . $network_id . "'";
$result = $db->query($sql);
if ($db->num_rows($result)) {
$ok=1;
}
}
if ($ok==1) {
$items[$FiberplanPipeEndpoint->fiberPlanPipe_id]['description'] = $FiberplanPipeEndpoint->fiberPlanPipe->description;
$items[$FiberplanPipeEndpoint->fiberPlanPipe_id]['id'] = $FiberplanPipeEndpoint->fiberPlanPipe_id;
}
}
$response['success'] = true;
$response['data'] = $items;
} else {
$response['success'] = false;
}
echo json_encode($response);
exit;
}
}
public static function getFiberPlanPipeSub($fiberplanpipe_id, $internal = 0)
{
$items = [];
$db = FronkDB::singleton();
$sql = "SELECT `FiberPlanPipe`.`id`,`type`, `type_description`, `fiberPlanPipeTemplate_id`,`pipe7x4`, `pipe14x10`,colors FROM `FiberPlanPipe`
LEFT JOIN `FiberPlanPipeTemplate` ON `FiberPlanPipeTemplate`.`id`=`FiberPlanPipe`.`fiberPlanPipeTemplate_id`
LEFT JOIN `FiberPlanPipeManufacturer` ON `FiberPlanPipeTemplate`.`fiberPlanPipeManufacturer_id`=`FiberPlanPipeManufacturer`.`id`
WHERE `FiberPlanPipe`.`id`='" . $fiberplanpipe_id . "'
";
$res = $db->query($sql);
$buildings = FiberPlanPipeModel::getBuildingInfoAll();
if ($db->num_rows($res)) {
while ($data = $db->fetch_array($res)) {
$items[] = $data;
}
$response['success'] = true;
$response['data'] = $items;
$response['variables']['type_description'] = FiberPlanPipeModel::$type_descrition_definition;
} else {
$response['success'] = false;
}
if ($internal == 0) {
echo json_encode($response);
exit;
} else {
return $response;
}
}
public static function getLineworkerAddresses()
{
$items = [];
$db = FronkDB::singleton();
$sql = "SELECT `Addresstype`.`id`,`Address`.`company` FROM `Addresstype`
INNER JOIN `Address` ON (`Address`.`id`=`Addresstype`.`address_id`)
WHERE `type` = 'lineworker' ORDER by `Address`.`company` ";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new FiberPlanCable($data);
}
}
return $items;
}
public static function generateEndpoint($endpoint, $destination, $html = 1)
{
$endpoint = json_decode($endpoint, true);
$popid = $endpoint['pop_id'];
$racks = [];
$db = FronkDB::singleton();
$sql = "SELECT `id`, `pop_id`, `name`, `he` FROM `Poprack` WHERE `pop_id`='" . $popid . "' ";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_array($res)) {
$racks[$data['id']] = $data['name'];
}
}
$sql = "SELECT `Poprackmodule`.`id`, `Poprackmodule`.`poprack_id`, `Poprackmodule`.`type`, `Poprackmodule`.`device_id`, `Poprackmodule`.`name`, `Poprackmodule`.`start_he`, `Poprackmodule`.`end_he`, `Poprackmodule`.`ports`, `Poprackmodule`.`plug`, `Poprackmodule`.`width`, `Poprackmodule`.`position`,pop_id FROM `Poprackmodule`
INNER JOIN `Poprack` ON (`Poprack`.`id`=`Poprackmodule`.`poprack_id`)
WHERE `Poprack`.`pop_id`= '" . $popid . "'";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_array($res)) {
if ($data['plug'] == 1) $plug = 'LC/APC';
elseif ($data['plug'] == 2) $plug = 'SC/APC';
elseif ($data['plug'] == 3) $plug = 'E2000/APC';
$racksmodules[$data['poprack_id']][$data['id']]['name'] = $data['name'];
$racksmodules[$data['poprack_id']][$data['id']]['plug'] = $plug;
$racksmodules[$data['poprack_id']][$data['id']]['ports'] = $data['ports'];
$racksmodules[$data['poprack_id']][$data['id']]['start_he'] = $data['start_he'];
}
}
$counter = 1;
$oldrack = "";
if ($html == "0") {
$return['racks'] = $racks;
$return['racksmodules'] = $racksmodules;
return $return;
}
foreach ($endpoint['data'] as $module) {
unset($option);
if ($counter === 1) {
foreach ($racks as $rackid => $rack) {
if ($rackid == $module['rack_id']) $selected = 'selected="selected"';
else $selected = "";
$option .= '<option ' . $selected . ' value="' . $rackid . '">' . $rack . '</option>';
}
$return = '<div class="form-group row">
<label class="col-lg-2 col-form-label" for="lenght">Schrank <i data-popid="5" class="fa-regular fa-circle-plus add-rack"></i></label>
<div class="col-lg-5">
<select name="destination' . $destination . '_poprack_id" required="required" class="select2 form-control poprack_id">' . $option . '</select>
</div>
</div>';
$return .= '<div class="destinationmodules">';
unset($option);
foreach ($racksmodules[$module['rack_id']] as $racksmoduleid => $racksmodule) {
if ($racksmoduleid == $module['module_id']) $selected = 'selected="selected"';
else $selected = "";
$option .= '<option ' . $selected . ' data-ports="' . $racksmodule['ports'] . '" value="' . $racksmoduleid . '">(HE:' . $racksmodule['start_he'] . ') ' . $racksmodule['name'] . ' (' . $racksmodule['plug'] . ' ' . $racksmodule['ports'] . 'p)</option>';
}
$return .= '<div class="form-group module-row row">
<label class="col-lg-2 col-form-label" for="lenght"><span class="fibersum">(1-24)</span><i class="fa-regular fa-circle-plus add-module" data-poprackid="3"></i></label>
<div class="col-lg-5">
<select name="destination' . $destination . '_poprackmodule_id[]" required="required" class="select2 form-control poprackmodule_id">' . $option . '</select>
</div>
<div class="col-lg-4">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="destination' . $destination . '_poprackmodule_start[]" value="' . $module["startport"] . '" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="destination' . $destination . '_poprackmodule_end[]" value="' . $module["endport"] . '" type="number" class="form-control ports-end">
<input style="display:none" name="destination' . $destination . '_poprackmodule_rackid[]" value="' . $module["rack_id"] . '" type="number" class="form-control ports-rackid">
</div>
</div></div>
</div>
</div>';
} else if ($oldrack != $module['rack_id']) {
unset($option);
foreach ($racks as $rackid => $rack) {
if ($rackid == $module['rack_id']) $selected = 'selected="selected"';
else $selected = "";
$option .= '<option ' . $selected . ' value="' . $rackid . '">' . $rack . '</option>';
}
$return .= '</div>';
$return .= '<div class="form-group row" style="border-top: 1px dotted #9b9b9b;padding-top: 15px;">
<label class="col-lg-2 col-form-label" for="lenght">Schrank <i data-popid="5" class="fa-regular fa-circle-minus remove-rack"></i></label>
<div class="col-lg-5">
<select name="destination' . $destination . '_poprack_id" required="required" class="select2 form-control poprack_id">' . $option . '</select>
</div>
</div>';
$return .= '<div class="destinationmodules">';
unset($option);
foreach ($racksmodules[$module['rack_id']] as $racksmoduleid => $racksmodule) {
if ($racksmoduleid == $module['module_id']) $selected = 'selected="selected"';
else $selected = "";
$option .= '<option ' . $selected . ' data-ports="' . $racksmodule['ports'] . '" value="' . $racksmoduleid . '">(HE:' . $racksmodule['start_he'] . ') ' . $racksmodule['name'] . ' (' . $racksmodule['plug'] . ' ' . $racksmodule['ports'] . 'p)</option>';
}
$return .= '<div class="form-group module-row row">
<label class="col-lg-2 col-form-label" for="lenght"><span class="fibersum">(1-24)</span><i class="fa-regular fa-circle-plus add-module" data-poprackid="' . $module['rack_id'] . '"></i></label>
<div class="col-lg-5">
<select name="destination' . $destination . '_poprackmodule_id[]" required="required" class="select2 form-control poprackmodule_id">' . $option . '</select>
</div>
<div class="col-lg-4">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="destination' . $destination . '_poprackmodule_start[]" value="' . $module["startport"] . '" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="destination' . $destination . '_poprackmodule_end[]" value="' . $module["endport"] . '" type="number" class="form-control ports-end">
<input style="display:none" name="destination' . $destination . '_poprackmodule_rackid[]" value="' . $module["rack_id"] . '" type="number" class="form-control ports-rackid">
</div>
</div></div>
</div>
</div>';
} else {
unset($option);
foreach ($racksmodules[$module['rack_id']] as $racksmoduleid => $racksmodule) {
if ($racksmoduleid == $module['module_id']) $selected = 'selected="selected"';
else $selected = "";
$option .= '<option ' . $selected . ' data-ports="' . $racksmodule['ports'] . '" value="' . $racksmoduleid . '">(HE:' . $racksmodule['start_he'] . ') ' . $racksmodule['name'] . ' (' . $racksmodule['plug'] . ' ' . $racksmodule['ports'] . 'p)</option>';
}
$return .= '<div class="form-group module-row row">
<label class="col-lg-2 col-form-label" for="lenght"><span class="fibersum">(1-24)</span><i class="fa-regular fa-circle-minus remove-module" data-poprackid="' . $module['rack_id'] . '"></i></label>
<div class="col-lg-5">
<select name="destination' . $destination . '_poprackmodule_id[]" required="required" class="select2 form-control poprackmodule_id">' . $option . '</select>
</div>
<div class="col-lg-4">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="destination' . $destination . '_poprackmodule_start[]" value="' . $module["startport"] . '" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="destination' . $destination . '_poprackmodule_end[]" value="' . $module["endport"] . '" type="number" class="form-control ports-end">
<input style="display:none" name="destination' . $destination . '_poprackmodule_rackid[]" value="' . $module["rack_id"] . '" type="number" class="form-control ports-rackid">
</div>
</div></div>
</div>
</div>';
}
$oldrack = $module['rack_id'];
$counter++;
}
$return .= "</div>";
return $return;
}
}

View File

@@ -0,0 +1,65 @@
<?php
class FiberPlanCableEndpoint extends mfBaseModel
{
private $editor;
private $creator;
private $fiberPlanCable;
private $poprack;
private $poprackmodule;
private $fiberPlanDispatchersleeve;
private $rack;
private $module;
public function getProperty($name)
{
if ($this->$name == null) {
if (!$this->id) {
return null;
}
if ($name == "creator") {
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
if ($this->creator === null) {
$this->creator = new User($this->create_by);
if ($this->creator->id) {
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
}
}
return $this->creator;
}
if ($name == "editor") {
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
if ($this->editor === null) {
$this->editor = new User($this->edit_by);
if ($this->editor->id) {
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
}
}
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name . "_id";
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
if (!$this->$name) {
$this->$name = new $classname($this->$idfield);
}
if ($this->$name->id) {
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
}

View File

@@ -0,0 +1,161 @@
<?php
class FiberPlanCableEndpointController extends mfBaseController
{
protected function init()
{
$this->needlogin = true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me", $me);
if (!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
}
protected function indexAction()
{
$this->layout()->setTemplate("FiberPlanCableEndpoint/Index");
$fiberplancableendpoints = FiberPlanCableEndpointModel::getAll();
$this->layout()->set("fiberplancableendpoints", $fiberplancableendpoints);
}
protected function addAction()
{
$fiberPlanCables=FiberPlanCableModel::getAll();
$this->layout()->set("fiberPlanCables", $fiberPlanCables);
$pops=PopModel::getAll();
$this->layout()->set("pops", $pops);
$racks=RackModel::getAll();
$this->layout()->set("racks", $racks);
$modules=ModuleModel::getAll();
$this->layout()->set("modules", $modules);
$fiberPlanDispatchers=FiberPlanDispatcherModel::getAll();
$this->layout()->set("fiberPlanDispatchers", $fiberPlanDispatchers);
$buildings=BuildingModel::getAll();
$this->layout()->set("buildings", $buildings);
$this->layout()->setTemplate("FiberPlanCableEndpoint/Form");
}
protected function editAction()
{
$id = $this->request->id;
if (!is_numeric($id) || !$id) {
$this->layout()->setFlash("f nicht gefunden", "error");
$this->redirect("FiberPlanCableEndpoint");
}
$fiberplancableendpoints = new FiberPlanCableEndpoint($id);
if ($fiberplancableendpoints->id != $id) {
$this->layout()->setFlash("f nicht gefunden", "error");
$this->redirect("FiberPlanCableEndpoint");
}
$this->layout()->set("fiberplancableendpoints", $fiberplancableendpoints);
return $this->addAction();
}
protected function saveAction()
{
$r = $this->request;
$id = $r->id;
//var_dump($r->get());exit;
if (is_numeric($id) && $id > 0) {
$mode = "edit";
$fiberplancableendpoints = new FiberPlanCableEndpoint($id);
if (!$fiberplancableendpoints->id) {
$this->layout()->setFlash("f nicht gefunden", "error");
$this->redirect("FiberPlanCableEndpoint");
}
} else {
$mode = "add";
}
$data = [];
$data['fiberPlanCable_id'] = trim($r->fiberPlanCable_id);
$data['pop_id'] = trim($r->pop_id);
$data['rack_id'] = trim($r->rack_id);
$data['module_id'] = trim($r->module_id);
$data['fiberPlanDispatcher_id'] = trim($r->fiberPlanDispatcher_id);
$data['building_id'] = trim($r->building_id);
$data['startport'] = trim($r->startport);
$data['endport'] = trim($r->endport);
if (!$data['fiberPlanCable_id']) {
$data['fiberPlanCable_id']=NULL;
}
if (!$data['pop_id']) {
$data['pop_id']=NULL;
}
if (!$data['rack_id']) {
$data['rack_id']=NULL;
}
if (!$data['module_id']) {
$data['module_id']=NULL;
}
if (!$data['fiberPlanDispatcher_id']) {
$data['fiberPlanDispatcher_id']=NULL;
}
if (!$data['building_id']) {
$data['building_id']=NULL;
}
if (!$data['startport']) {
$data['startport']=NULL;
}
if (!$data['endport']) {
$data['endport']=NULL;
}
// var_dump($_FILES);
// var_dump($upload);
// exit;
if ($mode == "edit") {
$fiberplancableendpoints->update($data);
} else {
$fiberplancableendpoints = FiberPlanCableEndpointModel::create($data);
}
// var_dump($filestore);
// exit;
$id = $fiberplancableendpoints->save();
if (!$id) {
$this->layout()->setFlash("f konnte nicht angelegt werden", "error");
$this->redirect("FiberPlanCableEndpoint");
}
if ($mode == "edit") {
$this->layout()->setFlash("f erfolgreich geändert", "success");
} else if ($mode = "add") {
$this->layout()->setFlash("f erfolgreich angelegt", "success");
}
$this->redirect("FiberPlanCableEndpoint");
}
protected function deleteAction()
{
$id = $this->request->id;
$fiberplancableendpoints = new FiberPlanCableEndpoint($id);
if (!$fiberplancableendpoints->id || $fiberplancableendpoints->id != $id) {
$this->layout()->setFlash("f nicht gefunden.", "error");
$this->redirect("FiberPlanCableEndpoint");
}
$fiberplancableendpoints->delete();
$this->redirect("FiberPlanCableEndpoint");
}
}

View File

@@ -0,0 +1,131 @@
<?php
class FiberPlanCableEndpointModel
{
private $fiberPlanCable_id;
private $pop_id;
private $rack_id;
private $module_id;
private $fiberPlanDispatcher_id;
private $building_id;
private $startport;
private $endport;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanCableEndpoint();
foreach ($data as $field => $value) {
if (property_exists(get_called_class(), $field)) {
if (substr($field, 0, 5) == "vlan_" && !$value) {
$model->$field = null;
continue;
}
$model->$field = $value;
}
}
$me = mfValuecache::singleton()->get("me");
if (!$me) {
$me = new User();
$me->loadMe();
mfValuecache::singleton()->set("me", $me);
}
if ($model->create_by === null) {
$model->create_by = $me->id;
}
if ($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getOne($id)
{
if (!is_numeric($id) || !$id) {
throw new Exception("Invalid number", 400);
}
$item = [];
$db = FronkDB::singleton();
$res = $db->select("FiberPlanCableEndpoint", "*", "id=$id LIMIT 1");
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new FiberPlanCableEndpoint($data);
}
return $item;
}
public static function getAll()
{
$items = [];
$db = FronkDB::singleton();
$res = $db->select("FiberPlanCableEndpoint", "*", "1=1");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new FiberPlanCableEndpoint($data);
}
}
return $items;
}
public static function getFirst()
{
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("FiberPlanCableEndpoint", "*", "$where ");
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new FiberPlanCableEndpoint($data);
if ($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter)
{
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("FiberPlanCableEndpoint", "*", "$where");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[$data->fiberPlanPipeEndpoint_id][] = new FiberPlanCableEndpoint($data);
}
}
return $items;
}
private static function getSqlFilter($filter)
{
$where = "1=1 ";
//var_dump($filter);exit;
if (array_key_exists("fiberPlanCable_id", $filter)) {
$fiberPlanCable_id = $filter['fiberPlanCable_id'];
if (is_numeric($fiberPlanCable_id)) {
$where .= " AND fiberPlanCable_id=$fiberPlanCable_id ORDER by sort";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -0,0 +1,61 @@
<?php
class FiberPlanCablePipe extends mfBaseModel
{
private $editor;
private $creator;
private $fiberPlanCable;
private $fiberPlanPipe;
public function getProperty($name)
{
if ($this->$name == null) {
if (!$this->id) {
return null;
}
if ($name == "creator") {
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
if ($this->creator === null) {
$this->creator = new User($this->create_by);
if ($this->creator->id) {
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
}
}
return $this->creator;
}
if ($name == "editor") {
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
if ($this->editor === null) {
$this->editor = new User($this->edit_by);
if ($this->editor->id) {
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
}
}
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name . "_id";
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
if (!$this->$name) {
$this->$name = new $classname($this->$idfield);
}
if ($this->$name->id) {
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
return $this->$name;
} else {
return null;
}
}
return $this->$name;
}
}

View File

@@ -0,0 +1,137 @@
<?php
class FiberPlanCablePipeController extends mfBaseController
{
protected function init()
{
$this->needlogin = true;
$me = new User();
$me->loadMe();
$this->me = $me;
$this->layout()->set("me", $me);
if (!$me->is(["Admin"])) {
$this->redirect("Dashboard");
}
}
protected function indexAction()
{
$this->layout()->setTemplate("FiberPlanCablePipe/Index");
$fiberplancablepipes = FiberPlanCablePipeModel::getAll();
$this->layout()->set("fiberplancablepipes", $fiberplancablepipes);
}
protected function addAction()
{
$fiberPlanCables=FiberPlanCableModel::getAll();
$this->layout()->set("fiberPlanCables", $fiberPlanCables);
$fiberPlanPipes=FiberPlanPipeModel::getAll();
$this->layout()->set("fiberPlanPipes", $fiberPlanPipes);
$this->layout()->setTemplate("FiberPlanCablePipe/Form");
}
protected function editAction()
{
$id = $this->request->id;
if (!is_numeric($id) || !$id) {
$this->layout()->setFlash("Faserplanpipe nicht gefunden", "error");
$this->redirect("FiberPlanCablePipe");
}
$fiberplancablepipes = new FiberPlanCablePipe($id);
if ($fiberplancablepipes->id != $id) {
$this->layout()->setFlash("Faserplanpipe nicht gefunden", "error");
$this->redirect("FiberPlanCablePipe");
}
$this->layout()->set("fiberplancablepipes", $fiberplancablepipes);
return $this->addAction();
}
protected function saveAction()
{
$r = $this->request;
$id = $r->id;
//var_dump($r->get());exit;
if (is_numeric($id) && $id > 0) {
$mode = "edit";
$fiberplancablepipes = new FiberPlanCablePipe($id);
if (!$fiberplancablepipes->id) {
$this->layout()->setFlash("Faserplanpipes nicht gefunden", "error");
$this->redirect("FiberPlanCablePipe");
}
} else {
$mode = "add";
}
$data = [];
$data['fiberPlanCable_id'] = trim($r->fiberPlanCable_id);
$data['fiberPlanPipe_id'] = trim($r->fiberPlanPipe_id);
$data['fiberPlanPipe_sub'] = trim($r->fiberPlanPipe_sub);
$data['sort'] = trim($r->sort);
if (!$data['fiberPlanCable_id']) {
$data['fiberPlanCable_id']=NULL;
}
if (!$data['fiberPlanPipe_id']) {
$data['fiberPlanPipe_id']=NULL;
}
if (!$data['fiberPlanPipe_sub']) {
$data['fiberPlanPipe_sub']=NULL;
}
if (!$data['sort']) {
$data['sort']=NULL;
}
// var_dump($_FILES);
// var_dump($upload);
// exit;
if ($mode == "edit") {
$fiberplancablepipes->update($data);
} else {
$fiberplancablepipes = FiberPlanCablePipeModel::create($data);
}
// var_dump($filestore);
// exit;
$id = $fiberplancablepipes->save();
if (!$id) {
$this->layout()->setFlash("Faserplanpipe konnte nicht angelegt werden", "error");
$this->redirect("FiberPlanCablePipe");
}
if ($mode == "edit") {
$this->layout()->setFlash("Faserplanpipe erfolgreich geändert", "success");
} else if ($mode = "add") {
$this->layout()->setFlash("Faserplanpipe erfolgreich angelegt", "success");
}
$this->redirect("FiberPlanCablePipe");
}
protected function deleteAction()
{
$id = $this->request->id;
$fiberplancablepipes = new FiberPlanCablePipe($id);
if (!$fiberplancablepipes->id || $fiberplancablepipes->id != $id) {
$this->layout()->setFlash("Faserplanpipe nicht gefunden.", "error");
$this->redirect("FiberPlanCablePipe");
}
$fiberplancablepipes->delete();
$this->redirect("FiberPlanCablePipe");
}
}

View File

@@ -0,0 +1,129 @@
<?php
class FiberPlanCablePipeModel
{
private $fiberPlanCable_id;
private $fiberPlanPipe_id;
private $fiberPlanPipe_sub;
private $direction;
private $sort;
public static function find($data)
{
}
public static function create(array $data)
{
$model = new FiberPlanCablePipe();
foreach ($data as $field => $value) {
if (property_exists(get_called_class(), $field)) {
if (substr($field, 0, 5) == "vlan_" && !$value) {
$model->$field = null;
continue;
}
$model->$field = $value;
}
}
$me = mfValuecache::singleton()->get("me");
if (!$me) {
$me = new User();
$me->loadMe();
mfValuecache::singleton()->set("me", $me);
}
if ($model->create_by === null) {
$model->create_by = $me->id;
}
if ($model->edit_by === null) {
$model->edit_by = $me->id;
}
return $model;
}
public static function getOne($id)
{
if (!is_numeric($id) || !$id) {
throw new Exception("Invalid number", 400);
}
$item = [];
$db = FronkDB::singleton();
$res = $db->select("FiberPlanCablePipe", "*", "id=$id LIMIT 1");
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new FiberPlanCablePipe($data);
}
return $item;
}
public static function getAll()
{
$items = [];
$db = FronkDB::singleton();
$res = $db->select("FiberPlanCablePipe", "*", "1=1");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new FiberPlanCablePipe($data);
}
}
return $items;
}
public static function getFirst()
{
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("FiberPlanCablePipe", "*", "$where ");
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new FiberPlanCablePipe($data);
if ($item->id) {
return $item;
} else {
return null;
}
}
return null;
}
public static function search($filter)
{
$items = [];
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("FiberPlanCablePipe", "*", "$where");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[$data->id] = new FiberPlanCablePipe($data);
}
}
return $items;
}
private static function getSqlFilter($filter)
{
$where = "1=1 ";
//var_dump($filter);exit;
if (array_key_exists("fiberPlanCable_id", $filter)) {
$fiberPlanCable_id = $filter['fiberPlanCable_id'];
if (is_numeric($fiberPlanCable_id)) {
$where .= " AND fiberPlanCable_id=$fiberPlanCable_id ORDER by sort";
}
}
//var_dump($filter, $where);exit;
return $where;
}
}

View File

@@ -95,6 +95,33 @@ class FiberPlanPipeEndpointModel
return null;
}
public static function searchNetworks($filter)
{
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("FiberPlanPipeEndpoint", "*", "$where ORDER by sort LIMIT 1");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$FiberplanPipeEndpoint = new FiberPlanPipeEndpoint($data);
if ($data->pop_id) {
$sql = "SELECT network_id FROM PopNetwork WHERE pop_id='" . $data->pop_id . "' LIMIT 1";
$result = $db->query($sql);
$fetch = $db->fetch_object($result);
$item = (string) $fetch->network_id;
}
if ($data->fiberPlanDispatcher_id) {
$item = (string) $FiberplanPipeEndpoint->fiberPlanDispatcher->network_id;
}
if ($data->building_id) {
$item = (string) $FiberplanPipeEndpoint->building->network_id;
}
}
}
return $item;
}
public static function search($filter)
{
$items = [];

View File

@@ -53,6 +53,8 @@ class FiberPlanPipeManufacturerModel
$res = $db->select("FiberPlanPipeManufacturer", "*", "id=$id LIMIT 1");
if ($db->num_rows($res)) {
$data = $db->fetch_object($res);
$colors=json_decode($data->colors);
$data->colors=$colors;
$item = new FiberPlanPipeManufacturer($data);
}
return $item;

View File

@@ -102,7 +102,7 @@ class FiberPlanPipeTemplateModel
$res = $db->select("FiberPlanPipeTemplate", "*", "$where");
if ($db->num_rows($res)) {
while ($data = $db->fetch_object($res)) {
$items[] = new FiberPlanPipeTemplate($data);
$items[$data->id] = new FiberPlanPipeTemplate($data);
}
}
return $items;

View File

@@ -73,5 +73,30 @@ class PoprackmoduleModel
exit;
}
public static function getpoprackmoduleall($pop_id)
{
$items = [];
$db = FronkDB::singleton();
$sql = "SELECT `Poprackmodule`.`id`, `Poprackmodule`.`name`, `Poprackmodule`.`start_he`,`Poprackmodule`.`end_he`,`Poprackmodule`.`plug`,`Poprackmodule`.`ports`,`Poprack`.id poprackid ,`Poprack`.name poprackname FROM `Poprackmodule` INNER JOIN
`Poprack` ON (`Poprack`.`id` = `Poprackmodule`.`poprack_id`)
WHERE `Poprack`.`pop_id`='" . $pop_id . "' AND `Poprackmodule`.`type` ='0' ORDER by `Poprack`.`sort`,`Poprackmodule`.`start_he`,`Poprackmodule`.`position`";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_array($res)) {
$items[$data['poprackname']][] = $data;
}
$response['data'] = $items;
$response['success'] = true;
} else {
$response['success'] = false;
}
echo json_encode($response);
exit;
}
}

View File

@@ -8,7 +8,6 @@ final class FiberPlanCable extends AbstractMigration
{
if ($this->getEnvironment() == "thetool") {
$table = $this->table("FiberPlanCable", ["signed" => true]);
$table->addColumn("description", "text", ["null" => false]);
$table->addColumn("fibers", "integer", ["null" => false]);
$table->addColumn("diameter", "integer", ["null" => false]);

View File

@@ -0,0 +1,960 @@
const poprackmodulesoption = {};
function checkendpoints() {
let endpointcounter = $('.fiberplanpipe-label').length;
let endpointtext;
$('.fiberplanpipe-label').each(function (index) {
$(this).find('.move-endpoint-up').remove();
$(this).find('.move-endpoint-down').remove();
$(this).find('.remove-endpoint').remove();
if (index == 0 && endpointcounter - 1 == 0) {
// endpointtext = "Startpunkt";
} else if (index == 0) {
$(this).closest('.fiberplanpipe-label').find('.label-text').after('<i data-index=' + index + ' title="nach unten verschieben" class="fa-sharp fa-solid fa-down move-endpoint-down"></i>');
} else if (endpointcounter == 2) {
endpointtext = 'Standort ' + index;
$(this).closest('.fiberplanpipe-label').find('.label-text').after('<i title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('<i data-index=' + index + ' class="fa-regular fa-circle-minus remove-endpoint"></i>');
} else if (endpointcounter - 1 == index) {
endpointtext = 'Standort ' + index;
$(this).closest('.fiberplanpipe-label').find('.label-text').after('<i data-index=' + index + ' style="margin-right:22px;" title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('<i data-index=' + index + ' class="fa-regular fa-circle-minus remove-endpoint"></i>');
} else if (index > 0) {
endpointtext = 'Standort ' + index;
$(this).closest('.fiberplanpipe-label').find('.label-text').after('<i data-index=' + index + ' title="nach unten verschieben" class="fa-sharp fa-solid fa-down move-endpoint-down"></i><i data-index=' + index + ' title="nach oben verschieben" class="fa-sharp fa-solid fa-up move-endpoint-up"></i>');
$(this).find('.endpointsymbol').html('<i data-index=' + index + ' class="fa-regular fa-circle-minus remove-endpoint"></i>');
}
// $(this).find('.label-text').text(endpointtext + ' *');
});
}
function checkracks() {
$.each($('.fiberplanpipe-pop-racks'), function (index, value) {
var option = "<option></option>";
var thisis = $(this);
$.getJSON(poprackmoduleallUrl + "&pop_id=" + $(this).data('popid'), {})
.done(function (data) {
if (data.success) {
var plug;
$.each(data.data, function (k, val) {
option = option + '<optgroup label="Rack: ' + k + '">';
$.each(val, function (key, value) {
if (value.plug == "1") {
plug = " (LC/APC)";
} else if (value.plug == "2") {
plug = " (SC/APC)";
} else if (value.plug == "3") {
plug = " (E2000/APC)";
}
option = option + '<option data-ports="' + value.ports + '" value="' + value.id + '">HE(' + value.start_he + ') ' + value.name + ' (1-' + value.ports + ')' + plug + '</option>';
})
option = option + "</optgroup>";
});
}
thisis.closest('.fiberplancableendpoint-div').find('.poprackmodule_id').html(option);
$.each(thisis.closest('.fiberplancableendpoint-div').find('.poprackmodule_id'), function (index, value) {
if ($(this).data('poprackmodule_id') != "undefined") {
$(this).val($(this).data('poprackmodule_id'));
$(this).trigger("change", "1");
}
});
}
)
.done(function (data) {
});
});
}
function checksleeves() {
$.each($('.fiberplanpipe-dispatcher-sleeves'), function (index, value) {
var option = "<option></option>";
var thisis = $(this);
$.getJSON(dispatchersleeveUrl + "&dispatcher_id=" + $(this).data('id'), {})
.done(function (data) {
if (data.success) {
$.each(data.data, function (k, val) {
option = option + '<option value="' + val.id + '">' + val.name + '</option>';
});
thisis.closest('.fiberplancableendpoint-div').find('.sleeveid').html(option);
$.each(thisis.closest('.fiberplancableendpoint-div').find('.fiberplandispatcher_id'), function (index, value) {
if ($(this).data('id') != "undefined") {
$(this).val($(this).data('id'));
$(this).trigger("change", "1");
}
});
}
});
});
}
function checkusedfibers(trigger) {
var destination = trigger.closest('.fiberplanpipe-body-div').find('.module-row');
var fibercounter = 0;
var sumstart;
var sumend;
destination.each(function (index) {
sumstart = fibercounter + 1;
if (parseInt($(this).find('.ports-end').val()) && parseInt($(this).find('.ports-start').val())) {
fibercounter = fibercounter + parseInt($(this).find('.ports-end').val()) - parseInt($(this).find('.ports-start').val()) + 1;
sumend = fibercounter;
$(this).find('.fibersum').text('(' + sumstart + '-' + sumend + ')');
}
});
trigger.closest('.destinationpoint').find('.fiber-used').text(fibercounter);
}
function checkusedpipes() {
var counter = 0;
$.each($('.fiberplanpipesub'), function (index, value) {
$('.fiberplanpipe-subpipe').eq(counter).html($(this).next('span').find('.select2-selection__rendered').html());
counter++;
});
}
function formatState(state) {
if (!state.id || !state.title) {
return state.text;
}
const titleArray = state.title.split(";");
var title = titleArray[0];
var titlestripe = titleArray[1];
var border = 'border:none;'
if (title == "#ffffff" || title == "#ffff01" || title == "#01ffff") {
border = 'border:1px solid #9d9d9d;';
}
var height = '10px';
var striped = '';
if (titlestripe == 1) {
striped = 'style="background-color: #000;height: 100%;width: 45%;text-align: center;margin-left: auto;margin-right: auto;"';
}
if (state.text.indexOf("14x10") != -1) {
height = "12px";
}
var returnstate = $(
'<div style="display: inline-block;width: 50px;background-color: ' + title + '; border-radius: 14px; height: ' + height + ';' + border + '"><div ' + striped + '></div></div><div style="margin-left:5px;display: inline-block;">' + state.text + '</div>'
);
return returnstate;
};
function generateDestinationmid(destinations, destinationtype, destinationdiv, param = 0, append = 0) {
var destination_typename = "Schächte/Verteiler";
var randid;
$('#' + destinationdiv).append(` <div class="destination-dropdown row">
<i class="fa-solid fa-square-caret-up "></i><h4>` + destinationtype + ` (` + destination_typename + `) </h4>
</div>`);
console.log(destinations);
$.each(destinations, function (index, destination) {
var destination_typename = destination.typename;
var destination_type = destination.type;
if (destination.typename === undefined) {
destination_type = "4";
}
if (append === 0) {
var addsleevebutton = "";
if (destination_type == "4") {
addsleevebutton = '<i data-popid="' + destination.id + '" class="fa-regular fa-circle-plus add-sleeve"></i>';
}
}
if (destination_type == "4") {
randid = Math.floor(Math.random() * 10000);
$('#' + destinationdiv).append(`
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="comment">Name` + addsleevebutton + `</label>
<div class="col-lg-6 col-form-label"><span id="` + destinationdiv + `-id" data-id="` + destination.id + `">` + destination.name + `<input type="hidden" name="` + destinationdiv + `_id" value="` + destination.id + `"> </span></div>
</div>
<div id="` + randid + `_sleeves_div"> </div>
`);
console.log(randid);
var sleeveoptions = '<option value="">&nbsp;</option>';
$.each(destination.sleeves, function (k, val) {
console.log(val);
sleeveoptions = sleeveoptions + '<option value="' + k + '">' + val + '</option>';
});
$('#' + randid + '_sleeves_div').append(`<div class="form-group row">
<label class="col-lg-3 col-form-label" for="lenght">Muffe </label>
<div class="col-lg-5">
<select name="` + destinationdiv + `_sleeve_id[]" required="required" class="select2 form-control sleeveid">` + sleeveoptions + `</select>
</div>
<div class="col-lg-3">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="` + destinationdiv + `_sleeve_start[]" value="1" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="` + destinationdiv + `_sleeve_end[]" value="48" type="number" class="form-control ports-end">
</div>
</div></div>
</div> </div>
`);
}
});
};
function generateDestination(destination, destinationtype, destinationdiv, param = 0, append = 0) {
var destination_typename = destination.typename;
var destination_type = destination.type;
if (destination.typename === undefined) {
destination_typename = "Schächte";
destination_type = "4";
}
if (append === 0) {
var addsleevebutton = "";
if (destination_type == "4") {
addsleevebutton = '<i data-popid="' + destination.id + '" class="fa-regular fa-circle-plus add-sleeve"></i>';
}
$('#' + destinationdiv).append(`
<div class="destination-dropdown row">
<i class="fa-solid fa-square-caret-up "></i><h4>` + destinationtype + ` (` + destination_typename + `) </h4>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="comment">Name` + addsleevebutton + `</label>
<div class="col-lg-6 col-form-label"><span id="` + destinationdiv + `-id" data-id="` + destination.id + `">` + destination.name + `<input type="hidden" name="` + destinationdiv + `_id" value="` + destination.id + `"> </span></div>
</div>
`);
}
if (destination_type == "4") {
$.getJSON(dispatchersleeveUrl + "&dispatcher_id=" + destination.id, {})
.done(function (data) {
if (data.success) {
var sleeveoptions = '<option value="">&nbsp;</option>';
$.each(data.data, function (k, val) {
sleeveoptions = sleeveoptions + '<option value="' + val.id + '">' + val.name + '</option>';
});
console.log(destinationdiv);
$('#' + destinationdiv).append(`<div class="form-group row">
<label class="col-lg-3 col-form-label" for="lenght">Muffe </label>
<div class="col-lg-5">
<select name="` + destinationdiv + `_sleeve_id[]" required="required" class="select2 form-control sleeveid">` + sleeveoptions + `</select>
</div>
<div class="col-lg-3">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="` + destinationdiv + `_sleeve_start[]" value="1" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="` + destinationdiv + `_sleeve_end[]" value="48" type="number" class="form-control ports-end">
</div>
</div></div>
</div> </div>
`);
}
})
}
if (destination_type == "2") {
destinationname = destination.name;
var popid = destination.id;
$.getJSON(poprackUrl + "&pop_id=" + destination.id, {})
.done(function (data) {
if (data.success) {
var fibers = $('#fibers').find(':selected').data('fibers');
if (fibers === undefined) {
fibers = 0;
}
var rackoptions = '<option value="">&nbsp;</option>';
$.each(data.data, function (k, val) {
rackoptions = rackoptions + '<option value="' + val.id + '">' + val.name + '</option>';
});
if (append === 0) {
$('#' + destinationdiv).append(`<div class="form-group row">
<label class="col-lg-3 col-form-label" for="lenght">Fasern </i></label>
<div class="col-lg-6 col-form-label"><span class="fiber-used">0 </span><span > von </span><span class="fiber-counter">` + fibers + `</span> Fasern aufgelegt</div>
</div>`);
if (param == 0) {
$('#' + destinationdiv).append(`<div class="form-group row">
<label class="col-lg-3 col-form-label" for="lenght">Schrank <i data-popid="` + popid + `" class="fa-regular fa-circle-plus add-rack"></i></label>
<div class="col-lg-5">
<select name="` + destinationdiv + `_poprack_id" required="required" class="select2 form-control poprack_id">` + rackoptions + `</select>
</div>
</div>`);
} else if (param == 1) {
if (destinationdiv == 'destinationendpoint') {
var dest = destinationendpoint;
}
if (destinationdiv == 'destinationstartpoint') {
var dest = destinationstartpoint;
}
$('#' + destinationdiv).append(dest);
checkusedfibers($('#' + destinationdiv));
}
} else if (append === 1) {
console.log('cool');
$('#' + destinationdiv).append(`<div class="form-group row" style="border-top: 1px dotted #9b9b9b;padding-top: 15px;">
<label class="col-lg-3 col-form-label" for="lenght">Schrank <i data-popid="` + popid + `" class="fa-regular fa-circle-minus remove-rack"></i></label>
<div class="col-lg-5">
<select name="` + destinationdiv + `_poprack_id" required="required" class="select2 form-control poprack_id">` + rackoptions + `</select>
</div>
</div>`);
}
} else {
$('#' + destinationdiv).append(`
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="lenght">Schrank </label>
<div class="col-lg-6">
<div class="col-form-label">Keine Schränke vorhanden.</div>
</div>
</div>`);
}
}
)
.done(function (data) {
$('#' + destinationdiv).append(`<div class="destinationmodules"></div>`);
});
}
}
function addModule(thistrigger, poprackid, append = 0, param = 0, selected = null, startport = null, endport = null, popid = null) {
if (popid) {
$.getJSON(poprackUrl + "&pop_id=" + popid, {})
.done(function (data) {
if (data.success) {
var rackoptions = '<option value="">&nbsp;</option>';
$.each(data.data, function (k, val) {
rackoptions = rackoptions + '<option value="' + val.id + '">' + val.name + '</option>';
});
console.log('cool1');
$('#destinationstartpoint').append(`<div class="form-group row" style="border-top: 1px dotted #9b9b9b;padding-top: 15px;">
<label class="col-lg-3 col-form-label" for="lenght">Schrank <i data-popid="` + popid + `" class="fa-regular fa-circle-minus remove-rack"></i></label>
<div class="col-lg-5">
<select name="` + poprackid + `_poprack_id" required="required" class="select2 form-control poprack_id">` + rackoptions + `</select>
</div>
</div>`);
$('#destinationstartpoint').append(`<div class="destinationmodules"></div>`);
thistrigger = thistrigger.nextAll().eq(1);
}
});
}
$.getJSON(poprackmoduleUrl + "&poprack_id=" + poprackid, {})
.done(function (data) {
if (data.success) {
var options = "";
var rackoptions = '<option value="">&nbsp;</option>';
var systemoption;
var plug;
var portsstart = 1;
var portsend;
var counter = 1;
$.each(data.data, function (k, val) {
if (counter == 1) {
portsend = val.ports;
}
if (val.plug == "1") {
systemoption = " (LC/APC " + val.ports + "p)";
} else if (val.plug == "2") {
systemoption = " (SC/APC " + val.ports + "p)";
} else if (val.plug == "3") {
systemoption = " (E2000/APC " + val.ports + "p)";
} else {
systemoption = "";
}
if (selected && selected == val.id) {
options = options + '<option selected="selected" data-ports="' + val.ports + '" value="' + val.id + '">' + '(HE:' + val.start_he + ") " + val.name + systemoption + '</option>';
} else {
options = options + '<option data-ports="' + val.ports + '" value="' + val.id + '">' + '(HE:' + val.start_he + ") " + val.name + systemoption + '</option>';
}
counter++;
});
if (startport) {
portsstart = startport;
}
if (endport) {
portsend = endport;
}
var destinationpoint = thistrigger.closest('.destinationpoint').attr('id');
var html;
if (append === 0) {
html = `<div class="form-group module-row row">
<label class="col-lg-3 col-form-label" for="lenght"><span class="fibersum"></span><i class="fa-regular fa-circle-plus add-module" data-poprackid="` + poprackid + `"></i></label>`;
} else if (append === 1) {
html = `<div class="form-group module-row row">
<label class="col-lg-3 col-form-label" for="lenght"><span class="fibersum"></span><i class="fa-regular fa-circle-minus remove-module"></i><i class="fa-solid fa-arrow-up up-module"></i></label>`;
}
html = html + `
<div class="col-lg-5">
<select name="` + destinationpoint + `_poprackmodule_id[]" required="required" class="select2 form-control poprackmodule_id">` + options + `</select>
</div>
<div class="col-lg-3">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="` + destinationpoint + `_poprackmodule_start[]" value="` + portsstart + `" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="` + destinationpoint + `_poprackmodule_end[]" value="` + portsend + `" type="number" class="form-control ports-end">
<input style="display:none" name="` + destinationpoint + `_poprackmodule_rackid[]" value="` + poprackid + `" type="number" class="form-control ports-rackid">
</div>
</div></div>
</div>
</div>`;
if (append === 0) {
thistrigger.closest('.form-group').next().html(html);
} else if (append === 1) {
thistrigger.append(html);
}
} else {
thistrigger.closest('.form-group').next().html(`
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="lenght"></label>
<div class="col-lg-6 text-center">
Keine Einschübe in diesem Schrank vorhanden
</div>
</div>`);
}
checkusedfibers(thistrigger);
})
}
$(document).ready(function () {
$(".select2").select2({placeholder: ""});
$(".select2select").select2({placeholder: ""});
$("#fiberplanpipesub").select2({
placeholder: "",
templateResult: formatState,
templateSelection: formatState
});
// disable mousewheel on a input number field when in focus
$('form').on('focus', 'input[type=number]', function (e) {
$(this).on('wheel.disableScroll', function (e) {
e.preventDefault()
})
});
$('form').on('blur', 'input[type=number]', function (e) {
$(this).off('wheel.disableScroll')
});
$("body").on("change", ".pipe-network", function (event, param = 0) {
var thisis = $(this);
var options = '<option value="">&nbsp;</option>';
$.getJSON(fiberPlanPipeUrl + "&network_id=" + $.trim($(this).val()), {})
.done(function (data) {
if (data.success) {
$.each(data.data, function (k, val) {
options = options + '<option value="' + val.id + '">' + val.description + '</option>';
});
$(thisis).closest(".form-group").find('.pipe-div').html('<select name="fiberplanpipe[]" required="required" class="select2select form-control fiberPlanPipe_id">' + options + '</select><input type="hidden" name="fiberplanpipe_id[]" class="fiberplanpipe_id" value="x">');
if (param == 1 && pipes.length == $('.fiberPlanPipe_id').length) {
var counter = 0;
pipes.forEach(function (value, index) {
$('.fiberPlanPipe_id').eq(counter).val(value);
$('.fiberplanpipe_id').eq(counter).val(pipesid[counter]);
$('.fiberPlanPipe_id').eq(counter).trigger("change", "1");
checkendpoints();
counter++;
});
}
$(".select2select").select2({placeholder: ""});
}
});
});
$("body").on("change", "#network_id", function (event, param = 0) {
var options = '<option value="">&nbsp;</option>';
$('#destination-div').empty();
$('#destination-div').append('<div id="destinationstartpoint"></div><div id="destinationmidpoint"></div><div id="destinationendpoint"></div>');
$.getJSON(fiberPlanPipeUrl + "&network_id=" + $.trim($(this).val()), {})
.done(function (data) {
if (data.success) {
$.each(data.data, function (k, val) {
options = options + '<option value="' + val.id + '">' + val.description + '</option>';
});
$('#subpipe-div').empty();
$('#pipe-div').empty();
$('#pipe-div').append('<select id="fiberPlanPipe_id" name="fiberplanpipe[]" required="required" class="select2 form-control">' + options + '</select>');
if (param == 1) {
// $("#fiberPlanPipe_id option[value=<?php echo $fiberplancables->fiberPlanPipe_id; ?>]").attr('selected', 'selected');
if ($('#fiberPlanPipe_id').val()) {
$("#fiberPlanPipe_id").trigger("change", "1")
}
}
$(".select2").select2({placeholder: ""});
$("#fiberplanpipesub").select2({
placeholder: "",
templateResult: formatState,
templateSelection: formatState
});
} else {
$('#subpipe-div').empty();
$('#pipe-div').html('<p class="text-center font-weight-500">Keine Rohre in diesem Netzgebiet vorhanden.</p>');
}
});
});
$("body").on("change", ".fiberPlanPipe_id", function (event, param = 0) {
// console.log(param);
var options = '<option value="">&nbsp;</option>';
var thisis = $(this);
$('#destination-div').empty();
$('#destination-div').append('<div id="destinationstartpoint" class="destinationpoint"></div><div id="destinationmidpoint" class="destinationpoint"></div><div id="destinationendpoint" class="destinationpoint"></div>');
$.getJSON(fiberPlanPipeSubUrl + "&fiberplanpipe_id=" + $.trim($(thisis).val()), {})
.done(function (data) {
if (data.success) {
$.each(data.data, function (k, val) {
var idcounter = 0;
var color;
// generateDestination(val.startpointname, "Startpunkt", "destinationstartpoint", param);
// generateDestinationmid(val.midpointname, "Zwischenpunkte", "destinationmidpoint", param);
//generateDestination(val.endpointname, "Endpunkt", "destinationendpoint", param);
if (val.fiberPlanPipeTemplate_id != null) {
var obj = jQuery.parseJSON(val.colors);
if (val.pipe7x4 != "0" && val.pipe7x4 != null) {
var counter = val.pipe7x4;
}
$.each(obj, function (key, col) {
if (counter == 0) {
return true;
}
color = col.color + ';0';
idcounter++;
options = options + '<option title="' + color + '" value="' + idcounter + '"> 7x4 (' + col.colordescription + ')</option>';
counter--;
});
if (counter != 0) {
$.each(obj, function (key, col) {
if (counter == 0) {
return true;
}
color = col.color + ';1';
idcounter++;
options = options + '<option title="' + color + '" value="' + idcounter + '"> 7x4 (' + col.colordescstriped + ')</option>';
counter--;
});
}
if (val.pipe14x10 != "0" && val.pipe14x10 != null) {
var counter = val.pipe14x10;
}
$.each(obj, function (key, col) {
if (counter == 0) {
return true;
}
color = col.color + ';0';
idcounter++;
options = options + '<option title="' + color + '" value="' + idcounter + '"> 14x10 (' + col.colordescription + ')</option>';
counter--;
});
if (counter != 0) {
$.each(obj, function (key, col) {
if (counter == 0) {
return true;
}
color = col.color + ';1';
idcounter++;
options = options + '<option title="' + color + '" value="' + idcounter + '"> 14x10 (' + col.colordescstriped + ')</option>';
counter--;
});
}
} else {
options = options + '<option title="" value="' + val.type_description + '"> ' + data.variables.type_description[val.type_description] + '</option>';
}
}
)
;
$(thisis).closest(".form-group").next().find('.subpipe-div').html('<select name="fiberplanpipesub[]" required="required" class=" form-control fiberplanpipesub">' + options + '</select>');
$(".fiberplanpipesub").select2({
placeholder: "",
templateResult: formatState,
templateSelection: formatState
});
if (param == 1 && subpipes.length == $('.fiberplanpipesub').length) {
var counter = 0;
subpipes.forEach(function (value, index) {
$('.fiberplanpipesub').eq(counter).val(value);
$('.fiberplanpipesub').eq(counter).trigger("change", "1");
counter++;
});
checkusedpipes();
checkracks();
// $("#fiberplanpipesub option[value=<?php echo $fiberplancables->fiberPlanPipe_sub; ?>]").attr('selected', 'selected');
}
}
}
)
;
});
$('#rackModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
var recipient = button.data('mdtype');
var destinationname = button.data('name');
var modal = $(this);
if (recipient == "rack") {
modal.find('.modal-title').text('Neuer Schrank (' + destinationname + ')');
}
})
if ($('#network_id').val()) {
$("#network_id").trigger("change", "1")
}
$("body").on("change", ".poprack_id", function (event, param = 0) {
var thistrigger = $(this);
var poprackid = $(this).val();
// console.log(param);
if (param == 0) {
addModule(thistrigger, poprackid);
}
});
$("body").on("click", ".add-module", function () {
var thistrigger = $(this);
thistrigger.closest('h5').next('div').append(`<div class="form-group module-row row">
<label class="col-lg-2 col-form-label" for="lenght"><i class="fa-regular fa-circle-minus remove-module"></i><i title="nach unten verschieben" class="fa-sharp fa-solid fa-down down-module"></i><i class="fa-sharp fa-solid fa-up up-module"></i></label>
<div class="col-lg-4">
<select data-poprackmodule_id="" name="poprackmodule_id[]" required="required" class="select2select form-control poprackmodule_id"></select>
</div>
<div class="col-lg-4">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="poprackmodule_start[]" value="" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="poprackmodule_end[]" value="" type="number" class="form-control ports-end">
<input style="display:none" name="poprackmodule_rackid[]" value="" type="number" class="form-control ports-rackid">
</div>
</div></div>
</div>
<div class="col-2"><label class="fibersum col-form-label"></label></div>
</div>`);
checkracks();
$(".select2select").select2({placeholder: ""});
if (thistrigger.closest('h5').next('div').length < 6) {
}
});
$("body").on("click", ".add-rack", function () {
var thistrigger = $(this);
var poprackid = $(this).data('poprackid');
// console.log(thistrigger);
var destinationpoint = $(this).closest('.destinationpoint').attr('id');
$.getJSON(fiberPlanPipeSubUrl + "&fiberplanpipe_id=" + $.trim($("#fiberPlanPipe_id").val()), {})
.done(function (data) {
if (data.success) {
$.each(data.data, function (k, val) {
var idcounter = 0;
var color;
if (destinationpoint == "destinationstartpoint") {
generateDestination(val.startpointname, "Startpunkt", "destinationstartpoint", 0, 1);
} else if (destinationpoint == "destinationendpoint") {
generateDestination(val.endpointname, "Endpunkt", "destinationendpoint", 0, 1);
}
})
}
});
});
$("body").on("click", ".add-sleeve", function () {
var thistrigger = $(this);
thistrigger.closest('h5').next('div').append(`<div class="form-group row">
<label class="col-lg-2 col-form-label" for="lenght"><span class="ml-2">Muffe</span></label>
<div class="col-lg-4">
<select name="sleeve_id[]" data-id="" required="required" class="select2select form-control fiberplandispatcher_id sleeveid"></select>
</div>
<div class="col-lg-4">
<div class="form-row">
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">von</div>
</div>
<input name="sleeve_start[]" value="" type="number" class="form-control ports-start">
</div>
</div>
<div class="col">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">bis</div>
</div>
<input name="sleeve_end[]" value="" type="number" class="form-control ports-end">
</div>
</div></div>
</div>
<div class="col-2"><span class="fibersum"></span></div>
</div>`);
checksleeves();
// checkusedfibers();
$(".select2select").select2({placeholder: ""});
if (thistrigger.closest('h5').next('div').length < 6) {
}
});
$("body").on("click", ".remove-module", function () {
var trigger = $(this).closest('.destinationmodules');
$(this).closest('div').remove();
checkusedfibers(trigger);
});
$("body").on("click", ".remove-rack", function () {
var trigger = $(this);
$(this).closest('.form-group').next().remove();
checkusedfibers(trigger);
$(this).closest('.form-group').remove();
});
$("body").on("change", "#responsible", function () {
if ($(this).val() == 1) {
$('#responsible-div').show();
$('#responsible-row').show();
$("#address_id").prop("disabled", false);
$(".select2select").select2({placeholder: ""});
} else {
$('#responsible-div').hide();
$('#responsible-row').hide();
$("#address_id").prop("disabled", true);
$(".select2select").select2({placeholder: ""});
}
});
$("body").on("change", ".poprackmodule_id", function (event, param = 0) {
// console.log('param'+param);
var portsend = $(this).closest('.module-row').find('.ports-end').val();
// console.log(portsend);
//Immer Ändern
if (param == 0) {
if ($(this).find(':selected').data('ports') != $(this).closest('.module-row').find('.ports-end').val()) {
$(this).closest('.module-row').find('.ports-end').val($(this).find(':selected').data('ports'));
$(this).closest('.module-row').find('.ports-start').val('1');
}
}
checkusedfibers($(this).closest('.module-row'));
});
$("body").on("change blur", ".ports-end", function () {
var maxports = $(this).closest('.module-row').find('.poprackmodule_id').find(':selected').data('ports');
var endports = $(this).val();
var startports = $(this).closest('.module-row').find('.ports-start').val();
if (!parseInt(endports) || endports > maxports) {
$(this).val(maxports);
} else if (parseInt(endports) < parseInt(startports)) {
$(this).val(startports);
}
checkusedfibers($(this).closest('.module-row'));
});
$("body").on("change", "#fibers", function () {
$('.fiber-counter').text($('#fibers').find(':selected').data('fibers'));
})
$("body").on("change blur", ".ports-start", function () {
var startports = $(this).val();
var endports = $(this).closest('.module-row').find('.ports-end').val();
if (!parseInt(startports) || startports < 1) {
$(this).val('1');
} else if (parseInt(startports) > parseInt(endports)) {
$(this).val(endports);
}
checkusedfibers($(this).closest('.module-row'));
});
$("body").on("click", ".destination-dropdown", function () {
if ($(this).find('i').hasClass('fa-square-caret-down')) {
$(this).find('i').removeClass('fa-square-caret-down');
$(this).find('i').addClass('fa-square-caret-up');
$(this).closest('.destinationpoint').find('.form-group').show();
} else {
$(this).find('i').addClass('fa-square-caret-down');
$(this).find('i').removeClass('fa-square-caret-up');
$(this).closest('.destinationpoint').find('.form-group').hide();
}
});
$.each($('.pipe-network'), function (index, value) {
var thisis = $(this);
$(this).trigger('change', '1')
})
$('body').on('click', '.add-pipe', function () {
$('#fiberplancablepipes-div').append(`<div class="fiberplancablepipe-div">
<div class=" form-group row">
<label class="col-lg-3 col-form-label fiberplanpipe-label" for="fiberPlanPipe_id"><span class=" label-text">Rohr *</span> <span class="endpointsymbol"></span></label>
<div class="col-lg-4">
<select required="required" name="fiberplanpipenetwork[]" class="select2select form-control pipe-network">
<option value=""></option>
</select>
</div>
<div class="col-lg-4 pipe-div"><select name="fiberplanpipe[]" required="required" class="select2select form-control fiberPlanPipe_id"></select><input type="hidden" name="fiberplanpipe_id[]" class="fiberplanpipe_id" value="x"></div>
</div>
<div class="form-group row">
<label class="col-lg-3 col-form-label" for="fiberPlanPipe_sub">Subrohr
*</label>
<div class="col-lg-4 subpipe-div">
</div>
</div>
</div>`);
$('#fiberplancableendpoints').append(`<div class="fiberplanpipe-main-div"></div>`);
var fiberplancablepipelength = $('.fiberplancablepipe-div').length;
$('.fiberplancablepipe-div').eq(fiberplancablepipelength - 1).find('.pipe-network').html($('.fiberplancablepipe-div').eq(fiberplancablepipelength - 2).find('.pipe-network').html());
$('.fiberplancablepipe-div').eq(fiberplancablepipelength - 1).find('.pipe-network').trigger('change');
$('.select2select').select2({placeholder: ""});
checkendpoints();
});
$("body").on("click", ".remove-endpoint", function () {
let endpointcounter;
$(this).closest('.fiberplancablepipe-div').remove();
$('.fiberplanpipe-main-div').eq($(this).data('index')).remove();
checkendpoints();
});
$("body").on("click", ".move-endpoint-up", function () {
$(this).closest('.fiberplancablepipe-div').insertBefore($(this).closest('.fiberplancablepipe-div').prev());
$('.fiberplanpipe-main-div').eq($(this).data('index')).insertBefore($('.fiberplanpipe-main-div').eq($(this).data('index')).prev());
checkendpoints();
});
$("body").on("click", ".move-endpoint-down", function () {
$(this).closest('.fiberplancablepipe-div').insertAfter($(this).closest('.fiberplancablepipe-div').next());
$('.fiberplanpipe-main-div').eq($(this).data('index')).insertAfter($('.fiberplanpipe-main-div').eq($(this).data('index')).next());
checkendpoints();
});
$("body").on("click", ".change-fiberplanpipe-body", function () {
if ($(this).hasClass('fa-square-chevron-down')) {
$(this).removeClass('fa-square-chevron-down');
$(this).addClass('fa-square-chevron-up');
$(this).closest('.fiberplanpipe-main-div').find('.fiberplanpipe-body-div').hide();
} else if ($(this).hasClass('fa-square-chevron-up')) {
$(this).removeClass('fa-square-chevron-up');
$(this).addClass('fa-square-chevron-down');
$(this).closest('.fiberplanpipe-main-div').find('.fiberplanpipe-body-div').show();
}
});
$("body").on("click", ".up-module", function () {
$(this).closest('.module-row').insertBefore($(this).closest('.module-row').prev());
checkusedfibers($(this).closest('.module-row'));
});
$("body").on("change", ".fiberplanpipesub", function () {
checkusedpipes();
});
$("body").on("click", ".change-fiberplanpipe-main", function () {
if ($(this).hasClass('fa-square-chevron-down')) {
$(this).removeClass('fa-square-chevron-down');
$(this).addClass('fa-square-chevron-up');
$.each($('.change-fiberplanpipe-body'), function (index, value) {
$(this).removeClass('fa-square-chevron-down');
$(this).addClass('fa-square-chevron-up');
});
$('.fiberplanpipe-body-div').hide();
} else if ($(this).hasClass('fa-square-chevron-up')) {
$.each($('.change-fiberplanpipe-body'), function (index, value) {
$(this).removeClass('fa-square-chevron-up');
$(this).addClass('fa-square-chevron-down');
});
$(this).removeClass('fa-square-chevron-up');
$(this).addClass('fa-square-chevron-down');
$('.fiberplanpipe-body-div').show();
}
});
checksleeves();
});