table data dysplay fix

This commit is contained in:
2025-08-06 12:09:14 +09:00
parent 8b37877b3e
commit 3f5c332ecd

View File

@@ -71,54 +71,44 @@
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-bordered table-sm align-middle"> <table class="table table-striped table-bordered table-sm align-middle">
<thead> <thead>
<tr> <tr>
<th><input type="checkbox" id="select-all" /></th> <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>
<th>Сумма счета</th> <th>Сумма счета</th>
<th>Бонус</th> <th>Бонус</th>
<th>ФД</th> <th>ФД</th>
<th>Депозит</th> <th>Депозит</th>
<th>Примечание</th> <th>Примечание</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for invoice in invoices %} {% for invoice in form.fields.invoices.queryset %}
<tr> <tr>
<td><input type="checkbox" name="invoices[]" value="{{ invoice.id }}"></td> <td><input type="checkbox" name="invoices[]" value="{{ invoice.id }}"></td>
<td>{{ invoice.created_at|date:"Y-m-d H:i:s" }}</td> <td>{{ invoice.created_at|date:"d.m.Y H:i" }}</td>
<td>{% if invoice.closed_at %}{{ invoice.closed_at|date:"Y-m-d H:i:s" }}{% else %}—{% endif %}</td> <td>{% if invoice.closed_at %}{{ invoice.closed_at|date:"d.m.Y H:i" | default: "Счет не закрыт!"}}{% else %}—{% endif %}</td>
<td>{{ invoice.ext_id }}</td> <td>{{ invoice.ext_id|default:"—" }}</td>
<td> <td>{{ invoice.client.name|default:"Не указан" }}</td>
{% if invoice.client %} <td>{{ invoice.client.club_card_number|default:"—" }}</td>
{{ invoice.client.name|default:"—" }} <td>{{ invoice.sum|default:"—" }}</td>
{% else %} <td>{{ invoice.bonus|default:"—" }}</td>
Не указан <td>{{ invoice.start_bonus|default:"—" }}</td>
{% endif %} <td>{{ invoice.deposit_sum|default:"—" }}</td>
</td> <td>{{ invoice.notes|default:"—" }}</td>
<td> </tr>
{% if invoice.client %} {% empty %}
{{ invoice.client.club_card_number|default:"—" }} <tr>
{% else %} <td colspan="11" class="text-center">Нет доступных счетов</td>
</tr>
{% endif %} {% endfor %}
</td> </tbody>
<td>{{ invoice.sum|floatformat:2 }}</td> </table>
<td>{{ invoice.bonus|floatformat:2|default:"—" }}</td>
<td>{{ invoice.start_bonus|floatformat:2|default:"—" }}</td>
<td>{{ invoice.deposit_sum|floatformat:2|default:"—" }}</td>
<td>{{ invoice.notes|default:"—" }}</td>
</tr>
{% empty %}
<tr><td colspan="11" class="text-center">Нет доступных счетов</td></tr>
{% endfor %}
</tbody>
</table>
</div> </div>
<button type="submit" class="btn btn-primary">Добавить выбранные счета</button> <button type="submit" class="btn btn-primary">Добавить выбранные счета</button>
</form> </form>