{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="button" data-toggle="tooltip" title="{{ button_delete }}" class="btn btn-danger" onclick="confirm('{{ text_confirm }}') ? $('#form-news').submit() : false;"><i class="fa fa-trash-o"></i></button>
		<button type="submit" form="form-news2" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div> 
  <div class="container-fluid">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-pencil"></i>{{ entry_status }}</h3>
      </div>
      <div class="panel-body">
        <form action="{{ action }}" method="post" enctype="multipart/form-data" id="form-news2" class="form-horizontal">

          <fieldset>
            <div class="form-group">
              <div class="col-sm-12">
                <select name="news_status" id="input-status" class="form-control">
                  {% if news_status %}
                  <option value="1" selected="selected">{{ text_enabled }}</option>
                  <option value="0">{{ text_disabled }}</option>
                   {% else %}
                  <option value="1">{{ text_enabled }}</option>
                  <option value="0" selected="selected">{{ text_disabled }}</option>
                  {% endif %}
                </select>
              </div>
            </div>

        </form>
      </div>
    </div>
	<div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-list"></i> {{ text_list }}</h3>
      </div>
      <div class="panel-body">
          <div class="form-group">
		  <input id="search" class="form-control" type="text" placeholder="{{ text_search }}">         
		  </div>
		  <form action="{{ delete }}" method="post" enctype="multipart/form-data" id="form-news">
		  <div class="table-responsive">
            <table class="table table-bordered table-striped table-hover">
			  <thead>
				<tr class="guide"> 
				  <td width="1%" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
				  <td width="2%" class="text-left">№</td>
				  <td width="30%" class="text-left">{{ text_email }}</td>
				  <td width="30%" class="text-left">{{ text_data }}</td>
				</tr>
			  </thead>
			  <tbody>
				{% if news %}
				  {% for result in news %}
					<tr>
					 <td class="text-center">{% if result.newsletter_id in selected %}
                    <input type="checkbox" name="selected[]" value="{{ result.newsletter_id }}" checked="checked" />
                    {% else %}
                    <input type="checkbox" name="selected[]" value="{{ result.newsletter_id }}" />
                    {% endif %}</td>
					<td>{{ result.newsletter_id }}</td>
					<td>{{ result.mail }}</td>
					<td>{{ result.date_added }}</td>
					</tr>     
                    {% endfor %}
				{% else %}
				  <tr>
					<td colspan="7" class="text-center">{{ text_no_results }}</td>
				  </tr>
				{% endif %}
			  </tbody>
			</table>
          </div>
        </form>
        <div class="row">
          <div class="col-sm-6 text-left">{{ pagination }}</div>
          <div class="col-sm-6 text-right">{{ results }}</div>
        </div>
	  </div>
    </div>
  </div>
</div>
{{ footer }}
<script>

$(function() {
    $("input#search").on("input", function() {
        var text = this.value.toLowerCase();
        $("tr:not(.guide) td").removeClass("hot").each(function(i, obj) {
            if ($(obj).text().toLowerCase().indexOf(text) > -1 && text) $(obj).addClass("hot")
        });
        $("tr:not(.guide)").show().filter(function() {
            return text && !$(".hot", this).length
        }).hide()
    })
});
</script>