{% extends "email/email.html" %}

{% load report %}

{% block title %}
<h3>[InvenTree] Component Shortfall Report</h3>
<p>The following components have been identified as having a shortfall</p>
{% if download_link %}
<p>The report can also be downloaded <a href='{{ download_link }}'>as an Excel file</a>.</p>
{% endif %}
{% endblock title %}

{% block body %}
    <tr>
        <th>Part</th>
        <th>Required</th>
        <th>Stock</th>
        <th>On Order</th>
        <th>In Production</th>
        <th>Shortfall</th>
        <th>Units</th>
    </tr>
    {% for entry in requirements %}
    <tr>
        <td>
            <a href='{{ entry.part_url }}'>{{ entry.part.full_name }}</a>
        </td>
        <td>{% format_number entry.required %}</td>
        <td>{% format_number entry.stock %}</td>
        <td>{% format_number entry.on_order %}</td>
        <td>{% format_number entry.in_production %}</td>
        <td>{% format_number entry.shortfall %}</td>
        <td>
            {% if entry.part.units %}
                {{ entry.part.units }}
            {% else %}
                -
            {% endif %}
        </td>
    </tr>
    {% endfor %}

{% endblock body %}
