{% extends 'base.html' %}

{% block title %}Custom Locations{% endblock %}

{% block header %}<h1>Show menus for custom location selection</h1>{% endblock %}

{% block content %}

<form class="filter-form" action="{% url 'mensaviewer:custom' %}" method="get">
  <input type="hidden" name="filterform" value="filter">
  <div class="type-filter">
    {% for name, id in types %}
    <label>
      {{ name }}
      <input type="checkbox" name="type" value={{ id }} {% if id in checked_types %} checked{% endif %}>
    </label>
    {% endfor %}
  </div>
  <hr>
  <div class="status-filter">
    {% for status_value in status_values %}
    <label>
      {{ status_value }}
      <input type="radio" name="status" value="{{ status_value }}" {% if status == status_value %} checked{% endif %}>
    </label>
    {% endfor %}
  </div>
  <hr>
  <div class="location-filter">
    {% for location in locations %}
    <label>
      {{ location.name }}
      <input type="checkbox" name="location" value="{{ location.mensa_id }}" {% if location.mensa_id in selected_locations %} checked{% endif %}>
    </label>
    {% endfor %}
  </div>
  <button type="submit">Filter</button>
</form>

<div class="container">
  {% for day, menus in menu_data.items %}
  <div class="column">
    <h2>{{ day }}</h2>

    {% for menu in menus %}
    <div class="menu">
      <p>{{ menu.art }} - <a href="{% url 'mensaviewer:location_detail' menu.location.pk %}">{{ menu.location.name }}</a></p>
      <hr>
      <h4><a href="{% url 'mensaviewer:menu_detail' menu.pk %}">{{ menu.name }}</a></h4>
      <h5>{{ menu.price }}</h5>
      <p>{{ menu.types }}</p>
      <p>{{ menu.allergens }}</p>
      <hr>
      <p>Rating: {{ menu.likes }}</p>
      <p>
        <a href="{% url 'mensaviewer:like' menu.pk %}?next={{ request.path }}">Like</a> |
        <a href="{% url 'mensaviewer:dislike' menu.pk %}?next={{ request.path }}">Dislike</a>
      </p>
    </div>
    {% endfor %}

  </div>
  {% endfor %}
</div>

{% endblock %}