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

{% block title %}{{ type == 'student' ? '学生' : type == 'teacher' ? '教师' : '家长' }}导入 - {{ parent() }}{% endblock %}

{% set menu = type == 'student' ? 'student' : type == 'teacher' ? 'teacher' : 'parent' %}
{% set script_controller = 'user/lead-excel' %}

{% block main %}
{{ web_macro.flash_messages() }}
<div class="page-header clearfix">
  <h1 class="pull-left">{{ type == 'student' ? '学生' : type == 'teacher' ? '教师' : '家长' }}导入 - 步骤1</h1>
</div>
  {# <div class="row"> #}
    <form id="user-import-form" class="form-horizontal" method="post" enctype="multipart/form-data">
      {% if type == 'student' %}
        {# <div class="row form-group">
          <label for="className"class="col-md-3 control-label">选择班级</label>
          <div class="col-md-3 controls">
            <input class="form-control" id="className" data-url="{{path('admin_class_list')}}" name="className" type="input" placeholder="班级选择" />
            <input class="form-control" id="classId" name="classId" type="hidden" />
          </div>
        </div> #}
      {% endif %}

      <div class="row form-group">
        <label class="col-md-3 control-label">选择要导入的文件</label>
        <div class="col-md-8 controls">
          <div class="uploader blue">
            <input type="text" class="filename" readonly="readonly"/>
            <input type="button" name="excel" class=" button" value="浏览..."/>
            <input type="file"  name="excel"/>
          </div>
          <a href="{{ asset(type == 'student' ? 'bundles/topxiaweb/example/students.xls' : type == 'teacher' ? 'bundles/topxiaweb/example/teachers.xls' : 'bundles/topxiaweb/example/parents.xls') }}">点击下载示例说明文件</a>
          <br>
          <span class="text-muted text-sm">支持从Excel文件导入</span>
        </div>
      </div>

      <div class="row form-group">
        <label class="col-md-3 control-label">用户已存在时的导入规则</label>
        <div class="col-md-8 controls">
          <label class="required" style="padding: 0 20px 0 0px;">
            <input type="radio"  required="required" value="ignore" checked=true name="rule">
            忽略跳过
          </label>
          <label class="required" >
            <input type="radio"  required="required" value="update" name="rule" >
            覆盖更新
          </label>
        </div>
      </div>

      <div class="row form-group">
        <label class="col-md-3 control-label"></label>
        <div class="col-md-8 controls">
          <button type="submit" class="btn btn-primary" id="start-import-btn">开始校验数据</button>
          <a class="btn btn-link" href="{{ path(type == 'student' ? 'admin_student' : type == 'teacher' ? 'admin_teacher' : 'admin_parent') }}">返回</a>
        </div>
      </div>

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

    </form>
  {# </div> #}

<style>.uploader{
position:relative;
display:inline-block;
overflow:hidden;
cursor:default;
padding:0px;
margin:0px 0px;
-moz-box-shadow:0px 0px 5px #ddd;
-webkit-box-shadow:0px 0px 5px #ddd;
box-shadow:0px 0px 5px #ddd;

-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
}

.filename{
float:left;
display:inline-block;
outline:0 none;
height:32px;
width:180px;
margin:0;
padding:8px 10px;
overflow:hidden;
cursor:default;
border:1px solid;
border-right:0;
font:9pt/100% Arial, Helvetica, sans-serif; color:#777;
text-shadow:1px 1px 0px #fff;
text-overflow:ellipsis;
white-space:nowrap;

-moz-border-radius:5px 0px 0px 5px;
-webkit-border-radius:5px 0px 0px 5px;
border-radius:5px 0px 0px 5px;

background:#f5f5f5;
background:-moz-linear-gradient(top, #fafafa 0%, #eee 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#fafafa), color-stop(100%,#f5f5f5));
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fafafa', endColorstr='#f5f5f5',GradientType=0);
border-color:#ccc;

-moz-box-shadow:0px 0px 1px #fff inset;
-webkit-box-shadow:0px 0px 1px #fff inset;
box-shadow:0px 0px 1px #fff inset;

-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
}

.button{
float:left;
height:32px;
display:inline-block;
outline:0 none;
padding:8px 12px;
margin:0;
cursor:pointer;
border:1px solid;
font:bold 9pt/100% Arial, Helvetica, sans-serif;

-moz-border-radius:0px 5px 5px 0px;
-webkit-border-radius:0px 5px 5px 0px;
border-radius:0px 5px 5px 0px;

-moz-box-shadow:0px 0px 1px #fff inset;
-webkit-box-shadow:0px 0px 1px #fff inset;
box-shadow:0px 0px 1px #fff inset;
}


.uploader input[type=file]{
position:absolute;
top:0; right:0; bottom:0;
border:0;
padding:0; margin:0;
height:30px;
cursor:pointer;
filter:alpha(opacity=0);
-moz-opacity:0;
-khtml-opacity: 0;
opacity:0;
}

input[type=button]::-moz-focus-inner{padding:0; border:0 none; -moz-box-sizing:content-box;}
input[type=button]::-webkit-focus-inner{padding:0; border:0 none; -webkit-box-sizing:content-box;}
input[type=text]::-moz-focus-inner{padding:0; border:0 none; -moz-box-sizing:content-box;}
input[type=text]::-webkit-focus-inner{padding:0; border:0 none; -webkit-box-sizing:content-box;}

.blue .button{
color:#fff;
text-shadow:1px 1px 0px #09365f;
background:#064884;
background:-moz-linear-gradient(top, #3b75b4 0%, #064884 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#3b75b4), color-stop(100%,#064884));
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#3b75b4', endColorstr='#064884',GradientType=0);
border-color:#09365f;
}

.blue:hover .button{
background:#3b75b4;
background:-moz-linear-gradient(top, #064884 0%, #3b75b4 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#064884), color-stop(100%,#3b75b4));
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#064884', endColorstr='#3b75b4',GradientType=0);
}
</style>

{% endblock %}