116 lines
5.7 KiB
PHP
116 lines
5.7 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('title', 'Alerts')
|
|
|
|
@section('content')
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<div>
|
|
<h1><i class="bi bi-bell"></i> Alerts</h1>
|
|
<p class="text-muted mb-0">Notification history for all your sites</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Filter Tabs -->
|
|
<ul class="nav nav-tabs mb-4" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link active" id="all-tab" data-bs-toggle="tab" data-bs-target="#all" type="button" role="tab">
|
|
All ({{ $notifications->total() }})
|
|
</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="unread-tab" data-bs-toggle="tab" data-bs-target="#unread" type="button" role="tab">
|
|
Unread ({{ $unreadCount }})
|
|
</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="read-tab" data-bs-toggle="tab" data-bs-target="#read" type="button" role="tab">
|
|
Read ({{ $readCount }})
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
|
|
<!-- Notifications List -->
|
|
<div class="card">
|
|
<div class="card-body">
|
|
@if($notifications->isEmpty())
|
|
<div class="alert alert-info mb-0">
|
|
<i class="bi bi-info-circle"></i> No alerts yet. You'll receive notifications when issues are detected with your sites.
|
|
</div>
|
|
@else
|
|
<div class="list-group list-group-flush">
|
|
@foreach($notifications as $notification)
|
|
<div class="list-group-item {{ !$notification->is_read ? 'bg-light' : '' }} border-start border-{{ $notification->type === 'uptime' ? 'danger' : ($notification->type === 'ssl' ? 'warning' : 'info') }} border-3">
|
|
<div class="d-flex w-100 justify-content-between align-items-start">
|
|
<div class="flex-grow-1">
|
|
<div class="d-flex align-items-center mb-1">
|
|
@if($notification->type === 'uptime')
|
|
<i class="bi bi-exclamation-triangle-fill text-danger me-2"></i>
|
|
<span class="badge bg-danger me-2">Uptime Alert</span>
|
|
@elseif($notification->type === 'ssl')
|
|
<i class="bi bi-shield-exclamation text-warning me-2"></i>
|
|
<span class="badge bg-warning me-2">SSL Alert</span>
|
|
@else
|
|
<i class="bi bi-link-45deg text-info me-2"></i>
|
|
<span class="badge bg-info me-2">Broken Links</span>
|
|
@endif
|
|
@if(!$notification->is_read)
|
|
<span class="badge bg-primary">New</span>
|
|
@endif
|
|
</div>
|
|
<p class="mb-1">{{ $notification->message }}</p>
|
|
<small class="text-muted">
|
|
<i class="bi bi-clock"></i> {{ $notification->created_at->diffForHumans() }}
|
|
</small>
|
|
</div>
|
|
<div class="ms-3">
|
|
@if(!$notification->is_read)
|
|
<form action="{{ route('alerts.markAsRead', $notification) }}" method="POST" class="d-inline">
|
|
@csrf
|
|
@method('PATCH')
|
|
<button type="submit" class="btn btn-sm btn-outline-primary" title="Mark as read">
|
|
<i class="bi bi-check"></i>
|
|
</button>
|
|
</form>
|
|
@endif
|
|
<form action="{{ route('alerts.destroy', $notification) }}" method="POST" class="d-inline">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-sm btn-outline-danger" title="Delete"
|
|
onclick="return confirm('Are you sure you want to delete this alert?')">
|
|
<i class="bi bi-trash"></i>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="mt-3">
|
|
{{ $notifications->links() }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@if($notifications->isNotEmpty())
|
|
<div class="card-footer">
|
|
<div class="d-flex gap-2">
|
|
<form action="{{ route('alerts.markAllAsRead') }}" method="POST">
|
|
@csrf
|
|
@method('PATCH')
|
|
<button type="submit" class="btn btn-sm btn-outline-primary">
|
|
<i class="bi bi-check-all"></i> Mark All as Read
|
|
</button>
|
|
</form>
|
|
<form action="{{ route('alerts.deleteRead') }}" method="POST" onsubmit="return confirm('Are you sure you want to delete all read alerts?')">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
|
<i class="bi bi-trash"></i> Delete All Read
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endsection
|