forgejo-tickets/web/templates/pages/admin/users/detail.html

84 lines
3.6 KiB
HTML

{{define "title"}}User Detail{{end}}
{{define "content"}}
{{with .Data}}
<div class="mb-4">
<a href="/admin/users" class="text-sm text-blue-600 hover:text-blue-500">&larr; Back to users</a>
</div>
<div class="bg-white p-6 rounded-lg shadow ring-1 ring-gray-200 mb-8">
<h1 class="text-xl font-bold text-gray-900">{{.User.Name}}</h1>
<dl class="mt-4 grid grid-cols-2 gap-4 text-sm">
<div>
<dt class="font-medium text-gray-500">Email</dt>
<dd class="text-gray-900">{{.User.Email}}</dd>
</div>
<div>
<dt class="font-medium text-gray-500">Verified</dt>
<dd>{{if .User.EmailVerified}}<span class="text-green-600">Yes</span>{{else}}<span class="text-red-600">No</span>{{end}}</dd>
</div>
<div>
<dt class="font-medium text-gray-500">Approved</dt>
<dd>{{if .User.Approved}}<span class="text-green-600">Yes</span>{{else}}<span class="text-yellow-600">Pending</span>{{end}}</dd>
</div>
<div>
<dt class="font-medium text-gray-500">Created</dt>
<dd class="text-gray-900">{{formatDate .User.CreatedAt}}</dd>
</div>
</dl>
</div>
<h2 class="text-lg font-semibold text-gray-900 mb-4">Project Access</h2>
{{if .AllRepos}}
<form method="POST" action="/admin/users/{{.User.ID}}/repos" class="bg-white p-6 rounded-lg shadow ring-1 ring-gray-200 mb-8">
<input type="hidden" name="gorilla.csrf.Token" value="{{$.CSRFToken}}">
<div class="space-y-2">
{{range .AllRepos}}
<label class="flex items-center gap-2">
<input type="checkbox" name="repo_ids" value="{{.ID}}"
{{if index $.Data.AssignedRepoIDs (print .ID)}}checked{{end}}
class="rounded border-gray-300 text-blue-600 focus:ring-blue-500">
<span class="text-sm text-gray-900">{{.Name}}</span>
</label>
{{end}}
</div>
<div class="mt-4">
<button type="submit" class="rounded-md bg-blue-600 px-4 py-2 text-sm font-semibold text-white shadow hover:bg-blue-500">Save Assignments</button>
</div>
</form>
{{else}}
<p class="text-sm text-gray-500 mb-8">No active projects available.</p>
{{end}}
<h2 class="text-lg font-semibold text-gray-900 mb-4">Tickets</h2>
{{if .Tickets}}
<div class="overflow-hidden bg-white shadow ring-1 ring-gray-200 rounded-lg">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Title</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Product</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Status</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase">Created</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
{{range .Tickets}}
<tr class="hover:bg-gray-50">
<td class="px-4 py-3">
<a href="/admin/tickets/{{.ID}}" class="text-sm font-medium text-blue-600 hover:text-blue-500">{{.Title}}</a>
</td>
<td class="px-4 py-3 text-sm text-gray-500">{{.RepoName}}</td>
<td class="px-4 py-3">{{statusBadge (print .Status)}}</td>
<td class="px-4 py-3 text-sm text-gray-500">{{formatDate .CreatedAt}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{else}}
<p class="text-sm text-gray-500">No tickets.</p>
{{end}}
{{end}}
{{end}}