{% extends 'inventory/base_inventory_minimal.html' %}
{% load inventory_filters %}
{% block inventory_title %}Партии товаров{% endblock %}
{% block breadcrumb_current %}Партии{% endblock %}
{% block inventory_content %}
<div class="card">
    <div class="card-header">
        <h4 class="mb-0">Все партии товаров на складе</h4>
    </div>
    <div class="card-body">
        {% if batches %}
        <div class="table-responsive">
            <table class="table table-hover table-sm">
                <thead>
                    <tr>
                        <th>ID Партии</th>
                        <th>Товар</th>
                        <th>Склад</th>
                        <th>Кол-во</th>
                        <th>Цена</th>
                        <th>Создана</th>
                        <th>Действия</th>
                    </tr>
                </thead>
                <tbody>
                    {% for batch in batches %}
                    <tr>
                        <td>
                            <strong>#{{ batch.pk }}</strong>
                        </td>
                        <td>{{ batch.product.name }}</td>
                        <td>{{ batch.warehouse.name }}</td>
                        <td>{{ batch.quantity|smart_quantity }}</td>
                        <td>{{ batch.cost_price }} руб.</td>
                        <td>{{ batch.created_at|date:"d.m.Y" }}</td>
                        <td>
                            <a href="{% url 'inventory:batch-detail' batch.pk %}" class="btn btn-sm btn-outline-info" title="Просмотр партии">
                                <i class="bi bi-eye"></i>
                            </a>
                        </td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
        {% else %}
        <div class="alert alert-info">Партий не найдено.</div>
        {% endif %}
    </div>
</div>
{% endblock %}
