{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n %}

{% block title %}{% trans 'Gateways' %}{% endblock %}

{% block breadcrumb %}
    <ol class="breadcrumb">
        <li><span class="glyphicon glyphicon-home"></span></li>
        <li class="active">{% trans 'Network access servers' %}</li>
    </ol>
{% endblock %}

{% block page-header %}
    {% trans 'Gateways' %}
{% endblock %}

{% block main %}
    <div class="row">
        {% for nas in object_list %}
            <div class="col-sm-6">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title">{{ nas.title }}</h3>
                    </div>
                    <div class="panel-body">
                        <dl class="dl-horizontal">
                            <dt>{% trans 'Ip address' %}</dt>       <dd>{{ nas.ip_address }}</dd>
                            <dt>{% trans 'Port' %}</dt>             <dd>{{ nas.ip_port }}</dd>
                            <dt>{% trans 'Auth login' %}</dt>       <dd>{{ nas.auth_login }}</dd>
                            <dt>{% trans 'Auth password' %}</dt>    <dd>{{ nas.auth_passw }}</dd>
                            <dt>{% trans 'NAS type' %}</dt>         <dd>{{ nas.get_nas_type_display }}</dd>
                            <dt>{% trans 'Is default' %}</dt>
                            <dd>
                                <input type="checkbox" {{ nas.default|yesno:'checked,' }}>
                            </dd>
                            <dt>{% trans 'Enabled' %}</dt>
                            <dd>
                                <input type="checkbox" {{ nas.enabled|yesno:'checked,' }}>
                            </dd>
                        </dl>
                    </div>
                    {% if perms.gw_app.change_nasmodel %}
                        <div class="panel-footer">
                            <div class="btn-group btn-group-sm">
                                <a href="{% url 'gw_app:edit' nas.pk %}" class="btn btn-default">
                                    <span class="glyphicon glyphicon-edit"></span>
                                    <span class="hidden-md">{% trans 'Edit' %}</span>
                                </a>
                            </div>
                        </div>
                    {% endif %}
                </div>
            </div>
        {% empty %}
            <div class="col-sm-12">
                <h3>{% trans "You don't have gateways" %}</h3>
            </div>
        {% endfor %}
        <div class="col-sm-12">
            <div class="btn-group btn-group-sm">
                <a href="{% url 'gw_app:add' %}" class="btn btn-default">
                    <span class="glyphicon glyphicon-plus"></span> {% trans 'Add' %}
                </a>
            </div>
        </div>
    </div>
{% endblock %}
