<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>

<link rel="stylesheet" href="${contextPath}/static/assets/css/jquery-ui.css" />
<link rel="stylesheet" href="${contextPath}/static/assets/css/ui.jqgrid.css" />
<link rel="stylesheet" href="${contextPath}/static/js/contract/ace.fileinput.css" />

<style>
	.hr-line-dashed {
	    background-color: #ffffff;
	    border-top: 1px dashed #e7eaec;
	    color: #ffffff;
	    height: 1px;
	    margin: 20px 0;
	}
</style>

<div class="well well-sm">
	<select class="select" id="adState">
		<option value="" selected = "selected">状态</option>
		<option value="true">启用</option>
		<option value="false">禁用</option>
	</select>
	<input type="text" class="input-sm" placeholder="关键词" id="keyword"/>
	<button type="button" class="btn btn-purple btn-sm" id="searchd">
		<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
		查询
	</button>
</div>

<div class="row">
	<div class="col-xs-12">
		<table id="grid-table"></table>
		<div id="grid-pager"></div>
		<script type="text/javascript">
			var $path_base = "${contextPath}/static";//in Ace demo this will be used for editurl parameter
		</script>
		<!-- PAGE CONTENT ENDS -->
	</div><!-- /.col -->
</div><!-- /.row -->

<div id="modal-bc" class="modal fade" tabindex="-1">
	<div class="modal-dialog" style="max-width: 600px;">
		<div class="modal-content">
			<div class="modal-header no-padding">
      			<div class="table-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						<span class="white">&times;</span>
					</button>
					广告配置
				</div>
	      	</div>
	      	<div class="modal-body" style="max-height: 500px;overflow-y: scroll;">
	      		<form id="bcForm" class="form-horizontal">
      				<input type="hidden" name="bcId" id="mod-bc-bcId"/>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">接口代码</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-code" class="form-control"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">状态</label>
			      		<div class="col-sm-10 text-left">
			      			<select class="form-control select" id="mod-bc-ad">
								<option value="true">启用</option>
								<option value="false">禁用</option>
							</select>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding">广告图片地址</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-adPic" class="form-control"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">广告文本</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-adText" class="form-control"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">图片名</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-picName" class="form-control" disabled="true"　readOnly="true"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">跳转地址</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-adLink" class="form-control"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">跳转类型</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-adType" class="form-control"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">广告类型</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-type" class="form-control"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">序号</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-sort" class="form-control"/>
			      		</div>
			      	</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">版本号</label>
			      		<div class="col-sm-10 text-left">
			      			<input type="text" id="mod-bc-version" class="form-control"/>
			      		</div>
			      	</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right">跳转页面</label>
						<div class="col-sm-10 text-left">
							<input type="text" id="mod-bc-redirectUrl" class="form-control"/>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right">弹窗出现间隔天数</label>
						<div class="col-sm-10 text-left">
							<input type="text" id="mod-bc-intervalDays" class="form-control"/>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right">弹窗当天允许次数</label>
						<div class="col-sm-10 text-left">
							<input type="text" id="mod-bc-numberOfDay" class="form-control"/>
						</div>
					</div>
			      	<div class="form-group">
			      		<label class="col-sm-2 control-label no-padding-right">图片</label>
			      		<div class="col-sm-10 text-left">
							<button class="btn btn-primary btn-white checkbox-inline" type="button" id="mod-bc-picBtn">上传图片</button>
			      			<div id="mod-bc-picDiv" class="checkbox-inline"></div>
			      		</div>
			      	</div>
		      	</form>
	      	</div>
	      	<div class="modal-footer">
                <button class="btn " data-dismiss="modal"><i class="fa fa-share bigger-160"></i>取消</button>
	      		<button class="btn btn-primary" type="button" id="mod-bc-submit"><strong>确定</strong></button>
			</div>
		</div>
	</div>
</div>

<div id="mod-pic" class="modal fade" tabindex="-1">
	<div class="modal-dialog" style="max-width: 500px;">
		<div class="modal-content">
			<div class="modal-header no-padding">
				<div class="table-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
						<span class="white">&times;</span>
					</button>
					图片上传
				</div>
			</div>
			<div class="modal-body">
				<div class="row">
					<div class="col-xs-12">
						<!-- PAGE CONTENT BEGINS  -->
						<form id="picform" >
							<input id="picFileId" type="file" name="file" multiple />
							<div class="hr hr-12 dotted"></div>
							<div class="text-center">
							<button type="button" class="btn btn-sm btn-primary" id="mod-pic-submit">上传</button>
							<button type="reset" class="btn btn-sm">清除</button>
							</div>
						</form>
					</div><!-- /.col -->
				</div><!-- /.row -->
				
			</div>
		</div><!-- /.modal-content -->
	</div><!-- /.modal-dialog -->
</div>

<!-- page specific plugin scripts -->
<script type="text/javascript">
	var bucket = '${oss_bucket_b}';
	var contextPath = '${contextPath}';
	var logoUrl = '${oss_bucket_b_url}';
	var logoThum = '${oss_bucket_b_url_img}';
	var myGrid = null;
	var url_b = '${duowenapp_b}';
	
	var scripts = [ null, "${contextPath}/static/assets/js/jqGrid/jquery.jqGrid.js", "${contextPath}/static/assets/js/jqGrid/i18n/grid.locale-cn.js", 
	                "${contextPath}/static/js/contract/promise-6.1.0.js", "http://gosspublic.alicdn.com/aliyun-oss-sdk-4.3.0.min.js",
	                "${contextPath}/static/js/contract/ace.fileinput.js", "${contextPath}/static/js/contract/uuid.js",
	                "${contextPath}/static/js/contract/picupload.js", "${contextPath}/static/assets/js/lazyload/jquery.lazyload.js","${contextPath}/static/js/network.js", 
	                "${contextPath}/static/js/am/bc.js", "${contextPath}/static/js/am/bc_init.js", null ];
	
	$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
		// inline scripts related to this page
		jQuery(function($) {
			
		});
	});
	
	function showPicModal(attachType){
		$('#mod-pic-attachType').val(attachType);
		$('#mod-pic').modal('toggle');
	}
</script>