{% extends "core/base.html" %}
{% block section_title %}{{ user }}{% endblock %}
{% block content %}
<div class="row">
    <div class="col">
        <div class="card mt-3">
            <div class="card-body">
                <h4>Description</h4>
                <div class="card-text"><p>{{ user.description }}</p></div>
                <table class="table table-bordered">
                    <tr>
                        <td><b>Customer</b></td>
                        <td><a href="{% url 'customer' user.customer.id %}">{{ user.customer }}</a></td>
                    </tr>
                    <tr>
                        <td><b>AD Login</b></td>
                        <td>{{ user.ad_login }}</td>
                    </tr>
                    <tr>
                        <td><b>AD Password</b></td>
                        <td>{{ user.ad_pw }}</td>
                    </tr>
                    <tr>
                        <td><b>Email Address</b></td>
                        <td>{{ user.ad_login }}</td>
                    </tr>
                    <tr>
                        <td><b>Mail Password</b></td>
                        <td>{{ user.mail_pw }}</td>
                    </tr>
                    <tr>
                        <td><b>User is activ</b></td>
                        <td>{{ user.enabled }}</td>
                    </tr>
                    <tr>
                        <td><b>Comptuers</b></td>
                        <td>
                        {% for computer in computers %}
                            <a href="{% url 'computer' computer.id %}">{{ computer}}</a>
                        {% endfor %}
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

    {% if ad_groups or mail_groups or mail_alias %}
    <div class="col">
        {% if mail_alias %}
        <div class="card mt-3">
            <div class="card-header">Mail Alias</div>
            <div class="card-body">
                <table class="table table-bordered">
                    {% for alias in mail_alias %}
                    <tr>
                    <td>
                    {{ alias }}
                    </td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
        {% endif %}

        {% if ad_groups %}
        <div class="card mt-3">
            <div class="card-header">AD Groups</div>
            <div class="card-body">
                <table class="table table-bordered">
                    {% for group in ad_groups %}
                    <tr>
                        <td>{{ group.group }}</td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
        {% endif %}

        {% if mail_groups %}
        <div class="card mt-3">
            <div class="card-header">Mail Groups</div>
            <div class="card-body">
                <table class="table table-bordered">
                    <tr>
                    <th>Group Name</th>
                    <th>Address</th>
                    </tr>
                    {% for group in mail_groups %}
                    <tr>
                        <td>{{ group.group }}</td>
                        <td>{{ group.group.mail_address }}</td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
        {% endif %}
    </div>
    {% endif %}

    {% if licenses %}
    <div class="col">
        <div class="card mt-3">
            <div class="card-header">Licenses</div>
            <div class="card-body">
                <table class="ui celled table">
                    {% for license in licenses %}
                    <tr>
                        <td>{{ license.license.software }}</td>
                        <td><code>{{ license.license.key }}</code></td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    {% endif %}
    </div>
</div>
{% endblock %}
