{% extends "layout.html" %}
{% block title %}User Details{% endblock %}
{% block content %}
<h2>User Details</h2>
<table>
<tr>
    <td class="tblLt">
        Full Name<br />
        <span class="note">for commit messages</span>
    </td>
    <td class="tblRt">
        {{ user.commit_name }}
    </td>
</tr>
<tr>
    <td class="tblLt">
        Email Address<br />
        <span class="note">for commit messages</span>
    </td>
    <td class="tblRt">
        {{ user.commit_email }}
    </td>
</tr>
<tr>
    <td class="tblLt">
        System Name<br />
        <span class="note">for website login</span>
    </td>
    <td class="tblRt">
        {{ user.user_name }}
    </td>
</tr>
{% if request.user['can_create_users']
    or request.user['user_id'] == user.user_id %}
<form
    method="POST"
    action="{{ url_for('change_user_password', id=user.user_id) }}"
>
{% if not request.user['can_create_users'] %}
<tr>
    <td class="tblLt">
        Old Password
    </td>
    <td class="tblRt">
        <input type="password" name="old_password" />
    </td>
</tr>
{% endif %}
<tr>
    <td class="tblLt">
        New Password
    </td>
    <td class="tblRt">
        <input type="password" name="new_password" />
        <input type="submit" value="Change Password" />
    </td>
</tr>
</form>
{% endif %}
{% if request.user['can_create_users'] %}
<form
    method="POST"
    action="{{ url_for('change_user_permissions', id=user.user_id) }}"
>
<tr>
    <td class="tblLt">
        Can Manage Users<br />
        <span class="note">Covers creation, editing, and deletion</span>
    </td>
    <td class="tblRt">
        <input
            type="radio"
            name="can_create_users"
            value="1"
{% if user['can_create_users'] %}
            checked="checked"
{% endif %}
            id="can_create_users_yes" />
        <label for="can_create_users_yes">Yes</label>
        <input
            type="radio"
            name="can_create_users"
            value="0"
{% if not user['can_create_users'] %}
            checked="checked"
{% endif %}
            id="can_create_users_no" />
        <label for="can_create_users_no">No</label>
    </td>
</tr>
<tr>
    <td class="tblLt">
        Can Manage Repositories<br />
        <span class="note">Covers creation, editing, and deletion</span>
    </td>
    <td class="tblRt">
        <input
            type="radio"
            name="can_create_repositories"
            value="1"
{% if user['can_create_repositories'] %}
            checked="checked"
{% endif %}
            id="can_create_repositories_yes" />
        <label for="can_create_repositories_yes">Yes</label>
        <input
            type="radio"
            name="can_create_repositories"
            value="0"
{% if not user['can_create_repositories'] %}
            checked="checked"
{% endif %}
            id="can_create_repositories_no" />
        <label for="can_create_repositories_no">No</label>
    </td>
</tr>
<tr>
    <td class="tblLt">
        Commit ACL Changes
    </td>
    <td class="tblRt">
        <input type="submit" value="Change Access Control Levels" />
    </td>
</tr>
</form>
<tr>
    <td class="tblLt">
        Deletion Link<br />
        <span class="note"><strong>Warning:</strong> no confirmation</span>
    </td>
    <td class="tblRt">
        <a href="{{ url_for('delete_user', id=user.user_id) }}">delete</a>
    </td>
</tr>
{% endif %}
</table>

{% endblock %}
