Sensor Network Overview

View All Sensors
@if(isset($sensors) && $sensors->count() > 0) @php // Format coordinates properly to ensure they're valid numbers $centerLat = is_array($mapCenter) ? floatval($mapCenter[0]) : -1.2921; $centerLng = is_array($mapCenter) ? floatval($mapCenter[1]) : 36.8219; // Ensure coordinates are valid numbers if (!is_numeric($centerLat) || !is_numeric($centerLng)) { $centerLat = -1.2921; $centerLng = 36.8219; } @endphp
@foreach($sensors as $sensor) @php // Calculate position on the map (this is approximate) $sensorLat = floatval($sensor->last_latitude); $sensorLng = floatval($sensor->last_longitude); if (!is_numeric($sensorLat) || !is_numeric($sensorLng)) { continue; } // Determine status color $statusColor = '#2ECC71'; // Green (default) if($sensor->is_leak_detected) { $statusColor = '#E74C3C'; // Red } elseif($sensor->last_gas_level < 20) { $statusColor = '#F39C12'; // Orange } elseif($sensor->battery_level < 20) { $statusColor = '#F1C40F'; // Yellow } @endphp
{{ $sensors->count() }} sensors in this area
Leak detected
Low gas
Low battery
Normal
@endforeach
@else

No sensors with location data available

@endif

Gas Companies

{{ $stats['gas_companies_count'] ?? 0 }}

Total Users

{{ $stats['users_count'] ?? 0 }}

Active Sensors

{{ $stats['active_sensors_count'] ?? 0 }}

{{ $stats['pending_refills_count'] }}

Pending Refill Requests

Gas Types

{{ $stats['gas_types_count'] ?? 0 }}

Gas Companies Overview

View All
@if(isset($gasCompanies) && $gasCompanies->count() > 0)
@foreach($gasCompanies as $company) @endforeach
Company Users Sensors Status
@if($company->logo) {{ $company->name }} @else
@endif
{{ $company->name }}
{{ $company->email }}
{{ $company->users_count ?? 0 }}
{{ $company->sensors_count ?? 0 }}
@if($company->is_active) Active @else Inactive @endif
@else

No gas companies found

Add Gas Company
@endif

Recent Alerts

View All
@if(isset($recentAlerts) && $recentAlerts->count() > 0)
@foreach($recentAlerts as $alert)

{{ $alert->type === 'leak' ? 'Gas Leak Detected' : 'Low Gas Level' }}

{{ $alert->created_at->diffForHumans() }}

{{ $alert->description }}

Sensor ID: {{ $alert->sensor->device_uuid }} User: {{ $alert->user->name }}
@if(!$alert->is_resolved)
@csrf @method('PATCH')
@else Resolved {{ $alert->resolved_at->diffForHumans() }} @endif
@endforeach
@else

No recent alerts

@endif

System Activity

@if(isset($systemActivity) && count($systemActivity) > 0)
@foreach($systemActivity as $activity)

{{ $activity['title'] }}

{{ $activity['description'] }}

{{ $activity['time'] }}

@endforeach
@else

No system activity recorded

@endif

New Users

View All
@if(isset($newUsers) && $newUsers->count() > 0)
@foreach($newUsers as $user)

{{ $user->name }}

{{ $user->email }}

{{ ucfirst(str_replace('_', ' ', $user->role)) }}
Joined {{ $user->created_at->diffForHumans() }} View Profile
@endforeach
@else

No new users

@endif

Gas Types Management

@if(isset($recentGasTypes) && $recentGasTypes->count() > 0)
@foreach($recentGasTypes as $gasType)
@if($gasType->image) {{ $gasType->name }} @else
@endif
{{ $gasType->is_available ? 'Available' : 'Unavailable' }}
@if(isset($gasType->gasCompany))
{{ $gasType->gasCompany->name }}
@endif

{{ $gasType->name }}

{{ $gasType->description }}

{{ number_format($gasType->price, 2) }} KES

{{ $gasType->weight }} kg

Stock: {{ $gasType->stock }}
Size: {{ $gasType->cylinder_size }}
@endforeach
@else

No gas types available

Add Your First Gas Type
@endif
@push('scripts') @endpush