backend-server-v2/web/templates/admin/users.html

54 lines
2.9 KiB
HTML

{{define "content"}}
<h1>Admin - Users</h1>
<p class="muted">Elenco utenti server-rendered.</p>
<form class="row" method="get" action="/admin/users">
<input type="text" name="q" placeholder="Cerca nome o email" value="{{.PageData.Q}}">
<select name="sort" style="padding:10px;border:1px solid #d1d5db;border-radius:8px;">
<option value="id" {{if eq .PageData.Sort "id"}}selected{{end}}>ID</option>
<option value="name" {{if eq .PageData.Sort "name"}}selected{{end}}>Name</option>
<option value="email" {{if eq .PageData.Sort "email"}}selected{{end}}>Email</option>
</select>
<select name="dir" style="padding:10px;border:1px solid #d1d5db;border-radius:8px;">
<option value="asc" {{if eq .PageData.Dir "asc"}}selected{{end}}>ASC</option>
<option value="desc" {{if eq .PageData.Dir "desc"}}selected{{end}}>DESC</option>
</select>
<input type="number" name="pageSize" min="1" max="100" value="{{.PageData.PageSize}}" style="max-width:120px;">
<input type="hidden" name="page" value="1">
<button type="submit">Filtra</button>
</form>
<table style="width:100%;border-collapse:collapse;margin-top:16px;">
<thead>
<tr>
<th style="text-align:left;border-bottom:1px solid #e5e7eb;padding:8px;">ID</th>
<th style="text-align:left;border-bottom:1px solid #e5e7eb;padding:8px;">Name</th>
<th style="text-align:left;border-bottom:1px solid #e5e7eb;padding:8px;">Email</th>
<th style="text-align:left;border-bottom:1px solid #e5e7eb;padding:8px;">Role</th>
<th style="text-align:left;border-bottom:1px solid #e5e7eb;padding:8px;">Verified</th>
</tr>
</thead>
<tbody>
{{range .PageData.Users}}
<tr>
<td style="border-bottom:1px solid #f1f5f9;padding:8px;">{{.ID}}</td>
<td style="border-bottom:1px solid #f1f5f9;padding:8px;">{{if .Name}}{{.Name}}{{else}}-{{end}}</td>
<td style="border-bottom:1px solid #f1f5f9;padding:8px;">{{.Email}}</td>
<td style="border-bottom:1px solid #f1f5f9;padding:8px;">{{.Role}}</td>
<td style="border-bottom:1px solid #f1f5f9;padding:8px;">{{if .EmailVerified}}yes{{else}}no{{end}}</td>
</tr>
{{else}}
<tr><td colspan="5" style="padding:12px;">Nessun utente trovato.</td></tr>
{{end}}
</tbody>
</table>
<div class="row" style="margin-top:12px;align-items:center;justify-content:space-between;">
<div class="muted">Totale: {{.PageData.Total}} utenti. Pagina {{.PageData.Page}}{{if gt .PageData.TotalPages 0}} / {{.PageData.TotalPages}}{{end}}</div>
<div class="row">
<a {{if not .PageData.HasPrev}}style="pointer-events:none;opacity:.5;"{{end}} href="/admin/users?q={{.PageData.Q}}&sort={{.PageData.Sort}}&dir={{.PageData.Dir}}&page={{.PageData.PrevPage}}&pageSize={{.PageData.PageSize}}">Prev</a>
<a {{if not .PageData.HasNext}}style="pointer-events:none;opacity:.5;"{{end}} href="/admin/users?q={{.PageData.Q}}&sort={{.PageData.Sort}}&dir={{.PageData.Dir}}&page={{.PageData.NextPage}}&pageSize={{.PageData.PageSize}}">Next</a>
</div>
</div>
{{end}}