{% extends "modal_form.html" %}

{% block pre_form_content %}

<div class='alert alert-block alert-danger'>
    Are you sure you want to delete part '<b>{{ part.full_name }}</b>'?
</div>

{% if part.used_in_count %}
<hr>
<p>This part is used in BOMs for {{ part.used_in_count }} other parts. If you delete this part, the BOMs for the following parts will be updated:
<ul class="list-group">
    {% for child in part.used_in.all %}
    <li class='list-group-item'>{{ child.part.full_name }} - {{ child.part.description }}</li>
    {% endfor %}
</p>
{% endif %}

{% if part.stock_items.all|length > 0 %}
<hr>
<p>There are {{ part.stock_items.all|length }} stock entries defined for this part. If you delete this part, the following stock entries will also be deleted:
    <ul class='list-group'>
        {% for stock in part.stock_items.all %}
        <li class='list-group-item'>{{ stock }}</li>
        {% endfor %}
    </ul>
</p>
{% endif %}

{% if part.supplier_parts.all|length > 0 %}
<hr>
<p>There are {{ part.supplier_parts.all|length }} suppliers defined for this part. If you delete this part, the following supplier parts will also be deleted.
    <ul class='list-group'>
        {% for spart in part.supplier_parts.all %}
        <li class='list-group-item'>{{ spart.supplier.name }} - {{ spart.SKU }}</li>
        {% endfor %}
    </ul>
</p>
{% endif %}

{% if part.serials.all|length > 0 %}
<hr>
<p>There are {{ part.serials.all|length }} unique parts tracked for '{{ part.full_name }}'. Deleting this part will permanently remove this tracking information.</p>
{% endif %}

{% endblock %}