{% extends 'pdf/_base.html.twig' %}

{% block title %}Attestation RGPD - Acces aux donnees{% endblock %}

{% block extra_styles %}
        .info-cell { border-left: 3px solid #4338ca; }
        .doc-type { background: #4338ca; }
        .session-meta { font-size: 9px; color: #666; margin: 2px 0 6px; }
        .session-meta strong { color: #111827; }
        .no-data { padding: 8px; background: #f9fafb; border: 2px dashed #d1d5db; font-style: italic; color: #999; text-align: center; font-size: 9px; }
{% endblock %}

{% block content %}
        <span class="doc-type">Droit d'acces</span>
        <h1>Donnees personnelles</h1>
        <div class="subtitle">RGPD &mdash; Article 15</div>
        <div class="info-grid">
            <div class="info-row">
                <div class="info-cell" style="width: 25%;"><span class="info-label">Reference</span><span class="info-value">{{ attestation.reference }}</span></div>
                <div class="info-cell" style="width: 25%;"><span class="info-label">Date</span><span class="info-value">{{ date|date('d/m/Y a H:i') }}</span></div>
                <div class="info-cell" style="width: 25%;"><span class="info-label">Adresse IP</span><span class="info-value">{{ ip }}</span></div>
                <div class="info-cell" style="width: 25%;"><span class="info-label">Sessions</span><span class="info-value">{{ data|length }}</span></div>
            </div>
        </div>

        {% for entry in data %}
            <h2>Session #{{ loop.index }}</h2>
            <div class="session-meta"><strong>ID :</strong> {{ entry.visitor.id }} &mdash; <strong>Visite :</strong> {{ entry.visitor.createdAt|date('d/m/Y H:i') }}</div>
            {% if entry.events|length > 0 %}
                <table class="data">
                    <thead><tr><th style="width: 25%;">Date</th><th style="width: 20%;">Type</th><th style="width: 55%;">Page</th></tr></thead>
                    <tbody>
                        {% for event in entry.events %}
                            <tr><td>{{ event.createdAt|date('d/m/Y H:i:s') }}</td><td>{{ event.type }}</td><td>{{ event.page }}</td></tr>
                        {% endfor %}
                    </tbody>
                </table>
            {% else %}
                <div class="no-data">Aucun evenement enregistre.</div>
            {% endif %}
        {% endfor %}
{% endblock %}

