Files
octopus/myproject/customers/templates/customers/customer_list.html
Andrey Smakotin 07829f867b Защита удаления заказов и улучшение интерфейса клиентов
Orders:
- Удаление разрешено только для черновиков (draft)
- Запрет удаления заказов с оплатой (amount_paid > 0)
- Кнопка "Удалить" скрыта для недопустимых заказов

Customers:
- Inline-редактирование полей клиента
- Улучшен дизайн карточки клиента
- Добавлена история заказов и кошелька

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 23:59:57 +03:00

129 lines
6.5 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.
{% extends "base.html" %}
{% block title %}Клиенты{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center mb-3">
<div>
<h1>Клиенты</h1>
<p class="text-muted mb-0">
Всего клиентов: <strong>{{ total_customers }}</strong>
</p>
</div>
<div class="btn-group" role="group">
<a href="{% url 'customers:customer-import' %}" class="btn btn-outline-success">
<i class="bi bi-upload"></i> Импорт
</a>
<a href="{% url 'customers:customer-export' %}" class="btn btn-outline-info">
<i class="bi bi-download"></i> Экспорт
</a>
<a href="{% url 'customers:customer-create' %}" class="btn btn-primary">
<i class="bi bi-plus-circle"></i> Добавить клиента
</a>
</div>
</div>
<!-- Поиск -->
<div class="card mb-3">
<div class="card-body">
<form method="get" class="row g-2">
<div class="col-md-8">
<input type="text" class="form-control" name="q" value="{{ query }}"
placeholder="Поиск по имени, email или телефону..."
autofocus>
</div>
<div class="col-md-4">
<div class="btn-group w-100" role="group">
<button type="submit" class="btn btn-primary">
<i class="bi bi-search"></i> Поиск
</button>
{% if query %}
<a href="{% url 'customers:customer-list' %}" class="btn btn-outline-secondary">
<i class="bi bi-x-circle"></i> Очистить
</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
<!-- Таблица клиентов -->
<div class="card">
<div class="card-body">
{% if page_obj %}
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead>
<tr>
<th>Имя</th>
<th>Email</th>
<th>Телефон</th>
<th class="text-end">Действия</th>
</tr>
</thead>
<tbody>
{% for customer in page_obj %}
<tr
style="cursor:pointer"
onclick="window.location='{% url 'customers:customer-detail' customer.pk %}'"
>
<td class="fw-semibold">{{ customer.full_name }}</td>
<td>{{ customer.email|default:'—' }}</td>
<td>{{ customer.phone|default:'—' }}</td>
<td class="text-end" onclick="event.stopPropagation();">
<a href="{% url 'customers:customer-detail' customer.pk %}"
class="btn btn-sm btn-outline-primary" title="Просмотр">
<i class="bi bi-eye"></i>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- Pagination -->
{% if page_obj.has_other_pages %}
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}{% if query %}&q={{ query }}{% endif %}">Предыдущая</a>
</li>
{% endif %}
{% for num in page_obj.paginator.page_range %}
{% if page_obj.number == num %}
<li class="page-item active"><span class="page-link">{{ num }}</span></li>
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
<li class="page-item"><a class="page-link" href="?page={{ num }}{% if query %}&q={{ query }}{% endif %}">{{ num }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}{% if query %}&q={{ query }}{% endif %}">Следующая</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% else %}
<p>Клиенты не найдены.</p>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}