{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin user")}}
	<div class="admin-setting-content">
		<h4 class="ui top attached header">
			{{ctx.Locale.Tr "admin.orgs.org_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .Total}})
			<div class="ui right">
				<a class="ui primary tiny button" href="{{AppSubUrl}}/org/create">{{ctx.Locale.Tr "admin.orgs.new_orga"}}</a>
			</div>
		</h4>
		<div class="ui attached segment">
			<div class="ui secondary filter menu tw-items-center tw-mx-0">
				<form class="ui form ignore-dirty tw-flex-1">
					{{template "shared/search/combo" dict "Value" .Keyword "Placeholder" (ctx.Locale.Tr "search.org_kind")}}
				</form>
				<!-- Sort -->
				<div class="ui dropdown type jump item tw-mr-0">
					<span class="text">
						{{ctx.Locale.Tr "repo.issues.filter_sort"}}
					</span>
					{{svg "octicon-triangle-down" 14 "dropdown icon"}}
					<div class="menu">
						<a class="{{if or (eq .SortType "oldest") (not .SortType)}}active {{end}}item" href="?sort=oldest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.oldest"}}</a>
						<a class="{{if eq .SortType "newest"}}active {{end}}item" href="?sort=newest&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.latest"}}</a>
						<a class="{{if eq .SortType "alphabetically"}}active {{end}}item" href="?sort=alphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a>
						<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="?sort=reversealphabetically&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a>
						<a class="{{if eq .SortType "recentupdate"}}active {{end}}item" href="?sort=recentupdate&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.recentupdate"}}</a>
						<a class="{{if eq .SortType "leastupdate"}}active {{end}}item" href="?sort=leastupdate&q={{$.Keyword}}">{{ctx.Locale.Tr "repo.issues.filter_sort.leastupdate"}}</a>
					</div>
				</div>
			</div>
		</div>
		<div class="ui attached table segment">
			<table class="ui very basic striped table unstackable">
				<thead>
					<tr>
						<th data-sortt-asc="oldest" data-sortt-desc="newest">ID{{SortArrow "oldest" "newest" $.SortType false}}</th>
						<th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically" data-sortt-default="true">
							{{ctx.Locale.Tr "admin.orgs.name"}}
							{{SortArrow "alphabetically" "reversealphabetically" $.SortType true}}
						</th>
						<th>{{ctx.Locale.Tr "admin.orgs.teams"}}</th>
						<th>{{ctx.Locale.Tr "admin.orgs.members"}}</th>
						<th>{{ctx.Locale.Tr "admin.users.repos"}}</th>
						<th data-sortt-asc="recentupdate" data-sortt-desc="leastupdate">
							{{ctx.Locale.Tr "admin.users.created"}}
							{{SortArrow "recentupdate" "leastupdate" $.SortType false}}
						</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
					{{range .Users}}
						<tr>
							<td>{{.ID}}</td>
							<td>
								<a href="{{.HomeLink}}">{{.Name}}</a>
								{{if .Visibility.IsPrivate}}
									<span class="text gold">{{svg "octicon-lock"}}</span>
								{{end}}
								{{if eq .Type 3}}{{/* Reserved organization */}}
									<span class="ui mini label">{{ctx.Locale.Tr "admin.users.reserved"}}</span>
								{{end}}
							</td>
							<td>{{.NumTeams}}</td>
							<td>{{.NumMembers}}</td>
							<td>{{.NumRepos}}</td>
							<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
							<td><a href="{{.OrganisationLink}}/settings" data-tooltip-content="{{ctx.Locale.Tr "edit"}}">{{svg "octicon-pencil"}}</a></td>
						</tr>
					{{else}}
						<tr><td class="tw-text-center" colspan="7">{{ctx.Locale.Tr "repo.pulls.no_results"}}</td></tr>
					{{end}}
				</tbody>
			</table>
		</div>

		{{template "base/paginate" .}}
	</div>
{{template "admin/layout_footer" .}}
