{% extends "base.html" %} {% from "macros.html" import modal_editor, modal_editor_open, format_session %} {% block title %}PySkat - Matches{% endblock %} {% block head %}{% endblock %} {% macro player_display(player) %} {{ player.id }} {{ player.name }} {% endmacro %} {% macro player_select(input_id, label, checked=[]) %}
{% for p in players %}
{% endfor %}
{% endmacro %} {% macro session_select(input_id, label, selected=none) %}
{% endmacro %} {% block content %}

Matches{% if filtered_for_session %} for Session {{ session_id }}{% endif %}

{{ modal_editor_open("add-match", "Add New Match", "success") }} {{ modal_editor_open("shuffle-matches", "Shuffle Players to Matches", "primary") }}
{% for m in matches %} {% if m.size > 0 %} {{ player_display(m.players[0]) }} {% else %} {% endif %} {% for p in m.players[1:] %} {{ player_display(p) }} {% endfor %} {% endfor %}
ID Session Player ID Player Name Remarks Actions
{{ m.id }} {{ m.session_id or "" }}{{ m.remarks }}
{{ modal_editor_open("edit-match-{}".format(m.id), "Edit", "warning") }} {{ modal_editor_open("delete-match-{}".format(m.id), "Delete", "danger") }}
{% call modal_editor("add-match", "Add New Match", submit_label="Add", submit_color="success") %} {{ session_select("session", "Session", session_id) }} {{ player_select("players", "Players") }}
{% endcall %} {% call modal_editor("shuffle-matches", "Shuffle Players to Matches", submit_label="Shuffle", submit_color="warning") %} {{ session_select("session", "Session") }}
{{ player_select("include", "Include Players Specifically") }} {{ player_select("exclude", "Exclude Players Specifically") }} {{ player_select("include_only", "Include Only These Players") }}
{% endcall %} {% for m in matches %} {% call modal_editor("edit-match-{}".format(m.id), "Edit Match", "Edit", "warning") %} {{ session_select("session", "Session", m.session_id) }} {{ player_select("players", "Players", m.player_ids) }}
{% endcall %} {% call modal_editor("delete-match-{}".format(m.id), "Delete Match", "Delete", "danger") %} Really delete the match {{- m.name -}} with the ID {{- m.id -}}? {% endcall %} {% endfor %} {% endblock %}