{% extends 'task-manage/modal-layout.html.twig' %}

{% do script(['libs/jquery-validation.js','libs/iframe-resizer.js','app/js/task-manage/create/index.js']) %}

{% block task_create_type %}
  <div id="task-create-type" class="hidden" data-editor-mode="{{ mode }}"
      {% if mode == 'edit' %}
    data-editor-type="{{ currentType }}"
    data-editor-step2-url="{{ path('course_manage_task_fields', {courseId: course.id, mode: 'edit', id: task.id}) }}"
    data-save-url="{{ path('course_manage_task_update', {courseId: course.id, id: task.id }) }}"
  {% elseif mode == 'create' %}
    data-save-url="{{ path('course_manage_task_create', {courseId: course.id}) }}"
      {% endif %}>
    <form class="form-horizontal" id="step1-form">
      <ul class="form-group task-create-type-list ">
        {% cache courseSet.type ~ '-create-task-activity-metas-' ~ setting('storage.upload_mode', 'local') 1000 %}
          {% for type, meta in activity_metas() if type|activity_visible(courseSet, course) %}
            <li class="col-xs-3 task-create-type-item js-course-tasks-item {% if task.type|default(null)==  type %} active {% endif %}"
                data-role="activityType" data-type="{{ type }}"
                data-content-url="{{ path('course_manage_task_fields',{courseId:course.id, mode: 'create', type: type}) }}">
              <a href="javascript:;" {% if mode=='edit' %} disabled {% endif %}>
                <i class="{{ meta.icon }}"></i>
                {{ meta.name }}
              </a>
            </li>
          {% endfor %}
        {% endcache %}
        <li class="col-xs-12">
          <label for="mediaType" class="hidden">分类</label>
          <input name="mediaType" id="mediaType" class="type-hidden">
          <input class="js-hidden-data" type="hidden" name="mode" value="{{ taskMode|default('') }}">
          <input class="js-hidden-data" type="hidden" name="categoryId" value="{{ categoryId|default(null) }}">
          <input class="js-hidden-data" type="hidden" name="chapterId" value="{{ chapterId|default(null) }}">
          <input class="js-hidden-data" type="hidden" name="fromCourseId" value='{{ course.id }}'>
          <input class="js-hidden-data" type="hidden" name="courseSetType" id="courseSetType" value="{{ courseSet.type }}">
          <input type="hidden" id="courseExpiryMode" value="{{ course.expiryMode }}">
        </li>
      </ul>
    </form>
  </div>
{% endblock %}
