kinda stuck trying to harmonize bench and lineup
This commit is contained in:
@@ -7,14 +7,10 @@
|
||||
{{ event.venue.name }} <br>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<form action="{% url 'edit lineup' event_id=event.id%}" method="post">
|
||||
|
||||
<div class="col-md-6">
|
||||
<h5>Lineup</h5>
|
||||
{# <ul class="list-group">#}
|
||||
<form action="{% url 'edit lineup' event_id=event.id%}" method="post">
|
||||
|
||||
{% csrf_token %}
|
||||
{{ positionings_formset.management_form }}
|
||||
{# {% for pos in positionings_formset %}#}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -24,20 +20,21 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="lineup">
|
||||
{% for player in positionings_players_initial|dictsort:"positioning.order" %}
|
||||
{% if player.positioning %}
|
||||
{#{% for player in positionings_players_initial|dictsort:"positioning.order" %}#}
|
||||
{% csrf_token %}
|
||||
{{ formset_starting.management_form }}
|
||||
{% for form in formset_starting %}
|
||||
<tr data-player-id="{{ player.id }}",
|
||||
data-positioning-position="{{ player.positioning.position }}"
|
||||
data-positioning-position="{{ form.instance.player.positioning.position }}"
|
||||
>
|
||||
{# <th scope="row">{{ form.order }}</th>#}
|
||||
{# <td>{{ form.player }}</td>#}
|
||||
{# <td>{{ form.position }}</td>#}
|
||||
<th scope="row">{% if player.positioning.order %}{{ player.positioning.order }}{% endif %}</th>
|
||||
<th>{{ player.first_name }} {{ player.last_name }}</th>
|
||||
<td>{{ player.positioning.position }}</td>
|
||||
<th scope="row">{% if form.instance.order %}{{ form.instance.order }}{% endif %}</th>
|
||||
<th>{{ form.instance.player.first_name }} {{ form.instance.player.last_name }}</th>
|
||||
<td>{{ form.instance.position }}</td>
|
||||
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -57,23 +54,23 @@
|
||||
<th scope="col">Statline</th>
|
||||
</tr>
|
||||
<tbody id="bench">
|
||||
{% for player in players %}
|
||||
{% if not player.positioning %}
|
||||
<tr data-player-id="{{ player.id }}">
|
||||
{% for form in formset_bench %}
|
||||
{% if not player.positioning.order and not player.positioning.position == "P" %}
|
||||
<tr data-player-id="{{ pos.player.id }}">
|
||||
<td>
|
||||
{% if player.availability.available == 2 %}
|
||||
{% if pos.player.availability.available == 2 %}
|
||||
<img class="bg-success p-2 rounded-circle" width="5" height="5"><span class="visually-hidden">Yes</span></img>
|
||||
{% elif player.availability.available == 1%}
|
||||
{% elif pos.player.availability.available == 1%}
|
||||
<img class="bg-info p-2 rounded-circle" width="5" height="5"><span class="visually-hidden">Maybe</span></span>
|
||||
{% elif player.availability.available == 0%}
|
||||
{% elif pos.player.availability.available == 0%}
|
||||
<img class="bg-danger p-2 rounded-circle" width="5" height="5"><span class="visually-hidden">No</span></span>
|
||||
{% elif player.availability.available == -1%}
|
||||
{% elif pos.player.availability.available == -1%}
|
||||
<img class="bg-secondary p-2 rounded-circle" width="5" height="5"><span class="visually-hidden">Unknown</span></span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<th><span class="d-none d-md-block" id="player-name-{{ player.id }}">{{ player.first_name }}</span> {{ player.last_name }}</th>
|
||||
<td id="player-jersey-number-{{ player.id }}">{{ player.jersey_number }} </td>
|
||||
<td id="player-statline-{{ player.id }}"><code>{{ player.statline}}</code></td>
|
||||
<th><span class="d-none d-md-block" id="player-name-{{ form.instance.player.id }}">{{ form.instance.player.first_name }}</span> {{ form.instance.player.last_name }}</th>
|
||||
<td id="player-jersey-number-{{ form.instance.player.id }}">{{ form.instance.player.jersey_number }} </td>
|
||||
<td id="player-statline-{{ form.instance.player.player.id }}"><code>{{ form.instance.player.statline}}</code></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user