feat: add color, discount price, and new item attributes to catalog and update UI
All checks were successful
Build and Push Docker Image / build (push) Successful in 25s

- Introduced `Color` model with admin and added a color field to items
- Added `discount_price` and `is_new` fields to the `Item` model with necessary migrations
- Updated pricing logic to display original and discount prices in templates
- Enhanced product detail and item card templates with color swatches and metadata
- Added sidebar sections for sales and new items with paginated mini-cards
- Updated styles to support discount pricing, swatches, and sidebar mini-cards
- Extended catalog views to filter by sales or new items and updated filtering logic
This commit is contained in:
2026-05-25 18:10:32 +02:00
parent 81e30f853d
commit c42d32c76b
8 changed files with 342 additions and 38 deletions

View File

@@ -43,18 +43,29 @@
<h1 class="product-summary__title">{{ item.name }}</h1>
<div class="product-summary__meta">
<span class="product-summary__price">{{ item.price }} руб.</span>
<div class="product-summary__price-block">
<span class="product-summary__price{% if item.has_discount %} product-summary__price--discount{% endif %}">
{{ item.display_price }} руб.
</span>
{% if item.has_discount %}
<span class="product-summary__price-original">{{ item.price }} руб.</span>
{% endif %}
</div>
<span class="product-summary__availability {% if item.is_available %}available{% else %}unavailable{% endif %}">
{% if item.is_available %}В наличии{% else %}Нет в наличии{% endif %}
</span>
</div>
<div class="product-summary__swatches" aria-hidden="true">
<span class="product-summary__swatch product-summary__swatch--dark"></span>
<span class="product-summary__swatch product-summary__swatch--graphite"></span>
<span class="product-summary__swatch product-summary__swatch--taupe"></span>
<span class="product-summary__swatch product-summary__swatch--sand"></span>
</div>
{% if item.color %}
<div class="product-summary__swatches" aria-label="Цвет товара">
<span
class="product-summary__swatch product-summary__swatch--active"
style="background: {{ item.color.hex_code }};"
title="{{ item.color.name }}"
></span>
<span class="product-summary__color-name">{{ item.color.name }}</span>
</div>
{% endif %}
{% if item.description %}
<div class="product-summary__description">{{ item.description|linebreaksbr }}</div>