swirl/views/system/user/list.jet
2017-09-26 20:50:09 +08:00

134 lines
3.9 KiB
Go

{{ extends "../../_layouts/default" }}
{{ import "../../_modules/pager" }}
{{ block script() }}
<script>$(() => new Swirl.User.ListPage())</script>
{{ end }}
{{ block body() }}
<section class="hero is-dark">
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title is-2">USER</h1>
<h2 class="subtitle is-5">
Manage users.
</h2>
</div>
</div>
<div class="hero-foot">
<div class="container">
<nav class="tabs is-boxed">
<ul>
<li>
<a href="/system/role/">Roles</a>
</li>
<li class="is-active">
<a href="/system/user/">Users</a>
</li>
<li>
<a href="/system/setting/">Settings</a>
</li>
<li>
<a href="/system/event/">Events</a>
</li>
</ul>
</nav>
</div>
</div>
</section>
<section class="section">
<nav class="level">
<!-- Left side -->
<div class="level-left">
<div class="level-item">
<form>
<input name="filter" value="{{.Filter}}" type="hidden">
<div class="field has-addons">
<p class="control">
<input name="query" value="{{.Query}}" class="input" type="text" placeholder="Search by name, login name and email">
</p>
<p class="control">
<button type="submit" class="button is-primary">Search</button>
</p>
</div>
</form>
</div>
<div class="level-item">
<p class="subtitle is-5">
<strong>{{.Pager.Count}}</strong> users
</p>
</div>
</div>
<!-- Right side -->
<div class="level-right">
<p class="level-item">
{{if .Filter == ""}}
<strong>All</strong>
{{else}}
<a href="/system/user/">All</a>
{{end}}
</p>
<p class="level-item">
{{if .Filter == "admins"}}
<strong>Admins</strong>
{{else}}
<a href="?filter=admins">Admins</a>
{{end}}
</p>
<p class="level-item">
{{if .Filter == "active"}}
<strong>Active</strong>
{{else}}
<a href="?filter=active">Active</a>
{{end}}
</p>
<p class="level-item">
{{if .Filter == "blocked"}}
<strong>Blocked</strong>
{{else}}
<a href="?filter=blocked">Blocked</a>
{{end}}
<p class="level-item">
<a href="new" class="button is-success"><span class="icon"><i class="fa fa-plus"></i></span><span>New</span></a>
</p>
</div>
</nav>
<table id="table-items" class="table is-bordered is-striped is-narrow is-fullwidth">
<thead>
<tr>
<th>Name</th>
<th>Login Name</th>
<th>Email</th>
<th>Type</th>
<th>Status</th>
<th>Created at</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{{range .Users}}
<tr data-id="{{.ID}}">
<td><a href="{{.LoginName}}/detail">{{.Name}}</a></td>
<td>{{.LoginName}}</td>
<td>{{.Email}}</td>
<td>{{.Type}}</td>
<td><span class="tag is-{{.Status == 1 ? "success" : "warning"}}">{{.Status == 1 ? "Active" : "Blocked"}}</span></td>
<td>{{time(.CreatedAt)}}</td>
<td>
<a href="{{.LoginName}}/edit" class="button is-small is-dark is-outlined">Edit</a>
{{if .Status == 1}}
<button class="button is-small is-warning is-outlined" data-action="block-user">Block</button>
{{else}}
<button class="button is-small is-warning is-outlined" data-action="unblock-user">Unblock</button>
{{end}}
<button class="button is-small is-danger is-outlined" data-action="delete-user">Delete</button>
</td>
</tr>
{{end}}
</tbody>
</table>
{{ yield pager(info=.Pager) }}
</section>
{{ end }}