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.
407 lines
13 KiB
407 lines
13 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>team</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>
|
|
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
|
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
var ln = parseInt('${team1Stats.size()}');
|
|
|
|
//$(document).ready(function() {
|
|
var headers = $("[name='headers']");
|
|
var lignesResults = $("[name='lignesResults']");
|
|
|
|
var nbTeam = $(headers).find("th").size() - ln *2 -12;
|
|
|
|
|
|
|
|
// color impact in center columns
|
|
var impSel = $("[name='impSel']");
|
|
for (x=0;x<$(impSel).size();x++){
|
|
var n = ""+(parseFloat($(impSel).eq(x).text()));
|
|
if(n>0){
|
|
$(impSel).eq(x).text("+" + n);
|
|
$(impSel).eq(x).removeClass("negative").addClass("positive");
|
|
}else{
|
|
$(impSel).eq(x).removeClass("positive").addClass("negative");
|
|
}
|
|
}
|
|
|
|
var entete = $("[name='headers']");
|
|
//hide ft / fg stats
|
|
$(entete).find('th').each (function() {
|
|
if($(this).text().includes("/")){
|
|
$(this).hide();
|
|
}
|
|
});
|
|
var entete2 = $("[name='headersTop']");
|
|
//hide ft / fg stats
|
|
$(entete2).find('th').each (function() {
|
|
if($(this).text().includes("/")){
|
|
$(this).hide();
|
|
}
|
|
});
|
|
var entete3 = $("[name='headersMid']");
|
|
//hide ft / fg stats
|
|
$(entete3).find('th').each (function() {
|
|
if($(this).text().includes("/")){
|
|
$(this).hide();
|
|
}
|
|
});
|
|
var tradeProjSel = $("td[name='tradeProjSel']");
|
|
//hide ft / fg stats
|
|
$(tradeProjSel).each (function() {
|
|
if($(this).text().includes("/")){
|
|
$(this).hide();
|
|
}
|
|
});
|
|
|
|
//color other team points
|
|
var actualProj = $("[name='actualProj']");
|
|
var cat = $("[name='cat']");
|
|
var z = 0;
|
|
for (x=0;x<$(tradeProjSel).size();x++){
|
|
if(z==$(cat).size()){z=0;}
|
|
if(z>$(cat).size()-nbTeam-1){
|
|
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text()));
|
|
if(n>0){
|
|
$(tradeProjSel).eq(x).removeClass("negative").addClass("positive");
|
|
}else{
|
|
$(tradeProjSel).eq(x).removeClass("positive").addClass("negative");
|
|
}
|
|
|
|
}
|
|
z+=1;
|
|
}
|
|
|
|
var sort = $("[name='sort']");
|
|
$(sort).each(function(col) {
|
|
$(this).hover(
|
|
function() { $(this).addClass('focus'); },
|
|
function() { $(this).removeClass('focus'); }
|
|
);
|
|
|
|
if($(this).text()=="TOT RD"){
|
|
$(this).addClass('desc selected');
|
|
}
|
|
|
|
$(this).click(function() {
|
|
if ($(this).is('.desc')) {
|
|
$(this).removeClass('desc');
|
|
$(this).addClass('asc selected');
|
|
sortOrder = 1;
|
|
}
|
|
else {
|
|
$(this).addClass('desc selected');
|
|
$(this).removeClass('asc');
|
|
sortOrder = -1;
|
|
}
|
|
$(this).siblings().removeClass('asc selected');
|
|
$(this).siblings().removeClass('desc selected');
|
|
|
|
var arrData = $('table').find("tr[name='lignesResults']");
|
|
/* var arrData = $('table').find('tbody:nth-of-type(2) > tr').get(); */
|
|
|
|
arrData.sort(function(a, b) {
|
|
var val1 = $(a).children('td').eq(col+${nbStats}+4).text().replace("+","").toUpperCase();
|
|
var val2 = $(b).children('td').eq(col+${nbStats}+4).text().replace("+","").toUpperCase();
|
|
if($.isNumeric(val1) && $.isNumeric(val2))
|
|
return sortOrder == 1 ? val1-val2 : val2-val1;
|
|
else
|
|
return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0;
|
|
});
|
|
|
|
|
|
|
|
$.each(arrData, function(index, row) {
|
|
$('tbody:nth-of-type(2)').append(row);
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
$("#everything-wrapper").fadeIn();
|
|
$('#loader').hide();
|
|
});
|
|
|
|
function listDiff(Elem)
|
|
{
|
|
|
|
var impSel = $(Elem).find("td[name='impSel']");
|
|
var imp = $("[name='imp']");
|
|
var drop = $(Elem).find("td[name='drop']");
|
|
var get = $(Elem).find("td[name='get']");
|
|
var actualPlayers = $("[name='actualPlayers']");
|
|
var tradePlayers = $("[name='tradePlayers']");
|
|
var cat = $("[name='cat']");
|
|
var actualProj = $("[name='actualProj']");
|
|
var tradeProj = $("[name='tradeProj']");
|
|
var diff = $("[name='diff']")
|
|
var tradeProjSel = $(Elem).find("td[name='tradeProjSel']");
|
|
|
|
$(actualPlayers).eq(0).text($(drop).eq(0).text());
|
|
$(tradePlayers).eq(0).text($(get).eq(0).text());
|
|
//$(actualPlayers).eq(1).text($(drop).eq(1).text());
|
|
//$(tradePlayers).eq(1).text($(get).eq(1).text());
|
|
|
|
for (x=0;x<$(impSel).size();x++){
|
|
$(imp).eq(x).text($(impSel).eq(x).text());
|
|
var n = ""+(parseFloat($(imp).eq(x).text()));
|
|
if(n>0){
|
|
$(imp).eq(x).removeClass("negative").addClass("positive");
|
|
}else{
|
|
$(imp).eq(x).removeClass("positive").addClass("negative");
|
|
}
|
|
}
|
|
|
|
for (x=0;x<$(cat).size();x++){
|
|
|
|
if($(cat).eq(x).text().includes('/')){
|
|
var decomp = $(tradeProjSel).eq(x).text().split("/");
|
|
var decomp2 = $(actualProj).eq(x).text().split("/");
|
|
|
|
$(tradeProj).eq(x).text(parseFloat(decomp[0]).toFixed(0) + "/" + parseFloat(decomp[1]).toFixed(0));
|
|
|
|
var valProj1 = parseFloat(decomp[0]) - parseFloat(decomp2[0]);
|
|
var valProj2 = parseFloat(decomp[1]) - parseFloat(decomp2[1]);
|
|
$(diff).eq(x).text(valProj1.toFixed(0) + "/" + valProj2.toFixed(0));//remaining points
|
|
}else if($(cat).eq(x).text().includes('%')){
|
|
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()).toFixed(2));
|
|
var n = (parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text())).toFixed(2);
|
|
if(n>0){
|
|
$(diff).eq(x).text("+" + n);
|
|
$(diff).eq(x).removeClass("negative").addClass("positive");
|
|
$(diff).eq(x+1).removeClass("negative").addClass("positive");
|
|
}else{
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("positive").addClass("negative");
|
|
$(diff).eq(x+1).removeClass("positive").addClass("negative");
|
|
}
|
|
}else if($(cat).eq(x).text() == 'TO'){
|
|
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()));
|
|
var n = ""+(parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text()));
|
|
if(n>0){
|
|
$(diff).eq(x).text("+" + n);
|
|
$(diff).eq(x).removeClass("positive").addClass("negative");
|
|
}else{
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("negative").addClass("positive");
|
|
}
|
|
}else{
|
|
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()));
|
|
//inverse diff si col RK
|
|
if($(cat).eq(x).text() == 'RK'){
|
|
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text()));
|
|
if(n>0){
|
|
$(diff).eq(x).text("+" + n);
|
|
$(diff).eq(x).removeClass("negative").addClass("positive");
|
|
}else{
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("positive").addClass("negative");
|
|
}
|
|
}else{
|
|
var n = parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text());
|
|
if(n>0){
|
|
$(diff).eq(x).text("+" + n);
|
|
$(diff).eq(x).removeClass("negative").addClass("positive");
|
|
}else{
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("positive").addClass("negative");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
</head>
|
|
<body onload="">
|
|
|
|
|
|
<c:set var="mainTRADE" value="${requestScope.mainTRADE}" />
|
|
<c:set var="stats" value="${requestScope.statBase}" />
|
|
<c:set var="nbTeam" value="${requestScope.nbTeam}" />
|
|
<c:set var="team1" value="${requestScope.team1}" />
|
|
<c:set var="team1Stats" value="${requestScope.team1Stats}" />
|
|
<c:set var="team2" value="${requestScope.team2}" />
|
|
<c:set var="team2Stats" value="${requestScope.team2Stats}" />
|
|
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" />
|
|
|
|
<div id="everything-wrapper" >
|
|
|
|
<table class="tableTrade" style="font-size: 7px;">
|
|
|
|
<thead ">
|
|
<!-- ajoute 3 titres de section ----- TEAM 2 -------------TEAM 2 --------OTHERS -->
|
|
<tr class="Header"">
|
|
<th name="tradeTab" rowspan="2" colspan="2"><c:out value="Traded players" /></th>
|
|
<th name="team1Tab" colspan="${(fn:length(stats)-nbTeam+2-6-2)/2 }"><c:out value="${team1.name}" /></th>
|
|
<th name="impTab" rowspan="2" colspan="6"><c:out value="Trade Impact" /></th>
|
|
<th name="team2Tab" colspan="${(fn:length(stats)-nbTeam+2-6-2)/2 }"><c:out value="${team2.name}" /></th>
|
|
<th name="impTeamTab" colspan="${nbTeam - 2}"><c:out value="Impact on other teams" /></th>
|
|
</tr>
|
|
|
|
|
|
<!-- STATS CAT -->
|
|
<tr name="headersTop" class="Header">
|
|
<c:forEach var="stat" items= "${stats}" varStatus="i">
|
|
<c:if test="${stat.name == 'RK-P'}">
|
|
|
|
<c:if test="${i.first}">
|
|
|
|
</c:if>
|
|
<th ><c:out value="RK" /></th>
|
|
</c:if>
|
|
<c:if test="${stat.name != 'IMP'}">
|
|
<th><c:out value="${stat.name}" /></th>
|
|
</c:if>
|
|
</c:forEach>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<!-- LIGNE ACTUAL STATS PROJECTION-->
|
|
<tr name="headersTop" class="ligneHead" ">
|
|
<c:forEach var="stat" items= "${team1Stats}" varStatus="i">
|
|
<c:if test="${i.first}">
|
|
<th name="actualPlayers" rowspan="3">T1 trade</th>
|
|
<th name="tradePlayers" rowspan="3">T1 trade</th>
|
|
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th>
|
|
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th>
|
|
</c:if>
|
|
<th name="actualProj"><c:out value="${stat.valProjection}" /></th>
|
|
</c:forEach>
|
|
|
|
<th colspan="6">ACTUAL PROJECTION</th>
|
|
|
|
<c:forEach var="stat" items= "${team2Stats}" varStatus="i" >
|
|
<c:if test="${i.first}">
|
|
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team2projectedRK}" /></th>
|
|
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team2projTot}" /></th>
|
|
</c:if>
|
|
<th name="actualProj"><c:out value="${stat.valProjection}" /></th>
|
|
</c:forEach>
|
|
|
|
<c:forEach var="stat" items= "${otherTeamStats}" >
|
|
<th name="actualProj"><c:out value="${stat}" /></th>
|
|
</c:forEach>
|
|
</tr>
|
|
|
|
<!-- LIGNE WITH TRADE STATS PROJECTION-->
|
|
<tr name="headersMid" class="ligneHead" ">
|
|
<c:forEach var="stat" items= "${stats}" varStatus="i">
|
|
<c:if test="${i.first}">
|
|
|
|
</c:if>
|
|
<c:if test="${stat.name == 'RK-P'}">
|
|
<th name="tradeProj"><c:out value="--" /></th>
|
|
</c:if>
|
|
<c:if test="${stat.name != 'IMP'}">
|
|
<c:if test="${stat.name.contains('/')}">
|
|
<th name="tradeProj"><c:out value="--/--" /></th>
|
|
</c:if>
|
|
<c:if test="${!stat.name.contains('/')}">
|
|
<th name="tradeProj"><c:out value="--" /></th>
|
|
</c:if>
|
|
</c:if>
|
|
<c:if test="${stat.name == 'IMP'}">
|
|
<th name="imp"><c:out value="<>" /></th>
|
|
</c:if>
|
|
|
|
</c:forEach>
|
|
</tr>
|
|
<!------------- LIGNE DIFFERENCES ----->
|
|
<tr name="headersTop" class="ligneHead" ">
|
|
<c:forEach var="stat" items= "${stats}" varStatus="i">
|
|
<c:if test="${stat.name == 'RK-P'}">
|
|
<c:if test="${!i.first}">
|
|
<th colspan="6">DIFFERENCES</th>
|
|
</c:if>
|
|
<c:if test="${i.first}">
|
|
|
|
</c:if>
|
|
<th id="diff" name="diff"><c:out value="--" /></th>
|
|
</c:if>
|
|
<c:if test="${stat.name != 'IMP'}">
|
|
<c:if test="${stat.name.contains('/')}">
|
|
<th id="diff" name="diff"><c:out value="--/--" /></th>
|
|
</c:if>
|
|
<c:if test="${!stat.name.contains('/')}">
|
|
<th id="diff" name="diff"><c:out value="--" /></th>
|
|
</c:if>
|
|
</c:if>
|
|
</c:forEach>
|
|
</tr>
|
|
</tbody>
|
|
<thead>
|
|
<!------ DROP GET / REPEAT STATS CAT ----->
|
|
<tr name="headers" class="Header" ">
|
|
<c:forEach var="stat" items= "${stats}" varStatus="i">
|
|
<c:if test="${stat.name == 'RK-P'}">
|
|
<c:if test="${!i.first}">
|
|
<th name="sort">RK D</th>
|
|
<th name="sort">PT D</th>
|
|
<th name="sort">TOT RD</th>
|
|
<th name="sort">TOT PD</th>
|
|
<th name="sort">RK D</th>
|
|
<th name="sort">PT D</th>
|
|
</c:if>
|
|
<c:if test="${i.first}">
|
|
<th ><c:out value="${team1.name}" /></th>
|
|
<th ><c:out value="${team2.name}" /></th>
|
|
</c:if>
|
|
|
|
<th name="cat"><c:out value="RK" /></th>
|
|
</c:if>
|
|
<c:if test="${stat.name != 'IMP'}">
|
|
<th name="cat"><c:out value="${stat.name}" /></th>
|
|
</c:if>
|
|
</c:forEach>
|
|
</tr>
|
|
</thead>
|
|
<!------------------------ START RESULT TAB-------------------------------->
|
|
<tbody id="tTradediv" style="">
|
|
<c:forEach var="trade" items= "${mainTRADE}" varStatus="j">
|
|
|
|
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);">
|
|
<c:forEach var="stat" items= "${trade}" varStatus="i" >
|
|
<c:if test="${i.first}">
|
|
<td name="drop"><c:out value="${stat.player}" /></td>
|
|
<td name="get"><c:out value="${stat.team}" /></td>
|
|
</c:if>
|
|
<c:if test="${stat.name == 'RK-P'}">
|
|
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td>
|
|
</c:if>
|
|
<c:if test="${stat.name != 'IMP'}">
|
|
<td name="tradeProjSel" align="center"><c:out value="${stat.valProjection}" /></td>
|
|
</c:if>
|
|
<c:if test="${stat.name == 'IMP'}">
|
|
<td name="impSel" align="center"><c:out value="${stat.valProjection}" /></td>
|
|
</c:if>
|
|
|
|
</c:forEach>
|
|
|
|
</tr>
|
|
|
|
</c:forEach>
|
|
</tbody>
|
|
|
|
</table>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|