@extends('layouts.app') @section('title', 'Sensor Alerts: ' . $sensor->device_uuid) @section('content')

Sensor Alerts: {{ $sensor->device_uuid }}

{{ $sensor->gasCompany ? $sensor->gasCompany->name : 'No Company' }}
@php $status = $sensor->status ?? 'offline'; $statusClasses = [ 'online' => 'bg-green-100 text-green-800', 'offline' => 'bg-gray-100 text-gray-800', 'battery_low' => 'bg-yellow-100 text-yellow-800', ][$status] ?? 'bg-gray-100 text-gray-800'; @endphp {{ ucfirst($status) }}

Sensor Alerts

History of all alerts triggered by this sensor

@if($alerts->count() > 0)
    @foreach($alerts as $alert)
  • @if($alert->type === 'gas_leak')
    @elseif($alert->type === 'low_gas')
    @else
    @endif
    {{ ucfirst(str_replace('_', ' ', $alert->type)) }}
    {{ $alert->description }}
    {{ $alert->created_at->diffForHumans() }}
    {{ $alert->created_at->format('M j, Y g:i A') }}
    @if($alert->resolved_at)
    Resolved
    @else
    Active
    @endif
    @if($alert->metadata)
    Additional Information:
    {{ json_encode($alert->metadata, JSON_PRETTY_PRINT) }}
    @endif
  • @endforeach
{{ $alerts->links() }}
@else

No alerts found

This sensor has not triggered any alerts yet.

@endif
@endsection