@extends('layouts.portal')
@section('title', 'Uyarılarım')
@section('content')
<div class="d-flex align-items-start justify-content-between flex-wrap gap-3 mb-4">
    <div>
        <h2 class="mb-1">Uyarılarım</h2>
        <p class="portal-muted mb-0">Performans, harcama, SEO ve sistem uyarıları.</p>
    </div>
</div>

@include('portal.partials-client-filter')

<div class="card soft-panel">
    <div class="card-body">
        <div class="table-responsive">
            <table class="table">
                <thead>
                <tr>
                    <th>Müşteri</th>
                    <th>Platform</th>
                    <th>Uyarı</th>
                    <th>Seviye</th>
                    <th>Durum</th>
                    <th>Tarih</th>
                </tr>
                </thead>
                <tbody>
                @forelse($alerts as $alert)
                    <tr>
                        <td>{{ $alert->client?->company_name }}</td>
                        <td>{{ strtoupper(str_replace('_', ' ', $alert->platform)) }}</td>
                        <td>
                            <strong>{{ $alert->title }}</strong>
                            <div class="portal-muted small">{{ $alert->message }}</div>
                        </td>
                        <td><span class="badge badge-warning">{{ $alert->severity }}</span></td>
                        <td>
                            @if($alert->resolved_at)
                                <span class="badge badge-success">Çözüldü</span>
                            @else
                                <span class="badge badge-danger">Açık</span>
                            @endif
                        </td>
                        <td>{{ $alert->triggered_at ? $alert->triggered_at->format('d.m.Y H:i') : $alert->created_at->format('d.m.Y H:i') }}</td>
                    </tr>
                @empty
                    <tr><td colspan="6" class="text-center text-muted py-5">Uyarı bulunamadı.</td></tr>
                @endforelse
                </tbody>
            </table>
        </div>
        {{ $alerts->links() }}
    </div>
</div>
@endsection
