add_participants: Refactor admin interface for participant management

This commit is contained in:
2025-08-06 11:55:15 +09:00
parent becf4f5c99
commit 68caea5937
3 changed files with 76 additions and 56 deletions

View File

@@ -48,6 +48,18 @@
<input type="date" name="created_before" value="{{ request.GET.created_before }}" class="form-control">
</div>
</div>
<div class="row mt-3">
<div class="col-md-3 form-check mt-2">
<input type="checkbox" class="form-check-input" name="without_bonus" id="without_bonus" {% if request.GET.without_bonus %}checked{% endif %}>
<label class="form-check-label" for="without_bonus">Только без бонуса</label>
</div>
<div class="col-md-3 form-check mt-2">
<input type="checkbox" class="form-check-input" name="without_fd" id="without_fd" {% if request.GET.without_fd %}checked{% endif %}>
<label class="form-check-label" for="without_fd">Только без ФД</label>
</div>
</div>
<div class="mt-3">
<button type="submit" class="btn btn-primary">Применить фильтр</button>
</div>
@@ -55,59 +67,51 @@
<p><strong>Найдено подходящих счетов: {{ invoice_count }}</strong></p>
<!-- Форма добавления участников -->
<form method="post">
{% csrf_token %}
<div class="table-responsive">
<table class="table table-striped table-bordered table-sm">
<thead>
<tr>
<th><input type="checkbox" id="select-all" /></th>
<th>Создан</th>
<th>Закрыт</th>
<th>Счет</th>
<th>Клиент</th>
<th>Номер клиента</th>
<th>Сумма счета</th>
<th>Бонус</th>
<th>ФД</th>
<th>Депозит</th>
<th>Примечание</th>
</tr>
</thead>
<tbody>
{% for invoice in form.fields.invoices.queryset %}
<!-- Форма добавления участников -->
<form method="post">
{% csrf_token %}
<div class="table-responsive">
<table class="table table-striped table-bordered table-sm align-middle">
<thead>
<tr>
<input type="checkbox" name="invoices" value="{{ invoice.id }}">
<td>{{ invoice.created_at|date:"d.m.Y H:i" }}</td>
<td>
{% if invoice.closed_at %}
{{ invoice.closed_at|date:"d.m.Y H:i" }}
{% else %}
{% endif %}
</td>
<td>{{ invoice.ext_id|default:"—" }}</td>
<td>{{ invoice.client.name|default:"Не указан" }}</td>
<td>{{ invoice.client.club_card_number|default:"—" }}</td>
<td>{{ invoice.sum|default:"—" }}</td>
<td>{{ invoice.bonus|default:"—" }}</td>
<td>{{ invoice.start_bonus|default:"—" }}</td>
<td>{{ invoice.deposit_sum|default:"—" }}</td>
<td>{{ invoice.notes|default:"—" }}</td>
<th><input type="checkbox" id="select-all" /></th>
<th>Создан</th>
<th>Закрыт</th>
<th>Счёт</th>
<th>Клиент</th>
<th>Номер клиента</th>
<th>Сумма счета</th>
<th>Бонус</th>
<th>ФД</th>
<th>Депозит</th>
<th>Примечание</th>
</tr>
{% empty %}
<tr>
<td colspan="11" class="text-center">Нет доступных счетов</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<button type="submit" class="btn btn-primary">Добавить выбранные счета</button>
</form>
</thead>
<tbody>
{% for invoice in form.fields.invoices.queryset %}
<tr>
<td><input type="checkbox" name="invoices[]" value="{{ invoice.id }}"></td>
<td>{{ invoice.created_at|date:"d.m.Y H:i" }}</td>
<td>{% if invoice.closed_at %}{{ invoice.closed_at|date:"d.m.Y H:i" }}{% else %}—{% endif %}</td>
<td>{{ invoice.ext_id|default:"—" }}</td>
<td>{{ invoice.client.name|default:"Не указан" }}</td>
<td>{{ invoice.client.club_card_number|default:"—" }}</td>
<td>{{ invoice.sum|default:"—" }}</td>
<td>{{ invoice.bonus|default:"—" }}</td>
<td>{{ invoice.start_bonus|default:"—" }}</td>
<td>{{ invoice.deposit_sum|default:"—" }}</td>
<td>{{ invoice.notes|default:"—" }}</td>
</tr>
{% empty %}
<tr>
<td colspan="11" class="text-center">Нет доступных счетов</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<button type="submit" class="btn btn-primary">Добавить выбранные счета</button>
</form>
<a href="{% url 'admin:draw_lotteryparticipant_changelist' %}" class="btn btn-secondary mt-3">Вернуться к списку участников</a>
</div>