{% extends "base.html" %} {% from 'macros/help.html' import help_icon %} {% from 'macros/badges.html' import badge_info %} {% block title %}Akce — MedCover{% endblock %} {# ── Helper macro: generate events.index URL preserving all active filters ── #} {% macro filter_url(page=None, archived=None) %} {{- url_for('events.index', page=page, statuses=active_statuses|join(','), types=active_types|join(',') if active_types|length < all_event_types|length else None, me_id=active_me.id if active_me else None, sort=sort_col if sort_col != 'start' else None, dir=sort_dir if sort_col != 'start' or sort_dir != 'asc' else None, archived=1 if (archived if archived is not none else show_archived) else None, for_me=1 if for_me else None, ) -}} {%- endmacro %} {% block content %}

Akce {{ help_icon("Akce procházejí těmito fázemi:\n• Koncept — vidí jen koordinátoři, nelze se přihlásit\n• Zveřejněná — viditelná, přihlášky zatím uzavřeny\n• Přihlášky otevřeny — členové se mohou přihlašovat (manuálně nebo automaticky dle data otevření)\n• Přihlášky uzavřeny — obsazování uzavřeno, akce probíhá\n• Dokončena — automaticky po skončení akce (scheduler)\n• Zrušena — lze nastavit kdykoli\nFáze Koncept → Zveřejněná a Zveřejněná → Přihlášky otevřeny jsou manuální (nebo automatické dle data). Fáze Dokončena se nastaví automaticky po uplynutí data ukončení.", "Fáze akce") }}

{# View toggle #}
{% if show_archived %} Skrýt archivované {% else %} Zobrazit archivované {% endif %} {% if current_user.has_permission('event.create') %} Nová akce {% if event_templates %} {% endif %} {% endif %}
{# ── Status filter bar ──────────────────────────────────────────────────── #} {# Build a helper macro to toggle a status in/out of the active set #} {% macro status_url(toggle_status) %} {%- set new_statuses = [] -%} {%- if toggle_status in active_statuses -%} {%- set new_statuses = active_statuses | reject('equalto', toggle_status) | list -%} {%- else -%} {%- set new_statuses = active_statuses + [toggle_status] -%} {%- endif -%} {{ url_for('events.index', statuses=new_statuses|join(','), types=active_types|join(',') if active_types|length < all_event_types|length else None, me_id=active_me.id if active_me else None, sort=sort_col if sort_col != 'start' else None, dir=sort_dir if sort_col != 'start' or sort_dir != 'asc' else None, archived=1 if show_archived else None, for_me=1 if for_me else None) }} {%- endmacro %} {# Type filter toggle macro #} {% macro type_url(toggle_type) %} {%- set new_types = [] -%} {%- if toggle_type in active_types -%} {%- set new_types = active_types | reject('equalto', toggle_type) | list -%} {%- else -%} {%- set new_types = active_types + [toggle_type] -%} {%- endif -%} {{ url_for('events.index', types=new_types|join(',') if new_types|length < all_event_types|length else None, statuses=active_statuses|join(','), me_id=active_me.id if active_me else None, sort=sort_col if sort_col != 'start' else None, dir=sort_dir if sort_col != 'start' or sort_dir != 'asc' else None, archived=1 if show_archived else None, for_me=1 if for_me else None) }} {%- endmacro %} {# Sort URL: preserve statuses + types + me_id + archived, toggle sort col/dir #} {% macro sort_url(col) %} {%- set new_dir = 'asc' -%} {%- if sort_col == col -%} {%- set new_dir = 'desc' if sort_dir == 'asc' else 'asc' -%} {%- endif -%} {{ url_for('events.index', sort=col, dir=new_dir, statuses=active_statuses|join(','), types=active_types|join(',') if active_types|length < all_event_types|length else None, me_id=active_me.id if active_me else None, archived=1 if show_archived else None, for_me=1 if for_me else None) }} {%- endmacro %} {% macro sort_icon(col) %} {%- if sort_col == col -%} {{ '↑' if sort_dir == 'asc' else '↓' }} {%- else -%} {%- endif -%} {%- endmacro %}
Stav: {% if has_draft_perm %} Koncept {% endif %} Zveřejněná Přihlášky otevřeny Přihlášky uzavřeny Dokončena Zrušena {% if current_user.has_permission('event.assign_own') %} Pro mě {% endif %} Výchozí
{# ── Event type filter bar ────────────────────────────────────────────────── #}
Typ: Zdravotní dozor Školení Prezentační akce
{# ── Bulk action toolbar (hidden until rows are selected) ───────────────── #} {% if current_user.has_any_permission('event.publish', 'event.assignments.open', 'event.cancel', 'event.edit') %}
{# dynamic hidden event_ids inputs #}
0 vybráno {% if current_user.has_permission('event.publish') %} {% endif %} {% if current_user.has_permission('event.assignments.open') %} {% endif %} {% if current_user.has_permission('event.cancel') %} {% endif %} {% if current_user.has_permission('event.edit') %} {% endif %} {% if current_user.has_permission('report.view') %} {% endif %}
{# Separate form for printout — cannot be nested inside bulk-form #} {% if current_user.has_permission('report.view') %}
{% endif %}
{% endif %} {# ── Table view ─────────────────────────────────────────────────────────── #}
{% if events %}
{% for event in events %} {% set mand_total = event.mandatory_total_spots %} {% set mand_filled = event.mandatory_filled_spots %} {% set opt_total = event.optional_total_spots %} {% set staffing_ratio = (mand_filled / mand_total) if mand_total > 0 else 0 %} {% endfor %}
Název {{ sort_icon('name') }} Začátek {{ sort_icon('start') }} Stav {{ sort_icon('status') }} Obsazení {{ sort_icon('total') }} Zodpovědná
osoba {{ sort_icon('rp') }}
Nadřazená
akce {{ sort_icon('me_name') }}
{{ event.name }}{% if not event.master_event.is_general %} ({{ event.master_event.name }}){% endif %} {% if event.paid %}Placená{% else %}Neplacená{% endif %} {% if event.event_type != EventType.MEDICAL_COVER %} {{ event.event_type.value }} {% endif %} {{ event.start_datetime | localdt("%d.%m.%Y") }}
{{ event.start_datetime | czechday }} {{ event.start_datetime | localdt("%H:%M") }} ({{ event.scheduled_hours | cznum(strip=True) }} h)
{% if event.status == EventStatus.CANCELLED %}{% endif %}{{ event.status.value }}{% if event.status == EventStatus.CANCELLED %}{% endif %} {% if event.status == EventStatus.CANCELLED %}— {% else %} {{ mand_filled }}/{{ mand_total }} {% if opt_total > 0 %} {{ badge_info('+' ~ opt_total ~ '\u00a0vol.', extra_classes='ms-1 font-65') }} {% endif %} {% endif %} {% if event.responsible_person %} {{ event.responsible_person.name }} {% elif event.status.name not in ('DRAFT', 'CANCELLED') %} Chybí {% else %} — {% endif %} {% if not event.master_event.is_general %}{{ event.master_event.name }}{% else %}—{% endif %} {% set eligible_spots = eligible_spot_map.get(event.id) %} {% if eligible_spots %} {% if eligible_spots | length == 1 %}
{% else %} {% endif %} {% endif %}
{# ── Pagination ─────────────────────────────────────────────────────────── #} {% if pagination.pages > 1 %} {% endif %} {% else %}

Žádné akce neodpovídají aktivním filtrům.

{% endif %}
{# ── Modal: pick a spot when multiple eligible ──────────────────────────── #} {# ── Calendar view ──────────────────────────────────────────────────────── #}
{% endblock %} {% block extra_scripts %} {# FullCalendar v6 — bundled locally (no separate CSS; styles are injected by the JS) #} {% endblock %}