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

{% set menu = 'admin_operation_mobile_banner_manage' %}

{% set script_controller = 'operation/mobile' %}


{% block main %}
<style>

#mobile-banner1-container img , 
#mobile-banner2-container img , 
#mobile-banner3-container img , 
#mobile-banner4-container img , 
#mobile-banner5-container img 
{max-width: 80%; margin-bottom: 10px;}

.course-grids {
  margin:0 -15px 0 0;
  padding:0;
  list-style: none;
}

.course-grid {
  display: inline-block;
  vertical-align: top;
  margin: 15px 15px 15px 0;
  border: 1px solid #e1e1e1;
  border-radius: 4px;
}

.banner-course .course-grid {
  margin: 0 0 0 0;
  margin-left: 10px;
}

.course-grid .series-mode-label {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
}

.course-grid .grid-body {
  position: relative;
  width: 170px;
  display: block;
  overflow: hidden;
  border-radius: 4px;
  color: #353535;
}

.grid-body a{
  text-decoration: none;
}

.course-grid .title {
  display: block;
  padding: 10px;
  min-height: 52px;
  color: #555;
  font-weight: bold;
}

.course-grid .add-course {
  font-size: 80px;
  height: 148px;
  text-align: center;
  padding-top: 30px;
}


</style>
{% if setting("mobile.enabled") == 1 %}

{{ web_macro.flash_messages() }}

