<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10">
		<ul id="msgops">
			% if c.domid:
			<li>${h.link_to(_('Import Accounts'), url('accounts-import', domainid=c.domid))}</li>
			<li>${h.link_to(_('Export Accounts'), url('accounts-export-bydom', domainid=c.domid))}</li>
			% else:
			<li>${h.link_to(_('Export Accounts'), url('accounts-export-byorg', orgid=c.orgid) if c.orgid else url('accounts-export'))}</li>
			% endif
		</ul>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="space-6"></div>
${s.searchbox(url('accounts-search'), [('d', c.domid),]) if c.domid 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.current(), 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" title="'+_("Administrator")+'"></i>')
			elif user.account_type == 2:
				user_icon = h.literal('<i class="icon-user green" title="'+_("Domain Admin")+'"></i>')
			else:
				user_icon = h.literal('<i class="icon-user blue" title="'+_("User")+'"></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-edit blue"></i>'), url('account-edit', userid=user.id), title=_("Update Account"))}</td>
			<td>${h.link_to(h.literal('<i class="icon-remove red"></i>'), url('account-delete', userid=user.id), title=_("Delete Account"))}</td>
		</tr>
		% endfor
		% if not c.page.items:
		<tr><td class="spanrow" colspan="8">${_('No accounts found')}</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>
<div class="clear"></div>
<div class="sp10"></div>
<%def name="title()">
${_('Accounts ')}
% if c.page.page_count != 0:
${ungettext(':: Showing page %(n)d of %(c)d page.', ':: Showing page %(n)d of %(c)d pages.', c.page.page_count) % dict(n=c.page.page, c=c.page.page_count)}
% endif
</%def>

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

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

<%def name="paging(page_nums, fieldname)">
% if c.page.page_count != 0:
<p>${_('Showing items %(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 items:')}
${h.pager_select(fieldname, str(c.page.items_per_page))}
${_('per page')}
</div>
<div class="pages">
% if c.page.page_count == 1:
-
% endif
% else:
<p>${_('No items found')}</p>
% endif
% if c.page.next_page != c.page.first_page and c.page.page != c.page.first_page:
<span>
	% if c.domid:
	${h.link_to(h.literal('<i class="icon-double-angle-left"></i>'), url('accounts-bydom-pages', page=c.page.first_page, domid=c.domid))}
	% else:
	${h.link_to(h.literal('<i class="icon-double-angle-left"></i>'), url('accounts-byorg-pages', page=c.page.first_page, orgid=c.orgid) if orgid else url('account-pages', page=c.page.first_page))}
	% endif
</span>
<span>...</span>
% endif
% if c.page.previous_page:
<span>
	% if c.domid:
	${h.link_to(h.literal('<i class="icon-angle-left"></i>'), url('accounts-bydom-pages', page=c.page.previous_page, domid=c.domid))}
	% else:
	${h.link_to(h.literal('<i class="icon-angle-left"></i>'), url('accounts-byorg-pages', page=c.page.previous_page, orgid=c.orgid) if orgid else url('account-pages', page=c.page.previous_page))}
	% endif
</span>
% endif
% for linkpage in page_nums:
% 	if linkpage == c.page.page:
<span class="curpage">${linkpage}</span>
% 	else:
<span>
	% if c.domid:
	${h.link_to(h.literal(linkpage), url('accounts-bydom-pages', page=linkpage, domid=c.domid))}
	% else:
	${h.link_to(h.literal(linkpage), url('accounts-byorg-pages', page=linkpage, orgid=c.orgid) if orgid else url('account-pages', page=linkpage))}
	% endif
</span>
% 	endif
% endfor
% if c.page.next_page:
<span>
	% if c.domid:
	${h.link_to(h.literal('<i class="icon-angle-right"></i>'), url('accounts-bydom-pages', page=c.page.next_page, domid=c.domid))}
	% else:
	${h.link_to(h.literal('<i class="icon-angle-right"></i>'), url('accounts-byorg-pages', page=c.page.next_page, orgid=c.orgid) if orgid else url('account-pages', page=c.page.next_page))}
	% endif
</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>
	% if c.domid:
	${h.link_to(h.literal('<i class="icon-double-angle-right"></i>'), url('accounts-bydom-pages', page=c.page.page_count, domid=c.domid))}
	% else:
	${h.link_to(h.literal('<i class="icon-double-angle-right"></i>'), url('accounts-byorg-pages', page=c.page.page_count, orgid=c.orgid) if orgid else url('account-pages', page=c.page.page_count))}
	% endif
</span>
% endif
% if c.page.page_count != 0:
</div>
% else:
<div class="pages">-</div>
% endif
</%def>

<%def name="submenu()">
<div class="navbar navbar-static-top">
    <div class="navbar-inner">
        <div class="nav-collapse collapse">
            <ul class="nav navbar-nav">
                <li class="nav_item">${h.link_to(_('Add account'), url(controller='accounts', action='add'), id="user-add")}</li>
            </ul>
        </div>
    </div>
</div>
</%def>

<%def name="localscripts()">\
<script type="text/javascript">
var setitems_url = "${url(controller='accounts', action='setnum')}";
var baruwa_custom_name = "${config.get('baruwa.custom.name', 'Baruwa')}";
</script>
${h.javascript_link(h.media_url() + 'js/vendor/jquery.address-1.4.min.js',
h.media_url() + 'js/baruwa/accounts.min.js')}
</%def>
<%namespace name="s" file="../includes/search.html"/>
<%namespace name="functions" file="../includes/functions.html"/>
<%inherit file="../base.html"/>

