<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <base href="#springUrl('/assets/adminlte/')"/>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>工作台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">

    <!-- DataTables -->
    <link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">

    <!-- Theme style -->
    <link rel="stylesheet" href="dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
    <!-- iCheck -->
    <link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
    <!-- Morris chart -->
    <link rel="stylesheet" href="plugins/morris/morris.css">
    <!-- jvectormap -->
    <link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <!-- Date Picker -->
    <link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
    <!-- Daterange picker -->
    <link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
    <link rel="stylesheet"
          href="plugins\bootstrap-fileinput\fileinput.min.css">
    <!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">


<div class="wrapper">
    <div class="content-wrapper" style="margin-left:0;">
        <div id="importExcelDiv"></div>

        <section class="content-header">
            <h1>
                点赞管理
                <small>点赞</small>
            </h1>
            <ol class="breadcrumb">
                <li><a><i class="fa fa-dashboard"></i>首页</a></li>
                <li><a class="active">点赞管理列表</a></li>
            </ol>
        </section>


        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <form id="seachTableForm" action="#springUrl('/a/like/exportListData')" method="get" onkeydown="if(event.keyCode==13){return false;}">
                                <!--<div class="col-xs-2">
                                    <input type="text" class="form-control required"
                                           placeholder="名称" name="entityName"
                                           value="">
                                </div>-->
                                <div class="col-xs-2">
                                    <input type="text" class="form-control required"
                                           placeholder="点赞人昵称" name="userName"
                                           value="">
                                </div>
                                <input name="entitycontent" value="$!{id}" style="display: none;">
                                <input name="moduleType" value="$!{moduleType}" style="display: none;">

                                <!--<div class="col-xs-2">
                                    <select class="form-control select2 select2-hidden-accessible" name="moduleType">
                                        <option value="">全部</option>
                                        <option value="1">模块1</option>
                                        <option value="2">模块2</option>
                                    </select>
                                </div>-->
                                    <a class="search btn btn-primary">搜索</a>
                                    #if($shiro.hasPermission("like:edit"))
                                    <button  class="btn btn-primary">导出</button>
                                    #end
                            </form>
                        </div><!-- /.box-header -->
                        <div class="box-body">
                            <table id="table" class="table table-bordered table-striped">
                                <thead>
                                <tr>
                                    <td hidden="true">Id</td>
                                    <th>模块名称</th>
                                    <th>实体内容</th>
                                    <th>操作类型</th>
                                    <th>点赞人昵称</th>
                                    <th>点赞时间</th>
                                </tr>
                                </thead>
                                <tbody id="tablebody">
                                </tbody>
                            </table>
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->


    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
        src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
    function   formatDates(now)   {
        var date = new Date(now);
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        var d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        var h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        var minute = date.getMinutes();
        var second = date.getSeconds();
        minute = minute < 10 ? ('0' + minute) : minute;
        second = second < 10 ? ('0' + second) : second;
        return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;
    }

    function seachTable() {
        var sSource = "#springUrl('/a/like/listData')";
        var aoData = {
            iDisplayStart: 1,
            iDosplayLength: 10
        }
        var retrieveData = function (sSource, aoData, fnCallback) {

            $("#seachTableForm input ,.select2").each(function () {
                var params = {
                    name: $(this).attr("name"),
                    value: $(this).val()
                };
                aoData.push(params);
            })

            $.ajax({
                "type": "GET",
                "url": sSource,
                "dataType": "json",
                "data": aoData, //以json格式传递
                "success": fnCallback
            });
        };
        var protocol=window.location.protocol;
        var host=window.location.host;
        $('#table').DataTable({
            "lengthChange": false,
            "searching": false,
            "ordering": false,
            "bFiltered": false,
            "bStateSave" : true, // save datatable state(pagination, sort, etc) in cookie.
            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": sSource,
            "fnServerData": retrieveData,
            "pagingType": "full_numbers",
            "aoColumns": [
                {
                    "mData": "id"
                },{
                    "mData": "moduleType"
                },{
                    "mData": "entitycontent"
                },{
                    "mData": "type"
                },{
                    "mData": "userName"
                },{
                    "mData": "createTime"
                }],
            "aoColumnDefs": [
                {
                    'visible': false,
                    'targets': [0]
                },{
                    "aTargets": [1],
                    "mData": "moduleType",
                    "mRender": function (a, b, c, d) {
                        if(a == 0){
                            return "展会";
                        }else{
                            return "评论";
                        }
                    }
                },{
                    "aTargets": [3],
                    "mData": "type",
                    "mRender": function (a, b, c, d) {
                        if(a == 0){
                            return "点赞";
                        }else{
                            return "";
                        }
                    }
                },{
                    "aTargets": [5],
                    "mData": "createTime",
                    "mRender": function (a, b, c, d) {
                        if(a){
                            return formatDates(a);
                        }else{
                            return "";
                        }
                    }
                }
            ]
        });
    }

    jQuery(document).ready(function () {
        seachTable();
        $('.datepicker').datepicker({
            show: true,
            format: 'yyyy-mm-dd',
            autoclose: true,
            language: 'zh-CN',
            todayBtn: 'linked',
            clearBtn: 'linked'

        });
        $('.search').click(function () {
            $("#table").dataTable().fnClearTable();
        });
    });
    Cfapp.init();
</script>

</body>
</html>
