<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:65:"F:\www\EduWork/./application/admin\view\student\registration.html";i:1477642730;}*/ ?>
<div id="studentGoManage">
<link href="static/plugins/bootstarp-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet">
<link href="static/plugins/bootstrap-touchspin/jquery.bootstrap-touchspin.min.css" rel="stylesheet">

<div class="row">
    <div id="breadcrumb" class="col-xs-12">
        <a href="#" class="show-sidebar">
            <i class="fa fa-bars"></i>
        </a>
        <ol class="breadcrumb pull-left">
            <li><a href="#">学员管理</a></li>
            <li><a href="#">新学员报名</a></li>
        </ol>
    </div>
</div>

<div class="row">
    <div class="col-xs-12 col-sm-12">
        <div class="box">
            <div class="box-header">
                <div class="box-name">
                    <i class="fa fa-paper-plane-o"></i>
                    <span>新学员报名</span>
                </div>
                <div class="box-icons">
                    <a class="collapse-link">
                        <i class="fa fa-chevron-up"></i>
                    </a>
                    <a class="expand-link">
                        <i class="fa fa-expand"></i>
                    </a>
                    <a class="close-link">
                        <i class="fa fa-times"></i>
                    </a>
                </div>
                <div class="no-move"></div>
            </div>
            <div class="box-content">
                <h4 class="page-header">新增学员信息</h4>
                <form class="form-horizontal" role="form" id="studentForm">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="student_name" name="student_name">
                        </div>
                        <label class="col-sm-2 control-label">性别</label>
                        &nbsp;&nbsp;&nbsp;
                        <label><input type="radio" name="student_sex" value="0">&nbsp;男 &nbsp;&nbsp;&nbsp;&nbsp;</label>
                        <label><input type="radio" name="student_sex" value="1">&nbsp; 女</label>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">联系方式</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="student_phone" name="student_phone">
                        </div>
                        <label class="col-sm-2 control-label">身份证</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="student_idcard" name="student_idcard">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">就读学校</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="student_school" name="student_school">
                        </div>
                        <label class="col-sm-2 control-label">学校年级</label>
                        <div class="col-sm-4">
                            <select name="student_gradeid" id="select_gradeid" class="form-control"  >
							</select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">报名日期</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="createtime9" name="student_createtime" readonly>
                        </div>
                        <label class="col-sm-2 control-label">培训班级</label>
                        <div class="col-sm-4">
                            <select name="student_classid" id="select_classid"  class="form-control" >

                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">选择课程</label>
                        <div class="col-sm-4">
                            <select id="select_courseid" name="student_courseid" class="form-control"  >
                            </select>
                        </div>
                        <label class="col-sm-2 control-label">支付宝账号</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="cardnum" name="student_cardnum" data-toggle="tooltip"
                                   data-placement="bottom" title="Tooltip for name">
                        </div>
						
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">备注</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="remark" name="student_remark" data-toggle="tooltip"
                                   data-placement="bottom" title="Tooltip for last name">
                        </div>
						
                    </div>
					
                    <div class="clearfix"></div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-2">
                            <button type="cancel" class="btn btn-default btn-label-left">
                                <span><i class="fa fa-clock-o txt-danger"></i></span>
                                取消
                            </button>
                             &nbsp;&nbsp;&nbsp;&nbsp;
                            <button type="button" class="btn btn-primary btn-label-left" id="Submit">
                                <span><i class="fa fa-folder-open-o txt-danger"></i></span>
                                保存
                            </button>
                         
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        $.getScript("static/plugins/bootstarp-datepicker/js/bootstrap-datepicker.min.js", function () {
            $.getScript("static/js/ajax/student_registration.js");
        })
    });
    $('#createtime9').datepicker({
        format : "yyyy-mm-dd",
        todayBtn : "linked",
        autoclose : true,
        todayHighlight : true,
        clearBtn : true
    });
</script>
<script>
    $(function(){
        var height=$('#student_name').height();
   
        $('#select_classid').height(height);
        $('#select_gradeid').height(height);
        $('#select_courseid').height(height);
        
        $('select').css("padding","2px");
        //选定班级，即选定课程
        $('#select_classid').change(function(){
            var classid = $('#select_classid').val();
            if(classid == '' && $('#select_gradeid').val() == ''){
                getCourseJSON();
                return;
            }
            if(classid == '' && $('#select_gradeid').val() != ''){
                $('#select_gradeid').trigger('change');
                return;
            }
            $.ajax({
                url: 'admin/Student/getCourseByClass',
                type: 'POST',
                data:'id=' + classid,
                dataType: 'JSON',//返回的数据类型
                success: function (data) {
                    $("#select_courseid").empty();
                    $("#select_courseid").prepend("<option value='"+data.id+"'>"+data.course_name+"</option>");
                }
            });
        });
        //选中课程，返回相应的班级选项
        $('#select_courseid').change(function(){
            var courseid = $('#select_courseid').val();
            if(courseid == ''){
                getClassJSON();
                return;
            }
            $.ajax({
                url: 'admin/Student/getClassByCourse',
                type: 'POST',
                data:'id=' + courseid,
                dataType: 'JSON',//返回的数据类型
                success: function (data) {
                    $("#select_classid").empty();
                    for (var i = 0; i < data.length; i++) {
                        $("#select_classid").append('<option value="' + data[i].id + '">' + data[i].classes_name + '</option>');
                    }
                }
            });
        });
        //选中年级，返回此年级的课程选项
        $('#select_gradeid').change(function(){
            var gradeid = $('#select_gradeid').val();
            if(gradeid == ''){
                getClassJSON();
                getCourseJSON();
                return;
            };

            $.ajax({
                url: 'admin/Student/getCourseByGrade',
                type: 'POST',
                data:'id=' + gradeid,
                dataType: 'JSON',//返回的数据类型
                success: function (data) {
                    $("#select_courseid").empty();
                    for (var i = 0; i < data.length; i++) {
                        $("#select_courseid").append('<option value="' + data[i].id + '">' + data[i].course_name + '</option>');
                    }
                    if(data.length < 1){$("#select_classid").empty();return;};
                    $('#select_courseid').trigger('change');
                }
            });
        });
    });
</script>
</div>

