${s.searchbox(url('accounts-search'), [('d', c.d)]) if c.d else s.searchbox(url('accounts-search'))}
<div class="space-6"></div>
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10 toolbar">${self.paging(h.do_pagination(c.page), 'saccountstop')}</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="space-6"></div>
${h.form(url(controller='accounts'), method='post')}
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10" id="bulkaccount">
		<div class="row-fluid">
			<div class="span4 hidden-phone"></div>
			<div class="span2 half">${h.radio('whatdo', 'delete', label='Delete', class_='fieldcontrols')}</div>
			<div class="span2 half">${h.radio('whatdo', 'disable', label='Disable', class_='fieldcontrols')}</div>
			<div class="span2 half">${h.radio('whatdo', 'enable', label='Enable', class_='fieldcontrols')}</div>
			<div class="span2"><button class="btn btn-small btn-success"><i class="icon-cog"></i> ${_('Process')}</button></div>
		</div>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="space-6"></div>
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10">
		<table class="table table-bordered table-condensed table-hover table-striped">
		<thead>
		<tr>
		    <th>${h.checkbox('checkall')}</th>
		    <th>&nbsp;</th>
		    <th>${_('Username')}</th>
		    <th class="hidden-phone">${_('Full names')}</th>
		    <th class="hidden-phone">${_('Email address')}</th>
		    <th class="hidden-phone">${_('Status')}</th>
			<th colspan="2">${_('Actions')}</th>
		</tr>
		</thead>
		<tbody>
		% for user in c.page.items:
		<% 
			if user.account_type == 1:
				user_icon = h.literal('<i class="icon-user red"></i>')
			elif user.account_type == 2:
				user_icon = h.literal('<i class="icon-user green"></i>')
			else:
				user_icon = h.literal('<i class="icon-user blue"></i>')
		%>
		<tr id="account-id-${user.id}">
			<td>${h.checkbox('accountid', value=user.id, class_='selector')}</td>
		    <td>${h.link_to(user_icon, url('account-detail', userid=user.id))}</td>
		    <td>${h.link_to(user.username, url('account-detail', userid=user.id))}</td>
		    <td class="hidden-phone">${user.firstname} ${user.lastname}</td>
		    <td class="hidden-phone">${h.link_to(user.email, url('account-detail', userid=user.id))}</td>
		    <td class="hidden-phone">${functions.item_status(user.active)}</td>
			<td>${h.link_to(h.literal('<i class="icon-cog blue"></i>'), url('account-edit', userid=user.id))}</td>
			<td>${h.link_to(h.literal('<i class="icon-remove red"></i>'), url('account-delete', userid=user.id))}</td>
		</tr>
		% endfor
		% if not c.page.items:
		<tr><td colspan="8">${_('No accounts found matching: %s') % c.q}</td></tr>
		% endif
		</tbody>
		</table>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
${h.end_form()}\
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10 toolbar">${self.paging(h.do_pagination(c.page), 'saccountsbottom')}</div>
	<div class="span1 hidden-phone"></div>
</div>

<%def name="title()">
${_('Accounts :: Search results :: Showing page %(n)d of %(c)d pages.') % dict(n=c.page.page, c=c.page.page_count) if c.page.page_count != 0 else _('Accounts :: Search results')}
</%def>

<%def name="heading()">
${_('Accounts :: Search results :: Showing page %(n)d of %(c)d pages.') % dict(n=c.page.page, c=c.page.page_count) if c.page.page_count != 0 else _('Accounts :: Search results')}
</%def>

<%def name="headers()">
</%def>

<%def name="paging(page_nums, fieldname)">
% if c.page.page_count != 0:
<%
kwd = {}
if c.d:
	kwd['d'] = c.d
%>
<p>${_('Showing results %(i)d to %(l)d of %(count)d') % dict(i=c.page.first_item, l=c.page.last_item, count=c.page.item_count)}.</p>
<div class="limiter">
${_('Show:')}
${h.pager_select(fieldname, str(c.page.items_per_page))}
${_('results per page')}
</div>
<div class="pages">
% if c.page.page_count == 1:
-
% endif
% else:
<p>${_('No items found matching: %s') % c.q}</p>
% endif
% if c.page.next_page != c.page.first_page and c.page.page != c.page.first_page:
<span>
	${h.link_to(h.literal('<i class="icon-double-angle-left"></i>'), url.current(p=c.page.first_page, q=c.q, **kwd))}
</span>
<span>...</span>
% endif
% if c.page.previous_page:
<span>
	${h.link_to(h.literal('<i class="icon-angle-left"></i>'), url.current(p=c.page.previous_page, q=c.q, **kwd))}
</span>
% endif
% for linkpage in page_nums:
% 	if linkpage == c.page.page:
<span class="curpage">${linkpage}</span>
% 	else:
<span>
	${h.link_to(h.literal(linkpage), url.current(p=linkpage, q=c.q, **kwd))}
</span>
% 	endif
% endfor
% if c.page.next_page:
<span>
	${h.link_to(h.literal('<i class="icon-angle-right"></i>'), url.current(p=c.page.next_page, q=c.q, **kwd))}
</span>
% endif
% if c.page.next_page != c.page.page_count and c.page.page != c.page.page_count and c.page.page_count != 0:
<span>...</span>
<span>
	${h.link_to(h.literal('<i class="icon-double-angle-right"></i>'), url.current(p=c.page.page_count, q=c.q, **kwd))}
</span>
% endif
% if c.page.page_count != 0:
</div>
% else:
<div class="pages">-</div>
% endif
</%def>
<%def name="submenu()"></%def>
<%def name="localscripts()">\
${h.javascript_link(h.media_url() + 'js/baruwa/accounts.search.min.js')}
</%def>
<%namespace name="s" file="../includes/search.html"/>
<%namespace name="functions" file="../includes/functions.html"/>
<%inherit file="../base.html"/>
