Device Update

* Customer Search erweitert
This commit is contained in:
Daniel Spitzer
2025-01-22 18:14:33 +01:00
parent 579d7088a8
commit 4555d4ce1d
2 changed files with 69 additions and 54 deletions

View File

@@ -211,7 +211,9 @@ foreach ($devicesall as $deviceall) {
<?php if ($devices->parent_id) : ?>
<tr>
<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>
<?php endif; ?>
<tr>
@@ -688,11 +690,11 @@ foreach ($devicesall as $deviceall) {
$.getJSON("<?= self::getUrl("Device", "api", ['do' => 'getoltinfo', 'ip' => $devices->ip]) ?>", {})
.done(function (data) {
if (data.success == false) {
$('#olt-body').text('Keine OLT/ONT Daten verfügbar');
} else {
if (data.success == false) {
$('#olt-body').text('Keine OLT/ONT Daten verfügbar');
} else {
$('#olt-body').append(`<div >
$('#olt-body').append(`<div >
<table class="sp-table-border float-left" >
<thead><tr><td>OLT</td></tr></thead>
<tbody id="olt-table"></tbody></table>
@@ -703,43 +705,51 @@ foreach ($devicesall as $deviceall) {
<thead><tr><td>Splitter</td></tr></thead>
<tbody id="olt-splitter"></tbody></table>
</div>`);
var datacounter = 1;
let customername;
let customerid;
$('#olt-uptime').html("(<b>Uptime:</b> " + data.data.olt.uptime + ")")
$.each(data.data.ports, function (i, item) {
$('#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>');
if (typeof (item['ont']) === "object") {
var online = 0;
var offline = 0;
var allonts = 0;
var datacounter = 1;
let customername;
let customerid;
$('#olt-uptime').html("(<b>Uptime:</b> " + data.data.olt.uptime + ")")
$.each(data.data.ports, function (i, item) {
$('#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>');
if (typeof (item['ont']) === "object") {
var online = 0;
var offline = 0;
var allonts = 0;
$.each(item['ont'], function (o, ont) {
var status;
if (ont.status == "1") {
online++;
status = '<i class="fa-regular fa-circle-check"></i>';
$.each(item['ont'], function (o, ont) {
var status;
if (ont.status == "1") {
online++;
status = '<i class="fa-regular fa-circle-check"></i>';
} else if (ont.status == "2") {
offline++;
status = '<i class="fa-regular fa-circle-xmark"></i></i>'
}
allonts++;
if (typeof customers[ont['serial']] !== "undefined") {
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) {
customername = customers[ont['serial']]['street'] + ", " + customers[ont['serial']]['zip'] + " " + customers[ont['serial']]['city']
} else {
customername = "" + customers[ont['serial']]['company'] + " (C)";
}
} else {
customername = "N/A";
customerid = "N/A";
}
$('#datatable tbody').append(`
} else if (ont.status == "2") {
offline++;
status = '<i class="fa-regular fa-circle-xmark"></i></i>'
}
allonts++;
if (typeof customers[ont['serial']] !== "undefined") {
customerid = customers[ont['serial']]['customer_number'];
if (customers[ont['serial']]['company'] != "" && customers[ont['serial']]['company'] != null) {
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 if (customers[ont['serial']]['TerminationContact'] != "" && customers[ont['serial']]['TerminationContact'] != null) {
customername = customers[ont['serial']]['TerminationContact'];
} else if (customers[ont['serial']]['BuildingContact'] != "" && customers[ont['serial']]['BuildingContact'] != null) {
customername = customers[ont['serial']]['BuildingContact'];
} 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>
<td class="sp-ont-text">` + item['portshort'] + `/` + o + `</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>
</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>');
}
datacounter++;
});
$('#olt-datatables').show();
}
)
;
$('#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>');
}
datacounter++;
}
)
;
$('#olt-datatables').show();
}
$('.spinner-big').hide();
$('#olt-info').show();
}
$('.spinner-big').hide();
$('#olt-info').show();
}).done(function (data) {
).done(function (data) {
var hidesearch = [3];
let table;
if (typeof hidesearch === "undefined") {

View File

@@ -144,7 +144,7 @@ class DeviceModel
{
$items = [];
$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 OrderProduct ON (Patching.termination_id=OrderProduct.termination_id)
LEFT JOIN `Order` ON (`Order`.id=OrderProduct.order_id)