{% extends "base.html" %}

{% block title %}myTBA Event {{event.name}} - The Blue Alliance{% endblock %}

{% block meta_description %}Manage your favorites and subscriptions{% endblock %}

{% block content %}
<div class="container">
  <div class="row">
    <div class="col-md-8 col-md-offset-2">
      <ol class="breadcrumb">
        <li><a href="{{ url_for('account.overview') }}">Account Overview</a></li>
        <li><a href="/account/mytba#my-events">Manage myTBA</a></li>
        <li class="active">Event: {{event.name}}</li>
      </ol>

      <h1>myTBA Event: {{event.name}}</h1>
      <p>
        Favorite this event for personalized content and quick access to it later.<br>
        {% include "mytba_partials/mytba_push.html" %}
      </p>

      {% if is_wildcard %}
      <h2 class="bg-danger">
        WARNING!<br>
        You are about to subscribe to notifications for all events in {{event.year}}.
        This is only advised if you are on a developer account and want to receive
        push notifications via webhooks for all events.
      </h2>
      {% endif %}

      <form method="post">
        <input name="action" type="hidden" value="subscription_year_add" />
        <input name="account_id" type="hidden" value="{{ user.uid }}" />
        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>

        <table class="table">
          {% if not is_wildcard %}
          <tr>
            <td>Favorite:</td>
            <td>
              <ul style="list-style-type: none;">
                <li><input type="checkbox" name="favorite"{% if is_favorite %} checked{% endif %}/></li>
              </ul>
            </td>
          </tr>
          {% endif %}
          <tr>
            <td>Subscriptions:</td>
            <td>
              <ul style="list-style-type: none;">
                {% for notif_type_enum, name in enabled_notifications %}
                  <li><input type="checkbox" name="notification_types" value="{{notif_type_enum}}"{% if notif_type_enum in subscription.notification_types %} checked{% endif %}/> {{ name }}</li>
                {% endfor %}
              </ul>
            </td>
          </tr>
        </table>
        <td><button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-thumbs-up"></span> Save</button></td>
        <a href="/account/mytba#my-events" class="btn btn-default"><span class="glyphicon glyphicon-thumbs-down"></span> Cancel</a>
      </form>

    </div>
  </div>
</div>
{% endblock %}
