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

{% block title %}创建{% if type == 'normal' %}课程{% else %}直播课程{% endif %} - {{ parent() }}{% endblock %}

{% set script_controller = 'course/create' %}

{% block content %}
<div class="row">
  <div class="col-md-offset-2 col-md-8">
    <div class="panel panel-default panel-page">
      <div class="panel-heading"><h2>创建{% if type == 'normal' %}课程{% else %}直播课程{% endif %}</h2></div>

      {# {% if not app.user.largeAvatar or not app.user.title or not userProfile.about %}
        <div class="alert alert-info">
          <h5><strong>请先完成以下设置，才能创建课程：</strong></h5>
          <ol>
            <li>设置头像。
              {% if app.user.largeAvatar %}
                <span class="text-success"><span class="glyphicon glyphicon-ok-circle"></span> 已完成</span> </li>
              {% else %}
                <span class="text-danger"><span class="glyphicon glyphicon-remove-circle"></span> 未完成</span>，<a href="{{ path('settings_avatar', {fromCourse:true}) }}" class="alert-link">去设置</a>
              {% endif %}
            <li>设置头衔 、自我介绍。
              {% if app.user.title and userProfile.about %}
                <span class="text-success"><span class="glyphicon glyphicon-ok-circle"></span> 已完成</span> </li>
              {% else %}
                <span class="text-danger"><span class="glyphicon glyphicon-remove-circle"></span> 未完成</span>，<a href="{{ path('settings', {fromCourse:true}) }}" class="alert-link">去设置</a>
              {% endif %}
            </li>
          </ol>
        </div>
      {% else %} #}
        <form id="course-create-form" class="form-horizontal" method="post" data-url="{{ path('get_material') }}">

          {{ web_macro.flash_messages() }}

          <div class="form-group">
            <div class="col-md-2 control-label"><label for="course_title" class="required">标题</label></div>
            <div class="col-md-8 controls">
              <input type="text" id="course_title" name="title" required="required" class="form-control" data-widget-cid="widget-1" data-explain="">
              <div class="help-block" style="display:none;"></div>
            </div>
          </div>

          <div class="form-group">
            <label class="col-md-2 control-label">所属年级</label>
            <div class="col-md-4 controls">
              <select class="form-control event" name="gradeId" id="gradeId"  data-url="{{ path('get_subjects') }}">
                {{ select_options_for_grade('','','--通用--') }}
              </select>
              <div class="help-block" style="display:none;"></div>
            </div>
          </div>

          <div class="row form-group">
            <div class="col-md-2 control-label">
              <label>学期</label>
            </div>
            <div class="col-md-8 controls radios">
              {{ radios('term',{'first':'一学期','second':'二学期'}, 'first')}}
            </div>
          </div>

          <div class="form-group">
            <label class="col-md-2 control-label">所属学科</label>
            <div class="col-md-4 controls">
              <select class="form-control event" id="subjectId" name="subjectId">
                <option value="0">--通用--</option>
              </select>
            </div>
          </div>

          <div class="form-group">
            <div class="col-md-2 control-label">{# <label for="course_material" class="required">教材</label> #}</div>
            <div class="col-md-4 controls">
              <input type="text" class="hidden" name="materialId" value="" id="materialId" readonly>
              <input type="text" class="form-control" value=""  id="material" readonly>
              <div class="help-block" style="display:none;"></div>
            </div>
          </div>

          <div class="row form-group">
            <div class="col-md-2 control-label">
              <label>生成目录</label>
            </div>
            <div class="col-md-8 controls radios">
              {{ radios('hasCatalog',{1:'是',0:'否'}, 1)}}
              <div class="help-block">是否根据知识树生成课程目录</div>
            </div>
          </div>

          <div class="form-group">
            <div class="col-md-offset-2 col-md-8 controls">
              <input id="course-create-btn" data-submiting-text="正在创建" class="btn btn-fat btn-primary" type="submit" value="创建">
            </div>
          </div>


{#           {% if not setting('copyright.owned') %}
          <div class="form-group">
            <div class="col-md-offset-2 col-md-8 controls">
              <p class="mtl"><a href="http://www.qiqiuyu.com/course/22" class="text-muted" target="_blank">如何创建课程？</a></p>
            </div>
          </div>
          {% endif %} #}

          <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
          <input type="hidden" name="type" value="{{ type }}">

        </form>

      {# {% endif %} #}
    </div>

  </div>

</div>
{% endblock %}