summaryrefslogtreecommitdiff
path: root/core/templates
diff options
context:
space:
mode:
authorspl3g <spleefer6@gmail.com>2026-06-01 17:38:35 +0300
committerspl3g <spleefer6@gmail.com>2026-06-01 21:22:49 +0300
commit386e9defbea931ebc5139a5db5c74e6f44bbbe02 (patch)
tree9dff93fbd1c680790c11dbb80a231f50a004bc19 /core/templates
parent611f3017c00dd9a220402489602defab66f2c9f0 (diff)
add product creation page and search filters
Diffstat (limited to 'core/templates')
-rw-r--r--core/templates/core/login.html2
-rw-r--r--core/templates/core/product_form.html15
-rw-r--r--core/templates/core/product_list.html42
3 files changed, 59 insertions, 0 deletions
diff --git a/core/templates/core/login.html b/core/templates/core/login.html
index c17f521..098a9fd 100644
--- a/core/templates/core/login.html
+++ b/core/templates/core/login.html
@@ -27,5 +27,7 @@
<input type="password" name="password">
<button type="submit" class="btn">Войти</button>
</form>
+
+ <a href="{% url 'product_list' %}">Войти как гость</a>
</div>
{% endblock %}
diff --git a/core/templates/core/product_form.html b/core/templates/core/product_form.html
new file mode 100644
index 0000000..81a7075
--- /dev/null
+++ b/core/templates/core/product_form.html
@@ -0,0 +1,15 @@
+{% extends 'core/base.html' %}
+
+{% block title %}{% if is_edit %}Редактирование{% else %}Добавление{% endif %} товара - ОООБувь{% endblock %}
+
+{% block h1 %}{% if is_edit %}Редактирование{% else %}Добавление{% endif %} товара{% endblock %}
+
+{% block content %}
+<div>
+ <form method="post" enctype="multipart/form-data">
+ {% csrf_token %}
+ {{ form }}
+ <button type="submit" class="btn">Сохранить</button>
+ </form>
+</div>
+{% endblock %}
diff --git a/core/templates/core/product_list.html b/core/templates/core/product_list.html
index ac4b8c7..ad7a5bf 100644
--- a/core/templates/core/product_list.html
+++ b/core/templates/core/product_list.html
@@ -5,6 +5,48 @@
{% block h1 %}Каталог товаров{% endblock %}
{% block content %}
+{% if user.role.name == "Администратор" or user.role.name == "Менеджер" %}
+<div>
+ <form method="get" style="display: flex;">
+ <div>
+ <label>Поиск:</label><br/>
+ <input type="text" name="search" value="{{ current_search }}" placeholder="Найти..." oninput="clearTimeout(this.delay); this.delay = setTimeout(() => this.form.submit(), 500);">
+ </div>
+
+ <div>
+ <label>Поставщик:</label><br/>
+ <select name="supplier" onchange="this.form.submit()">
+ <option value="all">Все поставщики</option>
+ {% for supplier in suppliers %}
+ supplier.id|stringformat:"i"
+ <option value="{{ supplier.id }}" {% if current_supplier == supplier.id|stringformat:"i" %}selected{% endif %}>{{ supplier.name }}</option>
+ {% endfor %}
+ </select>
+ </div>
+
+ <div>
+ <label>Сортировка:</label><br/>
+ <select name="sort" onchange="this.form.submit()">
+ <option value="">Без сортировки</option>
+ <option value="asc" {% if current_sort == "asc" %}selected{% endif %}>По возрастанию</option>
+ <option value="desc" {% if current_sort == "desc" %}selected{% endif %}>По убыванию</option>
+ </select>
+ </div>
+
+ {% comment %}
+ <div style="margin-left: 10px;">
+ <a href="{% url 'order_list' %}" class="btn" style="background-color: #5bc0de;">Заказы</a>
+ </div>
+ {% endcomment %}
+
+ {% if user.role.name == 'Администратор' %}
+ <div style="margin-left: auto;">
+ <a href="{% url 'product_create' %}" class="btn">Добавить товар</a>
+ </div>
+ {% endif %}
+ </form>
+</div>
+{% endif %}
<div>
{% for product in products %}
<div class="product-card