refactor(inventory): redesign inventory home layout with compact cards

- Replace large operation cards with smaller, uniform inventory-card components
- Update icon sizes and text styles for better visual hierarchy
- Group operations into a cleaner 4x3 grid layout using Bootstrap columns
- Simplify card hover effects with subtler shadows and background gradients
- Remove unused purple utility classes and old card-body styles
- Add focus outline support for accessibility on inventory cards

fix(customers): show total debt only when applicable and add external links

- Display total debt row only if debt is greater than zero in customer detail
- Remove redundant conditional inside debt display cell
- Add target="_blank" and rel attributes to order detail links to open in new tab
This commit is contained in:
2025-12-31 23:11:11 +03:00
parent 6971f58d45
commit ff1c29baae
2 changed files with 130 additions and 204 deletions

View File

@@ -138,17 +138,15 @@
<span class="badge bg-info">{{ last_year_orders_sum|floatformat:2 }} руб.</span>
</td>
</tr>
{% if total_debt > 0 %}
<tr>
<td class="text-muted"><i class="bi bi-exclamation-triangle-fill text-danger"></i> Общий долг:</td>
<td colspan="2">
{% if total_debt > 0 %}
<span class="badge bg-danger">{{ total_debt|floatformat:2 }} руб.</span>
<small class="text-muted ms-2">(Заказов: {{ active_orders_count }})</small>
{% else %}
<span class="badge bg-success">0.00 руб.</span>
{% endif %}
<span class="badge bg-danger">{{ total_debt|floatformat:2 }} руб.</span>
<small class="text-muted ms-2">(Заказов: {{ active_orders_count }})</small>
</td>
</tr>
{% endif %}
<!-- Разделитель -->
<tr>
@@ -305,7 +303,7 @@
{% endif %}
</td>
<td class="text-end">
<a href="{% url 'orders:order-detail' order.order_number %}" class="btn btn-sm btn-outline-primary">
<a href="{% url 'orders:order-detail' order.order_number %}" class="btn btn-sm btn-outline-primary" target="_blank" rel="noopener noreferrer" title="Открыть в новой вкладке">
<i class="bi bi-eye"></i>
</a>
</td>

View File

