You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
185 lines
4.7 KiB
185 lines
4.7 KiB
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
|
pageEncoding="ISO-8859-1"%>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" >
|
|
|
|
<title>trade</title>
|
|
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
|
|
|
|
|
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
$('#drop1').val(6);
|
|
listTeam('drop1','team1_div','team2_div',true)
|
|
|
|
|
|
|
|
}); //end doc ready
|
|
|
|
|
|
function listTeam(Elem, Div, otherDiv, first)
|
|
{
|
|
var selT = document.getElementsByName(Elem)[0].value;
|
|
|
|
if (Elem == 'drop1'){
|
|
//desactive l entree dans la liste 2
|
|
$("#drop2 > option").each(function() {
|
|
this.removeAttribute("disabled");
|
|
if(this.value == selT){
|
|
this.setAttribute("disabled", "disabled");
|
|
}
|
|
});
|
|
var othT = $('#drop2 option:selected').val();
|
|
}else{
|
|
//desactive l entree dans la liste 1
|
|
$("#drop1 > option").each(function() {
|
|
this.removeAttribute("disabled");
|
|
if(this.value == selT){
|
|
this.setAttribute("disabled", "disabled");
|
|
}
|
|
});
|
|
var othT = $('#drop1 option:selected').val();
|
|
}
|
|
|
|
$.ajax(
|
|
{
|
|
url:'CALL_DIV_team',
|
|
type:'get',
|
|
data: {selectedT: selT, otherT: othT, tableName: Div, otherTableName: otherDiv},
|
|
success:function(response)
|
|
{
|
|
$("#"+Div).html(response);
|
|
}
|
|
});
|
|
|
|
if(Elem == 'drop2' && first){
|
|
listTeam('drop1','team1_div','team2_div',false)
|
|
}
|
|
else if(Elem == 'drop1' && first){
|
|
listTeam('drop2','team2_div','team1_div',false)
|
|
}
|
|
|
|
}
|
|
|
|
function listTrade()
|
|
{
|
|
|
|
//$("#divTeams").fadeOut();
|
|
$("#divTrade").fadeIn();
|
|
|
|
//$("#btnList").fadeOut();
|
|
|
|
|
|
var T1 = document.getElementById('drop1').value;
|
|
var T2 = document.getElementById('drop2').value;
|
|
|
|
stringSelT1 = "";
|
|
$("#team1_div tr.selected").each(function() {
|
|
stringSelT1 += $(this).attr("player") +",";
|
|
});
|
|
stringSelT2 = "";
|
|
$("#team2_div tr.selected").each(function() {
|
|
stringSelT2 += $(this).attr("player") +",";
|
|
});
|
|
|
|
$.ajax(
|
|
{
|
|
url:'DIV_trade',
|
|
type:'get',
|
|
data: {team1: T1 , team2: T2 , selTeam1: stringSelT1 , selTeam2: stringSelT2},
|
|
success:function(response)
|
|
{
|
|
$("#trade_div").html(response);
|
|
//$("#btnTrade").fadeIn();
|
|
}
|
|
});
|
|
|
|
|
|
}
|
|
function chooseTrade()
|
|
{
|
|
//$("#divTeams").fadeIn();
|
|
//$("#btnList").fadeIn();
|
|
//$("#divTrade").fadeOut();
|
|
//$("#btnTrade").fadeOut();
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<c:set var="teams" value="${requestScope.teamList}" />
|
|
|
|
<div class="wrapper">
|
|
<header class="main-head">
|
|
<c:out value="Trade Analyser" />
|
|
<div style="width: 100%;text-align: center;margin-bottom:10px;">
|
|
<div id="btnList" style="display: inline-block;vertical-align:top;">
|
|
<input type="submit" value="Test trade" onclick="listTrade();"/>
|
|
</div>
|
|
<div id="btnTrade" style="display: inline-block;vertical-align:top;display: none;">
|
|
<input type="submit" value="Select Trade" onclick="chooseTrade();"/>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- <nav class="main-nav">
|
|
<ul>
|
|
<li><a href="">Nav 1</a></li>
|
|
<li><a href="">Nav 2</a></li>
|
|
<li><a href="">Nav 3</a></li>
|
|
</ul>
|
|
</nav>
|
|
-->
|
|
|
|
<article class="team">
|
|
<ul class="listingTeam">
|
|
<li id="divTeams1">
|
|
<Select id="drop1" name="drop1" onchange="return listTeam('drop1','team1_div','team2_div',true);">
|
|
<c:forEach var="team" items= "${teams}" varStatus="i">
|
|
<Option value="${i.index}">${team.name}</ Option>
|
|
</c:forEach>
|
|
</select>
|
|
<div id="team1_div"></div>
|
|
</li>
|
|
|
|
<li id="divTeams2">
|
|
<Select id="drop2" name="drop2" onchange="return listTeam('drop2','team2_div','team1_div',true);">
|
|
<c:forEach var="team" items= "${teams}" varStatus="i">
|
|
<Option value="${i.index}">${team.name}</ Option>
|
|
</c:forEach>
|
|
</select>
|
|
<div id="team2_div"></div>
|
|
</li>
|
|
|
|
<li class="wide" id="divTrade" style="display: none;">
|
|
<div class="cn">
|
|
<div id="loader" style="width: 100%;text-align: center;margin-top: 15px">
|
|
<span><c:out value="Calculating best trades" /></span>
|
|
<span class="l-1"></span>
|
|
<span class="l-2"></span>
|
|
<span class="l-3"></span>
|
|
<span class="l-4"></span>
|
|
<span class="l-5"></span>
|
|
<span class="l-6"></span>
|
|
</div>
|
|
</div>
|
|
<div id="trade_div"></div>
|
|
|
|
</li>
|
|
</ul>
|
|
</article>
|
|
<footer class="main-footer">The footer</footer>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|