feat(pos): добавить редактирование цены товара в корзине
- Добавить модалку редактирования товара в корзине (edit_cart_item_modal.html) - Создать JS модуль cart-item-editor.js для логики редактирования - При клике на строку товара открывается модалка с возможностью изменения цены и количества - Добавить визуальную индикацию изменённой цены (оранжевый цвет и звёздочка) - Экспортировать корзину в window.cart для доступа из других модулей - Добавить авто-выделение текста при фокусе в полях ввода Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
{% load static %}
|
||||
<div class="modal fade" id="editCartItemModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">
|
||||
<i class="bi bi-pencil-square"></i> Редактирование товара
|
||||
</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Название товара -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-muted small">Товар</label>
|
||||
<div id="editModalProductName" class="fw-semibold">—</div>
|
||||
</div>
|
||||
|
||||
<!-- Базовая цена (оригинальная) -->
|
||||
<div class="mb-3">
|
||||
<label class="form-label text-muted small">Базовая цена</label>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<span id="editModalBasePrice" class="text-muted">0.00 руб.</span>
|
||||
<span id="editModalUnitBadge" class="badge bg-secondary" style="display: none;"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Новая цена -->
|
||||
<div class="mb-3">
|
||||
<label for="editModalPrice" class="form-label fw-semibold">Цена за единицу</label>
|
||||
<div class="input-group">
|
||||
<input type="number" class="form-control" id="editModalPrice"
|
||||
min="0" step="0.01" placeholder="0.00">
|
||||
<span class="input-group-text">руб.</span>
|
||||
</div>
|
||||
<div id="editModalPriceWarning" class="text-warning small mt-1" style="display: none;">
|
||||
<i class="bi bi-exclamation-triangle"></i> Цена изменена
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Количество -->
|
||||
<div class="mb-3">
|
||||
<label for="editModalQuantity" class="form-label fw-semibold">Количество</label>
|
||||
<input type="number" class="form-control" id="editModalQuantity"
|
||||
min="0.001" step="0.001" value="1">
|
||||
</div>
|
||||
|
||||
<!-- Итого -->
|
||||
<div class="alert alert-info mb-0">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<strong>Сумма:</strong>
|
||||
<span class="fs-5" id="editModalTotal">0.00 руб.</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</button>
|
||||
<button type="button" class="btn btn-primary" id="confirmEditCartItem">
|
||||
<i class="bi bi-check-lg"></i> Сохранить
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -713,6 +713,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Модалка редактирования товара в корзине -->
|
||||
{% include 'pos/components/edit_cart_item_modal.html' %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
@@ -732,4 +735,5 @@
|
||||
|
||||
<script src="{% static 'products/js/product-search-picker.js' %}"></script>
|
||||
<script src="{% static 'pos/js/terminal.js' %}"></script>
|
||||
<script src="{% static 'pos/js/cart-item-editor.js' %}"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user