{% extends "base.html" %}
{% block title %}Weekends - Edward Betts{% endblock %}

{% block content %}
<div class="p-2">

  <h1>Weekends</h1>
  <table class="table table-hover w-auto">
    <thead>
      <tr>
        <th class="text-end">Week</th>
        <th class="text-end">Date</th>
        <th>Saturday</th>
        <th>Sunday</th>
      </tr>
    </thead>
    <tbody>

  {% for weekend in items %}
  <tr>
    <td class="text-end">
        {{ weekend.date.isocalendar().week }}
    </td>
    <td class="text-end text-nowrap">
        {{ weekend.date.strftime("%-d %b %Y") }}
    </td>
    {% for day in "saturday", "sunday" %}
      <td>
        {% if weekend[day] %}
          {% for event in weekend[day] %}
            <a href="{{ event.url }}">{{ event.title }}</a>{% if not loop.last %},{%endif %}
          {% endfor %}
        {% else %}
          <strong>free</strong>
        {% endif %}
      </td>
    {% endfor %}
    </tr>
  {% endfor %}
    </tbody>
  </table>
</div>

{% endblock %}