<%@ page language="java" contentType="text/html;charset=UTF-8" %> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 
<%@ page isELIgnored="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>赛事酒店编辑</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="<%=request.getContextPath() %>/js/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="<%=request.getContextPath() %>/js/bootstrap/css/bootstrap-theme.min.css">
    <script type="text/javascript" charset="utf-8" src="<%=request.getContextPath() %>/js/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="<%=request.getContextPath() %>/js/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid"> 
	<div class="alert alert-success" role="alert" style="text-align: center;">
		<c:if test="${matchHotel.id ==null }">
			添加赛事酒店
		</c:if>
		<c:if test="${matchHotel.id !=null }">
			修改赛事酒店
		</c:if>
	</div>
		<c:if test="${matchHotel.id ==null }">
			<form class="form-horizontal" action="<%=request.getContextPath() %>/ckuMatchHotel/addMatchHotel.do">
		</c:if>
		<c:if test="${matchHotel.id !=null }">
			<form class="form-horizontal" action="<%=request.getContextPath() %>/ckuMatchHotel/updateMatchHotel.do">
		</c:if>
		<input type="hidden" name="id" value="${matchHotel.id }" class="form-control">
		  <div class="form-group">
		    <label class="col-sm-2 control-label">酒店名称:</label>
		    <div class="col-sm-10">
		    	<input type="text" name="hotelName" value="${matchHotel.hotelName }" class="form-control" placeholder="酒店名称">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">酒店地址:</label>
		    <div class="col-sm-10">
		    	<input type="text" name="hotelAddress" value="${matchHotel.hotelAddress }" class="form-control" placeholder="酒店地址">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">联系电话:</label>
		    <div class="col-sm-10">
		    	<input type="text" name="hotelPhone" value="${matchHotel.hotelPhone }" class="form-control" placeholder="联系电话">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">路线:</label>
		    <div class="col-sm-10">
		    	<input type="text" name="hotelLine" value="${matchHotel.hotelLine }" class="form-control" placeholder="路线">
		    </div>
		  </div>
		  <div class="form-group">
		    <label class="col-sm-2 control-label">简介:</label>
		    <div class="col-sm-10">
		    	<input type="text" name="hotelInfo" value="${matchHotel.hotelInfo }" class="form-control" placeholder="简介">
		    </div>
		  </div>
		<c:if test="${matchHotel.ckuImageList !=null }">
		  <div class="form-group">
		  <label class="col-sm-2 control-label">酒店图片:</label>
			<div class="row">
			<c:forEach var="imageList" items="${matchHotel.ckuImageList }" >
				<div class="col-xs-2 col-md-2">
					<a href="#" class="thumbnail"> 
						<img id="showImageList" src="${imageList.imageMinUrl}" />
							<button type="button" onclick="delect(${imageList.imageId})" class="btn btn-warning" >删除</button>
					</a>
				</div>
			</c:forEach>
			</div>
		</div>
	  </c:if>
		  <div class="form-group" style="text-align: center;">
			<button type="submit" class="btn btn-default">提交</button>
		  	<button type="reset" class="btn btn-default">重置</button>
		  	<a type="reset" class="btn btn-default">返回</a>
		  </div>
	</form>
</div>
<script type="text/javascript">
//删除图片
function delect(id){
	$.ajax({
		type:"POST",
		url:"<%=request.getContextPath() %>/ckuImage/del.do",
		data: {id:id}, 
		dataType: 'json',
        timeout: 30000,
        async:true,
        success: function(json){
        	if(json.rc==0){
    			window.location.reload();
    		}
        },
        error: function(xhr, type){
			
        }
	});
}
</script>
</body>
</html>
