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

{% block title %}增加{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}课程有效期{% endblock %}
{% block body %}

<form id="expiryday-set-form" class="form-horizontal" method="post" action="{{ path('course_set_expiryday', { courseId:course.id, userId:user.id }) }}">
  {% if course.status == 'published' %}
    <div class="row form-group">
      <div class="col-md-2 control-label">
        <label for="course-title">课程标题</label>
      </div>
      <div class="col-md-7 controls">
        <div style="margin-top: 7px;">
          {{ course.title }}
          </div>
      </div>
    </div>

  	<div class="row form-group">
      <div class="col-md-2 control-label">
        <label for="student-nickname">{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}昵称</label>
      </div>
      <div class="col-md-7 controls">
        <div style="margin-top: 7px;">
          {{ user.nickname }}
          </div>
    	</div>
    </div>

    <div class="row form-group">
      <div class="col-md-2 control-label">
        <label for="set-more-expiryday">增加天数</label>
      </div>
      <div class="col-md-7 controls">
        <input type="text" id="set-more-expiryday" name="expiryDay" value="0" class="form-control width-input">
      </div>
    </div>
  {% else %}
    <div class="empty">{{dict_text('courseStatus', course.status)}}课程不能增加{% if setting('default.user_name') %}{{setting('default.user_name')|default('学员')}}{% else %}学员{% endif %}有效期，请课程发布后再增加。</div>
  {% endif %}

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

</form>

{% endblock %}

{% block footer %}
  {% if course.status == 'published' %}
    <button type="submit" id="submit" class="btn btn-primary pull-right" data-toggle="form-submit" data-target="#expiryday-set-form" data-user="{{default.user_name|default('学员')}}">保存</button>
  {% endif %}
  <button type="button" class="btn btn-link pull-right" data-dismiss="modal">取消</button>
  <script>app.load('course-manage/set-expiryday-modal')</script>
{% endblock %}
