Merge branch 'spidev' into 'master'

Device Update

See merge request fronk/thetool!941
This commit is contained in:
Daniel Spitzer
2025-01-22 17:19:29 +00:00
2 changed files with 69 additions and 54 deletions
+68 -53
View File
@@ -211,7 +211,9 @@ foreach ($devicesall as $deviceall) {
<?php if ($devices->parent_id) : ?> <?php if ($devices->parent_id) : ?>
<tr> <tr>
<th>Parent Device</th> <th>Parent Device</th>
<td><a href="<?= self::getUrl("Device", "Detail", ["id" => $devices->parent_id]) ?>"><?= $DevicesAll[$devices->parent_id]?></a></td> <td>
<a href="<?= self::getUrl("Device", "Detail", ["id" => $devices->parent_id]) ?>"><?= $DevicesAll[$devices->parent_id] ?></a>
</td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<tr> <tr>
@@ -688,11 +690,11 @@ foreach ($devicesall as $deviceall) {
$.getJSON("<?= self::getUrl("Device", "api", ['do' => 'getoltinfo', 'ip' => $devices->ip]) ?>", {}) $.getJSON("<?= self::getUrl("Device", "api", ['do' => 'getoltinfo', 'ip' => $devices->ip]) ?>", {})
.done(function (data) { .done(function (data) {
if (data.success == false) { if (data.success == false) {
$('#olt-body').text('Keine OLT/ONT Daten verfügbar'); $('#olt-body').text('Keine OLT/ONT Daten verfügbar');
} else { } else {
$('#olt-body').append(`<div > $('#olt-body').append(`<div >
<table class="sp-table-border float-left" > <table class="sp-table-border float-left" >
<thead><tr><td>OLT</td></tr></thead> <thead><tr><td>OLT</td></tr></thead>
<tbody id="olt-table"></tbody></table> <tbody id="olt-table"></tbody></table>
@@ -703,43 +705,51 @@ foreach ($devicesall as $deviceall) {
<thead><tr><td>Splitter</td></tr></thead> <thead><tr><td>Splitter</td></tr></thead>
<tbody id="olt-splitter"></tbody></table> <tbody id="olt-splitter"></tbody></table>
</div>`); </div>`);
var datacounter = 1; var datacounter = 1;
let customername; let customername;
let customerid; let customerid;
$('#olt-uptime').html("(<b>Uptime:</b> " + data.data.olt.uptime + ")") $('#olt-uptime').html("(<b>Uptime:</b> " + data.data.olt.uptime + ")")
$.each(data.data.ports, function (i, item) { $.each(data.data.ports, function (i, item) {
$('#olt-table').append('<tr><td class="p-2">' + item['port'] + '</td></tr>'); $('#olt-table').append('<tr><td class="p-2">' + item['port'] + '</td></tr>');
$('#olt-ports').append('<tr><td data-oltport=' + i + ' class="sp-port-lines" ">&nbsp;</td></tr>'); $('#olt-ports').append('<tr><td data-oltport=' + i + ' class="sp-port-lines" ">&nbsp;</td></tr>');
if (typeof (item['ont']) === "object") { if (typeof (item['ont']) === "object") {
var online = 0; var online = 0;
var offline = 0; var offline = 0;
var allonts = 0; var allonts = 0;
$.each(item['ont'], function (o, ont) { $.each(item['ont'], function (o, ont) {
var status; var status;
if (ont.status == "1") { if (ont.status == "1") {
online++; online++;
status = '<i class="fa-regular fa-circle-check"></i>'; status = '<i class="fa-regular fa-circle-check"></i>';
} else if (ont.status == "2") { } else if (ont.status == "2") {
offline++; offline++;
status = '<i class="fa-regular fa-circle-xmark"></i></i>' status = '<i class="fa-regular fa-circle-xmark"></i></i>'
} }
allonts++; allonts++;
if (typeof customers[ont['serial']] !== "undefined") { if (typeof customers[ont['serial']] !== "undefined") {
customerid = customers[ont['serial']]['customer_number']; customerid = customers[ont['serial']]['customer_number'];
if (customers[ont['serial']]['lastname'] != "" && customers[ont['serial']]['lastname'] != null) {
customername = customers[ont['serial']]['lastname'] + " " + customers[ont['serial']]['firstname'];
} else if (customers[ont['serial']]['lastname'] == null) { if (customers[ont['serial']]['company'] != "" && customers[ont['serial']]['company'] != null) {
customername = customers[ont['serial']]['street'] + ", " + customers[ont['serial']]['zip'] + " " + customers[ont['serial']]['city']
} else { customername = "" + customers[ont['serial']]['company'] + " (C)";
customername = "" + customers[ont['serial']]['company'] + " (C)"; } else if (customers[ont['serial']]['lastname'] != "" && customers[ont['serial']]['lastname'] != null) {
} customername = customers[ont['serial']]['lastname'] + " " + customers[ont['serial']]['firstname'];
} else { } else if (customers[ont['serial']]['TerminationContact'] != "" && customers[ont['serial']]['TerminationContact'] != null) {
customername = "N/A"; customername = customers[ont['serial']]['TerminationContact'];
customerid = "N/A"; } else if (customers[ont['serial']]['BuildingContact'] != "" && customers[ont['serial']]['BuildingContact'] != null) {
} customername = customers[ont['serial']]['BuildingContact'];
$('#datatable tbody').append(` } else if (customers[ont['serial']]['lastname'] == null) {
}
customername +='&nbsp;<br>'+ customers[ont['serial']]['street'] + ", " + customers[ont['serial']]['zip'] + " " + customers[ont['serial']]['city']
} else {
customername = "N/A";
customerid = "N/A";
}
$('#datatable tbody').append(`
<tr> <tr>
<td class="sp-ont-text">` + item['portshort'] + `/` + o + `</td> <td class="sp-ont-text">` + item['portshort'] + `/` + o + `</td>
<td class="sp-ont-text">` + customerid + `</td> <td class="sp-ont-text">` + customerid + `</td>
@@ -749,20 +759,25 @@ foreach ($devicesall as $deviceall) {
<td class="sp-ont-text"><div class="text-decoration-underline" data-port="` + item['portsimple'] + `" data-ontid="` + o + `" data-portid="` + item['portindex'] + `" data-snr="` + ont['serial'] + `" data-toggle="modal" data-target="#ontDetailInfo">` + ont['serial'] + `</div></td> <td class="sp-ont-text"><div class="text-decoration-underline" data-port="` + item['portsimple'] + `" data-ontid="` + o + `" data-portid="` + item['portindex'] + `" data-snr="` + ont['serial'] + `" data-toggle="modal" data-target="#ontDetailInfo">` + ont['serial'] + `</div></td>
</tr> </tr>
`); `);
}); }
$('#olt-splitter').append('<tr><td class=""><span title="Doppelklick zum editieren" data-portid="' + item['portindex'] + '" class="float-left sp-splitter-count-left ">' + allonts + '</span><span data-shown="0" data-port="' + item['portsimple'] + '" data-portid="' + item['portindex'] + '" data-splitcounter="' + datacounter + '" data-oltport=' + i + ' class="sp-splitter-count-show">show</span><span class="float-right sp-splitter-count-right"><span style="color: green">' + online + '</span>/<span style="color: red">' + offline + '</span></span></td></tr>'); )
} else { ;
$('#olt-splitter').append('<tr><td class=""><span title="Doppelklick zum editieren" data-portid="' + item['portindex'] + '" class="float-left sp-splitter-count-left ">N/A</span><span class="float-right sp-splitter-count-right">N/A</span></td></tr>'); $('#olt-splitter').append('<tr><td class=""><span title="Doppelklick zum editieren" data-portid="' + item['portindex'] + '" class="float-left sp-splitter-count-left ">' + allonts + '</span><span data-shown="0" data-port="' + item['portsimple'] + '" data-portid="' + item['portindex'] + '" data-splitcounter="' + datacounter + '" data-oltport=' + i + ' class="sp-splitter-count-show">show</span><span class="float-right sp-splitter-count-right"><span style="color: green">' + online + '</span>/<span style="color: red">' + offline + '</span></span></td></tr>');
} } else {
datacounter++; $('#olt-splitter').append('<tr><td class=""><span title="Doppelklick zum editieren" data-portid="' + item['portindex'] + '" class="float-left sp-splitter-count-left ">N/A</span><span class="float-right sp-splitter-count-right">N/A</span></td></tr>');
}); }
$('#olt-datatables').show(); datacounter++;
}
)
;
$('#olt-datatables').show();
}
$('.spinner-big').hide();
$('#olt-info').show();
} }
).done(function (data) {
$('.spinner-big').hide();
$('#olt-info').show();
}).done(function (data) {
var hidesearch = [3]; var hidesearch = [3];
let table; let table;
if (typeof hidesearch === "undefined") { if (typeof hidesearch === "undefined") {
+1 -1
View File
@@ -144,7 +144,7 @@ class DeviceModel
{ {
$items = []; $items = [];
$db = FronkDB::singleton(); $db = FronkDB::singleton();
$sql = "Select Patching.id,lastname,firstname,customer_number,company,device_name,device_port,value_string,Building.`street`,Building.`zip`, Building.`city` FROM Workflowvalue $sql = "Select Patching.id,lastname,firstname,customer_number,company,device_name,device_port,value_string,Building.`street`,Building.`zip`, `Building`.`city`,`Building`.`contact` `BuildingContact`,`Termination`.`contact` TerminationContact FROM Workflowvalue
LEFT JOIN Termination ON Termination.id=Workflowvalue.object_id LEFT JOIN Patching ON Termination.id = Patching.termination_id LEFT JOIN Termination ON Termination.id=Workflowvalue.object_id LEFT JOIN Patching ON Termination.id = Patching.termination_id
LEFT JOIN OrderProduct ON (Patching.termination_id=OrderProduct.termination_id) LEFT JOIN OrderProduct ON (Patching.termination_id=OrderProduct.termination_id)
LEFT JOIN `Order` ON (`Order`.id=OrderProduct.order_id) LEFT JOIN `Order` ON (`Order`.id=OrderProduct.order_id)