<!--written by: Aakash Patel
# tested by: Aakash Patel
# debugged by: Aakash Patel-->

{% extends "base.html" %}

{% block title %}Virtual Stock Market - Dashboard{% endblock %}
{% block dashboardNav %}class="selectMenu"{% endblock %}

{% block content %}

<br /><h2>League Info & Details</h2>
{% if isAdmin %}
<a href="{% url league.views.adminpanel league.id %}">League Admin Panel</a>
{% endif %}
<br />
{% if not hidetable %}
<br />
<a href="{% url league.views.league_ranking league.id %}">League Ranking</a>
<center>
<table border="1">
        <tr>
                <th>League Name</th>
                <th>Start Date</th>
                <th>End Date</th>
                <th>Starting Balance</th>
        </tr>  
                
                        <tr>
                        <td style="text-align:center"> {{league.league_name}} </td>
			 <td style="text-align:center"> {{league.start_date|date:"m-d-Y"}} </td>
			 <td style="text-align:center"> {{league.end_date|date:"m-d-Y"}} </td>
			 <td style="text-align:center"> ${{league.starting_balance}} </td>                   
                        
                      
                        </tr>
</table>

<br />



{% if users %}
<table border="1">
        <thead>
                <th>Username</th>
		<th>Cash Balance</th>
		<th>Current Value</th>
        </thead>  
	{% for LeagueUser in users %}
                        <tr>
                        	<td> {{LeagueUser.user_name}} </td>
				<td> {{LeagueUser.cash_balance}} </td>
				<td> {{LeagueUser.current_value}} </td>
                        </tr>
	{% endfor %}
               
</table>
{% else %}
<span>There are no users in this league.</span>
{% endif %}

{% endif %}


<br>
{% if not showjoin %}
<form action ="{% url league.views.join %}" method = "post">
{% csrf_token %}


<input type ="hidden" name="leagueId" value="{{league.id}} " />

<input type="submit"  value="Join League">

</form>
{% endif %}

{% if privatejoinshow %}
<h4>This is a private league. Enter the password below to join.</h4>
<form action="{% url league.views.join %}" method="post">
{% csrf_token %}

Password: <input type ="text" name="password" value="" /><br />

<input type ="hidden" name="leagueId" value="{{league.id}} " />

<input type="submit"  value="Join League">

</form>
{% endif %}

</center>

{% endblock %}

