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.
566 lines
18 KiB
566 lines
18 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"%>
|
|
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
|
|
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
|
|
|
|
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
|
|
$(window).load(function() {
|
|
var ln = parseInt('${team1Stats.size()}');
|
|
|
|
//$(document).ready(function() {
|
|
|
|
var lignesResults = $("[name='lignesResults']");
|
|
var z = 0;
|
|
$(lignesResults).each (function() {
|
|
z = 0;
|
|
$(this).find("td").each(function() {
|
|
if(z==0){
|
|
$(this).css("width", "95");
|
|
}else if (+z <= ln ){
|
|
$(this).css("width", "28");
|
|
}else {
|
|
$(this).css("width", "48");
|
|
}
|
|
z+=1;
|
|
});
|
|
});
|
|
var headers = $("[name='headers']");
|
|
$(headers).each (function() {
|
|
z=0;
|
|
$(this).find("th").each(function() {
|
|
if(z==0){
|
|
$(this).css("width", "95");
|
|
}else if (+z <= ln ){
|
|
$(this).css("width", "28");
|
|
}else{
|
|
$(this).css("width", "48");
|
|
}
|
|
z+=1;
|
|
});
|
|
});
|
|
|
|
var statTab = $("[name='statTab']");
|
|
var teamTab = $("[name='teamTab']");
|
|
|
|
$(statTab).css("width", 95+6.8 + (ln) * (28+6.8) -6.8);
|
|
$(teamTab).css("width", (48+6.8) * (z-ln-1) -6.8);
|
|
|
|
|
|
//color other team points
|
|
var tradeProjSel = $("td[name='tradeProjSel']");
|
|
var actualProj = $("[name='actualProj']");
|
|
var cat = $("[name='cat']");
|
|
z = 0;
|
|
for (x=0;x<$(tradeProjSel).size();x++){
|
|
if(z==$(cat).size()){z=0;}
|
|
if($(cat).eq(z).text() == "RK-P"){
|
|
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text()));
|
|
if(n>0){
|
|
$(tradeProjSel).eq(x).addClass("positive");
|
|
$(tradeProjSel).eq(x-1).addClass("positive");
|
|
}else if(n==0){
|
|
$(tradeProjSel).eq(x).addClass("neutral");
|
|
$(tradeProjSel).eq(x-1).addClass("neutral");
|
|
}else{
|
|
$(tradeProjSel).eq(x).addClass("negative");
|
|
$(tradeProjSel).eq(x-1).addClass("negative");
|
|
}
|
|
}
|
|
if(z >= ln){
|
|
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text()));
|
|
if(n>0){
|
|
$(tradeProjSel).eq(x).addClass("positive");
|
|
}else if(n==0){
|
|
$(tradeProjSel).eq(x).addClass("neutral");
|
|
}else{
|
|
$(tradeProjSel).eq(x).addClass("negative");
|
|
}
|
|
}
|
|
z+=1;
|
|
}
|
|
|
|
var actual = $(actualProj).eq(1).text();
|
|
var potPTScell = $("[name='potPTScell']");
|
|
var potRKcell = $("[name='potRKcell']");
|
|
z = 0;
|
|
$(potPTScell).each (function() {
|
|
var n = ""+(parseFloat($(this).text()) - parseFloat(actual));
|
|
if(n>0){
|
|
$(this).addClass("positive");
|
|
$(potRKcell).eq(z).addClass("positive");
|
|
}else if(n==0){
|
|
$(this).addClass("neutral");
|
|
$(potRKcell).eq(z).addClass("neutral");
|
|
}else{
|
|
$(this).addClass("negative");
|
|
$(potRKcell).eq(z).addClass("negative")
|
|
}
|
|
z+=1;
|
|
});
|
|
|
|
//var player = $("[name='player']");
|
|
//callfilterResults($(player).eq(0).text());
|
|
|
|
// var potRK = '${potRKJson}';
|
|
// var potRKJson = JSON.parse(potRK);
|
|
// var potRKcell = $("[name='potRKcell']");
|
|
// x=0;
|
|
// $(potRKcell).each(function(col) {
|
|
// $(this).text(potRKJson[x]);
|
|
// x+=1;
|
|
// });
|
|
|
|
// var potPts = '${potPtsJson}';
|
|
// var potPtsJson = JSON.parse(potPts);
|
|
// var potPTScell = $("[name='potPTScell']");
|
|
// var x=0;
|
|
// $(potPTScell).each(function(col) {
|
|
// $(this).text(potPtsJson[x]);
|
|
// x+=1;
|
|
// });
|
|
/* var actualProj = $("[name='actualProj']");
|
|
var actual = $(actualProj).eq(1).text();
|
|
// Declare variables
|
|
var input, filter, table, tr, td,td2, i;
|
|
|
|
table = document.getElementById("tableList");
|
|
tr = $("[name='lignesPlayer']");
|
|
// Loop through all table rows, and hide those who don't match the search query
|
|
for (i = 0; i < tr.length; i++) {
|
|
td = tr[i].getElementsByTagName("td")[3];
|
|
if (td) {
|
|
if (td.innerHTML > actual) {
|
|
tr[i].classList.remove('normal');
|
|
tr[i].classList.add("freeAgentGreen");
|
|
} else if (td.innerHTML == actual) {
|
|
tr[i].classList.remove('normal');
|
|
tr[i].classList.add("freeAgentOrange");
|
|
} else if (td.innerHTML < actual) {
|
|
tr[i].classList.remove('normal');
|
|
tr[i].classList.add("freeAgentRed");
|
|
}
|
|
}
|
|
}
|
|
|
|
table = document.getElementById("tTrade");
|
|
tr = $("[name='lignesResults']");
|
|
// Loop through all table rows, and hide those who don't match the search query
|
|
for (i = 0; i < tr.length; i++) {
|
|
td = tr[i].getElementsByTagName("td")[3];
|
|
td2 = tr[i].getElementsByTagName("td")[0];
|
|
if (td) {
|
|
if (td2.innerHTML.indexOf("*") > -1) {
|
|
tr[i].classList.remove('tab');
|
|
tr[i].classList.add("freeAgentInjured");
|
|
} else if (td.innerHTML > actual) {
|
|
tr[i].classList.remove('tab');
|
|
tr[i].classList.add("freeAgentGreen");
|
|
} else if (td.innerHTML == actual) {
|
|
tr[i].classList.remove('tab');
|
|
tr[i].classList.add("freeAgentOrange");
|
|
} else if (td.innerHTML < actual) {
|
|
tr[i].classList.remove('tab');
|
|
tr[i].classList.add("freeAgentRed");
|
|
}
|
|
}
|
|
} */
|
|
|
|
|
|
|
|
|
|
|
|
var sort = $("[title='filter']");
|
|
$(sort).each(function(col) {
|
|
$(this).hover(
|
|
function() { $(this).addClass('focus'); },
|
|
function() { $(this).removeClass('focus'); }
|
|
);
|
|
|
|
if($(this).text()=="RK-P"){
|
|
$(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).text().replace("+","").toUpperCase();
|
|
var val2 = $(b).children('td').eq(col).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(3)').append(row);
|
|
});
|
|
});
|
|
});
|
|
|
|
$("#everything-wrapper").fadeIn("fast");
|
|
});
|
|
//});
|
|
|
|
|
|
|
|
function filterName(){
|
|
// Declare variables
|
|
var input, filter, table, tr, td, i;
|
|
input = document.getElementById("myInput");
|
|
filter = input.value.toUpperCase();
|
|
table = document.getElementById("tTrade");
|
|
tr = $("[name='lignesResults']");
|
|
|
|
// Loop through all table rows, and hide those who don't match the search query
|
|
for (i = 0; i < tr.length; i++) {
|
|
td = tr[i].getElementsByTagName("td")[0];
|
|
if (td) {
|
|
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
|
|
tr[i].style.display = "";
|
|
} else {
|
|
tr[i].style.display = "none";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function filterResults(Search)
|
|
{
|
|
// Declare variables
|
|
var input, filter, table, tr, td, i;
|
|
table = document.getElementById("tTrade");
|
|
tr = $("[name='lignesResults']");
|
|
|
|
// Loop through all table rows, and hide those who don't match the search query
|
|
for (i = 0; i < tr.length; i++) {
|
|
td = tr[i].getElementsByTagName("td")[0];
|
|
if (td) {
|
|
if (td.innerHTML.toUpperCase().indexOf(Search) > -1) {
|
|
tr[i].style.display = "";
|
|
} else {
|
|
tr[i].style.display = "none";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function callfilterResults(Elem) {
|
|
|
|
var player = $("[name='player']");
|
|
|
|
$.ajax(
|
|
{
|
|
url:'teamServlet',
|
|
type:'post',
|
|
data: {teamId:'${team1.code}', playerId: $(Elem).index() , action: 'faDiv'},
|
|
success:function(response)
|
|
{
|
|
$("#fa_div").html(response);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
|
|
function listDiff(Elem)
|
|
{
|
|
var drop = '${player.nom}';
|
|
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);
|
|
$(tradePlayers).eq(0).text($(get).eq(0).text());
|
|
|
|
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);
|
|
changeStyle(diff,n);
|
|
}else if($(cat).eq(x).text().includes('TO')){
|
|
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()));
|
|
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text()));
|
|
if(n>0){
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("positive neutral").addClass("negative");
|
|
}else if(n==0){
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("positive negative").addClass("neutral");
|
|
}else{
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("negative neutral").addClass("positive");
|
|
}
|
|
}else{
|
|
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()));
|
|
//inverse diff si col RK
|
|
if($(cat).eq(x).text() == 'Pot RK'){
|
|
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text()));
|
|
changeStyle(diff,n);
|
|
}else{
|
|
var n = parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text());
|
|
changeStyle(diff,n);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function changeStyle(diff,n)
|
|
{
|
|
if(n>0){
|
|
$(diff).eq(x).text("+" + n);
|
|
$(diff).eq(x).removeClass("negative neutral").addClass("positive");
|
|
}else if(n==0){
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("positive negative").addClass("neutral");
|
|
}else{
|
|
$(diff).eq(x).text(n);
|
|
$(diff).eq(x).removeClass("positive neutral").addClass("negative");
|
|
}
|
|
}
|
|
|
|
function makeTableScroll() {
|
|
|
|
var maxRows = 25;
|
|
var tablebody = document.getElementById('tTrade');
|
|
var rowsInTable = tablebody.rows.length;
|
|
var height = 0;
|
|
if (rowsInTable > maxRows) {
|
|
for (var i = 0; i < maxRows; i++) {
|
|
height += tablebody.rows[i].clientHeight;
|
|
}
|
|
tablebody.style.height = height + "px";
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</head>
|
|
<body onload="makeTableScroll()">
|
|
|
|
<c:set var="players" value="${requestScope.playerList}" />
|
|
<c:set var="teamID" value="${requestScope.teamID}" />
|
|
|
|
<c:set var="mainFA" value="${requestScope.mainFA}" />
|
|
<c:set var="stats" value="${requestScope.statBase}" />
|
|
<c:set var="team1" value="${requestScope.team1}" />
|
|
<c:set var="team1Stats" value="${requestScope.team1Stats}" />
|
|
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" />
|
|
<c:set var="nbTeam" value="${requestScope.nbTeam}" />
|
|
|
|
<h1 align='center'>Find Free Agents</h1>
|
|
|
|
<!-- <div style="width: 100%;text-align: center;">
|
|
<input type="submit" value="test fa" onclick="listFA();"/>
|
|
</div> -->
|
|
|
|
|
|
<div id="everything-wrapper" style="width: 100%;text-align: center;">
|
|
|
|
<div style="display: inline-block;vertical-align:top;width:275px;" >
|
|
|
|
<table class="tableTrade">
|
|
<thead>
|
|
<tr class="Header">
|
|
<th colspan="2" ><c:out value="TEAM" /></th>
|
|
<th name="actualRK"><c:out value="Proj RK" /></th>
|
|
<th name="actualPTS"><c:out value="Proj PTS" /></th>
|
|
</tr>
|
|
</thead>
|
|
<tr class="ligneHead">
|
|
<th colspan="2"><c:out value="${team1.name}" /></th>
|
|
<th name="actualRK"><fmt:formatNumber pattern="0.#" value="${team1.projRK}" /></th>
|
|
<th name="actualPTS"><fmt:formatNumber pattern="0.#" value="${team1.projTot}" /></th>
|
|
</tr>
|
|
|
|
<thead>
|
|
<tr class="Header">
|
|
<th><c:out value="Player RK" /></th>
|
|
<th align="left"><c:out value="Player" /></th>
|
|
<th ><c:out value="Pot RK" /></th>
|
|
<th ><c:out value="Pot PTS" /></th>
|
|
</tr>
|
|
|
|
</thead>
|
|
<tbody >
|
|
<c:forEach var="player" items= "${players}" varStatus="i">
|
|
<tr name="lignesPlayer" class="tab" id="${i.index}" onclick="return callfilterResults(this);">
|
|
<td align="center"><fmt:formatNumber pattern="0.#" value="${player.interRK}" /></td>
|
|
<td align="left" name ="player"><c:out value="${player.nom}" /></td>
|
|
<td name="potRKcell" ><fmt:formatNumber pattern="0.#" value="${player.potRK}" /></td>
|
|
<td name="potPTScell" ><fmt:formatNumber pattern="0.#" value="${player.potPoint}" /></td>
|
|
</tr>
|
|
</c:forEach>
|
|
</tbody>
|
|
</table>
|
|
|
|
<input type="text" id="myInput" onkeyup="filterName()" placeholder="Search for names..">
|
|
|
|
</div>
|
|
|
|
<div id="fa_div" style="display: inline-block;vertical-align:top">
|
|
|
|
<table class="tableTrade">
|
|
<thead >
|
|
<!---------------------- TAB HEADER------------------------------->
|
|
<tr class="Header" >
|
|
<th name="statTab" colspan="${fn:length(team1Stats)+1}"><c:out value="Waiver impact" /></th>
|
|
<th name="teamTab" colspan="${nbTeam - 1}"><c:out value="Impact on other teams" /></th>
|
|
</tr>
|
|
<!----------------------------------------- STATS CAT ---------------->
|
|
<tr name="headers" class="Header" >
|
|
<th align="left" ><c:out value="Drop" /></th>
|
|
<th ><c:out value="Pot RK" /></th>
|
|
<c:forEach var="stat" items= "${stats}" >
|
|
<c:if test="${!fn:contains(stat.name,'/')}">
|
|
<th ><c:out value="${fn:replace(stat.name,'Team ','')}" /></th>
|
|
</c:if>
|
|
</c:forEach>
|
|
</tr>
|
|
</thead>
|
|
<!------------------------------- LIGNE ACTUAL STATS PROJECTION-->
|
|
<tbody >
|
|
<tr name="headers" class="ligneHead" >
|
|
<c:forEach var="stat" items= "${team1Stats}" varStatus="i">
|
|
<c:if test="${i.first}">
|
|
<th name="actualPlayers">Actual Projection</th>
|
|
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th>
|
|
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th>
|
|
</c:if>
|
|
<c:if test="${!fn:contains(stat.name,'/')}">
|
|
<th name="actualProj"><c:out value="${stat.valProjection}" /></th>
|
|
</c:if>
|
|
</c:forEach>
|
|
|
|
<c:forEach var="stat" items= "${otherTeamStats}" >
|
|
<th name="actualProj"><c:out value="${stat}" /></th>
|
|
</c:forEach>
|
|
</tr>
|
|
|
|
<!-- LIGNE WITH FA STATS PROJECTION-->
|
|
<tr name="headers" class="ligneHead" >
|
|
<c:forEach var="stat" items= "${stats}" varStatus="i">
|
|
<c:if test="${stat.name == 'RK-P'}">
|
|
<th name="tradePlayers" >Proj with FA</th>
|
|
<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:forEach>
|
|
</tr>
|
|
|
|
<!------------- LIGNE DIFFERENCES ----->
|
|
<tr name="headers" class="ligneHead" >
|
|
<c:forEach var="stat" items= "${stats}" varStatus="i">
|
|
<c:if test="${stat.name == 'RK-P'}">
|
|
<th >Difference</th>
|
|
<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:forEach>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
<thead >
|
|
<!----------------------------------------- STATS CAT ---------------->
|
|
<tr name="headers" class="Header" >
|
|
<th align="left" title="filter"><c:out value="Waiver" /></th>
|
|
<th name="cat" title="filter"><c:out value="Pot RK" /></th>
|
|
<c:forEach var="stat" items= "${stats}" >
|
|
<c:if test="${!fn:contains(stat.name,'/')}">
|
|
<th name="cat" title="filter"><c:out value="${fn:replace(stat.name,'Team ','')}" /></th>
|
|
</c:if>
|
|
</c:forEach>
|
|
</tr>
|
|
</thead>
|
|
<!------------------------ START RESULT TAB-------------------------------->
|
|
|
|
<tbody id="tTrade" style="overflow-y: scroll;overflow-x: hidden;" >
|
|
<c:forEach var="fa" items= "${mainFA}" >
|
|
|
|
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);">
|
|
|
|
<c:forEach var="stat" items= "${fa}" varStatus="i" >
|
|
|
|
<c:if test="${i.first}">
|
|
<td align="left" name="get"><c:out value="${stat.player}" /></td>
|
|
<td name="tradeProjSel"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td>
|
|
</c:if>
|
|
<c:if test="${!fn:contains(stat.name,'/')}">
|
|
<c:if test="${!fn:contains(stat.name,'%')}">
|
|
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.valProjection}" /></td>
|
|
</c:if>
|
|
<c:if test="${fn:contains(stat.name,'%')}">
|
|
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.00" value="${stat.valProjection}" /></td>
|
|
</c:if>
|
|
</c:if>
|
|
|
|
</c:forEach>
|
|
|
|
</tr>
|
|
|
|
</c:forEach>
|
|
</tbody>
|
|
</table>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|
|
|