<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="${pageContext.request.contextPath}/lib/html5shiv.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/journalism/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/journalism/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/journalism/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/journalism/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/journalism/h-ui.admin/css/page.css"/>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/static/admin/index/js/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/admin/js/layer.js"></script>
    <script src="${pageContext.request.contextPath}/axingtai/laydate/laydate.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <title>会议室预约信息</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>LOGIN <span
        class="c-gray en">&gt;</span> 会议室预约信息 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                              href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
        <div class="text-c">
            <form class="form form-horizontal" id="form-article-adds" action="sgaoguang.html" method="post" enctype="multipart/form-data">
            <label style="margin-left:20px;">会议室</label>
            <select name="cidpfid" id="coomL" class="select"  style="width: auto" >
                <option value="0" >全部分类</option>
                <c:forEach items="${cooms}" var="coomLs">
                    <c:if test="${coomLs.id==cid}">
                        <option value="${coomLs.id}" selected>${coomLs.name}</option>
                    </c:if>
                    <c:if test="${coomLs.id!=cid}">
                        <option value="${coomLs.id}" >${coomLs.name}</option>
                    </c:if>
                </c:forEach>
            </select>

                <input type="text" value="${startTime}"  onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss' })" id="startTime" name="startTime" class="input-text Wdate" style="width: 15%">
                <span class="pro_dateto">至</span>
                <input type="text" value="${endTime}"  onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss' })" id="endTime" name="endTime" class="input-text Wdate" style="width:15%">
                <button name="" id="" class="btn btn-success"  type="submit"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
            </form>
        </div>

             <span class="r data_num">共有数据：<strong>${orders.total}</strong> 条</span>


    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
            <thead>
            <tr class="text-c">
                <th width="25">ID</th>
                <th  width="80">会议室名称</th>
                <th  width="80">预约人</th>
                <th  width="80">使用人数</th>
                <th  width="80">开始时间</th>
                <th  width="80">结束时间</th>
                <th  width="80">预约时间</th>
                <th  width="80">使用原因</th>
                <th width="80">状态</th>
                <th  width="80">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${orders.list}" var="item">
                <tr class="text-c">
                    <td>${item.id}</td>
                    <td>
                        <c:forEach items="${cooms}" var="cooms">
                            <c:if test="${cooms.id==item.cid}">
                                ${cooms.name}
                            </c:if>
                        </c:forEach>

                    </td>
                    <td>
                        <c:forEach items="${personnels}" var="personnels">
                            <c:if test="${personnels.id==item.pid}">
                                ${personnels.name}
                            </c:if>
                        </c:forEach>
                    </td>
                    <td>${item.numbers}</td>
                    <td>${item.starttime}</td>
                    <td>${item.endtime}</td>
                    <td>${item.ordertime}</td>
                    <td>${item.cause}</td>
                    <c:if test="${item.endtime>format}">
                        <td style="background-color: #00CC99">已预约</td>
                    </c:if>
                    <c:if test="${format>item.endtime}">
                        <td style="background-color: #424242">已完成</td>
                    </c:if>
                    <td class="f-14 td-manage">
                        <c:if test="${item.endtime>format}">
                        <a style="text-decoration:none" onClick="article_del(this,${item.id})" class="ml-5"
                           title="删除"><i class="Hui-iconfont">&#xe6e2;</i>取消其会议</a>
                        </c:if>
                        <c:if test="${format>item.endtime}">
                            <a style="text-decoration:none" onClick="article_del(this,${item.id})" class="ml-5"
                               title="删除"><i class="Hui-iconfont">&#xe6e2;</i>删除记录</a>
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <div id="PageNum">
        <section>
            <div class="bd points-goods-list">
                <ul class="pages">
                    <li><a href="${url}?pageNum=1">首页</a></li>
                    <li class="prev"><a href="${url}?pageNum=${orders.prePage}&startTime=${startTime}&endTime=${endTime}&cid=${cid}">上一页</a></li>
                    <c:forEach items="${orders.navigatepageNums}" var="nav">
                        <c:if test="${nav == orders.pageNum}">
                            <li ><a href="${url}?pageNum=${nav}&startTime=${startTime}&endTime=${endTime}&cid=${cid}" class="active">${nav}</a></li>
                        </c:if>
                        <c:if test="${nav != orders.pageNum}">
                            <li><a href="${url}?pageNum=${nav}&startTime=${startTime}&endTime=${endTime}&cid=${cid}">${nav}</a></li>
                        </c:if>
                    </c:forEach>
                    <%--<li><a href="#" class="active">1</a></li>--%>
                    <li class="next"><a href="${url}?pageNum=${pageInfo.nextPage}&startTime=${startTime}&endTime=${endTime}&cid=${cid}">下一页</a></li>
                    <li><a href="${url}?pageNum=${pageInfo.pages}&startTime=${startTime}&endTime=${endTime}&cid=${cid}">末页</a></li>
                </ul>
            </div>
        </section>
    </div>

</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/journalism/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript"
        src="${pageContext.request.contextPath}/static/journalism/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="${pageContext.request.contextPath}/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript">

    /*资讯-添加*/
    function article_add(title, url, w, h) {
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }

    /*资讯-编辑*/
    function article_edit(url, id) {
        var index = layer.open({
            type: 2,
            title: title,
            content: url,
            id: id
        });
        layer.full(index);

    }

    /*资讯-删除*/
    function article_del(obj, id) {
        layer.confirm('确认要执行吗？', function (index) {
            $.post("deorderById.html", {"id": id}, function () {
                console.log(111);
                $(obj).parents("tr").remove();
                layer.msg('已完成!', {icon: 1, time: 1000});
            });
        });
    }
    laydate.render({
        elem : '#test1', //指定元素
        type : 'datetime',
        done: function (value) {
            var startDate = new Date(value).getTime();
            var endTime = new Date($('#test2').val()).getTime();
            if (endTime < startDate) {
                layer.msg('结束时间不能小于开始时间');
                $('#test1').val($('#test2').val());
            }
        }
    });


    laydate.render({
        elem : '#test2', //指定元素
        type : 'datetime',
        done: function (value) {
            var startDate = new Date($('#test1').val()).getTime();
            var endTime = new Date(value).getTime();
            if (endTime < startDate) {
                layer.msg('结束时间不能小于开始时间');
                $('#test2').val($('#test1').val());
            }
        }

    });
</script>
</body>
</html>
