<%def name="select_field(field)">
    % if simplelist.search_field==field:
        selected \
    % endif
</%def>
<%def name="set_css_arrow(simplelist, field)">
    % if simplelist.order_field==field:
        <i class="fa fa-arrow-${simplelist.order_class[simplelist.order]}" aria-hidden="true"></i>
    % endif
</%def>
% if simplelist.yes_search:
<div class="form">
<form method="get" action="${simplelist.url}">
    ${lang('common','search', 'Search')}: <input type="text" name="search_text" value="${simplelist.search_text|n}"> 
    <select name="search_field">
    % for field in simplelist.search_fields:
        <option value="${simplelist.model.fields[field].name}" ${select_field(field)}>${simplelist.model.fields[field].label}</option>
    % endfor 
    </select>
    <input type="submit" value="${lang('common', 'search', 'Search')}" />
</form>
</div>
% endif
<table class="table_list">
    <tr class="title_list">
        % for field in simplelist.fields_showed:
            <td class="${simplelist.model.fields[field].name}_td"><a href="${add_get_parameters(simplelist.url, order_field=field, begin_page=simplelist.begin_page, order=simplelist.change_order[field], search_text=simplelist.search_text, search_field=simplelist.search_field)}" class="">${set_css_arrow(simplelist, field)}${simplelist.model.fields[field].label}</a></td>
        % endfor 
        % for extra_field in simplelist.arr_extra_fields:
            <td class="options_td">${ extra_field }</td>
        % endfor
    </tr>
    <%
    pos=0
    %>
    % for row in list:
    <%
        if not 'pos' in row:
            row['pos']=pos
    %>
    <tr class="row_list">
        % for field in simplelist.fields_showed:
            % if simplelist.model.fields[field].escape==True:
                <td class="${simplelist.model.fields[field].name}_td">${simplelist.model.fields[field].show_formatted(row[field])}</td>
            % else:
                <td class="${simplelist.model.fields[field].name}_td">${str(simplelist.model.fields[field].show_formatted(row[field]))|n}</td>
            % endif
        % endfor
        
        % for extra_field_func in simplelist.arr_extra_options:
            <td class="options_td">${ simplelist.set_options(extra_field_func, row)|n }</td>
        % endfor 
    </tr>
    <%
    pos+=1
    %>
    % endfor 
</table>
<p>
${lang('common', 'pages', 'Pages')}: ${pages|n}
</p>
