{% load static %}
{% load bloomerp %}
{% load crispy_forms_tags %}

<!--Card title-->
<h5 class="card-title">{{ foreign_model_name | title }} for {{ object }}</h5>
<!--End card title-->

<!--Filter section-->
{% include "snippets/list_view_filter.html" with target="#table_section" application_fields=application_fields content_type_id=foreign_content_type_id include_actions="true" initial_query=initial_query %}
<!--End filter-->

<!--Table-->
<div
    id="table_section"
    hx-get="{% url 'components_data_table' %}?data_table_content_type_id={{ foreign_content_type_id }}&{{ foreign_model_attribute }}={{ object.pk }}&data_table_include_actions=true"
    hx-trigger="load"
    hx-target="#table_section"
    hx-swap="innerHTML"
>
    <img src="{% static 'bloomerp/img/spinner.gif' %}" alt="Loading..." class="htmx-indicator">
</div>
<!--End table-->

<!--Create-->
<div class="d-flex justify-content-center">
    <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#createModal">
        Create {{ foreign_model_name | title }}
    </button>
</div>
<!--End create-->



