{% import "TopxiaAdminBundle::macro.html.twig" as admin_macro %}
<div class="col-md-12">
	<div class="panel panel-default">
		<div class="panel-heading">

           	<a class="pull-right" href="{{ url('admin_question', {postStatus: 'unPosted'}) }}"
           	>更多</a>
			<h3 class="panel-title">最新未回复问答</h3>
			 
		</div>

	{% if questions %}
	    <table class="table table-condensed table-bordered table-striped table-hover">
	      <thead>
	        <tr>
	          <th width="40%">问答标题</th>
	          <th width="35%">所属课程</th>
	          <th width="10%">提问人</th>
	          <th width="15%">操作</th>
	        </tr>
	      </thead>
	      <tbody class="tbody">
	        {% for question in questions %}
	          {% set course =  courses[question.courseId]|default(null) %}
		        <tr>
		          <td>
	              <a href="{{ path('course_thread_show', {courseId:question.courseId, id:question.id}) }}" target="_blank">
	                {{ question.title }}
	              </a>
	              <br />
	              <span class="text-muted text-sm">{{ question.hitNum }}次查看</span>
	              <span class="text-muted text-sm">•</span>
	              <span class="text-muted text-sm">发表于{{question.createdTime |date('Y-n-d H:i') }}</span>
		          </td>
		          <td>
		          	{% if course %}
		              <a href="{{ path('course_show', {id:courses[question.courseId].id}) }}" target="_blank">{{ courses[question.courseId].title }}</a>
		              <br>
		              <span class="text-muted text-sm">老师：
				            {% for teacherId in courses[question.courseId].teacherIds %}
				              {{ admin_macro.user_link(teachers[teacherId], 'text-muted text-sm') }}
				            {% endfor %}
				          </span>
			          {% else %}
			            --
			          {% endif %}
		          </td>
		          <td>
		            {{ admin_macro.user_link(askers[question.userId]|default(null)) }}
		          </td>
		          <td>
		          	{% if course %}
				          <button class="btn btn-default btn-sm remind-teachers" data-url="{{ path('admin_question_remind_teachers', {courseId:question.courseId, questionId:question.id}) }}">提醒教师</button>
			          {% endif %}
			        </td>
		        </tr>
	        {% endfor %}
	      </tbody>
        </table>
    {% else %}
      <div class="empty">暂无最新未回复问答</div>
    {% endif %}
	</div>
</div>