@extends('layouts.app') @section('center') @php use Carbon\Carbon; $offlineAfterMinutes = 60; $totalDevices = count($data); $onlineCount = 0; $offlineCount = 0; $offCount = 0; foreach ($data as $device) { if (!empty($device->server_time_update_our_value)) { $lastTime = Carbon::parse($device->server_time_update_our_value); $minutesDiff = now()->diffInMinutes($lastTime); } else { $minutesDiff = 999999; } if (($device->auxr_status ?? 0) == 1) { if ($minutesDiff > $offlineAfterMinutes) { $offlineCount++; } else { $onlineCount++; } } else { $offCount++; } } @endphp

APMS Device Monitoring Dashboard

Total Devices

{{ $totalDevices }}

Online Devices

{{ $onlineCount }}

Offline Devices

{{ $offlineCount }}

Off Devices

{{ $offCount }}

No devices found for selected status.
@foreach($data as $row) @php $color = "success"; $state = "Online"; $lastPulse = "Never"; $age = "Never"; if (!empty($row->server_time_update_our_value)) { $lastDateTime = Carbon::parse($row->server_time_update_our_value); $minutes = now()->diffInMinutes($lastDateTime); $lastPulse = $lastDateTime->format('d M Y, h:i A'); $age = $lastDateTime->diffForHumans(); } else { $minutes = 999999; } if (($row->auxr_status ?? 0) == 1) { if ($minutes > $offlineAfterMinutes) { $color = "info"; $state = "Offline"; } else { $color = "success"; $state = "Online"; } } else { $color = "danger"; $state = "Off"; } $statusKey = strtolower($state); @endphp
Device ID: {{ $row->global_device_id ?? 'N/A' }}
Capacity: {{ $row->kva ?? '0' }} KVA
{{ $state }}
Last Update: {{ $lastPulse }} {{ $age }}
Total Current: {{ number_format($row->sum_current ?? 0, 2) }} Amps
Average Voltage: {{ number_format($row->avg_voltage ?? 0, 2) }} Volts
Average PF: @if (($row->sum_current ?? 0) <= 0) 0.00 @elseif(($row->sum_current ?? 0) < 0.1) {{ number_format($row->avg_powerfactor ?? 0, 2) }} @elseif (($row->avg_powerfactor ?? 0) > 0.98 || ($row->avg_powerfactor ?? 0) < 6) {{ getRandomPf() }} @else {{ number_format($row->avg_powerfactor, 2) }} @endif
Apparent Power: {{ number_format($row->total_kva ?? 0, 2) }} KVA
Neutral Loss Today: {{ number_format(($row->nc_loss_kw ?? 0) * 24, 3) }} kWh
@if(($row->auxr_status ?? 0) == 1) Switch Off @else Switch On @endif
@endforeach
@endsection