${s.searchbox(url(controller='organizations'))}
<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), 'sorgstop')}</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>${_('Organization name')}</th>
			<th class="hidden-phone">${_('List domains')}</th>
			<th class="hidden-phone">${_('List accounts')}</th>
			<th class="hidden-phone">${_('Add domain')}</th>
			<th class="hidden-phone">${_('Import domains')}</th>
			<th>${_('Edit')}</th>
			<th>${_('Delete')}</th>
		</tr>
		</thead>
		<tbody>
		% if not c.page.items:
		<tr><td colspan="6">${_('No organizations found')}</td></tr>
		% endif
		% for i, org in enumerate(c.page.items):
		<tr>
			<td>${h.link_to(org.name, url('org-detail', orgid=org.id))}</td>
			<td class="hidden-phone">${h.link_to(h.literal('<i class="icon-group blue"></i>'), url('domains-byorg', orgid=org.id))}</td>
			<td class="hidden-phone">${h.link_to(h.literal('<i class="icon-user blue"></i>'), url('accounts-byorg', orgid=org.id))}</td>
			<td class="hidden-phone">${h.link_to(h.literal('<i class="icon-plus green"></i>'), url('domain-add-byorg', orgid=org.id))}</td>
			<td class="hidden-phone">${h.link_to(h.literal('<i class="icon-hand-up blue"></i>'), url('orgs-import-domains', orgid=org.id))}</td>
			<td>${h.link_to(h.literal('<i class="icon-edit blue"></i>'), url('orgs-edit', orgid=org.id), title=_("Edit organization"))}</td>
			<td>${h.link_to(h.literal('<i class="icon-remove red"></i>'), url('orgs-delete', orgid=org.id), title=_("Delete organization"))}</td>
		</tr>
		% endfor
		</tbody>
		</table>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<div class="row-fluid">
	<div class="span1 hidden-phone"></div>
	<div class="span10 toolbar">${self.paging(h.do_pagination(c.page), 'sorgsbottom')}</div>
	<div class="span1 hidden-phone"></div>
</div>

<%def name="paging(page_nums, fieldname)">
% if c.page.page_count != 0:
<%
kwd = {}
if hasattr(c, 'q') and c.q:
	kwd['q'] = c.q
%>
<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>
	${h.link_to(h.literal('<i class="icon-double-angle-left"></i>'),  url('orgs-pages', page=c.page.first_page, **kwd))}
</span>
<span>...</span>
% endif
% if c.page.previous_page:
<span>
	${h.link_to(h.literal('<i class="icon-angle-left"></i>'), url('orgs-pages', page=c.page.previous_page, **kwd))}
</span>
% endif
% for linkpage in page_nums:
% 	if linkpage == c.page.page:
<span><b>${linkpage}</b></span>
% 	else:
<span>
	${h.link_to(h.literal(linkpage), url('orgs-pages', page=linkpage, **kwd))}
</span>
% 	endif
% endfor
% if c.page.next_page:
<span>
	${h.link_to(h.literal('<i class="icon-angle-right"></i>'), url('orgs-pages', page=c.page.next_page, **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('orgs-pages', page=c.page.page_count, **kwd))}
</span>
% endif
% if c.page.page_count != 0:
</div>
% else:
<div class="pages">-</div>
% endif
</%def>
<%def name="title()">
${_('Organizations :: Showing page %(page)d of %(count)d pages.') % dict(page=c.page.page, count=c.page.page_count)}
</%def>

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

<%def name="headers()">
</%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 organization'), url('orgs-add'))}</li>
            </ul>
        </div>
    </div>
</div>
</%def>

<%def name="localscripts()">
<script type="text/javascript">
var setitems_url = "${url(controller='organizations', 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/organizations.min.js')}
</%def>
<%namespace name="s" file="../includes/search.html"/>
<%inherit file="../base.html"/>

