diff options
| author | spl3g <spleefer6@gmail.com> | 2026-06-01 21:23:12 +0300 |
|---|---|---|
| committer | spl3g <spleefer6@gmail.com> | 2026-06-01 21:23:12 +0300 |
| commit | c0fe3e1db70bdba85cf382624817d8d8ea9d6f85 (patch) | |
| tree | 74065ec21768d63f6cc537bdce72b63ddf513b32 /core/templates | |
| parent | 386e9defbea931ebc5139a5db5c74e6f44bbbe02 (diff) | |
add orders list, update, create
Diffstat (limited to 'core/templates')
| -rw-r--r-- | core/templates/core/base.html | 2 | ||||
| -rw-r--r-- | core/templates/core/order_form.html | 20 | ||||
| -rw-r--r-- | core/templates/core/order_list.html | 32 | ||||
| -rw-r--r-- | core/templates/core/product_list.html | 5 |
4 files changed, 56 insertions, 3 deletions
diff --git a/core/templates/core/base.html b/core/templates/core/base.html index 56d9e17..74aba44 100644 --- a/core/templates/core/base.html +++ b/core/templates/core/base.html @@ -14,7 +14,7 @@ </div> <div class="header-right"> {% if user.is_authenticated %} - <span>{{ user.role.name }}</span> + <span>{{ user.role.name }}</span> | <strong>{{ user.full_name }}</strong> <form action="{% url 'logout' %}" method="post" style="display: inline;"> {% csrf_token %} diff --git a/core/templates/core/order_form.html b/core/templates/core/order_form.html new file mode 100644 index 0000000..b46b593 --- /dev/null +++ b/core/templates/core/order_form.html @@ -0,0 +1,20 @@ +{% 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 }} + + <h3>Товары в заказе</h3> + {% for formset in inlines %} + {{ formset }} + {% endfor %} + <button type="submit" class="btn">Сохранить</button> + </form> +</div> +{% endblock %} diff --git a/core/templates/core/order_list.html b/core/templates/core/order_list.html new file mode 100644 index 0000000..8fe80bd --- /dev/null +++ b/core/templates/core/order_list.html @@ -0,0 +1,32 @@ +{% extends 'core/base.html' %} + +{% block title %}Заказы - ООООБУВЬ {% endblock %} + +{% block h1 %}Заказы{% endblock %} + +{% block content %} +{% if user.role.name == "Администратор" or user.role.name == "Менеджер" %} +<div> + <a href="{% url 'order_create' %}" class="btn">Добавить заказ</a> +</div> +{% endif %} +<div> + {% for order in orders %} + <div class="product-card"> + <div class="details"> + <strong> + {% for orderitem in order.items.all %} + {{orderitem.product.article}} + {% endfor %} + </strong><br/> + Пункт выдачи: {{ order.pickup_point.address }}<br/> + Статус: {{ order.status }}<br/> + {% if user.role.name == "Администратор" or user.role.name == "Менеджер" %} + <a href="{% url 'order_update' order.id %}">Редактировать заказ</a> + {% endif %} + </div> + <div class="delivery">{{ order.delivery_date }}</div> + </div> + {% endfor %} +</div> +{% endblock %} diff --git a/core/templates/core/product_list.html b/core/templates/core/product_list.html index ad7a5bf..b2aa6e0 100644 --- a/core/templates/core/product_list.html +++ b/core/templates/core/product_list.html @@ -33,11 +33,9 @@ </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;"> @@ -75,6 +73,9 @@ Единица измерения: {{ product.unit }} <br/> Колличество на складе: {{ product.discount }} + {% if user.role.name == 'Администратор' %} + <br/><a href="{% url 'product_edit' product.id %}">Редактировать товар</a> + {% endif%} </div> <div class="sale">{{ product.discount }}</div> </div> |
