{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set script_controller = 'article/list' %}

{% set menu = 'admin_operation_article_manage' %}

{% block main %}

<form class="well well-sm form-inline" action="{{ path('admin_article') }}">
	<div class="form-group">
		<select class="form-control" name="categoryId">
		 <option value="">--所属栏目--</option>
		   {% for tree in categoryTree %}
					<option value={{ tree.id }} {% if tree.id == categoryId  %}selected{% endif%}>{% for i in 0..(tree.depth-1)*2 %}&nbsp;&nbsp;&nbsp;&nbsp;{% endfor %}└─ {{ tree.name }}</option>
					{% endfor %}
		</select>
	</div>
	<div class="form-group">
		<input class="form-control" name="keywords" type="text" placeholder="标题关键词" value="{{ app.request.query.get('keywords') }}">
	</div>
	<div class="form-group">
		<select class="form-control" name="property">
		  {{ select_options(dict('articleProperty'), app.request.query.get('property'), '--属性--') }}
		</select>
	</div>
	<div class="form-group">
		<select class="form-control" name="status">
		  {{ select_options(dict('articleStatus'), app.request.query.get('status'), '--发布状态--') }}
		</select>
	</div>
	<button class="btn btn-primary" type="submit">搜索</button>

</form>

<div id="aticle-table-container">

<table class="table table-hover table-striped" id="article-table">
	<thead>
		<tr>
			<th width="10%"><input type="checkbox"  data-role="batch-select"> ID</th>
			<th width="20%">资讯标题</th>
			<th width="15%">栏目</th>
			<th width="18%">更新时间</th>
			<th width="15%">属性</th>
			<th width="10%">状态</th>
			<th width="15%">操作</th>
		</tr>
	</thead>
	<tbody>
		{% if articles %}
			{% for article in articles %}
			  {% set category = categories[article.categoryId]|default(null) %}
			  {% include 'TopxiaAdminBundle:Article:article-tr.html.twig' %}
			{% endfor %}
		{% else %}
			<tr><td colspan="20"><div class="empty">暂无页面记录</div></td></tr>
		{% endif %}
	</tbody>
	</table>
  <div>
    <label class="checkbox-inline"><input type="checkbox" data-role="batch-select"> 全选</label>
    <button class="btn btn-default btn-sm mlm" data-role="batch-delete"  data-name="资讯" data-url="{{ path('admin_article_delete') }}">删除</button>
  </div>
  </div>

{{ web_macro.paginator(paginator) }}

{% endblock %}