@extends('layouts.app') @section('content')
@if (session('success')) @endif @if (isset($errors) && $errors->any()) @endif
Alert #{{ $log->alert_no ?? ('EMG-' . str_pad($log->id, 5, '0', STR_PAD_LEFT)) }}
Triggered on: {{ $log->created_at ? $log->created_at->format('d M Y, h:i A') : '-' }}
@if($log->status === 'active') ACTIVE EMERGENCY @else RESOLVED @endif
Partner / User: @if($log->user) @php $panicUser = $log->user; $panicIsPartner = $panicUser->account_type === 'partner'; $panicUrl = $panicIsPartner && Route::has('admin.partners.show') ? route('admin.partners.show', $panicUser->id) : (Route::has('users.view') ? route('users.view', $panicUser->id) : null); @endphp @if($panicUrl) {{ $panicUser->name ?: ('User #' . $panicUser->id) }} @else {{ $panicUser->name ?: ('User #' . $panicUser->id) }} @endif @else N/A @endif
Emergency Reason: {{ $log->reason ?: 'Emergency help needed immediately' }}
Associated Booking: @if($log->booking) #{{ $log->booking->booking_no }} @else Standalone (No active booking) @endif
Live Location: @if($log->address) {{ $log->address }} @endif @if($log->latitude && $log->longitude) Open Google Maps @else Coordinates not available @endif
@if($log->status === 'resolved')
Admin Resolution Remark
Resolved

{{ $log->admin_remark ?: 'Marked as resolved without remark.' }}

@if($log->resolved_at) Resolved at: {{ $log->resolved_at->format('d M Y, h:i A') }} @endif
@endif
Emergency Contacts Alerted at Incident
{{ count($alertedContacts) }} Contact(s)
@if(count($alertedContacts) > 0)
@foreach($alertedContacts as $index => $contact) @php $name = $contact['name'] ?? ($contact['contact_name'] ?? 'Contact #' . ($index + 1)); $phone = $contact['phone'] ?? ($contact['phone_number'] ?? '-'); $cleanPhone = preg_replace('/[^0-9]/', '', (string)$phone); $relation = $contact['relation'] ?? ($contact['relationship'] ?? 'Family/Friend'); @endphp @endforeach
# Contact Name Relationship Phone Number Alert Status Quick Actions
{{ $index + 1 }}
{{ $name }}
{{ $relation }} {{ $phone }} Alert Sent
Call @if($cleanPhone) WhatsApp @endif
@else

No emergency contacts were attached to this panic alert at the time it was triggered.

@endif
@endsection