{% set options = item.options %}
{% set errors = item.errors|default([]) %}
{% set answers = item.answers %}

<div class="subject-item subject-sub-item js-subject-item" id="sub{% if seq is defined %}{{seq - 1}}{% else %}{{ subKey }}{% endif %}" data-material-token="{{ token|default('') }}" data-key="{% if seq is defined %}{{seq - 1}}{% else %}{{ subKey }}{% endif %}">
  <div class="subject-item__title subject-sub-item__title">
    <span class="subject-sub-item__number">
      {% if seq|default(null) %}
        {{ '(' ~ seq ~ ')'  }}
      {% else %}
        {{ '(' ~ loop.index ~ ')'  }}
      {% endif %}
    </span>
    {% if errors.stem is not defined %}
      <div class="subject-sub-item__stem">{{ item.stem|striptags('<br><img>')|bbCode2Html|raw|nl2br }}</div>
    {% elseif errors.stem.code == 100001 %}
      <span class="single-item__text--danger">{{ 'course.testpaper_manage.import.re_edit.error_no_stem'|trans }}</span>
    {% endif %}
  </div>
  <div class="subject-item__body">
    {% for option_key,option in options %}
      <label class="cd-radio single-item sub-single-item subject-forbid {% if option_key in answers  %}checked{% endif %}">
        <input type="radio" data-toggle="cd-radio" name="right" value="{{'option' ~ loop.index }}" {% if option_key in answers  %}checked{% endif %}>
        <div class="subject-table">
          <span>{{ dict_text('questionOption', option_key) }}. </span>
          <div class="single-item__text subject-table-cell {% if  errors['options_'~option_key] is defined %}single-item__text--danger{% endif %}">
            {% if errors['options_'~option_key] is not defined %}
              {{ option|striptags('<br><img>')|bbCode2Html|raw|nl2br }}
            {% elseif errors['options_'~option_key].code == 100002 %}
              {{ 'course.testpaper_manage.import.re_edit.error_no_option'|trans }}
            {% endif %}
          </div>
        </div>
      </label>
    {% endfor %}
    {% if errors.answers is defined and errors.answers.code == 100003 %}
      <span class="single-item__text--danger">{{ 'course.testpaper_manage.import.re_edit.error_no_answer'|trans }}</span>
    {% endif %}
    {% if item.analysis is not empty %}
      <div class="subject-sub-item__explain cd-ml32">{{ 'course.testpaper_manage.import.re_edit.explain'|trans }}：{{ item.analysis|striptags('<br><img>')|bbCode2Html|raw|nl2br }}</div>
    {% endif %}
  </div>
  {% include 'testpaper/subject/common.html.twig' with {position:'sub', type: item.type, difficulty: item.difficulty, score: item.score } %}
</div>