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():
.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)
.options(joinedload(db.UserRole.place))
.order_by(db.Round.level, db.Round.category, db.Round.seq, db.Round.part,
db.Contest.place_id, db.Contest.contest_id, db.Place.place_id)
.order_by(db.Place.place_id, db.Round.level, db.Round.category, db.Round.seq, db.Round.part, db.Contest.contest_id)
.all())
overview: List[OrgOverview] = []
......
......@@ -6,21 +6,56 @@
{% if overview %}
<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 %}
{% if curr.level != o.round.level %}
<thead><tr>
<th>Kategorie
<th>Kolo
<th>{{ o.round.get_level().name|capitalize }}
<th>Zadání
<th>Stav
<th>Soutěžící
<th>Moje role
<th>Odkazy
{% if curr.place_id != o.place.place_id %}
<li class="tab">
<label for="tab{{ o.place.place_id }}" style="font-size: 2rem">
{% if o.place.level == 2 %}Okres{% endif %}
{{ o.place.name }}
</label>
{% set curr.place_id = o.place.place_id %}
{% endif %}
{% endfor %}
</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>
{% set curr.level = o.round.level %}
{% set curr.place_id = o.place.place_id %}
{% endif %}
{% if o.contest %}
......@@ -49,24 +84,19 @@
{% endif %}
{% endif %}>
<td class="text-center"><b>{{ o.round.category }}</b>
<td>{{ o.round.name }}
{% if o.contest or o.round.level == o.place.level %}
<td>{{ o.place.name }}
{% else %}
<td><i>{{ o.place.name_locative() }}</i>
{% endif %}
<td>
<td>{% for s in o.contest_states %}{% if not loop.first %}<br>{% endif %}<span>{{ s.friendly_name() }}</span>{% endfor %}
<td class="hidden-xs">
{% set can, reason = o.rights.offer_view_statement() %}
{% if can %}
<a href='{{ url_for('org_task_statement', round_id=o.round.round_id) }}'>stáhnout</a>
{% else %}
{{ reason }}
{% endif %}
<td>{% for s in o.contest_states %}{% if not loop.first %}<br>{% endif %}<span>{{ s.friendly_name() }}</span>{% endfor %}
<td><!--{% if not o.contest %}{{ o.num_contests }}S / {% endif %}-->
<td class="hidden-xs"><!--{% if not o.contest %}{{ o.num_contests }}S / {% endif %}-->
{{- 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 %}
<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>
{% if o.contest or o.round.level > o.place.level %}
<a class="btn btn-xs btn-primary" href='{{ detail_url }}'>Detail</a>
......@@ -104,6 +134,7 @@
</tr>
{% endfor %}
</table>
</div>
{% else %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment