{% extends "base.html" %}

{% load neapolitan %}
{% load partials %}
{% load render_table from django_tables2 %}

{% block content %}
  <div class="sm:flex sm:items-center">
    <h1 class="text-base font-semibold leading-6 text-gray-900 sm:flex-auto">{{ object_verbose_name_plural|capfirst }}</h1>
    <div class="mt-4 sm:flex-none sm:mt-0 sm:ml-16">
      <a class="block py-2 px-3 text-sm font-semibold text-center text-white bg-indigo-600 rounded-md shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
         href="{{ create_view_url }}">Add a new {{ object_verbose_name }}</a>
    </div>
  </div>

  {% partialdef object-list inline=True %}
    {% if object_list %}
      {% if table %}
        {% render_table table %}
      {% else %}
        {% object_list object_list view %}
      {% endif %}
    {% else %}
      <p class="mt-8">There are no {{ object_verbose_name_plural }}. Create one now?</p>
    {% endif %}
  {% endpartialdef %}

  <hr>
{% endblock content %}
