{% if not rejudging.endtime %}
    <div>
        {{ button(path('jury_rejudging_finish', {rejudgingId: rejudging.rejudgingid, action: 'cancel'}), 'Cancel rejudging', 'danger', 'times') }}
        {% if todo == 0 %}
            {{ button(path('jury_rejudging_finish', {rejudgingId: rejudging.rejudgingid, action: 'apply'}), 'Apply rejudging', 'success', 'check') }}
        {% endif %}
    </div>
{% else %}
    <div>
        <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#rejudge-modal">
            <i class="fas fa-sync"></i> Repeat rejudging
        </button>
    </div>

    <div class="modal fade" id="rejudge-modal" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h2 class="modal-title">Repeat rejudging</h2>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <form action="{{ path('jury_create_rejudge') }}" method="post">
                    <div class="modal-body">
                        <input type="hidden" name="table" value="rejudging"/>
                        <input type="hidden" name="id" value="{{ rejudging.rejudgingid }}"/>
                        This will create a new rejudging with the same submissions as this rejudging.
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
                        <input type="submit" value="Repeat rejudging" class="btn btn-primary"/>
                    </div>
                </form>
            </div>
        </div>
    </div>
{% endif %}
