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

{% set script_controller = 'homeworkbundle/controller/homework/continue' %}

{% if itemSetResult|default(null) %}{% set itemSet = itemSetResult %}{% endif %}

{% block content %}
  <div class="question-set homework-set" id="homework-set">

    <div class="row question-set-heading">
      <div class="col-md-12">
        <div class="panel panel-default">
          <div class="panel-body">
            <div class="question-set-type">作业</div>
            <div class="question-set-title">{{ lesson.title }}</div>
            <div class="homwork-status">
              <div class="pull-right label label-success">答题中</div>
            </div>
            <div class="question-set-description">
              {{ homework.description |raw }}
              <p class="text-muted">所属课程 <a href="#">{{ course.title }}</a></p>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="row question-set-body">
      <div class="col-md-9 question-set-main">
        <div class="panel panel-default">
          <div class="panel-heading">作业题目 <small class="text-muted">共{{ itemSet.total }}题</small></div>
          <div class="panel-body">
            <div class="question-set-items">
              {% for item in itemSet.items %}
                {% if item.subItems|default(null) %}
                  {% include 'TopxiaWebBundle:Question:question-set-item-have-sub.html.twig' %}
                {% else %}
                  {% include 'TopxiaWebBundle:Question:question-set-item.html.twig' %}
                {% endif %}
              {% endfor %}
            </div>
          </div>
        </div>
      </div>

          <div class="col-md-3 question-set-side">
            <div class="panel panel-default question-set-card" data-spy="affix" data-offset-top="300" data-offset-bottom="200">
                <div class="panel-heading">
                答题卡 <button class="btn btn-default btn-sm pull-right" id="homework-save-btn" data-url="{{ path('course_homework_save',{courseId:course.id,homeworkId:homework.id}) }}">下次再做</button>
                </div>

                <div class="panel-body">
                  {%- for questionId in itemSet.questionIds -%}
                    <a href="javascript:;" class="question-index for-question-{{ questionId }} " data-anchor="{{questionId}}">{{ loop.index }}</a>
                  {%- endfor -%}
                </div>
                <div class="panel-footer">
                  <button class="btn btn-success btn-block " id="homework-finish-btn" data-url="{{ path('course_homework_submit',{courseId:course.id,homeworkId:homework.id}) }} " data-saving-text="正在保存...">提交作业</button>
                </div>
            </div>
        </div>

    </div>

  </div>
{% endblock %}