{% load markdown %}
{% load vulns %}

<!-- Header Table -->
<section id="vuln-{{ vulnerability.pk }}-header">
    <h3 id="vuln-{{ vulnerability.pk }}-title">
                <span class="fa-layers text-{{ vulnerability.get_severity_display|lower }}">
                    <i class="fas fa-bookmark"></i>
                    <span class="fa-layers-text" data-fa-transform="shrink-8 down-3" style="font-weight:900"></span>
                </span>
        {{ vulnerability.template.name }} - {{ vulnerability.name }}
    </h3>

    <table style="width: 100%" id="intro-detail-table">
        <thead>
            <tr>
                <th>Severity</th>
                <th>Category</th>
                <th>Discovery</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td class="text-{{ vulnerability.get_severity_display|lower }}">{{ vulnerability.get_severity_display|capfirst }}</td>
                <td>{{ vulnerability.template.category }}</td>
                <td>{{ vulnerability.date_created|date }}</td>
                {% if vulnerability.status == vulnerability.STATUS_CLOSED %}
                    {% if vulnerability.is_fixed %}
                        <td>Fixed</td>
                    {% else %}
                        <td>Unfixed</td>
                    {% endif %}
                {% else %}
                    <td>Open</td>
                {% endif %}
            </tr>
        </tbody>
    </table>

    <table style="margin-top: 30px;">
        <tr>
            <th style="padding-right: 65px">Affected Component</th>
            <td>{{ vulnerability.asset }}</td>
        </tr>
        <tr>
            <th>Tested Account</th>
            <td>{% if vulnerability.user_account %}{{ vulnerability.user_account }}{% else %}-{% endif %}</td>
        </tr>
        {% if project.cvss_required %}
            <tr>
                <th>CVSS-Vector</th>
                <td>{{ vulnerability.cvss_get_vector_string }} ({{ vulnerability.cvss_get_base_score }})</td>
            </tr>
        {% endif %}
    </table>


</section>

<section id="proofs-{{ vulnerability.pk }}">
    {% for proof in vulnerability.proofs %}
        {% if proof.description %}
            {{ proof.description|md_to_html }}
            {% if proof.image %}
                <figure>
                    <img src="{{ proof.base64_encoded_image }}" alt="proof-image"
                         style="width: 100%; max-width: 100%; height:auto;">
                    {% if proof.caption %}
                        <figcaption>{{ proof.caption }}</figcaption>
                    {% endif %}
                </figure>
            {% endif %}
        {% endif %}
        {% if proof.text %}
            {{ proof.text|md_to_html }}
        {% endif %}
    {% endfor %}
</section>