<%@ page import="com.lightinit.hsdataplatform.dictionary.DicPublishApiState" %>
<%@ 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>提交日期</th>
            <th class="hidden-print">操 作</th>
        </tr>
        </thead>
        <tbody>
        <c:choose>
            <c:when test="${list!=null}">
                <c:forEach items="${list}" var="item" >
                    <tr>
                        <td>
                            <a href="#" onclick="publicApiView(${item.id},${item.publishInfoId})">${item.resourceName}</a>
                        </td>
                        <td>${item.resourceIdentity}</td>
                        <td>${item.resourceSummary}</td>
                        <td>${item.providerName}</td>
                        <td>${item.catelogTheme}</td>
                        <td><%=DicPublishApiState.WAIT_PENDING%></td>
                        <td><fmt:formatDate value="${item.registerDate}" pattern="yyyy-MM-dd"/></td>
                        <td class="btn-table hidden-print">
                            <input type="hidden" name="id" value="${item.id}" />
                            <c:if test="${item.resourceState==dicResourceState_DRAFT}"></c:if>
                            <button  class="btn btn-sm btn-primary m-r-sm" onclick="toExamineButton(${item.id},${item.publishInfoId})"><i class="fa fa-edit"></i>审核</button>
                            <c:if test="${not empty item.outId1 and not empty item.outId2}">
                                <button  class="btn btn-sm btn-primary m-r-sm" onclick="routeView(${item.id},${item.publishInfoId})"><i class="fa fa-edit"></i>添加路由规则</button>
                            </c:if>
                            <c:if test="${empty item.outId1 and not empty item.outId2}">
                                <button  class="btn btn-sm btn-primary m-r-sm" onclick="outRouteView(${item.id},${item.publishInfoId},${item.outId2})"><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">


    function toExamineButton(id,publishInfoId) {
        window.location.href = "<%=basePath%>/admin/api_toExamine/toExamine.htm/"+id+"/"+publishInfoId ;
    }

    function routeView(id,publishInfoId) {
        window.location.href = "<%=basePath%>/admin/api_toExamine/routeView.htm/"+id+"/"+publishInfoId ;
    }

    function outRouteView(id,publishInfoId,outId2) {
        window.location.href = "<%=basePath%>/admin/api_toExamine/outRouteView.htm/"+id+"/"+publishInfoId+"/"+outId2 ;

    }


    function publicApiView(id,publishInfoId) {
        window.location.href = "<%=basePath%>/admin/api_toExamine/publishInfoView.htm/"+id+"/"+publishInfoId ;
    }

</script>