<form class="form-horizontal" id="mobile-form" method="post">

  <fieldset>
    
    
    <div class="help-block">客户端显示的轮播图。最多5张，建议图片大小为640*330，格式支持jpg、png。</div>
    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="banner1">轮播图1</label>
      </div>
      <div class="col-md-8 controls">
        <div id="mobile-banner1-container">{% if mobile.banner1 %}<img src="{{ asset(mobile.banner1) }}">{% endif %}</div>

        <button class="btn btn-default btn-sm" id="mobile-banner1-upload" type="button" data-url="{{ path('admin_operation_mobile_picture_upload', {type:'banner1'}) }}">上传</button>
        <button class="btn btn-default btn-sm" id="mobile-banner1-remove" type="button" data-url="{{ path('admin_operation_mobile_picture_remove', {type:'banner1'}) }}" {% if not mobile.banner1 %}style="display:none;"{% endif %}>删除</button>

        <p class="help-block">请上传png, gif, jpg格式的图片文件。</p>







        <div class="banner-setting" role="banner1-setting" {% if not mobile.banner1 %}style="display:none;"{% endif %}>
          <input type="radio" role="bannerClick1" name="bannerClick1" {% if not mobile.bannerClick1 %}checked="checked"{% endif %} value="0"/>默认（无触发动作）
          <input type="radio" role="bannerClick1" name="bannerClick1" value="1" {% if mobile.bannerClick1 == "1" %}checked="checked"{% endif %}/>跳转到连接地址

          <input type="radio" role="bannerClick1" name="bannerClick1" value="2" {% if mobile.bannerClick1 == "2" %}checked="checked"{% endif %}/>跳转到内部课程

          <div class="row">
            <div class="col-xs-11">
              <input type="text" id="bannerUrl1" name="bannerUrl1" class="form-control" value="{{mobile.bannerUrl1}}" placeholder="请填写连接地址" {% if mobile.bannerClick1 != "1" %}style="display:none"{% endif %}/>
            </div>  
          </div>

          <div class="row" id="selectBannerCourse1" data-role="selectBannerCourse" {% if mobile.bannerClick1 != "2" %}style="display:none"{% endif %}>
            <a data-role="selectCourse" class="btn btn-sm btn-primary pull-left" data-toggle="modal" data-target="#modal" data-url="{{path('admin_course_search_to_fill_banner')}}" >
             选课
            </a>
            <div name="bannerCourseShow1">
              <ul class="banner-course" role="bannerCourse">
                {% include 'TopxiaAdminBundle:Course:course-item.html.twig' with {course:bannerCourse1} %}
              </ul>
            </div>
            <input type="text" name="bannerJumpToCourseId1" class="form-control" value="{{mobile.bannerJumpToCourseId1}}" placeholder="请填写内部课程Id" style="display:none;"/>
          </div>
        </div>

        
        <input type="hidden" name="banner1" value="{{ mobile.banner1 }}">
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="banner2">轮播图2</label>
      </div>
      <div class="col-md-8 controls">
        <div id="mobile-banner2-container">{% if mobile.banner2 %}<img src="{{ asset(mobile.banner2) }}">{% endif %}</div>

        <button class="btn btn-default btn-sm" id="mobile-banner2-upload" type="button" data-url="{{ path('admin_operation_mobile_picture_upload', {type:'banner2'}) }}">上传</button>
        <button class="btn btn-default btn-sm" id="mobile-banner2-remove" type="button" data-url="{{ path('admin_operation_mobile_picture_remove', {type:'banner2'}) }}" {% if not mobile.banner2 %}style="display:none;"{% endif %}>删除</button>

        <p class="help-block">请上传png, gif, jpg格式的图片文件。</p>







        <div class="banner-setting" role="banner2-setting" {% if not mobile.banner2 %}style="display:none;"{% endif %}>
          <input type="radio" role="bannerClick2" name="bannerClick2" {% if not mobile.bannerClick2 %}checked="checked"{% endif %} value="0"/>默认（无触发动作）
          <input type="radio" role="bannerClick2" name="bannerClick2" value="1" {% if mobile.bannerClick2 == "1" %}checked="checked"{% endif %}/>跳转到连接地址

          <input type="radio" role="bannerClick2" name="bannerClick2" value="2" {% if mobile.bannerClick2 == "2" %}checked="checked"{% endif %}/>跳转到内部课程

          <div class="row">
            <div class="col-xs-11">
              <input type="text" id="bannerUrl2" name="bannerUrl2" class="form-control" value="{{mobile.bannerUrl2}}" placeholder="请填写连接地址" {% if mobile.bannerClick2 != "1" %}style="display:none"{% endif %}/>
            </div>  
          </div>

          <div class="row" id="selectBannerCourse2" data-role="selectBannerCourse" {% if mobile.bannerClick2 != "2" %}style="display:none"{% endif %}>
            <a data-role="selectCourse" class="btn btn-sm btn-primary pull-left" data-toggle="modal" data-target="#modal" data-url="{{path('admin_course_search_to_fill_banner')}}" >
             选课
            </a>
            <div name="bannerCourseShow2">
              <ul class="banner-course" role="bannerCourse">
                {% include 'TopxiaAdminBundle:Course:course-item.html.twig' with {course:bannerCourse2} %}
              </ul>
            </div>

            <input type="text" name="bannerJumpToCourseId2" class="form-control" value="{{mobile.bannerJumpToCourseId2}}" placeholder="请填写内部课程Id" style="display:none;"/>
          </div>
        </div>

        
        <input type="hidden" name="banner2" value="{{ mobile.banner2 }}">
      </div>
    </div>

    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="banner3">轮播图3</label>
      </div>
      <div class="col-md-8 controls">
        <div id="mobile-banner3-container">{% if mobile.banner3 %}<img src="{{ asset(mobile.banner3) }}">{% endif %}</div>

        <button class="btn btn-default btn-sm" id="mobile-banner3-upload" type="button" data-url="{{ path('admin_operation_mobile_picture_upload', {type:'banner3'}) }}">上传</button>
        <button class="btn btn-default btn-sm" id="mobile-banner3-remove" type="button" data-url="{{ path('admin_operation_mobile_picture_remove', {type:'banner3'}) }}" {% if not mobile.banner3 %}style="display:none;"{% endif %}>删除</button>

        <p class="help-block">请上传png, gif, jpg格式的图片文件。</p>







        <div class="banner-setting" role="banner3-setting" {% if not mobile.banner3 %}style="display:none;"{% endif %}>
          <input type="radio" role="bannerClick3" name="bannerClick3" {% if not mobile.bannerClick3 %}checked="checked"{% endif %} value="0"/>默认（无触发动作）
          <input type="radio" role="bannerClick3" name="bannerClick3" value="1" {% if mobile.bannerClick3 == "1" %}checked="checked"{% endif %}/>跳转到连接地址

          <input type="radio" role="bannerClick3" name="bannerClick3" value="2" {% if mobile.bannerClick3 == "2" %}checked="checked"{% endif %}/>跳转到内部课程

          <div class="row">
            <div class="col-xs-11">
              <input type="text" id="bannerUrl3" name="bannerUrl3" class="form-control" value="{{mobile.bannerUrl3}}" placeholder="请填写连接地址" {% if mobile.bannerClick3 != "1" %}style="display:none"{% endif %}/>
            </div>  
          </div>

          <div class="row" id="selectBannerCourse3" data-role="selectBannerCourse" {% if mobile.bannerClick3 != "2" %}style="display:none"{% endif %}>
            <a data-role="selectCourse" class="btn btn-sm btn-primary pull-left" data-toggle="modal" data-target="#modal" data-url="{{path('admin_course_search_to_fill_banner')}}" >
             选课
            </a>
            <div name="bannerCourseShow3">
              <ul class="banner-course" role="bannerCourse">
                {% include 'TopxiaAdminBundle:Course:course-item.html.twig' with {course:bannerCourse3} %}
              </ul>
            </div>
            <input type="text" name="bannerJumpToCourseId3" class="form-control" value="{{mobile.bannerJumpToCourseId3}}" placeholder="请填写内部课程Id" style="display:none;"/>
          </div>
        </div>

        
        <input type="hidden" name="banner3" value="{{ mobile.banner3 }}">
      </div>
    </div>


    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="banner4">轮播图4</label>
      </div>
      <div class="col-md-8 controls">
        <div id="mobile-banner4-container">{% if mobile.banner4 %}<img src="{{ asset(mobile.banner4) }}">{% endif %}</div>

        <button class="btn btn-default btn-sm" id="mobile-banner4-upload" type="button" data-url="{{ path('admin_operation_mobile_picture_upload', {type:'banner4'}) }}">上传</button>
        <button class="btn btn-default btn-sm" id="mobile-banner4-remove" type="button" data-url="{{ path('admin_operation_mobile_picture_remove', {type:'banner4'}) }}" {% if not mobile.banner4 %}style="display:none;"{% endif %}>删除</button>

        <p class="help-block">请上传png, gif, jpg格式的图片文件。</p>







        <div class="banner-setting" role="banner4-setting" {% if not mobile.banner4 %}style="display:none;"{% endif %}>
          <input type="radio" role="bannerClick4" name="bannerClick4" {% if not mobile.bannerClick4 %}checked="checked"{% endif %} value="0"/>默认（无触发动作）
          <input type="radio" role="bannerClick4" name="bannerClick4" value="1" {% if mobile.bannerClick4 == "1" %}checked="checked"{% endif %}/>跳转到连接地址

          <input type="radio" role="bannerClick4" name="bannerClick4" value="2" {% if mobile.bannerClick4 == "2" %}checked="checked"{% endif %}/>跳转到内部课程

          <div class="row">
            <div class="col-xs-11">
              <input type="text" id="bannerUrl4" name="bannerUrl4" class="form-control" value="{{mobile.bannerUrl4}}" placeholder="请填写连接地址" {% if mobile.bannerClick4 != "1" %}style="display:none"{% endif %}/>
            </div>  
          </div>

          <div class="row" id="selectBannerCourse4" data-role="selectBannerCourse" {% if mobile.bannerClick4 != "2" %}style="display:none"{% endif %}>
            <a data-role="selectCourse" class="btn btn-sm btn-primary pull-left" data-toggle="modal" data-target="#modal" data-url="{{path('admin_course_search_to_fill_banner')}}" >
             选课
            </a>
            <div name="bannerCourseShow4">
              <ul class="banner-course" role="bannerCourse">
                {% include 'TopxiaAdminBundle:Course:course-item.html.twig' with {course:bannerCourse4} %}
              </ul>
            </div>
            <input type="text" name="bannerJumpToCourseId4" class="form-control" value="{{mobile.bannerJumpToCourseId4}}" placeholder="请填写内部课程Id" style="display:none;"/>
          </div>
        </div>

        
        <input type="hidden" name="banner4" value="{{ mobile.banner4 }}">
      </div>
    </div>


    <div class="form-group">
      <div class="col-md-2 control-label">
        <label for="banner5">轮播图5</label>
      </div>
      <div class="col-md-8 controls">
        <div id="mobile-banner5-container">{% if mobile.banner5 %}<img src="{{ asset(mobile.banner5) }}">{% endif %}</div>

        <button class="btn btn-default btn-sm" id="mobile-banner5-upload" type="button" data-url="{{ path('admin_operation_mobile_picture_upload', {type:'banner5'}) }}">上传</button>
        <button class="btn btn-default btn-sm" id="mobile-banner5-remove" type="button" data-url="{{ path('admin_operation_mobile_picture_remove', {type:'banner5'}) }}" {% if not mobile.banner5 %}style="display:none;"{% endif %}>删除</button>

        <p class="help-block">请上传png, gif, jpg格式的图片文件。</p>







        <div class="banner-setting" role="banner5-setting" {% if not mobile.banner5 %}style="display:none;"{% endif %}>
          <input type="radio" role="bannerClick5" name="bannerClick5" {% if not mobile.bannerClick5 %}checked="checked"{% endif %} value="0"/>默认（无触发动作）
          <input type="radio" role="bannerClick5" name="bannerClick5" value="1" {% if mobile.bannerClick5 == "1" %}checked="checked"{% endif %}/>跳转到连接地址

          <input type="radio" role="bannerClick5" name="bannerClick5" value="2" {% if mobile.bannerClick5 == "2" %}checked="checked"{% endif %}/>跳转到内部课程

          <div class="row">
            <div class="col-xs-11">
              <input type="text" id="bannerUrl5" name="bannerUrl5" class="form-control" value="{{mobile.bannerUrl5}}" placeholder="请填写连接地址" {% if mobile.bannerClick5 != "1" %}style="display:none"{% endif %}/>
            </div>  
          </div>

          <div class="row" id="selectBannerCourse5" data-role="selectBannerCourse" {% if mobile.bannerClick5 != "2" %}style="display:none"{% endif %}>
            <a data-role="selectCourse" class="btn btn-sm btn-primary pull-left" data-toggle="modal" data-target="#modal" data-url="{{path('admin_course_search_to_fill_banner')}}" >
             选课
            </a>
            <div name="bannerCourseShow5">
              <ul class="banner-course" role="bannerCourse">
                {% include 'TopxiaAdminBundle:Course:course-item.html.twig' with {course:bannerCourse5} %}
              </ul>
            </div>
            <input type="text" name="bannerJumpToCourseId5" class="form-control" value="{{mobile.bannerJumpToCourseId5}}" placeholder="请填写内部课程Id" style="display:none;"/>
          </div>
        </div>

        
        <input type="hidden" name="banner5" value="{{ mobile.banner5 }}">
      </div>
    </div>

    
  </fieldset>

  <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
  
  <div class="row form-group">
    <div class="controls col-md-offset-2 col-md-8">
      <button type="submit" class="btn btn-primary">提交</button>
    </div>
  </div>

</form>

{% else %}
<div class="well" style="text-align:center;">


移动端未开启，请先在<a href="{{ path('admin_setting_mobile') }}"> 系统-课程设置-移动端设置 </a>中设置开启

</div>
{% endif %}

{% endblock %}