@@ -3,232 +3,160 @@
{% block title %}Склад{% endblock %}
{% block content %}
<div class="container-fluid py-4">
<!-- Заголовок -->
<div class="d-flex align-items-center justify-content-between mb-4">
<div>
<h4 class="mb-1">Управление складом</h4>
<p class="text-muted mb-0">Выберите операцию или справочник</p>
</div>
<div class="container-fluid px-3 py-3">
<!-- Компактный заголовок -->
<div class="mb-3">
<h5 class="mb-2" style="font-weight: 500; font-size: 1.25rem;">Управление складом</h5>
<small class="text-muted" style="font-size: 0.875rem;">Выберите операцию или справочник</small>
</div>
<!-- Единая сетка операций -->
<div class="row g-3">
<!-- Главные операции -->
<div class="col-12">
<h5 class="text-muted mb-4 fw-normal" style="font-size: 1.1rem; letter-spacing: 0.5px;">
Главные операции
</h5>
<div class="row g-4">
<!-- Документы поступления -->
<div class="col-12 col-md-6 col-lg-3">
<a href="{% url 'inventory:incoming-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-5">
<div class="text-center">
<i class="bi bi-file-earmark-plus text-muted mb-3" style="font-size: 2.5rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Документы поступления</h6>
<small class="text-muted">Коллективное поступление</small>
</div>
</div>
</a>
<!-- 1. Документы поступления -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:incoming-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-file-earmark-plus text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Документы поступления</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Коллективное поступление</small>
</div>
<!-- Документы списания -->
<div class="col-12 col-md-6 col-lg-3">
<a href="{% url 'inventory:writeoff-document-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-5">
<div class="text-center">
<i class="bi bi-file-earmark-minus text-muted mb-3" style="font-size: 2.5rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Документы списания</h6>
<small class="text-muted">Коллективное списание</small>
</div>
</div>
</a>
</div>
<!-- Инвентаризация -->
<div class="col-12 col-md-6 col-lg-3">
<a href="{% url 'inventory:inventory-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-5">
<div class="text-center">
<i class="bi bi-clipboard-check text-muted mb-3" style="font-size: 2.5rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Инвентаризация</h6>
<small class="text-muted">Переучет товаров</small>
</div>
</div>
</a>
</div>
<!-- Трансформации -->
<div class="col-12 col-md-6 col-lg-3">
<a href="{% url 'inventory:transformation-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-5">
<div class="text-center">
<i class="bi bi-arrow-repeat text-muted mb-3" style="font-size: 2.5rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Трансформации</h6>
<small class="text-muted">Превращение товаров</small>
</div>
</div>
</a>
</div>
</div>
</a>
</div>
<!-- Основные операции -->
<div class="col-12 mt-4">
<h5 class="text-muted mb-4 fw-normal" style="font-size: 1.1rem; letter-spacing: 0.5px;">
Операции
</h5>
<div class="row g-4">
<!-- Склады -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:warehouse-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-building text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Склады</h6>
<small class="text-muted">Управление складами</small>
</div>
</div>
</a>
<!-- 2. Документы списания -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:writeoff-document-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-file-earmark-minus text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Документы списания</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Коллективное списание</small>
</div>
<!-- Продажи -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:sale-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-arrow-up-square text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Продажи</h6>
<small class="text-muted">Реализация товара</small>
</div>
</div>
</a>
</div>
<!-- Перемещения -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:transfer-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-arrow-left-right text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Перемещения</h6>
<small class="text-muted">Между складами</small>
</div>
</div>
</a>
</div>
</div>
</a>
</div>
<!-- Справочники -->
<div class="col-12 mt-4">
<h5 class="text-muted mb-4 fw-normal" style="font-size: 1.1rem; letter-spacing: 0.5px;">
Справочники
</h5>
<div class="row g-4">
<!-- Остатки -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:stock-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-box-seam text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Остатки</h6>
<small class="text-muted">Текущие остатки товаров</small>
</div>
</div>
</a>
<!-- 3. Инвентаризация -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:inventory-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-clipboard-check text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Инвентаризация</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Переучет товаров</small>
</div>
</a>
</div>
<!-- Партии -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:batch-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-diagram-3 text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Партии</h6>
<small class="text-muted">Партии товаров</small>
</div>
</div>
</a>
<!-- 4. Трансформации -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:transformation-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-arrow-repeat text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Трансформации</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Превращение товаров</small>
</div>
</a>
</div>
<!-- Документы поступлений -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:incoming-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-box-arrow-in-down text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Документы поступлений</h6>
<small class="text-muted">История поступлений</small>
</div>
</div>
</a>
<!-- 5. Склады -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:warehouse-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-building text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Склады</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Управление складами</small>
</div>
</a>
</div>
<!-- Резервирования -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:reservation-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-bookmark-check text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Резервирования</h6>
<small class="text-muted">Активные резервы</small>
</div>
</div>
</a>
<!-- 6. Продажи -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:sale-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-arrow-up-square text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Продажи</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Реализация товара</small>
</div>
</a>
</div>
<!-- Распределение -->
<div class="col-12 col-md-6 col-lg-4">
<a href="{% url 'inventory:allocation-list' %}" class="card-main-operation h-100 text-decoration-none">
<div class="card-body p-4">
<div class="text-center">
<i class="bi bi-distribute-vertical text-muted mb-3" style="font-size: 2rem;"></i>
<h6 class="mb-2 text-dark fw-medium">Распределение</h6>
<small class="text-muted">Распределение продаж</small>
</div>
</div>
</a>
<!-- 7. Перемещения -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:transfer-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-arrow-left-right text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Перемещения</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Между складами</small>
</div>
</div>
</a>
</div>
<!-- 8. Остатки -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:stock-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-box-seam text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Остатки</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Текущие остатки товаров</small>
</div>
</a>
</div>
<!-- 9. Партии -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:batch-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-diagram-3 text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Партии</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Партии товаров</small>
</div>
</a>
</div>
<!-- 10. Резервирования -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:reservation-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-bookmark-check text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Резервирования</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Активные резервы</small>
</div>
</a>
</div>
<!-- 11. Распределение -->
<div class="col-6 col-sm-6 col-md-4 col-lg-3">
<a href="{% url 'inventory:allocation-list' %}" class="inventory-card text-decoration-none d-block">
<div class="p-3 text-center">
<i class="bi bi-distribute-vertical text-muted mb-2" style="font-size: 1.75rem;"></i>
<div class="mb-1" style="font-size: 0.95rem; font-weight: 600; color: #212529;">Распределение</div>
<small class="text-muted" style="font-size: 0.8rem; line-height: 1.3;">Распределение продаж</small>
</div>
</a>
</div>
</div>
</div>
<style>
.card-body {
cursor: pointer;
}
.bg-purple {
background-color: #6f42c1 !important;
}
.text-purple {
color: #6f42c1 !important;
}
.border-purple {
border-color: #6f42c1 !important;
}
/* Стили для всех карточек операций */
.card-main-operation {
border: 1px solid #e0e0e0;
border-radius: 8px;
/* Стили для карточек операций */
.inventory-card {
border: 1px solid #e8e8e8;
border-radius: 6px;
background-color: #ffffff;
transition: all 0.3s ease;
transition: all 0.2s ease;
height: 100%;
display: flex;
flex-direction: column;
}
.card-main-operation:hover {
.inventory-card:hover {
border-color: #6f42c1;
background: linear-gradient(135deg, #f8f4ff 0%, #e8e4ff 100%);
box-shadow: 0 8px 25px rgba(111, 66, 193, 0.25);
transform: translateY(-2px);
background: linear-gradient(135deg, #fafafa 0%, #f5f3ff 100%);
box-shadow: 0 4px 12px rgba(111, 66, 193, 0.15);
transform: translateY(-1px);
}
.card-main-operation .card-body {
cursor: pointer;
.inventory-card:focus {
outline: 2px solid #6f42c1;
outline-offset: 2px;
}
</style>
{% endblock %}