{% extends "modal_form.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block pre_form_content %}

{{ block.super }}

<div class='alert alert-block alert-info'>
    <b>{% trans "Automatically Allocate Stock" %}</b><br>
    {% trans "The following stock items will be allocated to the specified build output" %}
</div>
{% if allocations %}
<table class='table table-striped table-condensed'>
<tr>
    <th></th>
    <th>{% trans "Part" %}</th>
    <th>{% trans "Quantity" %}</th>
    <th>{% trans "Location" %}</th>
</tr>
{% for item in allocations %}
<tr>
    <td>
        {% include "hover_image.html" with image=item.stock_item.part.image hover=True %}
    </td>
    <td>
        {{ item.stock_item.part.full_name }}<br>
        <i>{{ item.stock_item.part.description }}</i>
    </td>
    <td>{% decimal item.quantity %}</td>
    <td>{{ item.stock_item.location }}</td>
</tr>
{% endfor %}
</table>

{% else %}
<div class='alert alert-block alert-warning'>
    {% trans "No stock items found that can be automatically allocated to this build" %}
    <br>
    {% trans "Stock items will have to be manually allocated" %}
</div>
{% endif %}

{% endblock %}