<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>

<html>
<head>
    <title>管理日历每日统计</title>
    <meta name="decorator" content="default"/>
    <style type="text/css">
        img{width: 50px; height: 50px;}
    </style>
    <script type="text/javascript">
        $(document).ready(function() {
            if($("#beginDate").val()==null || $("#beginDate").val()==''){
                $("#beginDate").val(getNowFormatDate());
            }
            if($("#endDate").val()==null || $("#endDate").val()==''){
                $("#endDate").val(getNowFormatDate());
            }
            laydate.render({
                elem: '#beginDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                format: 'yyyy-MM-dd',
                type : 'date'
            });

            laydate.render({
                elem: '#endDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                format: 'yyyy-MM-dd',
                type : 'date'
            });
        })

        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            month = (month < 10)?"0"+month:month;
            strDate = (strDate < 10)?"0"+strDate:strDate;
            var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
            return currentdate;
        }
        $(function () {
            $("img").each(function () {
                var num = 1 ;

                $(this).click(function () {
                    var flag = num%2;
                    if(flag == 1){
                        $(this).css("width","100%");
                        $(this).css("height","100%");
                        num++;
                    }else if(flag ==0){
                        $(this).css("width","50px");
                        $(this).css("height","50px");
                        num++;
                    }
                })
            });
        })
    </script>
    <script type="text/javascript">
        $(function () {

            $(".diffSelect").bind("change",function () {
                var selectVal = $(".diffSelect").val();
                if(0==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).show();
                    });
                }
                if(1==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("报告")>=0?$(this).show():$(this).hide();
                    })
                }
                if(2==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("外勤")>=0?$(this).show():$(this).hide();
                    })
                }
                if(3==selectVal){
                    $("table:eq(1) tr").each(function () {
                        ($(this).find("td:eq(3)").text().indexOf("考勤")>=0
                            || $(this).find("td:eq(3)").text().indexOf("正常上班")>=0
                            || $(this).find("td:eq(3)").text().indexOf("正常下班")>=0
                            || $(this).find("td:eq(3)").text().indexOf("早退")>=0
                            || $(this).find("td:eq(3)").text().indexOf("迟到")>=0
                        ) ?$(this).show():$(this).hide();
                    })
                }
                if(4==selectVal){
                    $("table:eq(1) tr").each(function () {
                        ($(this).find("td:eq(3)").text().indexOf("审核")>=0
                            || $(this).find("td:eq(3)").text().indexOf("用印")>=0
                            || $(this).find("td:eq(3)").text().indexOf("请假")>=0
                            || $(this).find("td:eq(3)").text().indexOf("出差")>=0
                            || $(this).find("td:eq(3)").text().indexOf("加班")>=0
                            || $(this).find("td:eq(3)").text().indexOf("外出")>=0
                        ) ?$(this).show():$(this).hide();
                    })
                }
                if(31==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("迟到")>=0?$(this).show():$(this).hide();
                    })
                }
                if(32==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("正常上班")>=0?$(this).show():$(this).hide();
                    })
                }
                if(33==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("早退")>=0?$(this).show():$(this).hide();
                    })
                }
                if(34==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("正常下班")>=0?$(this).show():$(this).hide();
                    })
                }
                if(41==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("用印")>=0?$(this).show():$(this).hide();
                    })
                }
                if(42==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("请假")>=0?$(this).show():$(this).hide();
                    })
                }
                if(43==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("出差")>=0?$(this).show():$(this).hide();
                    })
                }
                if(44==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("加班")>=0?$(this).show():$(this).hide();
                    })
                }
                if(45==selectVal){
                    $("table:eq(1) tr").each(function () {
                        $(this).find("td:eq(3)").text().indexOf("外出")>=0?$(this).show():$(this).hide();
                    })
                }
            })

        })



    </script>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="full-width fl">
            <div class="contentShadow layui-row" id="queryDiv">
                <form:form id="searchForm" modelAttribute="calendarCountEntity" action="${ctx}/work/report/workReport/reportlist" method="post" class="form-inline">
                    <%--以下三行照抄--%>
                    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                    <table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
                    <div class="commonQuery">
                        <div class="layui-item query athird">
                            <label class="layui-form-label">类型：</label>
                            <div class="layui-input-block">
                                <form:select path="type" class=" form-control  simple-select">
                                    <form:option value="" label=""/>
                                    <form:option value="1" label="工作日志"/>
                                    <form:option value="2" label="请假"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="layui-item query athird">
                            <label class="layui-form-label">日期：</label>
                            <div class="layui-input-block">
                                <input id="beginDate" name="startDate" placeholder="开始时间" type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
                                />
                                </input>
                                <span class="group-sep">-</span>
                                <input id="endDate" name="endDate" placeholder="结束时间"  type="text" readonly="readonly" maxlength="20" class="laydate-icondate form-control layer-date layui-input laydate-icon query-group"
                                />
                                </input>
                            </div>
                        </div>
                        <div class="layui-item athird">
                            <div class="input-group">
                                <a href="#" id="moresee"><i class="glyphicon glyphicon-menu-down"></i></a>
                                <button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
                                <button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
                            </div>
                        </div>
                        <div style="    clear:both;"></div>
                    </div>
                </form:form>
            </div>
        </div>
        <div class="ibox-content">
        <table class="table table-striped table-bordered table-hover table-condensed dataTables-example dataTable">
            <tr>
                <th style="text-align: center;" class="">姓名</th>
                <th style="text-align: center;" class="">工号</th>
               <%-- <th style="text-align: center;" class="">部门</th>--%>
                <th style="text-align: center;" class="">职级</th>
                <th style="text-align: center;" class="">类型</th>
                <th style="text-align: center;" class="">日期</th>
                <th style="text-align: center;" class="">操作</th>
            </tr>
        <c:forEach items="${manageCalendarDetailsList}" var="details">
            <!-- 工作日志-->
            <c:if test="${!empty details.workReports}">
                <c:forEach items="${details.workReports.workReport}" var="wr" varStatus="id_workReport">
                    <tr>
                        <td hidden="hidden">
                                ${wr.userId}
                        </td>
                        <td>
                                ${wr.userName}
                        </td>
                        <td>
                                ${wr.no}
                        </td>
                       <%-- <td>
                            ${wr.officeName}
                        </td>--%>
                        <td>
                               无
                        </td>
                        <td>
                            工作日志
                        </td>
                        <td>
                            <fmt:formatDate value="${wr.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <a onclick="openDialogView('查看工作报告', '${ctx}/work/report/workReport/form?id=${wr.workReportBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs"></i>查看详情</a>
                            </div>
                            <%--<input value="${wr.workReportBean.id}" hidden="hidden">--%>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>
            <!-- 外勤签到-->
            <c:if test="${!empty details.workOutSignIns}">
                <c:forEach items="${details.workOutSignIns.workOutSignIn}" var="sign">
                    <tr>
                        <td hidden="hidden">
                            ${sign.userId}
                        </td>
                        <td>
                                ${sign.userName}
                        </td>
                        <td>
                                ${sign.no}
                        </td>
                       <%-- <td>
                                ${sign.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            外勤签到
                        </td>
                        <td>
                            <fmt:formatDate value="${sign.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${sign.workOutSignInBean}" hidden="hidden"/>
                            <a onclick="openDialogView('查看外勤签到信息', '${ctx}/workoutsignin/workOutSignIn/form?id=${sign.workOutSignInBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs"> 查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>

            <!-- 审核-->
            <c:if test="${!empty details.audits}">
                <c:forEach items="${details.audits.workSealFrom}" var="seal">
                    <tr>
                        <td hidden="hidden">
                                ${seal.userId}
                        </td>
                        <td>
                                ${seal.userName}
                        </td>
                        <td>
                                ${seal.no}
                        </td>
                        <%--<td>
                                ${seal.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            用印
                        </td>
                        <td>
                            <fmt:formatDate value="${seal.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${seal.workSealFormBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看用印信息', '${ctx}/oa/manageCalendar/workSealForm?id=${seal.workSealFormBean.id}','80%','80%')" class="btn btn-info btn-xs"> 查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <c:forEach items="${details.audits.leave}" var="lev">
                    <tr>
                        <td hidden="hidden">
                                ${lev.userId}
                        </td>
                        <td>
                                ${lev.userName}
                        </td>
                        <td>
                                ${lev.no}
                        </td>
                        <%--<td>
                                ${lev.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            请假
                        </td>
                        <td>
                            <fmt:formatDate value="${lev.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${lev.leaveBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看请假信息', '${ctx}/oa/manageCalendar/leaveForm?id=${lev.leaveBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs"> 查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <c:forEach items="${details.audits.oaEvection}" var="evection">
                    <tr>
                        <td hidden="hidden">
                                ${evection.userId}
                        </td>
                        <td>
                                ${evection.userName}
                        </td>
                        <td>
                                ${evection.no}
                        </td>
                       <%-- <td>
                                ${evection.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            出差
                        </td>
                        <td>
                            <fmt:formatDate value="${evection.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${evection.oaEvectionBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看出差信息', '${ctx}/oa/manageCalendar/evectionForm?id=${evection.oaEvectionBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs"> 查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <c:forEach items="${details.audits.workOvertimeForm}" var="workOvertime">
                    <tr>
                        <td hidden="hidden">
                                ${workOvertime.userId}
                        </td>
                        <td>
                                ${workOvertime.userName}
                        </td>
                        <td>
                                ${workOvertime.no}
                        </td>
                       <%-- <td>
                                ${workOvertime.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            加班
                        </td>
                        <td>
                            <fmt:formatDate value="${workOvertime.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${workOvertime.workOvertimeFormBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看加班信息', '${ctx}/oa/manageCalendar/workOvertimeForm?id=${workOvertime.workOvertimeFormBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs"> 查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <c:forEach items="${details.audits.workGoOut}" var="out">
                    <tr>
                        <td hidden="hidden">
                                ${out.userId}
                        </td>
                        <td>
                                ${out.userName}
                        </td>
                        <td>
                                ${out.no}
                        </td>
                       <%-- <td>
                                ${out.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            外出
                        </td>
                        <td>
                            <fmt:formatDate value="${out.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${out.goOutBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看外出信息', '${ctx}/oa/manageCalendar/goOutForm?id=${out.goOutBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs"> 查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>
            <!-- 考勤-->
            <c:if test="${!empty details.attendances}">
                <c:forEach items="${details.attendances.late}" var="lat">
                    <tr>
                        <td hidden="hidden">
                                ${lat.userId}
                        </td>
                        <td>
                                ${lat.userName}
                        </td>
                        <td>
                                ${lat.no}
                        </td>
                       <%-- <td>
                                ${lat.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            迟到
                        </td>
                        <td>
                            <fmt:formatDate value="${lat.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input   value="${lat.oaAttendanceBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看考勤信息', '${ctx}/oa/oaAttendance/form?id=${lat.oaAttendanceBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs">查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <c:forEach items="${details.attendances.onDuty}" var="on">
                    <tr>
                        <td hidden="hidden">
                                ${on.userId}
                        </td>
                        <td>
                                ${on.userName}
                        </td>
                        <td>
                                ${on.no}
                        </td>
                        <%--<td>
                                ${on.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            正常上班
                        </td>
                        <td>
                            <fmt:formatDate value="${on.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${on.oaAttendanceBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看考勤信息', '${ctx}/oa/oaAttendance/form?id=${on.oaAttendanceBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs">查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <c:forEach items="${details.attendances.leaveEarly}" var="early">
                    <tr>
                        <td hidden="hidden">
                                ${early.userId}
                        </td>
                        <td>
                                ${early.userName}
                        </td>
                        <td>
                                ${early.no}
                        </td>
                       <%-- <td>
                                ${early.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            早退
                        </td>
                        <td>
                            <fmt:formatDate value="${early.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${early.oaAttendanceBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看考勤信息', '${ctx}/oa/oaAttendance/form?id=${early.oaAttendanceBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs">查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
                <c:forEach items="${details.attendances.offDut}" var="off">
                    <tr>
                        <td hidden="hidden">
                                ${off.userId}
                        </td>
                        <td>
                                ${off.userName}
                        </td>
                        <td>
                                ${off.no}
                        </td>
                       <%-- <td>
                                ${off.officeName}
                        </td>--%>
                        <td>
                            无
                        </td>
                        <td>
                            正常下班
                        </td>
                        <td>
                            <fmt:formatDate value="${off.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <div style="text-align: center">
                            <input  value="${off.oaAttendanceBean.id}" hidden="hidden"/>
                            <a onclick="openDialogView('查看考勤信息', '${ctx}/oa/oaAttendance/form?id=${off.oaAttendanceBean.id}&readAttr=disabled','80%','80%')" class="btn btn-info btn-xs">查看详情</a>
                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </c:if>
        </c:forEach>
        </table>
        </div>
    </div>
</div>
</body>
</html>
