<%def name="form()">
<div class="row-fluid form_area">
	<div class="span1 hidden-phone"></div>
	<div class="span10" id="afform">
		% if c.form.errors:
		<div id="filter-error" class="row-fluid">
			<div class="span12 alert alert-error">
				<button class="close" data-dismiss="alert" type="button">
					<i class="icon-remove"></i>
				</button>
				<%
				allerrors = []
				[allerrors.extend(l) for l in c.form.errors.values()]
				%>
				<i class="icon-remove"></i> <strong>${u', '.join(allerrors)}</strong>
			</div>
		</div>
		% endif
		<div class="row-fluid">
			<button class="close" type="button">
				<i class="icon-remove"></i>
			</button>
			${h.form(url(controller='reports'), id='filter-form', method='post')}
			<div class="span3">${c.form.filtered_field}</div>
		    <div class="span3">${c.form.filtered_by}</div>
		    <div class="span3">${c.form.filtered_value(size=30, class_="input-block-level")}</div>
		    <div class="span2"><button class="btn btn-small btn-success" id="filter_form_submit"><i class="icon-plus"></i> ${ _('Add filter')}</button></div>
			${h.HTML.div(c.form.csrf_token, style="display: none;")}
		    ${h.end_form()}
		</div>\
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<!-- Powered by Baruwa © 2011-2015 Andrew Colin Kissa -->
</%def>
<%def name="select_filter(app)">
<%
if not c.active_filters:
  filter_class = ' hide'
else:
  filter_class = ' show'
filterdict = dict(c.FILTER_ITEMS)
filterbydict = dict(c.FILTER_BY)
%>
<div class="row-fluid${filter_class}" id="${'mailfilter' if app == 'messages' else 'reportfilter'}">
	<div class="span1 hidden-phone"></div>
	<div class="span10 mkbox">
		<div id="filterrow" class="row-fluid">
			% if app == 'messages':
			<button class="close" data-dismiss="${'mailfilter' if app == 'messages' else 'reportfilter'}" type="button" id="apfb">
				<i class="icon-remove"></i>
			</button>
			% endif
		    <div class="span2">
		        ${_('Filters have been applied')} :
		     </div>
		     <div id="fhl" class="span9">
		            % for i, f in enumerate(c.active_filters):
		            	&nbsp;${h.link_to(h.literal('<i class="icon-remove red"></i>'), url('delete-filter', filterid=i)) + u' '+ unicode(filterdict[f['field']])} ${filterbydict[f['filter']]} ${f['value']}
		            % endfor
		    </div>
		</div>
	</div>
	<div class="span1 hidden-phone"></div>
</div>
<!-- Powered by Baruwa © 2011-2015 Andrew Colin Kissa -->
</%def>

