<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
    String basePath = request.getContextPath();
%>
<div class="table-responsive">
    <table class="table table-striped table-bordered table-hover " >
        <thead>
        <tr>
            <th>序号</th>
            <th>公司名称</th>
            <th>联系人姓名</th>
            <th>手机号码</th>
            <th>申请时间</th>
            <th>审核状态</th>
            <th class="hidden-print">操 作</th>
        </tr>
        </thead>
        <tbody>
        <c:choose>
            <c:when test="${list!=null}">
                <c:forEach items="${list}" var="item" varStatus="status">
                    <tr>
                        <td>${status.index+1}</td>
                        <td>${item.companyName}</td>
                        <td>${item.contact}</td>
                        <td>${item.phone}</td>
                        <td><fmt:formatDate value="${item.createdAt}"  type="Date" pattern="yyyy-MM-dd"/></td>
                        <%--<td><fmt:formatDate value="${item.authAt}"  type="Date" pattern="yyyy-MM-dd"/></td>--%>
                        <td>${item.authResult==null?'未审核':item.authResult}</td>
                        <td class="btn-table hidden-print">
                            <input type="hidden" name="id" value="${item.id}" />
                            <c:if test="${item.authResult !=null}">
                                <button name="btnDetail" class="btn btn-sm btn-primary m-r-sm" ><i class="fa fa-edit"></i>详情</button>
                            </c:if>
                            <c:if test="${item.authResult ==null}">
                                <button name="btnDetail" class="btn btn-sm btn-primary m-r-sm" ><i class="fa fa-edit"></i>详情</button>
                                <button name="btnAuth" id="btnAuth" class="btn btn-sm btn-primary m-r-sm"><i class="fa fa-edit"></i>审核</button>
                            </c:if>
                        </td>
                    </tr>
                </c:forEach>
            </c:when>
            <c:otherwise>
                <tr>
                    <td colspan="4">无数据</td>
                </tr>
            </c:otherwise>
        </c:choose>
        </tbody>
    </table>
</div>
<jsp:include page="../../../common/admin/pager.jsp">
    <jsp:param name="pageNo" value="${pager.pageNo}"/>
    <jsp:param name="pageSize" value="${pager.pageSize}"/>
    <jsp:param name="total" value="${pager.total}"/>
</jsp:include>
<script type="text/javascript">
    $("#divGrid table tbody tr td:last-child")

        .on("click", "button[name='btnDetail']", function () {
            var id = $(this).parent().children("input[type='hidden'][name='id']").val();
            $.popBsPartial({ url: "<%=basePath%>/admin/usercompany_mgr/detail.htm/" + id });
        })
        .on("click", "button[name='btnAuth']", function() {
            var id = $(this).parent().children("input[type='hidden'][name='id']").val();
            $.popBsPartial({ url: "<%=basePath%>/admin/usercompany_mgr/auth.htm/" + id });
        });
    $("#")
</script>