<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap-select.min.css"/>
    <script src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap-select.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/defaults-zh_CN.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/echarts.js"></script>
    <script src="${pageContext.request.contextPath}/js/base.js"></script>
    <script src="${pageContext.request.contextPath}/js/admin/admin_home.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/admin/admin_home.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/admin/admin_main.css"/>
    <title>商品管理页面</title>
</head>
<body>
<div class="table_normal_div">
    <table class="table_normal" id="table_product_list">
        <thead class="text_info">
        <tr>
            <th><input type="checkbox" class="cbx_select" id="cbx_select_all"><label for="cbx_select_all"></label></th>
            <th class="data_info" data-sort="asc" data-name="product_name">
                <span>产品名称</span>
                <span class="orderByDesc"></span>
                <span class="orderByAsc orderBySelect"></span>
            </th>
            <th class="data_info" data-sort="asc" data-name="product_title">
                <span>产品标题</span>
                <span class="orderByDesc"></span>
                <span class="orderByAsc orderBySelect"></span>
            </th>
            <th class="data_info" data-sort="asc" data-name="product_price">
                <span>原价</span>
                <span class="orderByDesc"></span>
                <span class="orderByAsc orderBySelect"></span>
            </th>
            <th class="data_info" data-sort="asc" data-name="product_sale_price">
                <span>促销价</span>
                <span class="orderByDesc"></span>
                <span class="orderByAsc orderBySelect"></span>
            </th>
            <th class="data_info" data-sort="asc" data-name="product_create_date">
                <span>创建时间</span>
                <span class="orderByDesc"></span>
                <span class="orderByAsc orderBySelect"></span>
            </th>
            <th class="data_info" data-sort="asc" data-name="product_isEnabled">
                <span>上架状态</span>
                <span class="orderByDesc"></span>
                <span class="orderByAsc orderBySelect"></span>
            </th>
            <th>操作</th>
            <th hidden>产品ID</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${requestScope.productList}" var="product">
            <tr>
                <td><input type="checkbox" class="cbx_select" id="cbx_product_select_${product.product_id}"><label for="cbx_product_select_${product.product_id}"></label></td>
                <td title="${product.product_name}">${product.product_name}</td>
                <td title="${product.product_title}">${product.product_title}</td>
                <td title="${product.product_price}">${product.product_price}</td>
                <td title="${product.product_sale_price}">${product.product_sale_price}</td>
                <td title="${product.product_create_date}">${product.product_create_date}</td>
                <td>
                    <c:choose>
                        <c:when test="${product.product_isEnabled==0}"><span class="td_success" title="产品正常销售中">销售中</span></c:when>
                        <c:when test="${product.product_isEnabled==2}"><span class="td_warn" title="产品显示在主页促销中">促销中</span></c:when>
                        <c:otherwise><span class="td_error" title="产品缺货或违规停售中">停售中</span></c:otherwise>
                    </c:choose>
                </td>
                <td><span class="td_special" title="查看产品详情"><a href="javascript:void(0)" onclick="getChildPage(this)">详情</a></span></td>
                <td hidden><span class="product_id">${product.product_id}</span></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div id="pageDiv">
        <ul>
            <li data-name="firstPage" <c:if test="${!requestScope.pageUtil.isHasPrev()}">class="disabled" </c:if>>
                <a href="product?action=list&page=1&size=10" onclick="javascript:void(0)" aria-label="首页"><span
                        aria-hidden="true">&laquo;</span></a>
            </li>
            <li data-name="prevPage" <c:if test="${!requestScope.pageUtil.isHasPrev()}">class="disabled" </c:if>>
                <a href="product?action=list&page=${requestScope.pageUtil.currentPage-1}&size=10"  aria-label="上一页"><span
                        aria-hidden="true">&lsaquo;</span></a>
            </li>

            <c:forEach begin="1" end="${requestScope.pageUtil.getTotalPage()}" varStatus="status">
                <c:if test="${status.count-requestScope.pageUtil.currentPage>=-5 && status.count-requestScope.pageUtil.currentPage<=5}">
                    <li <c:if test="${status.count==requestScope.pageUtil.currentPage}"> class="pageThis" </c:if>>
                        <a href="product?action=list&page=${status.count}" >${status.count}</a>
                    </li>
                </c:if>
            </c:forEach>

            <li data-name="nextPage" <c:if test="${!requestScope.pageUtil.isHasNext()}">class="disabled" </c:if>>
                <a href="product?action=list&page=${requestScope.pageUtil.currentPage+1}&size=10" aria-label="下一页"><span
                        aria-hidden="true">&rsaquo;</span></a>
            </li>
            <li data-name="lastPage" <c:if test="${!requestScope.pageUtil.isHasNext()}">class="disabled" </c:if>>
                <a href="product?action=list&page=${requestScope.pageUtil.getTotalPage()-1}&size=10"  aria-label="尾页">&raquo;</a>
            </li>
        </ul>
    </div>
</div>
</body>
</html>
