{% extends "stock/item_base.html" %}

{% load static %}
{% load i18n %}


{% block menubar %}
{% include "stock/navbar.html" with tab='children' %}
{% endblock %}

{% block heading %}
{% trans "Child Stock Items" %}
{% endblock %}

{% block details %}
{% if item.child_count > 0 %}
{% include "stock_table.html" %}
{% else %}
<div class='alert alert-block alert-info'>
    {% trans "This stock item does not have any child items" %}
</div>
{% endif %}

{% endblock %}

{% block js_ready %}
{{ block.super }}

{% if item.child_count > 0 %}
loadStockTable($("#stock-table"), {
    params: {
        location_detail: true,
        part_details: true,
        ancestor: {{ item.id }},
    },
    name: 'item-childs',
    groupByField: 'location',
    buttons: [
        '#stock-options',
    ],
    url: "{% url 'api-stock-list' %}",
});
{% endif %}

{% endblock %}