{% extends 'base.html' %}
{% load i18n %}
{% load form_as_div %}

{% block content %}
<div class="page-header row">
    <h1 class="col-xs-6">{% block title %}{% trans 'Edit Team' %}{% endblock %}</h1>
    <div class="header-buttons col-xs-6 text-right">
        <a href="{% url 'password_change' %}" class="btn btn-default">{% trans 'Change password' %}</a>
        {% if show_delete_button %}
        <a href="{% url 'delete_team' %}" class="btn btn-danger">{% trans 'Delete team' %}</a>
        {% endif %}
    </div>
</div>

{% if team and team.net_number %}
<div class="form-group">
    <label for="team-number">Team Number:</label>
    <input type="text" id="team-number" class="form-control" readonly="true" value="{{ team.net_number }}" />
</div>
{% endif %}

<form enctype="multipart/form-data" method="post">
    {% csrf_token %}

    {{ user_form|as_div }}
    {{ team_form|as_div }}

    <button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
</form>


{% if delete_form %}
<div class="modal show" data-backdrop="static" data-keyboard="false">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h2 class="modal-title">{% trans 'Delete team' %}</h2>
            </div>
            <form method="post">
                {% csrf_token %}

                <div class="modal-body">
                    <p>
                        {% blocktrans with user.username as username %}
                        Do you really want to <strong>delete</strong> your team {{ username }}? There is
                        <strong>no way</strong> to undo this!
                        {% endblocktrans %}
                    </p>
                    <p>
                        {% blocktrans %}
                        Please enter your password for confirmation.
                        {% endblocktrans %}
                    </p>
                    {{ delete_form|as_div }}
                </div>

                <div class="modal-footer">
                    <a href="{% url 'edit_team' %}" class="btn btn-default">{% trans 'Abort' %}</a>
                    <button type="submit" class="btn btn-danger">{% trans 'Delete' %}</button>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="modal-backdrop fade in"></div>
{% endif %}
{% endblock %}
