{% extends 'buybackprogram/page.html' %}
{% load i18n %}
{% load humanize %}
{% load django_bootstrap5 %}
{% load static %}

{% block body %}
<div class="card">
  <div class="card-body">
      <form class="form" action="{% url 'buybackprogram:location_add' %}" method="POST">
        {% csrf_token %}
        {% bootstrap_form form %}
        <button type="submit" class="btn btn-primary">{% trans "Add location" %}</button>
      </form>
      <table id="locations" style="margin: 20px auto;" class="table table-striped table-condensed">
      <thead>
        <th>{% trans "Solar System" %}</th>
        <th style="text-align: center;">{% trans "Name" %}</th>
        <th style="text-align: center;">{% trans "Structure ID" %}</th>
      </thead>
      <tbody>
        {% for location in locations %}
          {% if location.owner.user == request.user %}
            <tr>
              <td>{{location.eve_solar_system.name}}</td>
              <td style="text-align: center;">{{location.name}}</td>
              <td style="text-align: center;">{{location.structure_id}}</td>
              <td><a class="btn btn-sm btn-danger" href="{% url 'buybackprogram:location_remove' location_pk=location.id %}">{% trans "Delete" %}</a></td>
            </tr>
          {% endif %}
        {% endfor %}
      </tbody>
    </table>
  </div>
</div>
{% endblock %}

{% block extra_javascript %}
<script type="text/javascript" src="{% static 'buybackprogram/js/bootstrap-autocomplete.min.js' %}"></script>
<script type="text/javascript" src="{% static 'buybackprogram/js/autocomplete.js' %}"></script>
{% endblock %}

{% block extra_css %}
{% include "buybackprogram/bundles/buybackprogram-css-light.html" %}
{% endblock %}

{% block extra_script %}
{% endblock %}
