{% extends "modal_form.html" %}

{% block pre_form_content %}

{{ block.super }}

<b>Build: {{ build.title }}</b> - {{ build.quantity }} x {{ build.part.full_name }}
<br><br>
Automatically allocate stock to this build?
<hr>

{% if allocations %}

<table class='table table-striped table-condensed'>
<tr>
    <th></th>
    <th>Part</th>
    <th>Quantity</th>
    <th>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>{{ item.quantity }}</td>
    <td>{{ item.stock_item.location }}</td>
</tr>
{% endfor %}
</table>

{% else %}
<i>No stock could be selected for automatic build allocation.</i>
{% endif %}

{% endblock %}