{% extends "frontend/base.html" %}
{% load i18n static %}
{% block html_title %}
    {% block page_title %}
        {% translate "Instances" %}
    {% endblock page_title %}
{% endblock html_title %}
{% block content %}
    <section class="section">
        <div class="card">
            <div class="card-content">
                <div class="card-body">
                    <form class="search-form" auto-submit>
                        {{ filter_form }}
                    </form>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="card-content">
                <div class="card-body">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <th>{% translate "Name" %}</th>
                                <th>{% translate "Instance ID" %}</th>
                                <th>{% translate "Service" %}</th>
                                <th>{% translate "Service Provider" %}</th>
                                <th>{% translate "Service Provider Zone" %}</th>
                                <th>{% translate "Created At" %}</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for instance in instances %}
                                <tr>
                                    <td>
                                        <a href="{{ instance.urls.base }}">{{ instance.display_name }}</a>
                                    </td>
                                    <td>
                                        <code>{{ instance.name }}</code>
                                    </td>
                                    <td>{{ instance.context.service_definition.service.name }}</td>
                                    <td>{{ instance.context.service_offering.provider.name }}</td>
                                    <td>{{ instance.context.control_plane.name }}</td>
                                    <td>{{ instance.created_at|date:"SHORT_DATETIME_FORMAT" }}</td>
                                </tr>
                            {% empty %}
                                <tr>
                                    <td colspan="6">{% translate "No service instances found." %}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </section>
    <script src="{% static "js/autosubmit.js" %}" defer></script>
{% endblock %}
