<%@page	import="com.blueland.bpm.engine.core.model.ProcessDefinitionModel"%>
<%@page import="com.blueland.bpm.engine.config.model.ProcessInfoConfig"%>
<%@page import="com.blueland.bpm.common.page.*"%>
<%@page import="com.blueland.bpm.common.util.*"%>
<%@page import="java.util.*"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ include file="/commons/taglibs.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<%@ include file="/commons/meta.jsp"%>
	<base href="<%=basePath%>">
	<title>应用列表</title>
	<link href="${ctx}/resource/js/plugins/loadmask/jquery.loadmask.css" rel="stylesheet" type="text/css" />
	<script type='text/javascript' src='${ctx}/resource/js/plugins/loadmask/jquery.loadmask.js'></script>
	<link href="${ctx_js_plugins}/simpletable/simpletable.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="${ctx_js_plugins}/simpletable/simpletable.js"></script>


	<script type="text/javascript">
		$(document).ready(function() {
			// 分页需要依赖的初始化动作
			window.simpleTable = new SimpleTable('queryForm',${page.thisPageNumber},${page.pageSize},'${pageRequest.sortColumns}');
			jQuery.ajax({
				type: "get",
				url: "https://api.hngytobacco.com/user-center/user/p_longw",
				data: {},
				headers: {
					'Authorization': "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJnTlJqS1paaFdGQ05VbFNMd2RqTEFSR0FBZ3hqa2NrNyIsImV4cCI6MTU4NDAxNjc0NX0.Bv_9tqZvCmN29jDCuVv3QPWTHGnE5PBfg0DgWtiVWShPtXUKZQtdDW9iDAKpfiPa_nvNRxzSowiCs7DekbejEhISkayWAyctQvi24fK-NiP9PVNnZF2AjAGx0mjLPLNblqJwc5nTwJQY83VPn0Fs2cCS5esTncH6U_behFjoDMc"
				},
				success: function(resp)
				{
					alert(JSON.stringify(resp));
				}
			});
		});

		function createApplication(){
			var url="${ctx}/applicationMgr/create.do";
			showDiaLog(url,"添加应用",'800px','450px');
		}

		function onDelete(action, radioName, form){
			if (!hasOneChecked(radioName)) {
				alert('请选择要操作的对象!');
				return;
			}
			if(window.confirm('确定执行[删除]操作?')){
				setMask("main-container");
				form.action = action;
				form.submit();
			}
		}
	</script>
</head>
<body>
<%@ include file="/commons/messages.jsp"%>
<form id="queryForm" name="queryForm"
	  action="${ctx}/applicationMgr/list.do" method="post"
	  style="display: inline;">
	<div class="main-container" id="main-container">
		<div class="panel panel-primary">
			<div class="panel-heading">
				<h8>应用列表</h8>
			</div>
			<div class="panel-body" id="panel-body" style="padding:3px;">
				<div class="well well-sm" style="margin-bottom: 2px;">

					<table border="0" cellspacing="0" cellpadding="0"
						   class="table-search">
						<tr>
							<td>应用名称：</td>
							<td><input value="${query.appName}" id="appName"
									   name="appName" maxlength="50" /></td>
							<td><button type="submit" onclick="getReferenceForm(this).action='${ctx}/applicationMgr/list.do'"class="btn btn-xs btn-primary">查询
								<i class="ace-icon fa fa-search bigger-110"></i></button>
								<button type="button" onclick="createApplication();" class="btn btn-xs btn-success">添加应用
									<i class="ace-icon fa fa-plus bigger-110"></i></button>
								<button type="button" onclick="onDelete('${ctx}/applicationMgr/delete.do','items',document.forms.queryForm)" class="btn btn-xs btn-success"">删除应用
								<i class="ace-icon fa fa-trash-o bigger-110"></i>
								</button>
							</td>
						</tr>
					</table>
				</div>

				<div class="row">
					<div class="col-xs-12">
						<div class="table-responsive">
							<div style="width: 100%;overflow: auto;">
								<table style="width: inherit;max-width: 600%;table-layout: fixed;" id="sample-table-1"
									   class="table table-striped table-bordered table-hover">
									<thead>
									<tr>
										<th style="width: 20px"></th>
										<!-- 排序时为th增加sortColumn即可,new SimpleTable('sortColumns')会为tableHeader自动增加排序功能; -->
										<th style="width: 120px" sortColumn="appId">应用ID</th>
										<th style="width: 120px" sortColumn="appName">应用名称</th>
										<th style="width: 120px" sortColumn="appProvider">开发商</th>
										<th style="width: 120px" sortColumn="appStatus">应用状态</th>
										<th style="width: 120px" sortColumn="appUrl">待办URL</th>
									</tr>
									</thead>
									<tbody>
									<c:forEach items="${page.result}" var="item"
											   varStatus="status">
										<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
											<td><input type="radio" name="items" value="appId=${item.appId}"></td>
											<td><a href="javascript:void(0);"  onclick="showDiaLog('${ctx}/applicationMgr/edit.do?appId=${item.appId }', '修改应用', '800px','450px');">${item.appId}</a>&nbsp;</td>
											<td>${item.appName}&nbsp;</td>
											<td>${item.appProvider}&nbsp;</td>
											<td>${item.statusVal }&nbsp;</td>
											<td>${item.appAccessUrl}&nbsp;</td>
										</tr>
									</c:forEach>
									</tbody>
								</table>
							</div>
							<simpletable:pageToolbar page="${page}">
							</simpletable:pageToolbar>
						</div>
						<!-- /.table-responsive -->
					</div>
					<!-- /span -->
				</div>
			</div>
		</div>

	</div>
</form>
</body>
</html>

