Добавлено отображение единиц продажи на странице товара

На странице детализации товара теперь отображается таблица с единицами
продажи: название, единица измерения, коэффициент, цена, мин. количество
и шаг. Единица по умолчанию выделена зелёным.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-03 00:17:14 +03:00
parent d28a845664
commit 030d5ad198
2 changed files with 54 additions and 5 deletions

View File

@@ -142,11 +142,11 @@
<tr>
<th>Остаток:</th>
<td>
<strong class="fs-5 {% if product.total_free > 0 %}text-success{% else %}text-danger{% endif %}">{{ product.total_free|floatformat:0 }}</strong> <span class="text-muted">свободно</span>
<strong class="fs-5 {% if product.total_free > 0 %}text-success{% else %}text-danger{% endif %}">{{ product.total_free|floatformat:-2 }}</strong> <span class="text-muted">свободно</span>
{% if product.total_reserved > 0 %}
<a href="{% url 'inventory:reservation-list' %}?product={{ product.pk }}" class="ms-2 text-warning text-decoration-none" target="_blank" title="Посмотреть резервы"><i class="bi bi-lock"></i> {{ product.total_reserved|floatformat:0 }} в резерве <i class="bi bi-box-arrow-up-right small"></i></a>
<a href="{% url 'inventory:reservation-list' %}?product={{ product.pk }}" class="ms-2 text-warning text-decoration-none" target="_blank" title="Посмотреть резервы"><i class="bi bi-lock"></i> {{ product.total_reserved|floatformat:-2 }} в резерве <i class="bi bi-box-arrow-up-right small"></i></a>
{% endif %}
<span class="ms-2 text-muted small">(всего: {{ product.total_available|floatformat:0 }})</span>
<span class="ms-2 text-muted small">(всего: {{ product.total_available|floatformat:-2 }})</span>
</td>
</tr>
<tr>
@@ -283,6 +283,51 @@
{% endif %}
</td>
</tr>
{% if sales_units %}
<tr>
<th>Единицы продажи:</th>
<td>
<div class="table-responsive">
<table class="table table-sm table-bordered mb-0">
<thead class="table-light">
<tr>
<th>Название</th>
<th>Единица</th>
<th class="text-end">Коэфф.</th>
<th class="text-end">Цена</th>
<th class="text-center">Мин. кол-во</th>
<th class="text-center">Шаг</th>
</tr>
</thead>
<tbody>
{% for su in sales_units %}
<tr{% if su.is_default %} class="table-success"{% endif %}>
<td>
{{ su.name }}
{% if su.is_default %}<span class="badge bg-success ms-1">По умолчанию</span>{% endif %}
</td>
<td>
<span class="badge bg-secondary">{{ su.unit.short_name }}</span>
</td>
<td class="text-end">{{ su.conversion_factor }}</td>
<td class="text-end">
{% if su.sale_price %}
<span class="text-decoration-line-through text-muted">{{ su.price }}</span>
<strong class="text-danger">{{ su.sale_price }}</strong> руб.
{% else %}
<strong>{{ su.price }}</strong> руб.
{% endif %}
</td>
<td class="text-center">{{ su.min_quantity }}</td>
<td class="text-center">{{ su.quantity_step }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</td>
</tr>
{% endif %}
<tr>
<th>Статус:</th>
<td>