<%--
  Created by IntelliJ IDEA.
  User: wuxuan
  Date: 2024/4/9
  Time: 16:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page pageEncoding="UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ include file="../common/common.jsp" %>
<c:set var="basePage"><%=request.getContextPath() %>
</c:set>
<html>
<head>
    <title>代理商列表</title>
    <link rel="stylesheet" type="text/css" href="${basePage}/web/chatbot/static/css/noSignCustomerList.css">
</head>
<body>
<div class="page_container" id="app">
    <div class="page_head">
        <h3>CSP代理商列表</h3>
        <div class="breadcrumb">
            <a href="#">首页</a> > <a href="#">CSP业务</a> > CSP代理商列表
        </div>
    </div>

    <div class="container-fluid bg-body-tertiary config-content">
        <div class="row row-panel form-panel">
            <form method="post" id="form" action="${basePage}/chatbot/agentList.html">
                <div class="col-lg-3">
                    <label class="form-label"> 接口类型: </label>
                    <select class="form_control form_white" name="apiType" aria-label="接口类型">
                        <option value="">全部</option>
                        <option value="mobile5G" ${cspAgent.apiType == 'mobile5G' ? 'selected' : ''}>中国移动接口5G消息</option>
                        <option value="telecom5G" ${cspAgent.apiType == 'telecom5G' ? 'selected' : ''}>中国电信接口5G消息</option>
                        <option value="unicom5G" ${cspAgent.apiType == 'unicom5G' ? 'selected' : ''}>中国联通接口5G消息</option>
                    </select>
                </div>
                <div class="col-lg-3">
                    <label class="form-label"> 代理商编号: </label>
                    <input type="text" class="form_control form_white" placeholder="请输入代理商编号"
                           value="${cspAgent.agentCode}" name="agentCode"
                           aria-label="请输入代理商编号">
                </div>
                <div class="col-lg-3">
                    <label class="form-label"> 代理商名称: </label>
                    <input type="text" class="form_control form_white" placeholder="请输入代理商名称"
                           value="${cspAgent.agentName}" name="agentName"
                           aria-label="请输入代理商名称">
                </div>
                <div class="col-lg-3">
                    <div class="my-btn-group">
                        <button onclick="submitForm()" type="button" class="btn btn_blue">查询</button>
                        <a href="${basePage}/chatbot/agentConfigInfo.html" class="btn btn_green">添加代理商</a>
                    </div>
                </div>
            </form>
        </div>

        <div class="row row-panel">
            <div class="col-12">
                <div class="my-table-container page_container">
                    <table class="table table-hover datatable">
                        <thead>
                        <tr>
                            <th class="col-1" scope="col">ID</th>
                            <th class="col-2" scope="col">CSP编码</th>
                            <th class="col-2" scope="col">代理商名称</th>
                            <th class="col-3" scope="col">归属地区</th>
                            <th class="col-2" scope="col">备注</th>
                            <th class="col-2" scope="col">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:choose>
                        <c:when test="${empty agentList}">
                            <tr>
                                <td colspan="6" class="text-center">暂无数据</td>
                            </tr>
                        </c:when>
                        <c:otherwise>
                        <c:forEach items="${agentList}" var="item">
                            <tr>
                                <th scope="row">${item.id}</th>
                                <td>
                                    <c:choose>
                                        <c:when test="${not empty item.apiType and item.apiType != 'mobile5G'}">
                                            ${item.cspCode}
                                        </c:when>
                                        <c:otherwise>
                                            ${item.agentCode}
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <td>${item.agentName}</td>
                                <td>${item.regionName}</td>
                                <td>${item.remark}</td>
                                <td>
                                    <a href="${basePage}/chatbot/agentConfigInfo.html?id=${item.id}"
                                       class="btn btn_green">编辑代理商</a>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                        <tfoot>
                            ${cspAgent.page.pageStr}
                        </tfoot>
                        </c:otherwise>
                        </c:choose>
                    </table>
                </div>
            </div>
        </div>
    </div>

</div>
</body>
<script type="text/javascript" src="${basePage}/js/jquery.min-1.11.3.js"></script>
<script type="text/javascript" src="${basePage}/web/chatbot/static/js/csp_region.js"></script>
<script>
    function submitForm() {
        $("#form").submit();
    }
</script>
</html>
