<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>版本列表</title>
</head>
<body>
<!-- 面包屑 begin -->
<div class="row-fluid">
    <div class="span12">
        <ul class="breadcrumb">
            <li class="active" ><span class="divider" style="color:#26a0da;font-weight:bold;">/</span>版本列表</li>
        </ul>
    </div>
</div>
<!-- 面包屑 begin -->

<div class="page-container">
    <div class="row${fluid}">
        <div class="span12">
            <form id="filterForm" class="form-inline filterForm" action="${ctx}/appversion" method="get">
                <div class="buttons pull-right"  style="margin-left:15px;">
                    <a href="${ctx}/appversion?action=create" class="btn blue pull-right" title="新增"><i class="icon-plus"></i></a>
                </div>
            </form>
        </div>
    </div>
    <table class="table table-striped table-advance table-hover">
        <thead>
        <tr>
            <%--<th width="40" style="text-align:center"><input id="memberCheckAll" type="checkbox" onclick="checkAll(this)" /></th>--%>
            <%--<th width="100">id</th>--%>
            <th width="100">版本名称</th>
            <th width="100">版本号</th>
                <th width="100">版本编码</th>
                <th width="100">升级包链接</th>
                <th width="100">提示语</th>
                <th width="100">前端类别</th>
                <th width="100">是否强制更新</th>
                <th width="100">操作</th>
        </tr>
        </thead>
        <c:forEach items="${versions}" var="version">
            <tr>
                <%--<td nowrap="nowrap" style="text-align:center">--%>
                    <%--<c:out value="${version.id}" />--%>
                <%--</td>--%>
                <td nowrap="nowrap">
                    <c:out value="${version.name}" />
                </td>
                <td nowrap="nowrap">
                    <c:out value="${version.version}" />
                </td>
                    <td nowrap="nowrap">
                        <c:out value="${version.versionCode}" />
                    </td>
                    <td nowrap="nowrap">
                        <c:out value="${version.updateUrl}" />
                    </td>
                    <td nowrap="nowrap">
                        <c:out value="${version.description}" />
                    </td>
                    <td nowrap="nowrap">
                        <c:if test="${1 eq version.channel}">
                            <c:out value="android"/>
                        </c:if>
                        <c:if test="${2 eq version.channel}">
                            <c:out value="ios"/>
                        </c:if>
                    </td>
                    <td nowrap="nowrap">
                        <c:if test="${0 eq version.forceUpdate}">
                            <c:out value="否"/>
                        </c:if>
                        <c:if test="${1 eq version.forceUpdate}">
                            <c:out value="是"/>
                        </c:if>
                    </td>
                    <td nowrap="nowrap">
                        <i title="删除"
                                class="icon-minus pointer icon-large"
                                onclick="deleteById('${version.id}')"> </i>
                        &nbsp;&nbsp;
                    </td>
            </tr>
        </c:forEach>
    </table>
    <div class="row${fluid}">
        <house365:pagination page="${page}"/>
    </div>
</div>
<script type="text/javascript">
    <%--function authorize(id) {--%>
        <%--/*   House365Util.createRemoteModal("", "${ctx}/role/authorize/" + id, null,function () {--%>
		    	<%--return true;--%>
  			  <%--},"授权"); */--%>
        <%--window.location="${ctx}/role/authorize/" + id;--%>
    <%--}--%>

    var deleteById = function (selectedId) {
        /*
        id为空则是多选  判断是否为空
        为空 提示选择
        不为空 确认后删除
        不为空单选确认后删除
        */

        if(selectedId == "")
        {
            House365Util.createModal("删除版本", "请选择一条版本!", function () {
            });
        }
        else
        {
            House365Util.createModal("删除版本", "确定要删除该版本？", function () {
                $.ajax({
                    url: '${ctx}/appversion/' + selectedId,
                    type: "DELETE",
                    success: function () {
                        window.location.reload();
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert("删除出现异常，请联系管理员。");
                    }
                });
            });
        }

    };


</script>
</body>
</html>
