{% extends 'profil/profil_base.html' %}
{% load static %}
{% load custom_tag %}

{% block title %} Concours{% endblock title %}

{% block profil_content %}
<div class="row">
    <div class="col-lg-12"><br/>
        <h3><i class="bi bi-mortarboard-fill"></i> Postuler aux concours</h3><hr/>
    </div>
</div>
<div class="row col-lg-11">
    <table class="table profil-cmd">
        <thead>
            <tr>
                <th></th>
                <th>Intitulé</th>
                {% if not candidature %}
                <th></th>
                {% else %}
                <th>Status</th>
                {% endif %}
            </tr>
        </thead>
        <tbody>
            {% for conc in type_concours %}
            <tr>
                <td>{{ forloop.counter }}</td>
                <td>{{ conc.libelle }}</td>
                <td>
                    {% if not conc.id|candidature_check:candidat.id %}
                    <a class="btn btn-primary" href="{% url 'postuler' conc.id %}"> Postuler</a>
                    {% else %}
                    <span class="badge
                        {% if conc.id|candidature_check:candidat.id == 'approuvée' %}
                        btn-success
                        {% elif conc.id|candidature_check:candidat.id == 'réjetée' %}
                        btn-danger
                        {% else %}
                        btn-secondary
                        {% endif%}
                        ">
                        {{ conc.id|candidature_check:candidat.id }}
                    </span>
                    {% endif %}
                </td>
            </tr>
            {% empty %}
            <tr>
                <td colspan="3" style="text-align:center;background-color:#CECECE;">Aucun résultat</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
        <br/><br/>
</div>
{% endblock profil_content %}