<html py:extends="master.xhtml" py:strip="True">
<head py:block="head" py:strip="True">
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" py:if="False"/>
    <title py:block="master_title">TGAppPermissions</title>
    <link rel="stylesheet" type="text/css" media="screen" href="${tg.url('/_pluggable/tgapppermissions/css/style.css')}" />
</head>

<body py:block="body" py:strip="True">
    <div class="row">
        <div class="col-md-3 col-xs-12 col-md-offset-10">
            <a href="${tg.url(mount_point)}" class="btn btn-primary">Permissions</a>
        </div>
    </div>
    <div class="tgapppermissions-list">
        <div class="row" style="overflow-wrap: break-word; margin-bottom: 10px">
            <p class="pagelist">
              ${tmpl_context.paginators.users.pager()}
            </p>
            <form method="GET" action="${tg.url(mount_point + '/users')}" class="form-inline">
                <select name="search_by" id="field" class="form-control">
                    <option value="user_name">User Name</option>
                    <option value="display_name">Display Name</option>
                    <option value="email_address">Email</option>
                </select>
                <input name="search_value" class="form-control" style="width: auto"/>
                <input type="submit" value="Search" class="btn btn-primary"/>
            </form>
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>Actions</th>
                        <th>Display Name</th>
                        <th>User Name</th>
                        <th>Email</th>
                        <th>Created</th>
                        <th>Groups</th>
                    </tr>
                </thead>
                <tbody>
                    <tr py:for="u in users">
                        <td>
                            <a href="${tg.url(mount_point + '/edit_user/' +
                                str(getattr(u, h.tgapppermissions.get_primary_field('User'))))}"
                               class="tgappcategories-edit btn btn-primary">
                                <span class="glyphicon glyphicon-pencil"/>
                            </a>
                        </td>
                        <td>${u.display_name}</td>
                        <td>${u.user_name}</td>
                        <td>${u.email_address}</td>
                        <td>${u.created}</td>
                        <td>
                            <span py:for="g in u.groups">
                                ${g.display_name},
                            </span>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</body>
</html>
