<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								提交时间：<input type="text" name="extend3" id="extend3"/>
							</li>

							<li>
								学生姓名：<input type="text" name="studentName"/>
							</li>

							<li>
								所属班级：<input type="text" name="className"/>
							</li>

							<li>
								状态：<select id="extend5" name="extend5">
								<option value="-1">全部</option>
								<option value="0">未审批</option>
								<option value="1">已通过</option>
							</select>
							</li>

							<li style="width: 100%;text-align: center">
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<!--<a class="btn btn-success" onclick="$.operate.addFull()" shiro:hasPermission="teach:teachFileCollection:add">
					<i class="fa fa-plus"></i> 添加
				</a>-->
				<!--<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editFull()" shiro:hasPermission="teach:teachFileCollection:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="teach:teachFileCollection:remove">
					<i class="fa fa-remove"></i> 删除
				</a>-->
				<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="teach:teachFileCollection:export">
						<i class="fa fa-download"></i> 导出
				 </a>-->
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('teach:teachFileCollection:edit')}]];
        var detailFlag = [[${@permission.hasPermi('teach:teachFileCollection:detail')}]];
        var removeFlag = [[${@permission.hasPermi('teach:teachFileCollection:remove')}]];
        var updateAuditFlag = [[${@permission.hasPermi('teach:teachFileCollection:updateAudit')}]];
        var prefix = ctx + "teach/teachFileCollection";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "学生档案收集",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'studentId', 
					title : '学生ID',
					visible: false
				},
				{
					field : 'className',
					title : '班级',
					sortable: true
				},
				{
					field : 'studentName', 
					title : '学员',
					sortable: true
				},
				{
					field : 'extend3',
					title : '提交时间',
					sortable: true
				},
				{
					field : 'extend5',
					title : '状态',
					sortable: true,
                    formatter: function(value, row, index) {
                        if(value == 0){
							return "未审批";
						}else {
                            return "已通过";
						}
                    }
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.editFull(\'' + row.studentId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="#" onclick="$.operate.detail(\'' + row.studentId + '\')"><i class="fa fa-search"></i>详细</a>');
                        if(row.extend5 == 0){
                            actions.push('<a class="btn btn-info btn-xs ' + updateAuditFlag + '" href="#" onclick="updateAudit(\'' + row.studentId + '\')"><i class="fa fa-key"></i>通过</a>');
						}
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.studentId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });

        //时间选择器
        $(function () {
            laydate.render({
                elem: '#extend3', trigger: 'click'
            });
        });

        /* 审核通过 */
        function updateAudit(studentId) {
            $.modal.confirm("确认要通过审核吗？", function() {
                $.operate.post(prefix + "/updateAudit", { "studentId": studentId, "extend5": 1 });
            })
        }
    </script>
</body>
</html>