{% extends "markettracker/base.html" %}
{% load i18n %}

{% block content %}
<h2>{% trans "Planned Deliveries" %}</h2>

<h4 class="mt-3">{% trans "Items" %}</h4>
<table class="table table-striped">
  <thead>
    <tr>
      <th>{% trans "User" %}</th>
      <th>{% trans "Item" %}</th>
      <th>{% trans "Delivered" %}</th>
      <th>{% trans "Declared" %}</th>
    </tr>
  </thead>
  <tbody>
    {% for d in item_deliveries %}
    <tr class="table-info">
      <td>{{ d.user.profile.main_character.character_name|default:d.user.username }}</td>
      <td><img src="https://images.evetech.net/types/{{ d.item.id }}/icon?size=32"> {{ d.item.name }}</td>
      <td>{{ d.delivered_quantity }}</td>
      <td>{{ d.declared_quantity }}</td>
    </tr>
    {% empty %}
    <tr><td colspan="4" class="text-muted">{% trans "No item deliveries." %}</td></tr>
    {% endfor %}
  </tbody>
</table>

<h4 class="mt-4">{% trans "Contracts" %}</h4>
<table class="table table-striped">
  <thead>
    <tr>
      <th>{% trans "User" %}</th>
      <th>{% trans "Tracked" %}</th>
      <th>{% trans "Delivered" %}</th>
      <th>{% trans "Declared" %}</th>
    </tr>
  </thead>
  <tbody>
    {% for d in contract_deliveries %}
    <tr class="table-info">
      <td>{{ d.user.profile.main_character.character_name|default:d.user.username }}</td>
      <td>
        {% if d.tracked_contract.mode == "doctrine" and d.tracked_contract.fitting %}
          {{ d.tracked_contract.fitting.name }}
        {% else %}
          {{ d.tracked_contract.title_filter|default:"—" }}
        {% endif %}
      </td>
      <td>{{ d.delivered_quantity }}</td>
      <td>{{ d.declared_quantity }}</td>
    </tr>
    {% empty %}
    <tr><td colspan="4" class="text-muted">{% trans "No contract deliveries." %}</td></tr>
    {% endfor %}
  </tbody>
</table>
{% endblock %}
