Skip to content
Snippets Groups Projects
Commit d74095ac authored by Jan Prachař's avatar Jan Prachař
Browse files

org_index: Záložky pro jednotlivé soutěžní oblasti

parent 4f9cfb47
No related branches found
No related tags found
No related merge requests found
...@@ -78,8 +78,7 @@ def org_index(): ...@@ -78,8 +78,7 @@ def org_index():
.outerjoin(db.Contest, and_(db.Contest.round_id == db.Round.round_id, db.Contest.place_id == db.UserRole.place_id)) .outerjoin(db.Contest, and_(db.Contest.round_id == db.Round.round_id, db.Contest.place_id == db.UserRole.place_id))
.filter(db.Round.year == config.CURRENT_YEAR) .filter(db.Round.year == config.CURRENT_YEAR)
.options(joinedload(db.UserRole.place)) .options(joinedload(db.UserRole.place))
.order_by(db.Round.level, db.Round.category, db.Round.seq, db.Round.part, .order_by(db.Place.place_id, db.Round.level, db.Round.category, db.Round.seq, db.Round.part, db.Contest.contest_id)
db.Contest.place_id, db.Contest.contest_id, db.Place.place_id)
.all()) .all())
overview: List[OrgOverview] = [] overview: List[OrgOverview] = []
... ...
......
...@@ -6,21 +6,56 @@ ...@@ -6,21 +6,56 @@
{% if overview %} {% if overview %}
<h3>Moje soutěže</h3> <h3>Moje soutěže</h3>
<table class="table table-bordered table-hover">
{% set curr = namespace(level=-1) %} <div class="tabbed">
{% set curr = namespace(place_id=-1) %}
{% for o in overview %}
{% if curr.place_id != o.place.place_id %}
<input type="radio" id="tab{{ o.place.place_id }}" name="css-tabs"{% if curr.place_id == -1 %} checked{% endif %}>
{% set curr.place_id = o.place.place_id %}
{% endif %}
{% endfor %}
<ul class="tabs">
{% set curr = namespace(place_id=-1) %}
{% for o in overview %} {% for o in overview %}
{% if curr.level != o.round.level %} {% if curr.place_id != o.place.place_id %}
<thead><tr> <li class="tab">
<th>Kategorie <label for="tab{{ o.place.place_id }}" style="font-size: 2rem">
<th>Kolo {% if o.place.level == 2 %}Okres{% endif %}
<th>{{ o.round.get_level().name|capitalize }} {{ o.place.name }}
<th>Zadání </label>
<th>Stav {% set curr.place_id = o.place.place_id %}
<th>Soutěžící {% endif %}
<th>Moje role {% endfor %}
<th>Odkazy </ul>
{% set curr = namespace(place_id=-1, level=-1) %}
{% for o in overview %}
{% if curr.place_id != o.place.place_id %}
{% if curr.place_id != -1 %}
</table>
</div>
{% endif %}
<div class="tab-content">
<table class="table table-bordered table-hover" style="border-left: none; border-right: none; margin-bottom: 0px">
{% endif %}
{% if curr.level != o.round.level or curr.place_id != o.place.place_id %}
<thead>
{% if curr.place_id == o.place.place_id %}
<tr>
<td colspan="6" style="background-color: #fff; border-left-width: 0px; border-right-width: 0px; height: 3rem">
{% endif %}
<tr>
<th colspan="2">{{ o.round.name }}</h4>
<th class="hidden-xs">Zadání
<th class="hidden-xs">Soutěžící
<th class="hidden-xs">Moje role
<th>
</thead> </thead>
{% set curr.level = o.round.level %} {% set curr.level = o.round.level %}
{% set curr.place_id = o.place.place_id %}
{% endif %} {% endif %}
{% if o.contest %} {% if o.contest %}
...@@ -49,24 +84,19 @@ ...@@ -49,24 +84,19 @@
{% endif %} {% endif %}
{% endif %}> {% endif %}>
<td class="text-center"><b>{{ o.round.category }}</b> <td class="text-center"><b>{{ o.round.category }}</b>
<td>{{ o.round.name }} <td>{% for s in o.contest_states %}{% if not loop.first %}<br>{% endif %}<span>{{ s.friendly_name() }}</span>{% endfor %}
{% if o.contest or o.round.level == o.place.level %} <td class="hidden-xs">
<td>{{ o.place.name }}
{% else %}
<td><i>{{ o.place.name_locative() }}</i>
{% endif %}
<td>
{% set can, reason = o.rights.offer_view_statement() %} {% set can, reason = o.rights.offer_view_statement() %}
{% if can %} {% if can %}
<a href='{{ url_for('org_task_statement', round_id=o.round.round_id) }}'>stáhnout</a> <a href='{{ url_for('org_task_statement', round_id=o.round.round_id) }}'>stáhnout</a>
{% else %} {% else %}
{{ reason }} {{ reason }}
{% endif %} {% endif %}
<td>{% for s in o.contest_states %}{% if not loop.first %}<br>{% endif %}<span>{{ s.friendly_name() }}</span>{% endfor %} <td class="hidden-xs"><!--{% if not o.contest %}{{ o.num_contests }}S / {% endif %}-->
<td><!--{% if not o.contest %}{{ o.num_contests }}S / {% endif %}-->
{{- o.num_active_pants }} {{- o.num_active_pants }}
{%- if o.num_unconfirmed_pants %}<br><span class="text-danger text-nowrap">+{{ o.num_unconfirmed_pants|inflected('přihlášený', 'přihlášení', 'přihlášených') }}</span>{% endif %} {%- if o.num_unconfirmed_pants %}<br><span class="text-danger text-nowrap">+{{ o.num_unconfirmed_pants|inflected('přihlášený', 'přihlášení', 'přihlášených') }}</span>{% endif %}
<td>{% for r in o.role_list %}{{ role_type_names[r] }}{% if not loop.last %}<br>{% endif %}{% endfor %} <td>{% for r in o.role_list %}{{ role_type_names[r] }}{% if not loop.last %}<br>{% endif %}{% endfor %}
<td class="hidden-xs">{% for r in o.role_list %}{{ role_type_names[r] }}{% if not loop.last %}<br>{% endif %}{% endfor %}
<td> <td>
{% if o.contest or o.round.level > o.place.level %} {% if o.contest or o.round.level > o.place.level %}
<a class="btn btn-xs btn-primary" href='{{ detail_url }}'>Detail</a> <a class="btn btn-xs btn-primary" href='{{ detail_url }}'>Detail</a>
...@@ -104,6 +134,7 @@ ...@@ -104,6 +134,7 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div>
{% else %} {% else %}
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment