{% extends "modal_delete_form.html" %}

{% block pre_form_content %}
Are you sure you want to delete stock location '{{ location.name }}'?

<br>

{% if location.children.all|length > 0 %}
<p>This location contains {{ location.children.all|length }} child locations.<br>
If this location is deleted, these child locations will be moved to
{% if location.parent %}
the '{{ location.parent.name }}' location.
{% else %}
the top level 'Stock' location.
{% endif %}
</p>

<ul class='list-group'>
    {% for loc in location.children.all %}
    <li class='list-group-item'><b>{{ loc.name }}</b> - <i>{{ loc.description}}</i></li>
    {% endfor %}
</ul>
{% endif %}

{% if location.stock_items.all|length > 0 %}
<p>This location contains {{ location.stock_items.all|length }} stock items.<br>
{% if location.parent %}
If this location is deleted, these items will be moved to the '{{ location.parent.name }}' location.
{% else %}
If this location is deleted, these items will be moved to the top level 'Stock' location.
{% endif %}
</p>

<ul class='list-group'>
    {% for item in location.stock_items.all %}
    <li class='list-group-item'><b>{{ item.part.full_name }}</b> - <i>{{ item.part.description }}</i><span class='badge'>{{ item.quantity }}</span></li>
    {% endfor %}
</ul>
{% endif %}
{% endblock %}