{% extends "base_title.html" %}
{% load bootstrap %}

{% block realcontent %}

<h2>Revente de place</h2>
<h3>Places non revendues</h3>
<form class="form-horizontal" action="" method="post">
    {% csrf_token %}
    <div class="form-group">
        <div class="multiple-checkbox">
            <ul>
            {% for box in resellform.attributions %}
                <li>
                    {{box.tag}}
                    {{box.choice_label}}
                </li>
            {% endfor %}            
            </ul>
        </div>
    </div>
    <div class="form-actions">
        <input type="submit" class="btn btn-primary" name="resell" value="Revendre les places sélectionnées">
    </div>
</form>
<br>
{% if annulform.attributions or overdue %}
<h3>Places en cours de revente</h3>
<form action="" method="post">
    {% csrf_token %}
    <div class="form-group">
        <div class="multiple-checkbox">
            <ul>
            {% for box in annulform.attributions %}
                <li>
                    {{box.tag}}
                    {{box.choice_label}}
                </li>
            {% endfor %}            
            {% for attrib in overdue %}
                <li>
                    <input type="checkbox" style="visibility:hidden">
                    {{attrib.spectacle}}
                </li>
            {% endfor %}
            </ul>
        </div>
    </div>
    {% if annulform.attributions %}
    <input type="submit" class="btn btn-primary" name="annul" value="Annuler les reventes sélectionnées">
    {% endif %}
</form>
{% endif %}
<br>
{% if sold %}
<h3>Places revendues</h3>
<table class="table">
    {% for attrib in sold %}
    <tr>
        <form action="" method="post">
        {% csrf_token %}
        <td>{{attrib.spectacle}}</td>
        <td>{{attrib.revente.soldTo.user.get_full_name}}</td>
        <td><button type="submit" class="btn btn-primary" name="transfer"
                    value={{attrib.revente.id}}>Transférer</button></td>
        <td><button type="submit" class="btn btn-primary" name="reinit"
                    value={{attrib.revente.id}}>Réinitialiser</button></td>
        </form>
    </tr>
    {% endfor %}
</table>
{% endif %}
{% endblock %}