@extends('layouts.app') @section('title', 'Alert Details') @section('content')

Alert Details

@if(!$alert->is_resolved)
@csrf @method('PATCH')
@else Resolved @endif
@php $alertType = [ 'leak' => ['bg-red-100 text-red-800', 'M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'], 'low_gas' => ['bg-yellow-100 text-yellow-800', 'M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'], 'maintenance' => ['bg-blue-100 text-blue-800', 'M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z'], ][$alert->type] ?? ['bg-gray-100 text-gray-800', 'M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z']; @endphp

{{ ucfirst(str_replace('_', ' ', $alert->type)) }} Alert

{{ $alert->description }}

Status
@if($alert->is_resolved) Resolved @else Active @endif
Alert Type
{{ str_replace('_', ' ', $alert->type) }}
Gas Level
{{ $alert->gas_level }}%
Battery Level
{{ $alert->battery_level }}%
@if($alert->sensor)
Gas Company
@if($alert->sensor->gasCompany) {{ $alert->sensor->gasCompany->name }} @else N/A @endif
@endif
Triggered By
@if($alert->user) {{ $alert->user->name }} ({{ $alert->user->phone_number }}) @else System @endif
Triggered At
{{ $alert->created_at->format('M j, Y g:i A') }} ({{ $alert->created_at->diffForHumans() }})
@if($alert->is_resolved)
Resolved At
{{ $alert->resolved_at->format('M j, Y g:i A') }} ({{ $alert->resolved_at->diffForHumans() }})
Resolution Time
{{ $alert->created_at->diffForHumans($alert->resolved_at, true) }}
@endif
@if($alert->sensor && $alert->sensor->gasCompany)

Gas Company Contact Information

Company Name

{{ $alert->sensor->gasCompany->name }}

Contact Email

{{ $alert->sensor->gasCompany->contact_email }}

Contact Phone

{{ $alert->sensor->gasCompany->contact_phone }}

Address

{{ $alert->sensor->gasCompany->address }}

@endif
Back to Alerts
@endsection