{% extends 'TopxiaWebBundle::bootstrap-modal-layout.html.twig' %}

{% set modal_class = 'modal-lg' %}

{% block title %}{% if liveLesson|default(null) %}编辑{% else %}新增{% endif %}直播课时{% endblock %}

{% block body %}
	
  <form class="form-horizontal" id="live-lesson-form"　method="post"  {% if parentId is defined%}data-parentId="{{parentId}}" {% endif %}
  
	  {% if liveLesson|default(null) %}
	  	action="{{ path('live_course_manage_lesson_edit',{courseId:liveCourse.id,lessonId:liveLesson.id}) }}" 
	  {% else %} 
	    action="{{ path('live_course_manage_lesson_create',{id:liveCourse.id}) }}"
	  {% endif %}
	  >
	 
    <div class="form-group">
      <label class="col-md-2 control-label" for="live-title-field">标题</label>
      <div class="col-md-8 controls">
        <input class="form-control" id="live-title-field" type="text" name="title" value="{{ liveLesson.title|default() }}" tabindex="2">
      </div>
    </div> 

	<div class="form-group">

		<label class="col-md-2 control-label" >直播开始时间</label>
		 <div class="col-md-8 controls" style="z-index:2000;">
          <input type="text"  name="startTime" class="form-control width-input width-input-large" value="{{ liveLesson.startTime|default()|data_format }}">
          <div class="help-block" id="starttime-help-block">教师可在直播开始前1小时内进入直播教室，以准备相关教学资料。</div>
      </div>
	</div>

	<div class="form-group">
        <label class="col-md-2 control-label" >直播时长</label>
         <div class="col-md-8 controls">
            <input type="text"  name="timeLength" id="live-length-field" class="form-control width-input width-input-large" value="{{ liveLesson.length|default(60) }}" placeholder="时长" data-calculate-left-capacity-url="{{ path('live_lesson_calculate_left_capacity', {courseId:liveCourse.id, lessonId:liveLesson.id|default(0)}) }}" data-max-Student-Num = "{{ liveCourse.maxStudentNum }}"> 分钟
            <div class="help-block" id="timelength-help-block"></div>
        </div>

	
        <input type="hidden" id="live_lesson_time_check" data-url="{% if liveLesson|default(null) %}{{path('live_lesson_time_check',{id:liveCourse.id,lessonId:liveLesson.id}) }}{% else %}{{path('live_lesson_time_check',{id:liveCourse.id})}}{% endif %}">
	</div>

	<div class="form-group">

		<label class="col-md-2 control-label" for="live-summary-field">直播说明</label>
			<div class="col-md-8 controls">
				<textarea class="form-control" id="live_lesson-content-field" rows="10" name="summary"
          data-image-upload-url="{{ path('editor_upload', {token:upload_token('course')}) }}"
          data-flash-upload-url="{{ path('editor_upload', {token:upload_token('course', 'flash')}) }}"
>{{ liveLesson.summary|default('') }}</textarea>
			</div>

	</div>

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

  </form>

{% endblock %}

{% block footer %}
  <button type="button" class="btn btn-link" data-dismiss="modal">取消</button>
  <button type="submit" class="btn btn-primary"  data-toggle="form-submit" data-submiting-text="正在保存" data-target="#live-lesson-form" id="live-course-create-btn">保存</button>

    <script>app.load('live-course-manage/live-lesson-modal')</script>

{% endblock %}