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

{% block breadcrumb %}
    <ol class="breadcrumb">
        <li><span class="glyphicon glyphicon-home"></span></li>
        <li><a href="{% url 'acc_app:accounts_list' %}">{% trans 'Administrators' %}</a></li>
        <li class="active">{{ userprofile.username }}</li>
    </ol>
{% endblock %}

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

{% block main %}
    <div class="row">
        <div class="col-sm-3">
            <div class="thumbnail">
                <a href="{{ userprofile.get_big_ava }}" class="thumbnail">
                    <img alt="ava" src="{{ userprofile.get_min_ava }}"/>
                </a>
                <div class="caption btn-group btn-group-sm">
                    {% if userprofile == request.user %}
                        <a href="{% url 'acc_app:setup_info' %}" class="btn btn-primary">
                            <span class="glyphicon glyphicon-edit"></span>
                            <span class="hidden-sm hidden-md">{% trans 'Edit' %}</span>
                        </a>
                    {% else %}
                        {% if request.user.is_superuser %}
                            <a href="{% url 'acc_app:edit_profile' userprofile.id %}" class="btn btn-primary">
                                <span class="glyphicon glyphicon-edit"></span>
                                <span class="hidden-sm hidden-md">{% trans 'Edit' %}</span>
                            </a>
                        {% endif %}
                    {% endif %}
                    {% if request.user.is_superuser %}
                        <a href="{% url 'acc_app:setup_perms' userprofile.pk %}" class="btn btn-default"
                           title="{{ userprofile.is_superuser|yesno:_("Profile is superuser. Permissions to change it makes no sense.,") }}" data-toggle="tooltip">
                            <span class="glyphicon glyphicon-lock"></span>
                            <span class="hidden-sm hidden-md">{% trans 'Permission options' %}</span>
                        </a>
                    {% endif %}
                </div>
            </div>
        </div>

        <div class="col-sm-9">
            <h3>{{ userprofile.username|default:_('Not assigned') }}</h3>
            <ul class="nav nav-tabs">
                {% url 'acc_app:other_profile' uid as profile_url %}
                <li{% if profile_url == request.path %} class="active"{% endif %}>
                    <a href="{{ profile_url }}">
                        {% trans 'Administrator' %}
                    </a>
                </li>

                {% url 'acc_app:manage_responsibility_groups' uid as manrespgr %}
                <li{% if manrespgr == request.path %} class="active"{% endif %}>
                    <a href="{{ manrespgr }}">
                        {% trans 'Manage responsibility groups' %}
                    </a>
                </li>

                {% if request.user.is_superuser %}
                {% url 'acc_app:set_abon_groups_permission' uid as set_ag_perm %}
                <li{% if set_ag_perm == request.path %} class="active"{% endif %}>
                    <a href="{{ set_ag_perm }}">
                        <span class="glyphicon glyphicon-lock"></span>
                        {% trans 'Access to groups' %}
                    </a>
                </li>
                {% endif %}

                {% if perms.accounts_app.view_userprofilelog %}
                {% url 'acc_app:action_log' uid as actlog %}
                <li{% if actlog == request.path %} class="active"{% endif %}>
                    <a href="{{ actlog }}">
                        <span class="glyphicon glyphicon-book"></span>
                        {% trans 'Action log' %}
                    </a>
                </li>
                {% endif %}

            </ul>
            <div class="tab-content">
                <div class="tab-pane active">
                    {% block content %}{% endblock %}
                </div>
            </div>
        </div>
    </div>
{% endblock %}
