diff --git a/Layout/default/Device/Detail.php b/Layout/default/Device/Detail.php index 547a0ee16..1743b711a 100644 --- a/Layout/default/Device/Detail.php +++ b/Layout/default/Device/Detail.php @@ -211,7 +211,9 @@ foreach ($devicesall as $deviceall) { parent_id) : ?> Parent Device - $devices->parent_id]) ?>">parent_id]?> + + $devices->parent_id]) ?>">parent_id] ?> + @@ -688,11 +690,11 @@ foreach ($devicesall as $deviceall) { $.getJSON(" '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(`
+ $('#olt-body').append(`
OLT
@@ -703,43 +705,51 @@ foreach ($devicesall as $deviceall) { Splitter
`); - var datacounter = 1; - let customername; - let customerid; - $('#olt-uptime').html("(Uptime: " + data.data.olt.uptime + ")") - $.each(data.data.ports, function (i, item) { - $('#olt-table').append('' + item['port'] + ''); - $('#olt-ports').append(' '); - if (typeof (item['ont']) === "object") { - var online = 0; - var offline = 0; - var allonts = 0; + var datacounter = 1; + let customername; + let customerid; + $('#olt-uptime').html("(Uptime: " + data.data.olt.uptime + ")") + $.each(data.data.ports, function (i, item) { + $('#olt-table').append('' + item['port'] + ''); + $('#olt-ports').append(' '); + 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 = ''; + $.each(item['ont'], function (o, ont) { + var status; + if (ont.status == "1") { + online++; + status = ''; - } else if (ont.status == "2") { - offline++; - status = '' - } - 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 = '' + } + 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 +=' 
'+ customers[ont['serial']]['street'] + ", " + customers[ont['serial']]['zip'] + " " + customers[ont['serial']]['city'] + } else { + customername = "N/A"; + customerid = "N/A"; + } + $('#datatable tbody').append(` ` + item['portshort'] + `/` + o + ` ` + customerid + ` @@ -749,20 +759,25 @@ foreach ($devicesall as $deviceall) {
` + ont['serial'] + `
`); - }); - $('#olt-splitter').append('' + allonts + 'show' + online + '/' + offline + ''); - } else { - $('#olt-splitter').append('N/AN/A'); - } - datacounter++; - }); - $('#olt-datatables').show(); + } + ) + ; + $('#olt-splitter').append('' + allonts + 'show' + online + '/' + offline + ''); + } else { + $('#olt-splitter').append('N/AN/A'); + } + 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") { diff --git a/application/Device/DeviceModel.php b/application/Device/DeviceModel.php index feae145ed..c0f65f472 100644 --- a/application/Device/DeviceModel.php +++ b/application/Device/DeviceModel.php @@ -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)