Files
octopus/myproject/templates/navbar.html
Andrey Smakotin 766ca3c87c Add full CRUD interface for Showcase management
Implemented complete web interface for managing showcases (display areas for ready-made bouquets) with:

**Backend:**
- ShowcaseForm with validation (unique name per warehouse)
- ShowcaseListView with filtering by warehouse and status
- ShowcaseCreateView, ShowcaseUpdateView with success messages
- ShowcaseDeleteView with active reservation validation
- URL routes: list, create, edit, delete

**Frontend:**
- List page with warehouse grouping, active reservations count
- Responsive table with filters (warehouse, status)
- Create/edit form with Bootstrap styling
- Delete confirmation with active reservations check
- Breadcrumb navigation

**Features:**
 One warehouse can have multiple showcases (ForeignKey relationship)
 Unique showcase names within each warehouse
 Display active reservation counts for each showcase
 Prevent deletion if showcase has active reservations
 Auto-select default warehouse when creating showcase
 Navigation link added to main navbar between "Касса" and "Склад"
 Active state highlighting in navigation

**Files created:**
- inventory/forms_showcase.py (ShowcaseForm)
- inventory/views/showcase.py (4 CBV views)
- inventory/templates/inventory/showcase/ (list, form, delete templates)

**Files modified:**
- inventory/urls.py (added showcase routes)
- inventory/forms.py (added Showcase import)
- templates/navbar.html (added "Витрины" link)

URL structure:
/inventory/showcases/ - list
/inventory/showcases/create/ - create
/inventory/showcases/<id>/edit/ - edit
/inventory/showcases/<id>/delete/ - delete

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 10:52:53 +03:00

82 lines
5.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- navbar.html - Reusable navigation bar component -->
<style>
.navbar .dropdown:hover > .dropdown-menu {
display: block;
margin-top: 0;
}
</style>
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
<div class="container">
<!-- Toggler for mobile view -->
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar content -->
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
{% if user.is_authenticated %}
<!-- Main navigation links -->
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'products' and request.resolver_match.url_name in 'all-products,product-list,productkit-list,product-detail,product-create,product-update,productkit-detail,productkit-create,productkit-update' %}active{% endif %}" href="{% url 'products:all-products' %}">Товары</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'products' and 'configurablekit' in request.resolver_match.url_name %}active{% endif %}" href="{% url 'products:configurablekit-list' %}">Вариативные товары</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'products' and 'variantgroup' in request.resolver_match.url_name %}active{% endif %}" href="{% url 'products:variantgroup-list' %}">Варианты</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'products' and 'tag' in request.resolver_match.url_name %}active{% endif %}" href="{% url 'products:tag-list' %}">Теги</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle {% if request.resolver_match.namespace == 'orders' %}active{% endif %}" href="{% url 'orders:order-list' %}" id="ordersDropdown">Заказы</a>
<ul class="dropdown-menu" aria-labelledby="ordersDropdown">
<li><a class="dropdown-item" href="{% url 'orders:order-list' %}">Список заказов</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="{% url 'orders:status_list' %}">Статусы заказов</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'customers' %}active{% endif %}" href="{% url 'customers:customer-list' %}">Клиенты</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'pos' %}active{% endif %}" href="{% url 'pos:terminal' %}">Касса</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'inventory' and 'showcase' in request.resolver_match.url_name %}active{% endif %}" href="{% url 'inventory:showcase-list' %}">Витрины</a>
</li>
<li class="nav-item">
<a class="nav-link {% if request.resolver_match.namespace == 'inventory' and 'showcase' not in request.resolver_match.url_name %}active{% endif %}" href="{% url 'inventory:inventory-home' %}">Склад</a>
</li>
{% endif %}
</ul>
<ul class="navbar-nav align-items-center">
{% if user.is_authenticated %}
<!-- Show profile button and logout button for authenticated users -->
<li class="nav-item">
<a class="btn btn-outline-primary me-2" href="{% url 'accounts:profile' %}">Профиль</a>
</li>
<li class="nav-item d-flex align-items-center mx-2">
<span class="navbar-text mb-0">
({{ user.name|default:user.email }})
</span>
</li>
<li class="nav-item">
<a class="btn btn-outline-secondary ms-2" href="{% url 'accounts:logout' %}">Выйти</a>
</li>
{% else %}
<!-- Show login and register buttons for non-authenticated users -->
<li class="nav-item">
<a class="btn btn-outline-primary me-2" href="{% url 'accounts:login' %}">Вход</a>
</li>
<li class="nav-item">
<a class="btn btn-outline-secondary" href="{% url 'accounts:register' %}">Регистрация</a>
</li>
{% endif %}
</ul>
</div>
</div>
</nav>